@loaders.gl/parquet 3.4.0-alpha.5 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -9,7 +9,7 @@
9
9
  `))):s=t.stylize("[Circular]","special")),Qi(f)){if(o&&i.match(/^\d+$/))return s;f=JSON.stringify(""+i),f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=t.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=t.stylize(f,"string"))}return f+": "+s}function B2(t,e,r){var n=t.reduce(function(i,o){return o.indexOf(`
10
10
  `)>=0,i+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?r[0]+(e===""?"":e+`
11
11
  `)+" "+t.join(`,
12
- `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Cv(t){return Array.isArray(t)}function bh(t){return typeof t=="boolean"}function wp(t){return t===null}function k2(t){return t==null}function Vv(t){return typeof t=="number"}function gp(t){return typeof t=="string"}function I2(t){return babelHelpers.typeof(t)==="symbol"}function Qi(t){return t===void 0}function yp(t){return Ws(t)&&wh(t)==="[object RegExp]"}function Ws(t){return babelHelpers.typeof(t)==="object"&&t!==null}function hh(t){return Ws(t)&&wh(t)==="[object Date]"}function jp(t){return Ws(t)&&(wh(t)==="[object Error]"||t instanceof Error)}function _p(t){return typeof t=="function"}function S2(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||babelHelpers.typeof(t)==="symbol"||typeof t=="undefined"}function x2(t){return Buffer.isBuffer(t)}function wh(t){return Object.prototype.toString.call(t)}function gh(t){return t<10?"0"+t.toString(10):t.toString(10)}function A2(){var t=new Date,e=[gh(t.getHours()),gh(t.getMinutes()),gh(t.getSeconds())].join(":");return[t.getDate(),E2[t.getMonth()],e].join(" ")}function O2(){console.log("%s - %s",A2(),ch.apply(null,arguments))}function Wv(t,e){if(!e||!Ws(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function Yv(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var mp,i2,o2,f2,di,gn,s2,sh,Wf,Mv,ah,m2,b2,Vs,ye,n8,i8,o8,f8,Mo,s8,lh,a8,ln,l8,Uo,u8,h2,uh,w2,g2,bp,ph,E2,N2,jt,c8,p8,d8,m8,b8,h8,w8,g8,y8,j8,Kn,_8,q8,Se,v8,Ys,T8,Yf,B8,Kf,k8,qp,S8,Ks,x8,Gs,E8,$i,A8,G,O8,N8,D8,F8,P8,R8,H8,z8,M8,U8,L8,C8,V8,W8,Y8,K8,G8,J8,Z8,X8,Q8,$8,eC,tC,rC,nC,iC,oC,fC,sC,aC,lC,uC,cC,yh,pC,Lo,dC,Js,mC,Co,bC,hC,vp,wC,Tp,gC,Cl,yC,jC,Vl,_C,qC,Bp,vC,xe,TC,BC,kC,Kv,IC,Gv,SC,xC,EC,AC,OC,NC,DC,FC,PC,RC,HC,zC,MC,UC,LC,CC,VC,WC,YC,KC,GC,JC,ZC,XC,QC,$C,eV,tV,rV,nV,iV,oV,fV,sV,aV,lV,uV,cV,pV,dV,mV,bV,hV,wV,gV,yV,jV,_V,qV,vV,TV,BV,jh=re(()=>{mp=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};i2=a2,o2=u2,f2=d2,di=[],gn=[],s2=typeof Uint8Array!="undefined"?Uint8Array:Array,sh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Wf=0,Mv=sh.length;Wf<Mv;++Wf)di[Wf]=sh[Wf],gn[sh.charCodeAt(Wf)]=Wf;gn["-".charCodeAt(0)]=62;gn["_".charCodeAt(0)]=63;ah={byteLength:i2,toByteArray:o2,fromByteArray:f2},m2=function(e,r,n,i,o){var f,s,l=o*8-i-1,u=(1<<l)-1,c=u>>1,_=-7,p=n?o-1:0,j=n?-1:1,S=e[r+p];for(p+=j,f=S&(1<<-_)-1,S>>=-_,_+=l;_>0;f=f*256+e[r+p],p+=j,_-=8);for(s=f&(1<<-_)-1,f>>=-_,_+=i;_>0;s=s*256+e[r+p],p+=j,_-=8);if(f===0)f=1-c;else{if(f===u)return s?NaN:(S?-1:1)*(1/0);s=s+Math.pow(2,i),f=f-c}return(S?-1:1)*s*Math.pow(2,f-i)},b2=function(e,r,n,i,o,f){var s,l,u,c=f*8-o-1,_=(1<<c)-1,p=_>>1,j=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=i?0:f-1,T=i?1:-1,U=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,s=_):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?r+=j/u:r+=j*Math.pow(2,1-p),r*u>=2&&(s++,u/=2),s+p>=_?(l=0,s=_):s+p>=1?(l=(r*u-1)*Math.pow(2,o),s=s+p):(l=r*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;e[n+S]=l&255,S+=T,l/=256,o-=8);for(s=s<<o|l,c+=o;c>0;e[n+S]=s&255,S+=T,s/=256,c-=8);e[n+S-T]|=U*128},Vs={read:m2,write:b2},ye=Dt(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=f,e.SlowBuffer=U,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,f.TYPED_ARRAY_SUPPORT=i(),!f.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var q=new Uint8Array(1),d={foo:function(){return 42}};return Object.setPrototypeOf(d,Uint8Array.prototype),Object.setPrototypeOf(q,d),q.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.byteOffset}});function o(q){if(q>n)throw new RangeError('The value "'+q+'" is invalid for option "size"');var d=new Uint8Array(q);return Object.setPrototypeOf(d,f.prototype),d}function f(q,d,m){if(typeof q=="number"){if(typeof d=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return c(q)}return s(q,d,m)}f.poolSize=8192;function s(q,d,m){if(typeof q=="string")return _(q,d);if(ArrayBuffer.isView(q))return p(q);if(q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q));if(Ke(q,ArrayBuffer)||q&&Ke(q.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ke(q,SharedArrayBuffer)||q&&Ke(q.buffer,SharedArrayBuffer)))return j(q,d,m);if(typeof q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var B=q.valueOf&&q.valueOf();if(B!=null&&B!==q)return f.from(B,d,m);var R=S(q);if(R)return R;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]=="function")return f.from(q[Symbol.toPrimitive]("string"),d,m);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q))}f.from=function(q,d,m){return s(q,d,m)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array);function l(q){if(typeof q!="number")throw new TypeError('"size" argument must be of type number');if(q<0)throw new RangeError('The value "'+q+'" is invalid for option "size"')}function u(q,d,m){return l(q),q<=0?o(q):d!==void 0?typeof m=="string"?o(q).fill(d,m):o(q).fill(d):o(q)}f.alloc=function(q,d,m){return u(q,d,m)};function c(q){return l(q),o(q<0?0:T(q)|0)}f.allocUnsafe=function(q){return c(q)},f.allocUnsafeSlow=function(q){return c(q)};function _(q,d){if((typeof d!="string"||d==="")&&(d="utf8"),!f.isEncoding(d))throw new TypeError("Unknown encoding: "+d);var m=W(q,d)|0,B=o(m),R=B.write(q,d);return R!==m&&(B=B.slice(0,R)),B}function p(q){for(var d=q.length<0?0:T(q.length)|0,m=o(d),B=0;B<d;B+=1)m[B]=q[B]&255;return m}function j(q,d,m){if(d<0||q.byteLength<d)throw new RangeError('"offset" is outside of buffer bounds');if(q.byteLength<d+(m||0))throw new RangeError('"length" is outside of buffer bounds');var B;return d===void 0&&m===void 0?B=new Uint8Array(q):m===void 0?B=new Uint8Array(q,d):B=new Uint8Array(q,d,m),Object.setPrototypeOf(B,f.prototype),B}function S(q){if(f.isBuffer(q)){var d=T(q.length)|0,m=o(d);return m.length===0||q.copy(m,0,0,d),m}if(q.length!==void 0)return typeof q.length!="number"||Ht(q.length)?o(0):p(q);if(q.type==="Buffer"&&Array.isArray(q.data))return p(q.data)}function T(q){if(q>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return q|0}function U(q){return+q!=q&&(q=0),f.alloc(+q)}f.isBuffer=function(d){return d!=null&&d._isBuffer===!0&&d!==f.prototype},f.compare=function(d,m){if(Ke(d,Uint8Array)&&(d=f.from(d,d.offset,d.byteLength)),Ke(m,Uint8Array)&&(m=f.from(m,m.offset,m.byteLength)),!f.isBuffer(d)||!f.isBuffer(m))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(d===m)return 0;for(var B=d.length,R=m.length,fe=0,se=Math.min(B,R);fe<se;++fe)if(d[fe]!==m[fe]){B=d[fe],R=m[fe];break}return B<R?-1:R<B?1:0},f.isEncoding=function(d){switch(String(d).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}},f.concat=function(d,m){if(!Array.isArray(d))throw new TypeError('"list" argument must be an Array of Buffers');if(d.length===0)return f.alloc(0);var B;if(m===void 0)for(m=0,B=0;B<d.length;++B)m+=d[B].length;var R=f.allocUnsafe(m),fe=0;for(B=0;B<d.length;++B){var se=d[B];if(Ke(se,Uint8Array)&&(se=f.from(se)),!f.isBuffer(se))throw new TypeError('"list" argument must be an Array of Buffers');se.copy(R,fe),fe+=se.length}return R};function W(q,d){if(f.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||Ke(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(q));var m=q.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&m===0)return 0;for(var R=!1;;)switch(d){case"ascii":case"latin1":case"binary":return m;case"utf8":case"utf-8":return _e(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m*2;case"hex":return m>>>1;case"base64":return So(q).length;default:if(R)return B?-1:_e(q).length;d=(""+d).toLowerCase(),R=!0}}f.byteLength=W;function L(q,d,m){var B=!1;if((d===void 0||d<0)&&(d=0),d>this.length||((m===void 0||m>this.length)&&(m=this.length),m<=0)||(m>>>=0,d>>>=0,m<=d))return"";for(q||(q="utf8");;)switch(q){case"hex":return A(this,d,m);case"utf8":case"utf-8":return b(this,d,m);case"ascii":return z(this,d,m);case"latin1":case"binary":return oe(this,d,m);case"base64":return N(this,d,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ye(this,d,m);default:if(B)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),B=!0}}f.prototype._isBuffer=!0;function te(q,d,m){var B=q[d];q[d]=q[m],q[m]=B}f.prototype.swap16=function(){var d=this.length;if(d%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var m=0;m<d;m+=2)te(this,m,m+1);return this},f.prototype.swap32=function(){var d=this.length;if(d%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var m=0;m<d;m+=4)te(this,m,m+3),te(this,m+1,m+2);return this},f.prototype.swap64=function(){var d=this.length;if(d%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var m=0;m<d;m+=8)te(this,m,m+7),te(this,m+1,m+6),te(this,m+2,m+5),te(this,m+3,m+4);return this},f.prototype.toString=function(){var d=this.length;return d===0?"":arguments.length===0?b(this,0,d):L.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(d){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");return this===d?!0:f.compare(this,d)===0},f.prototype.inspect=function(){var d="",m=e.INSPECT_MAX_BYTES;return d=this.toString("hex",0,m).replace(/(.{2})/g,"$1 ").trim(),this.length>m&&(d+=" ... "),"<Buffer "+d+">"},r&&(f.prototype[r]=f.prototype.inspect),f.prototype.compare=function(d,m,B,R,fe){if(Ke(d,Uint8Array)&&(d=f.from(d,d.offset,d.byteLength)),!f.isBuffer(d))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(d));if(m===void 0&&(m=0),B===void 0&&(B=d?d.length:0),R===void 0&&(R=0),fe===void 0&&(fe=this.length),m<0||B>d.length||R<0||fe>this.length)throw new RangeError("out of range index");if(R>=fe&&m>=B)return 0;if(R>=fe)return-1;if(m>=B)return 1;if(m>>>=0,B>>>=0,R>>>=0,fe>>>=0,this===d)return 0;for(var se=fe-R,nt=B-m,Ze=Math.min(se,nt),vt=this.slice(R,fe),br=d.slice(m,B),ke=0;ke<Ze;++ke)if(vt[ke]!==br[ke]){se=vt[ke],nt=br[ke];break}return se<nt?-1:nt<se?1:0};function pe(q,d,m,B,R){if(q.length===0)return-1;if(typeof m=="string"?(B=m,m=0):m>2147483647?m=2147483647:m<-2147483648&&(m=-2147483648),m=+m,Ht(m)&&(m=R?0:q.length-1),m<0&&(m=q.length+m),m>=q.length){if(R)return-1;m=q.length-1}else if(m<0)if(R)m=0;else return-1;if(typeof d=="string"&&(d=f.from(d,B)),f.isBuffer(d))return d.length===0?-1:J(q,d,m,B,R);if(typeof d=="number")return d=d&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(q,d,m):Uint8Array.prototype.lastIndexOf.call(q,d,m):J(q,[d],m,B,R);throw new TypeError("val must be string, number or Buffer")}function J(q,d,m,B,R){var fe=1,se=q.length,nt=d.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(q.length<2||d.length<2)return-1;fe=2,se/=2,nt/=2,m/=2}function Ze(v,I){return fe===1?v[I]:v.readUInt16BE(I*fe)}var vt;if(R){var br=-1;for(vt=m;vt<se;vt++)if(Ze(q,vt)===Ze(d,br===-1?0:vt-br)){if(br===-1&&(br=vt),vt-br+1===nt)return br*fe}else br!==-1&&(vt-=vt-br),br=-1}else for(m+nt>se&&(m=se-nt),vt=m;vt>=0;vt--){for(var ke=!0,Cn=0;Cn<nt;Cn++)if(Ze(q,vt+Cn)!==Ze(d,Cn)){ke=!1;break}if(ke)return vt}return-1}f.prototype.includes=function(d,m,B){return this.indexOf(d,m,B)!==-1},f.prototype.indexOf=function(d,m,B){return pe(this,d,m,B,!0)},f.prototype.lastIndexOf=function(d,m,B){return pe(this,d,m,B,!1)};function D(q,d,m,B){m=Number(m)||0;var R=q.length-m;B?(B=Number(B),B>R&&(B=R)):B=R;var fe=d.length;B>fe/2&&(B=fe/2);for(var se=0;se<B;++se){var nt=parseInt(d.substr(se*2,2),16);if(Ht(nt))return se;q[m+se]=nt}return se}function le(q,d,m,B){return It(_e(d,q.length-m),q,m,B)}function Y(q,d,m,B){return It($(d),q,m,B)}function de(q,d,m,B){return Y(q,d,m,B)}function y(q,d,m,B){return It(So(d),q,m,B)}function g(q,d,m,B){return It(Io(d,q.length-m),q,m,B)}f.prototype.write=function(d,m,B,R){if(m===void 0)R="utf8",B=this.length,m=0;else if(B===void 0&&typeof m=="string")R=m,B=this.length,m=0;else if(isFinite(m))m=m>>>0,isFinite(B)?(B=B>>>0,R===void 0&&(R="utf8")):(R=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var fe=this.length-m;if((B===void 0||B>fe)&&(B=fe),d.length>0&&(B<0||m<0)||m>this.length)throw new RangeError("Attempt to write outside buffer bounds");R||(R="utf8");for(var se=!1;;)switch(R){case"hex":return D(this,d,m,B);case"utf8":case"utf-8":return le(this,d,m,B);case"ascii":return Y(this,d,m,B);case"latin1":case"binary":return de(this,d,m,B);case"base64":return y(this,d,m,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,d,m,B);default:if(se)throw new TypeError("Unknown encoding: "+R);R=(""+R).toLowerCase(),se=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function N(q,d,m){return d===0&&m===q.length?ah.fromByteArray(q):ah.fromByteArray(q.slice(d,m))}function b(q,d,m){m=Math.min(q.length,m);for(var B=[],R=d;R<m;){var fe=q[R],se=null,nt=fe>239?4:fe>223?3:fe>191?2:1;if(R+nt<=m){var Ze,vt,br,ke;switch(nt){case 1:fe<128&&(se=fe);break;case 2:Ze=q[R+1],(Ze&192)==128&&(ke=(fe&31)<<6|Ze&63,ke>127&&(se=ke));break;case 3:Ze=q[R+1],vt=q[R+2],(Ze&192)==128&&(vt&192)==128&&(ke=(fe&15)<<12|(Ze&63)<<6|vt&63,ke>2047&&(ke<55296||ke>57343)&&(se=ke));break;case 4:Ze=q[R+1],vt=q[R+2],br=q[R+3],(Ze&192)==128&&(vt&192)==128&&(br&192)==128&&(ke=(fe&15)<<18|(Ze&63)<<12|(vt&63)<<6|br&63,ke>65535&&ke<1114112&&(se=ke))}}se===null?(se=65533,nt=1):se>65535&&(se-=65536,B.push(se>>>10&1023|55296),se=56320|se&1023),B.push(se),R+=nt}return K(B)}var H=4096;function K(q){var d=q.length;if(d<=H)return String.fromCharCode.apply(String,q);for(var m="",B=0;B<d;)m+=String.fromCharCode.apply(String,q.slice(B,B+=H));return m}function z(q,d,m){var B="";m=Math.min(q.length,m);for(var R=d;R<m;++R)B+=String.fromCharCode(q[R]&127);return B}function oe(q,d,m){var B="";m=Math.min(q.length,m);for(var R=d;R<m;++R)B+=String.fromCharCode(q[R]);return B}function A(q,d,m){var B=q.length;(!d||d<0)&&(d=0),(!m||m<0||m>B)&&(m=B);for(var R="",fe=d;fe<m;++fe)R+=bt[q[fe]];return R}function Ye(q,d,m){for(var B=q.slice(d,m),R="",fe=0;fe<B.length;fe+=2)R+=String.fromCharCode(B[fe]+B[fe+1]*256);return R}f.prototype.slice=function(d,m){var B=this.length;d=~~d,m=m===void 0?B:~~m,d<0?(d+=B,d<0&&(d=0)):d>B&&(d=B),m<0?(m+=B,m<0&&(m=0)):m>B&&(m=B),m<d&&(m=d);var R=this.subarray(d,m);return Object.setPrototypeOf(R,f.prototype),R};function me(q,d,m){if(q%1!=0||q<0)throw new RangeError("offset is not uint");if(q+d>m)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d],fe=1,se=0;++se<m&&(fe*=256);)R+=this[d+se]*fe;return R},f.prototype.readUIntBE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d+--m],fe=1;m>0&&(fe*=256);)R+=this[d+--m]*fe;return R},f.prototype.readUInt8=function(d,m){return d=d>>>0,m||me(d,1,this.length),this[d]},f.prototype.readUInt16LE=function(d,m){return d=d>>>0,m||me(d,2,this.length),this[d]|this[d+1]<<8},f.prototype.readUInt16BE=function(d,m){return d=d>>>0,m||me(d,2,this.length),this[d]<<8|this[d+1]},f.prototype.readUInt32LE=function(d,m){return d=d>>>0,m||me(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+this[d+3]*16777216},f.prototype.readUInt32BE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]*16777216+(this[d+1]<<16|this[d+2]<<8|this[d+3])},f.prototype.readIntLE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d],fe=1,se=0;++se<m&&(fe*=256);)R+=this[d+se]*fe;return fe*=128,R>=fe&&(R-=Math.pow(2,8*m)),R},f.prototype.readIntBE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=m,fe=1,se=this[d+--R];R>0&&(fe*=256);)se+=this[d+--R]*fe;return fe*=128,se>=fe&&(se-=Math.pow(2,8*m)),se},f.prototype.readInt8=function(d,m){return d=d>>>0,m||me(d,1,this.length),this[d]&128?(255-this[d]+1)*-1:this[d]},f.prototype.readInt16LE=function(d,m){d=d>>>0,m||me(d,2,this.length);var B=this[d]|this[d+1]<<8;return B&32768?B|4294901760:B},f.prototype.readInt16BE=function(d,m){d=d>>>0,m||me(d,2,this.length);var B=this[d+1]|this[d]<<8;return B&32768?B|4294901760:B},f.prototype.readInt32LE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},f.prototype.readInt32BE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},f.prototype.readFloatLE=function(d,m){return d=d>>>0,m||me(d,4,this.length),Vs.read(this,d,!0,23,4)},f.prototype.readFloatBE=function(d,m){return d=d>>>0,m||me(d,4,this.length),Vs.read(this,d,!1,23,4)},f.prototype.readDoubleLE=function(d,m){return d=d>>>0,m||me(d,8,this.length),Vs.read(this,d,!0,52,8)},f.prototype.readDoubleBE=function(d,m){return d=d>>>0,m||me(d,8,this.length),Vs.read(this,d,!1,52,8)};function V(q,d,m,B,R,fe){if(!f.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(d>R||d<fe)throw new RangeError('"value" argument is out of bounds');if(m+B>q.length)throw new RangeError("Index out of range")}f.prototype.writeUIntLE=function(d,m,B,R){if(d=+d,m=m>>>0,B=B>>>0,!R){var fe=Math.pow(2,8*B)-1;V(this,d,m,B,fe,0)}var se=1,nt=0;for(this[m]=d&255;++nt<B&&(se*=256);)this[m+nt]=d/se&255;return m+B},f.prototype.writeUIntBE=function(d,m,B,R){if(d=+d,m=m>>>0,B=B>>>0,!R){var fe=Math.pow(2,8*B)-1;V(this,d,m,B,fe,0)}var se=B-1,nt=1;for(this[m+se]=d&255;--se>=0&&(nt*=256);)this[m+se]=d/nt&255;return m+B},f.prototype.writeUInt8=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,1,255,0),this[m]=d&255,m+1},f.prototype.writeUInt16LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,65535,0),this[m]=d&255,this[m+1]=d>>>8,m+2},f.prototype.writeUInt16BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,65535,0),this[m]=d>>>8,this[m+1]=d&255,m+2},f.prototype.writeUInt32LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,4294967295,0),this[m+3]=d>>>24,this[m+2]=d>>>16,this[m+1]=d>>>8,this[m]=d&255,m+4},f.prototype.writeUInt32BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,4294967295,0),this[m]=d>>>24,this[m+1]=d>>>16,this[m+2]=d>>>8,this[m+3]=d&255,m+4},f.prototype.writeIntLE=function(d,m,B,R){if(d=+d,m=m>>>0,!R){var fe=Math.pow(2,8*B-1);V(this,d,m,B,fe-1,-fe)}var se=0,nt=1,Ze=0;for(this[m]=d&255;++se<B&&(nt*=256);)d<0&&Ze===0&&this[m+se-1]!==0&&(Ze=1),this[m+se]=(d/nt>>0)-Ze&255;return m+B},f.prototype.writeIntBE=function(d,m,B,R){if(d=+d,m=m>>>0,!R){var fe=Math.pow(2,8*B-1);V(this,d,m,B,fe-1,-fe)}var se=B-1,nt=1,Ze=0;for(this[m+se]=d&255;--se>=0&&(nt*=256);)d<0&&Ze===0&&this[m+se+1]!==0&&(Ze=1),this[m+se]=(d/nt>>0)-Ze&255;return m+B},f.prototype.writeInt8=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,1,127,-128),d<0&&(d=255+d+1),this[m]=d&255,m+1},f.prototype.writeInt16LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,32767,-32768),this[m]=d&255,this[m+1]=d>>>8,m+2},f.prototype.writeInt16BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,32767,-32768),this[m]=d>>>8,this[m+1]=d&255,m+2},f.prototype.writeInt32LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,2147483647,-2147483648),this[m]=d&255,this[m+1]=d>>>8,this[m+2]=d>>>16,this[m+3]=d>>>24,m+4},f.prototype.writeInt32BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),this[m]=d>>>24,this[m+1]=d>>>16,this[m+2]=d>>>8,this[m+3]=d&255,m+4};function X(q,d,m,B,R,fe){if(m+B>q.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("Index out of range")}function ze(q,d,m,B,R){return d=+d,m=m>>>0,R||X(q,d,m,4),Vs.write(q,d,m,B,23,4),m+4}f.prototype.writeFloatLE=function(d,m,B){return ze(this,d,m,!0,B)},f.prototype.writeFloatBE=function(d,m,B){return ze(this,d,m,!1,B)};function we(q,d,m,B,R){return d=+d,m=m>>>0,R||X(q,d,m,8),Vs.write(q,d,m,B,52,8),m+8}f.prototype.writeDoubleLE=function(d,m,B){return we(this,d,m,!0,B)},f.prototype.writeDoubleBE=function(d,m,B){return we(this,d,m,!1,B)},f.prototype.copy=function(d,m,B,R){if(!f.isBuffer(d))throw new TypeError("argument should be a Buffer");if(B||(B=0),!R&&R!==0&&(R=this.length),m>=d.length&&(m=d.length),m||(m=0),R>0&&R<B&&(R=B),R===B||d.length===0||this.length===0)return 0;if(m<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(R<0)throw new RangeError("sourceEnd out of bounds");R>this.length&&(R=this.length),d.length-m<R-B&&(R=d.length-m+B);var fe=R-B;if(this===d&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(m,B,R);else if(this===d&&B<m&&m<R)for(var se=fe-1;se>=0;--se)d[se+m]=this[se+B];else Uint8Array.prototype.set.call(d,this.subarray(B,R),m);return fe},f.prototype.fill=function(d,m,B,R){if(typeof d=="string"){if(typeof m=="string"?(R=m,m=0,B=this.length):typeof B=="string"&&(R=B,B=this.length),R!==void 0&&typeof R!="string")throw new TypeError("encoding must be a string");if(typeof R=="string"&&!f.isEncoding(R))throw new TypeError("Unknown encoding: "+R);if(d.length===1){var fe=d.charCodeAt(0);(R==="utf8"&&fe<128||R==="latin1")&&(d=fe)}}else typeof d=="number"?d=d&255:typeof d=="boolean"&&(d=Number(d));if(m<0||this.length<m||this.length<B)throw new RangeError("Out of range index");if(B<=m)return this;m=m>>>0,B=B===void 0?this.length:B>>>0,d||(d=0);var se;if(typeof d=="number")for(se=m;se<B;++se)this[se]=d;else{var nt=f.isBuffer(d)?d:f.from(d,R),Ze=nt.length;if(Ze===0)throw new TypeError('The value "'+d+'" is invalid for argument "value"');for(se=0;se<B-m;++se)this[se+m]=nt[se%Ze]}return this};var rt=/[^+/0-9A-Za-z-_]/g;function kr(q){if(q=q.split("=")[0],q=q.trim().replace(rt,""),q.length<2)return"";for(;q.length%4!=0;)q=q+"=";return q}function _e(q,d){d=d||1/0;for(var m,B=q.length,R=null,fe=[],se=0;se<B;++se){if(m=q.charCodeAt(se),m>55295&&m<57344){if(!R){if(m>56319){(d-=3)>-1&&fe.push(239,191,189);continue}else if(se+1===B){(d-=3)>-1&&fe.push(239,191,189);continue}R=m;continue}if(m<56320){(d-=3)>-1&&fe.push(239,191,189),R=m;continue}m=(R-55296<<10|m-56320)+65536}else R&&(d-=3)>-1&&fe.push(239,191,189);if(R=null,m<128){if((d-=1)<0)break;fe.push(m)}else if(m<2048){if((d-=2)<0)break;fe.push(m>>6|192,m&63|128)}else if(m<65536){if((d-=3)<0)break;fe.push(m>>12|224,m>>6&63|128,m&63|128)}else if(m<1114112){if((d-=4)<0)break;fe.push(m>>18|240,m>>12&63|128,m>>6&63|128,m&63|128)}else throw new Error("Invalid code point")}return fe}function $(q){for(var d=[],m=0;m<q.length;++m)d.push(q.charCodeAt(m)&255);return d}function Io(q,d){for(var m,B,R,fe=[],se=0;se<q.length&&!((d-=2)<0);++se)m=q.charCodeAt(se),B=m>>8,R=m%256,fe.push(R),fe.push(B);return fe}function So(q){return ah.toByteArray(kr(q))}function It(q,d,m,B){for(var R=0;R<B&&!(R+m>=d.length||R>=q.length);++R)d[R+m]=q[R];return R}function Ke(q,d){return q instanceof d||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===d.name}function Ht(q){return q!==q}var bt=function(){for(var q="0123456789abcdef",d=new Array(256),m=0;m<16;++m)for(var B=m*16,R=0;R<16;++R)d[B+R]=q[m]+q[R];return d}()}),n8=ye.Buffer,i8=ye.SlowBuffer,o8=ye.INSPECT_MAX_BYTES,f8=ye.kMaxLength,Mo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function r(n){if(ye.Buffer.isBuffer(n))return n;if(ArrayBuffer.isView(n))return ye.Buffer.from(n.buffer);if(n instanceof ArrayBuffer)return ye.Buffer.from(n);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=r});Mt(Mo);s8=Mo.ensureBuffer,lh=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function n(i){if(typeof i!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof i);if(!r.test(i))throw new TypeError("Invalid format for UUID: "+i);let o,f=new Uint8Array(16);return f[0]=(o=parseInt(i.slice(0,8),16))>>>24,f[1]=o>>>16&255,f[2]=o>>>8&255,f[3]=o&255,f[4]=(o=parseInt(i.slice(9,13),16))>>>8,f[5]=o&255,f[6]=(o=parseInt(i.slice(14,18),16))>>>8,f[7]=o&255,f[8]=(o=parseInt(i.slice(19,23),16))>>>8,f[9]=o&255,f[10]=(o=parseInt(i.slice(24,36),16))/1099511627776&255,f[11]=o/4294967296&255,f[12]=o>>>24&255,f[13]=o>>>16&255,f[14]=o>>>8&255,f[15]=o&255,f}e.parseUUID=n});Mt(lh);a8=lh.parseUUID,ln=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class r{constructor(i,o){if(i!=null&&typeof i!="string"&&!ArrayBuffer.isView(i)&&!(i instanceof ArrayBuffer)&&!Array.isArray(i))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=o??r.BSON_BINARY_SUBTYPE_DEFAULT,i==null?(this.buffer=ye.Buffer.alloc(r.BUFFER_SIZE),this.position=0):(typeof i=="string"?this.buffer=ye.Buffer.from(i,"binary"):Array.isArray(i)?this.buffer=ye.Buffer.from(i):this.buffer=Mo.ensureBuffer(i),this.position=this.buffer.byteLength)}put(i){if(typeof i=="string"&&i.length!==1)throw new TypeError("only accepts single character String");if(typeof i!="number"&&i.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let o;if(typeof i=="string"?o=i.charCodeAt(0):typeof i=="number"?o=i:o=i[0],o<0||o>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=o;else{let f=ye.Buffer.alloc(r.BUFFER_SIZE+this.buffer.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f,this.buffer[this.position++]=o}}write(i,o){if(o=typeof o=="number"?o:this.position,this.buffer.length<o+i.length){let f=ye.Buffer.alloc(this.buffer.length+i.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f}ArrayBuffer.isView(i)?(this.buffer.set(Mo.ensureBuffer(i),o),this.position=o+i.byteLength>this.position?o+i.length:this.position):typeof i=="string"&&(this.buffer.write(i,o,i.length,"binary"),this.position=o+i.length>this.position?o+i.length:this.position)}read(i,o){return o=o&&o>0?o:this.position,this.buffer.slice(i,i+o)}value(i){return i=!!i,i&&this.buffer.length===this.position?this.buffer:i?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(i){return this.buffer.toString(i)}toExtendedJSON(i){i=i||{};let o=this.buffer.toString("base64"),f=Number(this.sub_type).toString(16);return i.legacy?{$binary:o,$type:f.length===1?"0"+f:f}:{$binary:{base64:o,subType:f.length===1?"0"+f:f}}}static fromExtendedJSON(i,o){o=o||{};let f,s;if("$binary"in i?o.legacy&&typeof i.$binary=="string"&&"$type"in i?(s=i.$type?parseInt(i.$type,16):0,f=ye.Buffer.from(i.$binary,"base64")):typeof i.$binary!="string"&&(s=i.$binary.subType?parseInt(i.$binary.subType,16):0,f=ye.Buffer.from(i.$binary.base64,"base64")):"$uuid"in i&&(s=4,f=ye.Buffer.from(lh.parseUUID(i.$uuid))),!f)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(i)}`);return new r(f,s)}}e.Binary=r,r.BSON_BINARY_SUBTYPE_DEFAULT=0,r.BUFFER_SIZE=256,r.SUBTYPE_DEFAULT=0,r.SUBTYPE_FUNCTION=1,r.SUBTYPE_BYTE_ARRAY=2,r.SUBTYPE_UUID_OLD=3,r.SUBTYPE_UUID=4,r.SUBTYPE_MD5=5,r.SUBTYPE_USER_DEFINED=128,Object.defineProperty(r.prototype,"_bsontype",{value:"Binary"})});Mt(ln);l8=ln.Binary,Uo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class r{constructor(i,o){this.code=i,this.scope=o}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(i){return new r(i.$code,i.$scope)}}e.Code=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Code"})});Mt(Uo);u8=Uo.Code,h2={};typeof Object.create=="function"?uh=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:uh=function(e,r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e};w2=uh,g2=/%[sdj%]/g;bp={};Xi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Xi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};E2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];N2={inherits:w2,_extend:Wv,log:O2,isBuffer:x2,isPrimitive:S2,isFunction:_p,isError:jp,isDate:hh,isObject:Ws,isRegExp:yp,isUndefined:Qi,isSymbol:I2,isString:gp,isNumber:Vv,isNullOrUndefined:k2,isNull:wp,isBoolean:bh,isArray:Cv,inspect:Xi,deprecate:Lv,format:ch,debuglog:y2},jt=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.isBuffer=e.haveBuffer=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.randomBytes=e.normalizedFunctionString=void 0;function r(p){return p.toString().replace("function(","function (")}e.normalizedFunctionString=r;function n(p){let j=ye.Buffer.alloc(p);for(let S=0;S<p;++S)j[S]=Math.floor(Math.random()*256);return j}if(e.randomBytes=n,typeof window!="undefined"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=p=>window.crypto.getRandomValues(ye.Buffer.alloc(p));else{try{e.randomBytes=h2.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=n)}function i(p){return Object.prototype.toString.call(p)==="[object Uint8Array]"}e.isUint8Array=i;function o(p){return Object.prototype.toString.call(p)==="[object BigInt64Array]"}e.isBigInt64Array=o;function f(p){return Object.prototype.toString.call(p)==="[object BigUint64Array]"}e.isBigUInt64Array=f;function s(){return typeof mp!="undefined"&&typeof mp.Buffer!="undefined"}e.haveBuffer=s;function l(p){return s()&&ye.Buffer.isBuffer(p)}e.isBuffer=l;function u(p){return c(p)&&Object.prototype.toString.call(p)==="[object Date]"}e.isDate=u;function c(p){return typeof p=="object"&&p!==null}e.isObjectLike=c;function _(p,j){if(typeof window=="undefined"||typeof self=="undefined")return N2.deprecate(p,j);let S=!1;function T(...U){return S||(console.warn(j),S=!0),p.apply(this,...U)}return T}e.deprecate=_});Mt(jt);c8=jt.deprecate,p8=jt.isObjectLike,d8=jt.isDate,m8=jt.isBuffer,b8=jt.haveBuffer,h8=jt.isBigUInt64Array,w8=jt.isBigInt64Array,g8=jt.isUint8Array,y8=jt.randomBytes,j8=jt.normalizedFunctionString,Kn=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function r(i){return jt.isObjectLike(i)&&i.$id!=null&&i.$ref!=null}e.isDBRefLike=r;class n{constructor(o,f,s,l){let u=o.split(".");u.length===2&&(s=u.shift(),o=u.shift()),this.collection=o,this.oid=f,this.db=s,this.fields=l||{}}get namespace(){return this.collection}set namespace(o){this.collection=o}toJSON(){let o=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(o.$db=this.db),o}toExtendedJSON(o){o=o||{};let f={$ref:this.collection,$id:this.oid};return o.legacy||(this.db&&(f.$db=this.db),f=Object.assign(f,this.fields)),f}static fromExtendedJSON(o){let f=Object.assign({},o);return delete f.$ref,delete f.$id,delete f.$db,new n(o.$ref,o.$id,o.$db,f)}}e.DBRef=n,Object.defineProperty(n.prototype,"_bsontype",{value:"DBRef"})});Mt(Kn);_8=Kn.DBRef,q8=Kn.isDBRefLike,Se=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let r;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}let n=1<<16,i=1<<24,o=n*n,f=o*o,s=f/2,l={},u={};class c{constructor(p=0,j=0,S){this.comp=c.prototype.compare,this.div=c.prototype.divide,this.eq=c.prototype.equals,this.gt=c.prototype.greaterThan,this.gte=c.prototype.greaterThanOrEqual,this.ge=c.prototype.greaterThanOrEqual,this.lt=c.prototype.lessThan,this.lte=c.prototype.lessThanOrEqual,this.mod=c.prototype.modulo,this.rem=c.prototype.modulo,this.mul=c.prototype.multiply,this.neg=c.prototype.negate,this.neq=c.prototype.notEquals,this.ne=c.prototype.notEquals,this.shl=c.prototype.shiftLeft,this.shr=c.prototype.shiftRight,this.shr_u=c.prototype.shiftRightUnsigned,this.shru=c.prototype.shiftRightUnsigned,this.sub=c.prototype.subtract,this.eqz=c.prototype.isZero,this.le=c.prototype.lessThanOrEqual,this.low=p|0,this.high=j|0,this.unsigned=!!S,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(p,j,S){return new c(p,j,S)}static fromInt(p,j){let S,T,U;return j?(p>>>=0,(U=0<=p&&p<256)&&(T=u[p],T)?T:(S=c.fromBits(p,(p|0)<0?-1:0,!0),U&&(u[p]=S),S)):(p|=0,(U=-128<=p&&p<128)&&(T=l[p],T)?T:(S=c.fromBits(p,p<0?-1:0,!1),U&&(l[p]=S),S))}static fromNumber(p,j){if(isNaN(p))return j?c.UZERO:c.ZERO;if(j){if(p<0)return c.UZERO;if(p>=f)return c.MAX_UNSIGNED_VALUE}else{if(p<=-s)return c.MIN_VALUE;if(p+1>=s)return c.MAX_VALUE}return p<0?c.fromNumber(-p,j).neg():c.fromBits(p%o|0,p/o|0,j)}static fromBigInt(p,j){return c.fromString(p.toString(),j)}static fromString(p,j,S){if(p.length===0)throw Error("empty string");if(p==="NaN"||p==="Infinity"||p==="+Infinity"||p==="-Infinity")return c.ZERO;if(typeof j=="number"?(S=j,j=!1):j=!!j,S=S||10,S<2||36<S)throw RangeError("radix");let T;if((T=p.indexOf("-"))>0)throw Error("interior hyphen");if(T===0)return c.fromString(p.substring(1),j,S).neg();let U=c.fromNumber(Math.pow(S,8)),W=c.ZERO;for(let L=0;L<p.length;L+=8){let te=Math.min(8,p.length-L),pe=parseInt(p.substring(L,L+te),S);if(te<8){let J=c.fromNumber(Math.pow(S,te));W=W.mul(J).add(c.fromNumber(pe))}else W=W.mul(U),W=W.add(c.fromNumber(pe))}return W.unsigned=j,W}static fromBytes(p,j,S){return S?c.fromBytesLE(p,j):c.fromBytesBE(p,j)}static fromBytesLE(p,j){return new c(p[0]|p[1]<<8|p[2]<<16|p[3]<<24,p[4]|p[5]<<8|p[6]<<16|p[7]<<24,j)}static fromBytesBE(p,j){return new c(p[4]<<24|p[5]<<16|p[6]<<8|p[7],p[0]<<24|p[1]<<16|p[2]<<8|p[3],j)}static isLong(p){return jt.isObjectLike(p)&&p.__isLong__===!0}static fromValue(p,j){return typeof p=="number"?c.fromNumber(p,j):typeof p=="string"?c.fromString(p,j):c.fromBits(p.low,p.high,typeof j=="boolean"?j:p.unsigned)}add(p){c.isLong(p)||(p=c.fromValue(p));let j=this.high>>>16,S=this.high&65535,T=this.low>>>16,U=this.low&65535,W=p.high>>>16,L=p.high&65535,te=p.low>>>16,pe=p.low&65535,J=0,D=0,le=0,Y=0;return Y+=U+pe,le+=Y>>>16,Y&=65535,le+=T+te,D+=le>>>16,le&=65535,D+=S+L,J+=D>>>16,D&=65535,J+=j+W,J&=65535,c.fromBits(le<<16|Y,J<<16|D,this.unsigned)}and(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low&p.low,this.high&p.high,this.unsigned)}compare(p){if(c.isLong(p)||(p=c.fromValue(p)),this.eq(p))return 0;let j=this.isNegative(),S=p.isNegative();return j&&!S?-1:!j&&S?1:this.unsigned?p.high>>>0>this.high>>>0||p.high===this.high&&p.low>>>0>this.low>>>0?-1:1:this.sub(p).isNegative()?-1:1}divide(p){if(c.isLong(p)||(p=c.fromValue(p)),p.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&this.high===-2147483648&&p.low===-1&&p.high===-1)return this;let U=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,p.low,p.high);return c.fromBits(U,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?c.UZERO:c.ZERO;let j,S,T;if(this.unsigned){if(p.unsigned||(p=p.toUnsigned()),p.gt(this))return c.UZERO;if(p.gt(this.shru(1)))return c.UONE;T=c.UZERO}else{if(this.eq(c.MIN_VALUE))return p.eq(c.ONE)||p.eq(c.NEG_ONE)?c.MIN_VALUE:p.eq(c.MIN_VALUE)?c.ONE:(j=this.shr(1).div(p).shl(1),j.eq(c.ZERO)?p.isNegative()?c.ONE:c.NEG_ONE:(S=this.sub(p.mul(j)),T=j.add(S.div(p)),T));if(p.eq(c.MIN_VALUE))return this.unsigned?c.UZERO:c.ZERO;if(this.isNegative())return p.isNegative()?this.neg().div(p.neg()):this.neg().div(p).neg();if(p.isNegative())return this.div(p.neg()).neg();T=c.ZERO}for(S=this;S.gte(p);){j=Math.max(1,Math.floor(S.toNumber()/p.toNumber()));let U=Math.ceil(Math.log(j)/Math.LN2),W=U<=48?1:Math.pow(2,U-48),L=c.fromNumber(j),te=L.mul(p);for(;te.isNegative()||te.gt(S);)j-=W,L=c.fromNumber(j,this.unsigned),te=L.mul(p);L.isZero()&&(L=c.ONE),T=T.add(L),S=S.sub(te)}return T}equals(p){return c.isLong(p)||(p=c.fromValue(p)),this.unsigned!==p.unsigned&&this.high>>>31==1&&p.high>>>31==1?!1:this.high===p.high&&this.low===p.low}getHighBits(){return this.high}getHighBitsUnsigned(){return this.high>>>0}getLowBits(){return this.low}getLowBitsUnsigned(){return this.low>>>0}getNumBitsAbs(){if(this.isNegative())return this.eq(c.MIN_VALUE)?64:this.neg().getNumBitsAbs();let p=this.high!==0?this.high:this.low,j;for(j=31;j>0&&(p&1<<j)==0;j--);return this.high!==0?j+33:j+1}greaterThan(p){return this.comp(p)>0}greaterThanOrEqual(p){return this.comp(p)>=0}isEven(){return(this.low&1)==0}isNegative(){return!this.unsigned&&this.high<0}isOdd(){return(this.low&1)==1}isPositive(){return this.unsigned||this.high>=0}isZero(){return this.high===0&&this.low===0}lessThan(p){return this.comp(p)<0}lessThanOrEqual(p){return this.comp(p)<=0}modulo(p){if(c.isLong(p)||(p=c.fromValue(p)),r){let j=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,p.low,p.high);return c.fromBits(j,r.get_high(),this.unsigned)}return this.sub(this.div(p).mul(p))}multiply(p){if(this.isZero())return c.ZERO;if(c.isLong(p)||(p=c.fromValue(p)),r){let de=r.mul(this.low,this.high,p.low,p.high);return c.fromBits(de,r.get_high(),this.unsigned)}if(p.isZero())return c.ZERO;if(this.eq(c.MIN_VALUE))return p.isOdd()?c.MIN_VALUE:c.ZERO;if(p.eq(c.MIN_VALUE))return this.isOdd()?c.MIN_VALUE:c.ZERO;if(this.isNegative())return p.isNegative()?this.neg().mul(p.neg()):this.neg().mul(p).neg();if(p.isNegative())return this.mul(p.neg()).neg();if(this.lt(c.TWO_PWR_24)&&p.lt(c.TWO_PWR_24))return c.fromNumber(this.toNumber()*p.toNumber(),this.unsigned);let j=this.high>>>16,S=this.high&65535,T=this.low>>>16,U=this.low&65535,W=p.high>>>16,L=p.high&65535,te=p.low>>>16,pe=p.low&65535,J=0,D=0,le=0,Y=0;return Y+=U*pe,le+=Y>>>16,Y&=65535,le+=T*pe,D+=le>>>16,le&=65535,le+=U*te,D+=le>>>16,le&=65535,D+=S*pe,J+=D>>>16,D&=65535,D+=T*te,J+=D>>>16,D&=65535,D+=U*L,J+=D>>>16,D&=65535,J+=j*pe+S*te+T*L+U*W,J&=65535,c.fromBits(le<<16|Y,J<<16|D,this.unsigned)}negate(){return!this.unsigned&&this.eq(c.MIN_VALUE)?c.MIN_VALUE:this.not().add(c.ONE)}not(){return c.fromBits(~this.low,~this.high,this.unsigned)}notEquals(p){return!this.equals(p)}or(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low|p.low,this.high|p.high,this.unsigned)}shiftLeft(p){return c.isLong(p)&&(p=p.toInt()),(p&=63)==0?this:p<32?c.fromBits(this.low<<p,this.high<<p|this.low>>>32-p,this.unsigned):c.fromBits(0,this.low<<p-32,this.unsigned)}shiftRight(p){return c.isLong(p)&&(p=p.toInt()),(p&=63)==0?this:p<32?c.fromBits(this.low>>>p|this.high<<32-p,this.high>>p,this.unsigned):c.fromBits(this.high>>p-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(p){if(c.isLong(p)&&(p=p.toInt()),p&=63,p===0)return this;{let j=this.high;if(p<32){let S=this.low;return c.fromBits(S>>>p|j<<32-p,j>>>p,this.unsigned)}else return p===32?c.fromBits(j,0,this.unsigned):c.fromBits(j>>>p-32,0,this.unsigned)}}subtract(p){return c.isLong(p)||(p=c.fromValue(p)),this.add(p.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(p){return p?this.toBytesLE():this.toBytesBE()}toBytesLE(){let p=this.high,j=this.low;return[j&255,j>>>8&255,j>>>16&255,j>>>24,p&255,p>>>8&255,p>>>16&255,p>>>24]}toBytesBE(){let p=this.high,j=this.low;return[p>>>24,p>>>16&255,p>>>8&255,p&255,j>>>24,j>>>16&255,j>>>8&255,j&255]}toSigned(){return this.unsigned?c.fromBits(this.low,this.high,!1):this}toString(p){if(p=p||10,p<2||36<p)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(c.MIN_VALUE)){let U=c.fromNumber(p),W=this.div(U),L=W.mul(U).sub(this);return W.toString(p)+L.toInt().toString(p)}else return"-"+this.neg().toString(p);let j=c.fromNumber(Math.pow(p,6),this.unsigned),S=this,T="";for(;;){let U=S.div(j),L=(S.sub(U.mul(j)).toInt()>>>0).toString(p);if(S=U,S.isZero())return L+T;for(;L.length<6;)L="0"+L;T=""+L+T}}toUnsigned(){return this.unsigned?this:c.fromBits(this.low,this.high,!0)}xor(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low^p.low,this.high^p.high,this.unsigned)}toExtendedJSON(p){return p&&p.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(p,j){let S=c.fromString(p.$numberLong);return j&&j.relaxed?S.toNumber():S}}e.Long=c,c.TWO_PWR_24=c.fromInt(i),c.MAX_UNSIGNED_VALUE=c.fromBits(4294967295|0,4294967295|0,!0),c.ZERO=c.fromInt(0),c.UZERO=c.fromInt(0,!0),c.ONE=c.fromInt(1),c.UONE=c.fromInt(1,!0),c.NEG_ONE=c.fromInt(-1),c.MAX_VALUE=c.fromBits(4294967295|0,2147483647|0,!1),c.MIN_VALUE=c.fromBits(0,2147483648|0,!1),Object.defineProperty(c.prototype,"__isLong__",{value:!0}),Object.defineProperty(c.prototype,"_bsontype",{value:"Long"})});Mt(Se);v8=Se.Long,Ys=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let r=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,n=/^(\+|-)?(Infinity|inf)$/i,i=/^(\+|-)?NaN$/i,o=6111,f=-6176,s=6176,l=34,u=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),c=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),_=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),p=/^([-+])?(\d+)?$/,j=31,S=16383,T=30,U=31;function W(le){return!isNaN(parseInt(le,10))}function L(le){let Y=Se.Long.fromNumber(1e3*1e3*1e3),de=Se.Long.fromNumber(0);if(!le.parts[0]&&!le.parts[1]&&!le.parts[2]&&!le.parts[3])return{quotient:le,rem:de};for(let y=0;y<=3;y++)de=de.shiftLeft(32),de=de.add(new Se.Long(le.parts[y],0)),le.parts[y]=de.div(Y).low,de=de.modulo(Y);return{quotient:le,rem:de}}function te(le,Y){if(!le&&!Y)return{high:Se.Long.fromNumber(0),low:Se.Long.fromNumber(0)};let de=le.shiftRightUnsigned(32),y=new Se.Long(le.getLowBits(),0),g=Y.shiftRightUnsigned(32),N=new Se.Long(Y.getLowBits(),0),b=de.multiply(g),H=de.multiply(N),K=y.multiply(g),z=y.multiply(N);return b=b.add(H.shiftRightUnsigned(32)),H=new Se.Long(H.getLowBits(),0).add(K).add(z.shiftRightUnsigned(32)),b=b.add(H.shiftRightUnsigned(32)),z=H.shiftLeft(32).add(new Se.Long(z.getLowBits(),0)),{high:b,low:z}}function pe(le,Y){let de=le.high>>>0,y=Y.high>>>0;if(de<y)return!0;if(de===y){let g=le.low>>>0,N=Y.low>>>0;if(g<N)return!0}return!1}function J(le,Y){throw new TypeError(`"${le}" is not a valid Decimal128 string - ${Y}`)}class D{constructor(Y){this.bytes=Y}static fromString(Y){let de=!1,y=!1,g=!1,N=0,b=0,H=0,K=0,z=0,oe=[0],A=0,Ye=0,me=0,V=0,X=0,ze=0,we=new Se.Long(0,0),rt=new Se.Long(0,0),kr=0,_e=0;if(Y.length>=7e3)throw new TypeError(""+Y+" not a valid Decimal128 string");let $=Y.match(r),Io=Y.match(n),So=Y.match(i);if(!$&&!Io&&!So||Y.length===0)throw new TypeError(""+Y+" not a valid Decimal128 string");if($){let bt=$[2],q=$[4],d=$[5],m=$[6];q&&m===void 0&&J(Y,"missing exponent power"),q&&bt===void 0&&J(Y,"missing exponent base"),q===void 0&&(d||m)&&J(Y,"missing e before exponent")}if((Y[_e]==="+"||Y[_e]==="-")&&(de=Y[_e++]==="-"),!W(Y[_e])&&Y[_e]!=="."){if(Y[_e]==="i"||Y[_e]==="I")return new D(ye.Buffer.from(de?c:_));if(Y[_e]==="N")return new D(ye.Buffer.from(u))}for(;W(Y[_e])||Y[_e]===".";){if(Y[_e]==="."){y&&J(Y,"contains multiple periods"),y=!0,_e=_e+1;continue}A<34&&(Y[_e]!=="0"||g)&&(g||(z=b),g=!0,oe[Ye++]=parseInt(Y[_e],10),A=A+1),g&&(H=H+1),y&&(K=K+1),b=b+1,_e=_e+1}if(y&&!b)throw new TypeError(""+Y+" not a valid Decimal128 string");if(Y[_e]==="e"||Y[_e]==="E"){let bt=Y.substr(++_e).match(p);if(!bt||!bt[2])return new D(ye.Buffer.from(u));X=parseInt(bt[0],10),_e=_e+bt[0].length}if(Y[_e])return new D(ye.Buffer.from(u));if(me=0,!A)me=0,V=0,oe[0]=0,H=1,A=1,N=0;else if(V=A-1,N=H,N!==1)for(;Y[z+N-1]==="0";)N=N-1;for(X<=K&&K-X>1<<14?X=f:X=X-K;X>o;){if(V=V+1,V-me>l){if(oe.join("").match(/^0+$/)){X=o;break}J(Y,"overflow")}X=X-1}for(;X<f||A<H;){if(V===0&&N<A){X=f,N=0;break}if(A<H?H=H-1:V=V-1,X<o)X=X+1;else{if(oe.join("").match(/^0+$/)){X=o;break}J(Y,"overflow")}}if(V-me+1<N){let bt=b;y&&(z=z+1,bt=bt+1),de&&(z=z+1,bt=bt+1);let q=parseInt(Y[z+V+1],10),d=0;if(q>=5&&(d=1,q===5)){for(d=oe[V]%2==1?1:0,ze=z+V+2;ze<bt;ze++)if(parseInt(Y[ze],10)){d=1;break}}if(d){let m=V;for(;m>=0;m--)if(++oe[m]>9&&(oe[m]=0,m===0))if(X<o)X=X+1,oe[m]=1;else return new D(ye.Buffer.from(de?c:_))}}if(we=Se.Long.fromNumber(0),rt=Se.Long.fromNumber(0),N===0)we=Se.Long.fromNumber(0),rt=Se.Long.fromNumber(0);else if(V-me<17){let bt=me;for(rt=Se.Long.fromNumber(oe[bt++]),we=new Se.Long(0,0);bt<=V;bt++)rt=rt.multiply(Se.Long.fromNumber(10)),rt=rt.add(Se.Long.fromNumber(oe[bt]))}else{let bt=me;for(we=Se.Long.fromNumber(oe[bt++]);bt<=V-17;bt++)we=we.multiply(Se.Long.fromNumber(10)),we=we.add(Se.Long.fromNumber(oe[bt]));for(rt=Se.Long.fromNumber(oe[bt++]);bt<=V;bt++)rt=rt.multiply(Se.Long.fromNumber(10)),rt=rt.add(Se.Long.fromNumber(oe[bt]))}let It=te(we,Se.Long.fromString("100000000000000000"));It.low=It.low.add(rt),pe(It.low,rt)&&(It.high=It.high.add(Se.Long.fromNumber(1))),kr=X+s;let Ke={low:Se.Long.fromNumber(0),high:Se.Long.fromNumber(0)};It.high.shiftRightUnsigned(49).and(Se.Long.fromNumber(1)).equals(Se.Long.fromNumber(1))?(Ke.high=Ke.high.or(Se.Long.fromNumber(3).shiftLeft(61)),Ke.high=Ke.high.or(Se.Long.fromNumber(kr).and(Se.Long.fromNumber(16383).shiftLeft(47))),Ke.high=Ke.high.or(It.high.and(Se.Long.fromNumber(140737488355327)))):(Ke.high=Ke.high.or(Se.Long.fromNumber(kr&16383).shiftLeft(49)),Ke.high=Ke.high.or(It.high.and(Se.Long.fromNumber(562949953421311)))),Ke.low=It.low,de&&(Ke.high=Ke.high.or(Se.Long.fromString("9223372036854775808")));let Ht=ye.Buffer.alloc(16);return _e=0,Ht[_e++]=Ke.low.low&255,Ht[_e++]=Ke.low.low>>8&255,Ht[_e++]=Ke.low.low>>16&255,Ht[_e++]=Ke.low.low>>24&255,Ht[_e++]=Ke.low.high&255,Ht[_e++]=Ke.low.high>>8&255,Ht[_e++]=Ke.low.high>>16&255,Ht[_e++]=Ke.low.high>>24&255,Ht[_e++]=Ke.high.low&255,Ht[_e++]=Ke.high.low>>8&255,Ht[_e++]=Ke.high.low>>16&255,Ht[_e++]=Ke.high.low>>24&255,Ht[_e++]=Ke.high.high&255,Ht[_e++]=Ke.high.high>>8&255,Ht[_e++]=Ke.high.high>>16&255,Ht[_e++]=Ke.high.high>>24&255,new D(Ht)}toString(){let Y,de=0,y=new Array(36);for(let _e=0;_e<y.length;_e++)y[_e]=0;let g=0,N=!1,b,H={parts:[0,0,0,0]},K,z,oe=[];g=0;let A=this.bytes,Ye=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,me=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,V=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,X=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24;g=0,{low:new Se.Long(Ye,me),high:new Se.Long(V,X)}.high.lessThan(Se.Long.ZERO)&&oe.push("-");let we=X>>26&j;if(we>>3==3){if(we===T)return oe.join("")+"Infinity";if(we===U)return"NaN";Y=X>>15&S,b=8+(X>>14&1)}else b=X>>14&7,Y=X>>17&S;let rt=Y-s;if(H.parts[0]=(X&16383)+((b&15)<<14),H.parts[1]=V,H.parts[2]=me,H.parts[3]=Ye,H.parts[0]===0&&H.parts[1]===0&&H.parts[2]===0&&H.parts[3]===0)N=!0;else for(z=3;z>=0;z--){let _e=0,$=L(H);if(H=$.quotient,_e=$.rem.low,!!_e)for(K=8;K>=0;K--)y[z*9+K]=_e%10,_e=Math.floor(_e/10)}if(N)de=1,y[g]=0;else for(de=36;!y[g];)de=de-1,g=g+1;let kr=de-1+rt;if(kr>=34||kr<=-7||rt>0){if(de>34)return oe.push(`${0}`),rt>0?oe.push("E+"+rt):rt<0&&oe.push("E"+rt),oe.join("");oe.push(`${y[g++]}`),de=de-1,de&&oe.push(".");for(let _e=0;_e<de;_e++)oe.push(`${y[g++]}`);oe.push("E"),kr>0?oe.push("+"+kr):oe.push(`${kr}`)}else if(rt>=0)for(let _e=0;_e<de;_e++)oe.push(`${y[g++]}`);else{let _e=de+rt;if(_e>0)for(let $=0;$<_e;$++)oe.push(`${y[g++]}`);else oe.push("0");for(oe.push(".");_e++<0;)oe.push("0");for(let $=0;$<de-Math.max(_e-1,0);$++)oe.push(`${y[g++]}`)}return oe.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(Y){return D.fromString(Y.$numberDecimal)}}e.Decimal128=D,Object.defineProperty(D.prototype,"_bsontype",{value:"Decimal128"})});Mt(Ys);T8=Ys.Decimal128,Yf=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class r{constructor(i){i instanceof Number&&(i=i.valueOf()),this.value=+i}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(i){if(i&&(i.legacy||i.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let o;return Number.isInteger(this.value)?(o=this.value.toFixed(1),o.length>=13&&(o=this.value.toExponential(13).toUpperCase())):o=this.value.toString(),{$numberDouble:o}}static fromExtendedJSON(i,o){let f=parseFloat(i.$numberDouble);return o&&o.relaxed?f:new r(f)}}e.Double=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Double"})});Mt(Yf);B8=Yf.Double,Kf=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class r{constructor(i){i instanceof Number&&(i=i.valueOf()),this.value=+i}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(i){return i&&(i.relaxed||i.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(i,o){return o&&o.relaxed?parseInt(i.$numberInt,10):new r(i.$numberInt)}}e.Int32=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Int32"})});Mt(Kf);k8=Kf.Int32,qp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let r;e.Map=r;let n=function(f){return f&&f.Math==Math&&f};function i(){return n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof mp=="object"&&mp)||Function("return this")()}let o=i();Object.prototype.hasOwnProperty.call(o,"Map")?e.Map=r=o.Map:e.Map=r=class{constructor(s=[]){this._keys=[],this._values={};for(let l=0;l<s.length;l++){if(s[l]==null)continue;let u=s[l],c=u[0],_=u[1];this._keys.push(c),this._values[c]={v:_,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(s){let l=this._values[s];return l==null?!1:(delete this._values[s],this._keys.splice(l.i,1),!0)}entries(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?[l,this._values[l].v]:void 0,done:l===void 0}}}}forEach(s,l){l=l||this;for(let u=0;u<this._keys.length;u++){let c=this._keys[u];s.call(l,this._values[c].v,c,l)}}get(s){return this._values[s]?this._values[s].v:void 0}has(s){return this._values[s]!=null}keys(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?l:void 0,done:l===void 0}}}}set(s,l){return this._values[s]?(this._values[s].v=l,this):(this._keys.push(s),this._values[s]={v:l,i:this._keys.length-1},this)}values(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?this._values[l].v:void 0,done:l===void 0}}}}get size(){return this._keys.length}}});Mt(qp);S8=qp.Map,Ks=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class r{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new r}}e.MaxKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MaxKey"})});Mt(Ks);x8=Ks.MaxKey,Gs=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class r{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new r}}e.MinKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MinKey"})});Mt(Gs);E8=Gs.MinKey,$i=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let r=jt.randomBytes(5),n=new RegExp("^[0-9a-fA-F]{24}$"),i=[];for(let c=0;c<256;c++)i[c]=(c<=15?"0":"")+c.toString(16);let o=[],f=0;for(;f<10;)o[48+f]=f++;for(;f<16;)o[65-10+f]=o[97-10+f]=f++;let s=Symbol("id");class l{constructor(_){if(_ instanceof l&&(this[s]=_.id,this.__id=_.__id),typeof _=="object"&&_&&"id"in _&&("toHexString"in _&&typeof _.toHexString=="function"?this[s]=ye.Buffer.from(_.toHexString(),"hex"):this[s]=typeof _.id=="string"?ye.Buffer.from(_.id):_.id),(_==null||typeof _=="number")&&(this[s]=l.generate(typeof _=="number"?_:void 0),l.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(_)&&_.byteLength===12&&(this[s]=Mo.ensureBuffer(_)),typeof _=="string")if(_.length===12){let p=ye.Buffer.from(_);p.byteLength===12&&(this[s]=p)}else if(_.length===24&&n.test(_))this[s]=ye.Buffer.from(_,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");l.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[s]}set id(_){this[s]=_,l.cacheHexString&&(this.__id=_.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(_){this.id.writeUInt32BE(_,0)}toHexString(){if(l.cacheHexString&&this.__id)return this.__id;let _=this.id.toString("hex");return l.cacheHexString&&!this.__id&&(this.__id=_),_}static getInc(){return l.index=(l.index+1)%16777215}static generate(_){typeof _!="number"&&(_=~~(Date.now()/1e3));let p=l.getInc(),j=ye.Buffer.alloc(12);return j.writeUInt32BE(_,0),j[4]=r[0],j[5]=r[1],j[6]=r[2],j[7]=r[3],j[8]=r[4],j[11]=p&255,j[10]=p>>8&255,j[9]=p>>16&255,j}toString(_){return _?this.id.toString(_):this.toHexString()}toJSON(){return this.toHexString()}equals(_){return _==null?!1:_ instanceof l?this.toString()===_.toString():typeof _=="string"&&l.isValid(_)&&_.length===12&&this.id instanceof ye.Buffer?_===this.id.toString("binary"):typeof _=="string"&&l.isValid(_)&&_.length===24?_.toLowerCase()===this.toHexString():typeof _=="string"&&l.isValid(_)&&_.length===12?ye.Buffer.from(_).equals(this.id):typeof _=="object"&&"toHexString"in _&&typeof _.toHexString=="function"?_.toHexString()===this.toHexString():!1}getTimestamp(){let _=new Date,p=this.id.readUInt32BE(0);return _.setTime(Math.floor(p)*1e3),_}static createPk(){return new l}static createFromTime(_){let p=ye.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return p.writeUInt32BE(_,0),new l(p)}static createFromHexString(_){if(typeof _=="undefined"||_!=null&&_.length!==24)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new l(ye.Buffer.from(_,"hex"))}static isValid(_){return _==null?!1:typeof _=="number"?!0:typeof _=="string"?_.length===12||_.length===24&&n.test(_):_ instanceof l||_ instanceof ye.Buffer&&_.length===12?!0:typeof _=="object"&&"toHexString"in _&&typeof _.toHexString=="function"?typeof _.id=="string"?_.id.length===12:_.toHexString().length===24&&n.test(_.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(_){return new l(_.$oid)}}e.ObjectId=l,l.index=~~(Math.random()*16777215),Object.defineProperty(l.prototype,"generate",{value:jt.deprecate(c=>l.generate(c),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(l.prototype,"getInc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(l.prototype,"get_inc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(l,"get_inc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")});let u=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(l.prototype,u,l.prototype.toString),Object.defineProperty(l.prototype,"inspect",l.prototype.toString),Object.defineProperty(l.prototype,"_bsontype",{value:"ObjectID"})});Mt($i);A8=$i.ObjectId,G=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128});Mt(G);O8=G.BSON_BINARY_SUBTYPE_USER_DEFINED,N8=G.BSON_BINARY_SUBTYPE_MD5,D8=G.BSON_BINARY_SUBTYPE_UUID_NEW,F8=G.BSON_BINARY_SUBTYPE_UUID,P8=G.BSON_BINARY_SUBTYPE_BYTE_ARRAY,R8=G.BSON_BINARY_SUBTYPE_FUNCTION,H8=G.BSON_BINARY_SUBTYPE_DEFAULT,z8=G.BSON_DATA_MAX_KEY,M8=G.BSON_DATA_MIN_KEY,U8=G.BSON_DATA_DECIMAL128,L8=G.BSON_DATA_LONG,C8=G.BSON_DATA_TIMESTAMP,V8=G.BSON_DATA_INT,W8=G.BSON_DATA_CODE_W_SCOPE,Y8=G.BSON_DATA_SYMBOL,K8=G.BSON_DATA_CODE,G8=G.BSON_DATA_DBPOINTER,J8=G.BSON_DATA_REGEXP,Z8=G.BSON_DATA_NULL,X8=G.BSON_DATA_DATE,Q8=G.BSON_DATA_BOOLEAN,$8=G.BSON_DATA_OID,eC=G.BSON_DATA_UNDEFINED,tC=G.BSON_DATA_BINARY,rC=G.BSON_DATA_ARRAY,nC=G.BSON_DATA_OBJECT,iC=G.BSON_DATA_STRING,oC=G.BSON_DATA_NUMBER,fC=G.JS_INT_MIN,sC=G.JS_INT_MAX,aC=G.BSON_INT64_MIN,lC=G.BSON_INT64_MAX,uC=G.BSON_INT32_MIN,cC=G.BSON_INT32_MAX,yh=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function r(i,o,f){let s=4+1;if(Array.isArray(i))for(let l=0;l<i.length;l++)s+=n(l.toString(),i[l],o,!0,f);else{i.toBSON&&(i=i.toBSON());for(let l in i)s+=n(l,i[l],o,!1,f)}return s}e.calculateObjectSize=r;function n(i,o,f=!1,s=!1,l=!1){switch(o&&o.toBSON&&(o=o.toBSON()),typeof o){case"string":return 1+ye.Buffer.byteLength(i,"utf8")+1+4+ye.Buffer.byteLength(o,"utf8")+1;case"number":return Math.floor(o)===o&&o>=G.JS_INT_MIN&&o<=G.JS_INT_MAX&&o>=G.BSON_INT32_MIN&&o<=G.BSON_INT32_MAX?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(4+1):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);case"undefined":return s||!l?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1:0;case"boolean":return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(1+1);case"object":if(o==null||o._bsontype==="MinKey"||o._bsontype==="MaxKey")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1;if(o._bsontype==="ObjectId"||o._bsontype==="ObjectID")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(12+1);if(o instanceof Date||jt.isDate(o))return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(o)||o instanceof ArrayBuffer)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(1+4+1)+o.byteLength;if(o._bsontype==="Long"||o._bsontype==="Double"||o._bsontype==="Timestamp")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);if(o._bsontype==="Decimal128")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(16+1);if(o._bsontype==="Code")return o.scope!=null&&Object.keys(o.scope).length>0?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+4+ye.Buffer.byteLength(o.code.toString(),"utf8")+1+r(o.scope,f,l):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+ye.Buffer.byteLength(o.code.toString(),"utf8")+1;if(o._bsontype==="Binary")return o.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(o.position+1+4+1+4):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(o.position+1+4+1);if(o._bsontype==="Symbol")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+ye.Buffer.byteLength(o.value,"utf8")+4+1+1;if(o._bsontype==="DBRef"){let u=Object.assign({$ref:o.collection,$id:o.oid},o.fields);return o.db!=null&&(u.$db=o.db),(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+r(u,f,l)}else return o instanceof RegExp||Object.prototype.toString.call(o)==="[object RegExp]"?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.source,"utf8")+1+(o.global?1:0)+(o.ignoreCase?1:0)+(o.multiline?1:0)+1:o._bsontype==="BSONRegExp"?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.pattern,"utf8")+1+ye.Buffer.byteLength(o.options,"utf8")+1:(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+r(o,f,l)+1;case"function":if(o instanceof RegExp||Object.prototype.toString.call(o)==="[object RegExp]"||String.call(o)==="[object RegExp]")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.source,"utf8")+1+(o.global?1:0)+(o.ignoreCase?1:0)+(o.multiline?1:0)+1;if(f&&o.scope!=null&&Object.keys(o.scope).length>0)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+4+ye.Buffer.byteLength(jt.normalizedFunctionString(o),"utf8")+1+r(o.scope,f,l);if(f)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+ye.Buffer.byteLength(jt.normalizedFunctionString(o),"utf8")+1}return 0}});Mt(yh);pC=yh.calculateObjectSize,Lo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function r(i){return i.split("").sort().join("")}class n{constructor(o,f){this.pattern=o,this.options=f??"",r(this.options);for(let s=0;s<this.options.length;s++)if(!(this.options[s]==="i"||this.options[s]==="m"||this.options[s]==="x"||this.options[s]==="l"||this.options[s]==="s"||this.options[s]==="u"))throw new Error(`The regular expression option [${this.options[s]}] is not supported`)}static parseOptions(o){return o?o.split("").sort().join(""):""}toExtendedJSON(o){return o=o||{},o.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(o){if("$regex"in o)if(typeof o.$regex!="string"){if(o.$regex._bsontype==="BSONRegExp")return o}else return new n(o.$regex,n.parseOptions(o.$options));if("$regularExpression"in o)return new n(o.$regularExpression.pattern,n.parseOptions(o.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(o)}`)}}e.BSONRegExp=n,Object.defineProperty(n.prototype,"_bsontype",{value:"BSONRegExp"})});Mt(Lo);dC=Lo.BSONRegExp,Js=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class r{constructor(i){this.value=i}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(i){return new r(i.$symbol)}}e.BSONSymbol=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Symbol"})});Mt(Js);mC=Js.BSONSymbol,Co=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=Se.Long;class r extends e.LongWithoutOverridesClass{constructor(i,o){Se.Long.isLong(i)?super(i.low,i.high,!0):super(i,o,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(i){return new r(Se.Long.fromInt(i,!0))}static fromNumber(i){return new r(Se.Long.fromNumber(i,!0))}static fromBits(i,o){return new r(i,o)}static fromString(i,o){return new r(Se.Long.fromString(i,!0,o))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(i){return new r(i.$timestamp.i,i.$timestamp.t)}}e.Timestamp=r,r.MAX_VALUE=Se.Long.MAX_UNSIGNED_VALUE});Mt(Co);bC=Co.Timestamp,hC=Co.LongWithoutOverridesClass,vp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let r=128,n=192,i=224,o=240,f=248,s=192,l=224,u=240,c=128;function _(p,j,S){let T=0;for(let U=j;U<S;U+=1){let W=p[U];if(T){if((W&n)!==c)return!1;T-=1}else if(W&r)if((W&i)===s)T=1;else if((W&o)===l)T=2;else if((W&f)===u)T=3;else return!1}return!T}e.validateUtf8=_});Mt(vp);wC=vp.validateUtf8,Tp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let r=Se.Long.fromNumber(G.JS_INT_MAX),n=Se.Long.fromNumber(G.JS_INT_MIN),i={};function o(l,u,c){u=u??{};let _=u&&u.index?u.index:0,p=l[_]|l[_+1]<<8|l[_+2]<<16|l[_+3]<<24;if(p<5)throw new Error(`bson size must be >= 5, is ${p}`);if(u.allowObjectSmallerThanBufferSize&&l.length<p)throw new Error(`buffer length ${l.length} must be >= bson size ${p}`);if(!u.allowObjectSmallerThanBufferSize&&l.length!==p)throw new Error(`buffer length ${l.length} must === bson size ${p}`);if(p+_>l.byteLength)throw new Error(`(bson size ${p} + options.index ${_} must be <= buffer length ${l.byteLength})`);if(l[_+p-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return f(l,_,u,c)}e.deserialize=o;function f(l,u,c,_=!1){let p=c.evalFunctions==null?!1:c.evalFunctions,j=c.cacheFunctions==null?!1:c.cacheFunctions,S=c.fieldsAsRaw==null?null:c.fieldsAsRaw,T=c.raw==null?!1:c.raw,U=typeof c.bsonRegExp=="boolean"?c.bsonRegExp:!1,W=c.promoteBuffers==null?!1:c.promoteBuffers,L=c.promoteLongs==null?!0:c.promoteLongs,te=c.promoteValues==null?!0:c.promoteValues,pe=u;if(l.length<5)throw new Error("corrupt bson message < 5 bytes long");let J=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(J<5||J>l.length)throw new Error("corrupt bson message");let D=_?[]:{},le=0,Y=!1;for(;!Y;){let g=l[u++];if(g===0)break;let N=u;for(;l[N]!==0&&N<l.length;)N++;if(N>=l.byteLength)throw new Error("Bad BSON Document: illegal CString");let b=_?le++:l.toString("utf8",u,N);if(u=N+1,g===G.BSON_DATA_STRING){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");if(!vp.validateUtf8(l,u,u+H-1))throw new Error("Invalid UTF-8 string in BSON document");let K=l.toString("utf8",u,u+H-1);D[b]=K,u=u+H}else if(g===G.BSON_DATA_OID){let H=ye.Buffer.alloc(12);l.copy(H,0,u,u+12),D[b]=new $i.ObjectId(H),u=u+12}else if(g===G.BSON_DATA_INT&&te===!1)D[b]=new Kf.Int32(l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24);else if(g===G.BSON_DATA_INT)D[b]=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;else if(g===G.BSON_DATA_NUMBER&&te===!1)D[b]=new Yf.Double(l.readDoubleLE(u)),u=u+8;else if(g===G.BSON_DATA_NUMBER)D[b]=l.readDoubleLE(u),u=u+8;else if(g===G.BSON_DATA_DATE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;D[b]=new Date(new Se.Long(H,K).toNumber())}else if(g===G.BSON_DATA_BOOLEAN){if(l[u]!==0&&l[u]!==1)throw new Error("illegal boolean type value");D[b]=l[u++]===1}else if(g===G.BSON_DATA_OBJECT){let H=u,K=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24;if(K<=0||K>l.length-u)throw new Error("bad embedded document length in bson");T?D[b]=l.slice(u,u+K):D[b]=f(l,H,c,!1),u=u+K}else if(g===G.BSON_DATA_ARRAY){let H=u,K=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24,z=c,oe=u+K;if(S&&S[b]){z={};for(let A in c)z[A]=c[A];z.raw=!0}if(D[b]=f(l,H,z,!0),u=u+K,l[u-1]!==0)throw new Error("invalid array terminator byte");if(u!==oe)throw new Error("corrupted array bson")}else if(g===G.BSON_DATA_UNDEFINED)D[b]=void 0;else if(g===G.BSON_DATA_NULL)D[b]=null;else if(g===G.BSON_DATA_LONG){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,z=new Se.Long(H,K);L&&te===!0?D[b]=z.lessThanOrEqual(r)&&z.greaterThanOrEqual(n)?z.toNumber():z:D[b]=z}else if(g===G.BSON_DATA_DECIMAL128){let H=ye.Buffer.alloc(16);l.copy(H,0,u,u+16),u=u+16;let K=new Ys.Decimal128(H);"toObject"in K&&typeof K.toObject=="function"?D[b]=K.toObject():D[b]=K}else if(g===G.BSON_DATA_BINARY){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=H,z=l[u++];if(H<0)throw new Error("Negative binary type element size found");if(H>l.byteLength)throw new Error("Binary type size larger than document size");if(l.slice!=null){if(z===ln.Binary.SUBTYPE_BYTE_ARRAY){if(H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,H<0)throw new Error("Negative binary type element size found for subtype 0x02");if(H>K-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(H<K-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}W&&te?D[b]=l.slice(u,u+H):D[b]=new ln.Binary(l.slice(u,u+H),z)}else{let oe=ye.Buffer.alloc(H);if(z===ln.Binary.SUBTYPE_BYTE_ARRAY){if(H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,H<0)throw new Error("Negative binary type element size found for subtype 0x02");if(H>K-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(H<K-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(N=0;N<H;N++)oe[N]=l[u+N];W&&te?D[b]=oe:D[b]=new ln.Binary(oe,z)}u=u+H}else if(g===G.BSON_DATA_REGEXP&&U===!1){for(N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let H=l.toString("utf8",u,N);for(u=N+1,N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let K=l.toString("utf8",u,N);u=N+1;let z=new Array(K.length);for(N=0;N<K.length;N++)switch(K[N]){case"m":z[N]="m";break;case"s":z[N]="g";break;case"i":z[N]="i";break}D[b]=new RegExp(H,z.join(""))}else if(g===G.BSON_DATA_REGEXP&&U===!0){for(N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let H=l.toString("utf8",u,N);for(u=N+1,N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let K=l.toString("utf8",u,N);u=N+1,D[b]=new Lo.BSONRegExp(H,K)}else if(g===G.BSON_DATA_SYMBOL){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");let K=l.toString("utf8",u,u+H-1);D[b]=te?K:new Js.BSONSymbol(K),u=u+H}else if(g===G.BSON_DATA_TIMESTAMP){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;D[b]=new Co.Timestamp(H,K)}else if(g===G.BSON_DATA_MIN_KEY)D[b]=new Gs.MinKey;else if(g===G.BSON_DATA_MAX_KEY)D[b]=new Ks.MaxKey;else if(g===G.BSON_DATA_CODE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");let K=l.toString("utf8",u,u+H-1);p?j?D[b]=s(K,i,D):D[b]=s(K):D[b]=new Uo.Code(K),u=u+H}else if(g===G.BSON_DATA_CODE_W_SCOPE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(K<=0||K>l.length-u||l[u+K-1]!==0)throw new Error("bad string length in bson");let z=l.toString("utf8",u,u+K-1);u=u+K;let oe=u,A=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24,Ye=f(l,oe,c,!1);if(u=u+A,H<4+4+A+K)throw new Error("code_w_scope total size is too short, truncating scope");if(H>4+4+A+K)throw new Error("code_w_scope total size is too long, clips outer document");p?(j?D[b]=s(z,i,D):D[b]=s(z),D[b].scope=Ye):D[b]=new Uo.Code(z,Ye)}else if(g===G.BSON_DATA_DBPOINTER){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");if(!vp.validateUtf8(l,u,u+H-1))throw new Error("Invalid UTF-8 string in BSON document");let K=l.toString("utf8",u,u+H-1);u=u+H;let z=ye.Buffer.alloc(12);l.copy(z,0,u,u+12);let oe=new $i.ObjectId(z);u=u+12,D[b]=new Kn.DBRef(K,oe)}else throw new Error("Detected unknown BSON type "+g.toString(16)+' for fieldname "'+b+'"')}if(J!==u-pe)throw _?new Error("corrupt array bson"):new Error("corrupt object bson");let de=Object.keys(D).filter(g=>g.startsWith("$")),y=!0;if(de.forEach(g=>{["$ref","$id","$db"].indexOf(g)===-1&&(y=!1)}),!y)return D;if(Kn.isDBRefLike(D)){let g=Object.assign({},D);return delete g.$ref,delete g.$id,delete g.$db,new Kn.DBRef(D.$ref,D.$id,D.$db,g)}return D}function s(l,u,c){return u?(u[l]==null&&(u[l]=new Function(l)),u[l].bind(c)):new Function(l)}});Mt(Tp);gC=Tp.deserialize,Cl=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function r(T){return jt.isObjectLike(T)&&Reflect.has(T,"_bsontype")&&typeof T._bsontype=="string"}e.isBSONType=r;let n=2147483647,i=-2147483648,o=9223372036854776e3,f=-9223372036854776e3,s={$oid:$i.ObjectId,$binary:ln.Binary,$uuid:ln.Binary,$symbol:Js.BSONSymbol,$numberInt:Kf.Int32,$numberDecimal:Ys.Decimal128,$numberDouble:Yf.Double,$numberLong:Se.Long,$minKey:Gs.MinKey,$maxKey:Ks.MaxKey,$regex:Lo.BSONRegExp,$regularExpression:Lo.BSONRegExp,$timestamp:Co.Timestamp};function l(T,U={}){if(typeof T=="number"){if(U.relaxed||U.legacy)return T;if(Math.floor(T)===T){if(T>=i&&T<=n)return new Kf.Int32(T);if(T>=f&&T<=o)return Se.Long.fromNumber(T)}return new Yf.Double(T)}if(T==null||typeof T!="object")return T;if(T.$undefined)return null;let W=Object.keys(T).filter(L=>L.startsWith("$")&&T[L]!=null);for(let L=0;L<W.length;L++){let te=s[W[L]];if(te)return te.fromExtendedJSON(T,U)}if(T.$date!=null){let L=T.$date,te=new Date;return U.legacy?typeof L=="number"?te.setTime(L):typeof L=="string"&&te.setTime(Date.parse(L)):typeof L=="string"?te.setTime(Date.parse(L)):Se.Long.isLong(L)?te.setTime(L.toNumber()):typeof L=="number"&&U.relaxed&&te.setTime(L),te}if(T.$code!=null){let L=Object.assign({},T);return T.$scope&&(L.$scope=l(T.$scope)),Uo.Code.fromExtendedJSON(T)}if(T.$ref!=null||T.$dbPointer!=null){let L=T.$ref?T:T.$dbPointer;if(L instanceof Kn.DBRef)return L;let te=Object.keys(L).filter(J=>J.startsWith("$")),pe=!0;if(te.forEach(J=>{["$ref","$id","$db"].indexOf(J)===-1&&(pe=!1)}),pe)return Kn.DBRef.fromExtendedJSON(L)}return T}function u(T,U){return T.map(W=>_(W,U))}function c(T){let U=T.toISOString();return T.getUTCMilliseconds()!==0?U:U.slice(0,-5)+"Z"}function _(T,U){if(Array.isArray(T))return u(T,U);if(T===void 0)return null;if(T instanceof Date){let W=T.getTime(),L=W>-1&&W<2534023188e5;return U.legacy?U.relaxed&&L?{$date:T.getTime()}:{$date:c(T)}:U.relaxed&&L?{$date:c(T)}:{$date:{$numberLong:T.getTime().toString()}}}if(typeof T=="number"&&!U.relaxed){if(Math.floor(T)===T){let W=T>=i&&T<=n,L=T>=f&&T<=o;if(W)return{$numberInt:T.toString()};if(L)return{$numberLong:T.toString()}}return{$numberDouble:T.toString()}}if(T instanceof RegExp){let W=T.flags;if(W===void 0){let te=T.toString().match(/[gimuy]*$/);te&&(W=te[0])}return new Lo.BSONRegExp(T.source,W).toExtendedJSON(U)}return T!=null&&typeof T=="object"?j(T,U):T}let p={Binary:T=>new ln.Binary(T.value(),T.sub_type),Code:T=>new Uo.Code(T.code,T.scope),DBRef:T=>new Kn.DBRef(T.collection||T.namespace,T.oid,T.db,T.fields),Decimal128:T=>new Ys.Decimal128(T.bytes),Double:T=>new Yf.Double(T.value),Int32:T=>new Kf.Int32(T.value),Long:T=>Se.Long.fromBits(T.low!=null?T.low:T.low_,T.low!=null?T.high:T.high_,T.low!=null?T.unsigned:T.unsigned_),MaxKey:()=>new Ks.MaxKey,MinKey:()=>new Gs.MinKey,ObjectID:T=>new $i.ObjectId(T),ObjectId:T=>new $i.ObjectId(T),BSONRegExp:T=>new Lo.BSONRegExp(T.pattern,T.options),Symbol:T=>new Js.BSONSymbol(T.value),Timestamp:T=>Co.Timestamp.fromBits(T.low,T.high)};function j(T,U){if(T==null||typeof T!="object")throw new Error("not an object instance");let W=T._bsontype;if(typeof W=="undefined"){let L={};for(let te in T)L[te]=_(T[te],U);return L}else if(r(T)){let L=T;if(typeof L.toExtendedJSON!="function"){let te=p[T._bsontype];if(!te)throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype);L=te(L)}return W==="Code"&&L.scope?L=new Uo.Code(L.code,_(L.scope,U)):W==="DBRef"&&L.oid&&(L=new Kn.DBRef(L.collection,_(L.oid,U),L.db,L.fields)),L.toExtendedJSON(U)}else throw new Error("_bsontype must be a string, but was: "+typeof W)}var S;(function(T){function U(pe,J){let D=Object.assign({},{relaxed:!0,legacy:!1},J);return typeof D.relaxed=="boolean"&&(D.strict=!D.relaxed),typeof D.strict=="boolean"&&(D.relaxed=!D.strict),JSON.parse(pe,(le,Y)=>l(Y,D))}T.parse=U;function W(pe,J,D,le){D!=null&&typeof D=="object"&&(le=D,D=0),J!=null&&typeof J=="object"&&!Array.isArray(J)&&(le=J,J=void 0,D=0),le=Object.assign({},{relaxed:!0,legacy:!1},le);let Y=_(pe,le);return JSON.stringify(Y,J,D)}T.stringify=W;function L(pe,J){return J=J||{},JSON.parse(W(pe,J))}T.serialize=L;function te(pe,J){return J=J||{},U(JSON.stringify(pe),J)}T.deserialize=te})(S=e.EJSON||(e.EJSON={}))});Mt(Cl);yC=Cl.EJSON,jC=Cl.isBSONType,Vl=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function r(i,o,f,s,l){let u,c,_=f==="big",p=l*8-s-1,j=(1<<p)-1,S=j>>1,T=-7,U=_?0:l-1,W=_?1:-1,L=i[o+U];for(U+=W,u=L&(1<<-T)-1,L>>=-T,T+=p;T>0;u=u*256+i[o+U],U+=W,T-=8);for(c=u&(1<<-T)-1,u>>=-T,T+=s;T>0;c=c*256+i[o+U],U+=W,T-=8);if(u===0)u=1-S;else{if(u===j)return c?NaN:(L?-1:1)*(1/0);c=c+Math.pow(2,s),u=u-S}return(L?-1:1)*c*Math.pow(2,u-s)}e.readIEEE754=r;function n(i,o,f,s,l,u){let c,_,p,j=s==="big",S=u*8-l-1,T=(1<<S)-1,U=T>>1,W=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=j?u-1:0,te=j?-1:1,pe=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(_=isNaN(o)?1:0,c=T):(c=Math.floor(Math.log(o)/Math.LN2),o*(p=Math.pow(2,-c))<1&&(c--,p*=2),c+U>=1?o+=W/p:o+=W*Math.pow(2,1-U),o*p>=2&&(c++,p/=2),c+U>=T?(_=0,c=T):c+U>=1?(_=(o*p-1)*Math.pow(2,l),c=c+U):(_=o*Math.pow(2,U-1)*Math.pow(2,l),c=0)),isNaN(o)&&(_=0);l>=8;)i[f+L]=_&255,L+=te,_/=256,l-=8;for(c=c<<l|_,isNaN(o)&&(c+=8),S+=l;S>0;)i[f+L]=c&255,L+=te,c/=256,S-=8;i[f+L-te]|=pe*128}e.writeIEEE754=n});Mt(Vl);_C=Vl.writeIEEE754,qC=Vl.readIEEE754,Bp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function i(y){return Object.prototype.toString.call(y)==="[object RegExp]"}function o(y,g,N,b,H){y[b++]=G.BSON_DATA_STRING;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K+1,y[b-1]=0;let z=y.write(N,b+4,void 0,"utf8");return y[b+3]=z+1>>24&255,y[b+2]=z+1>>16&255,y[b+1]=z+1>>8&255,y[b]=z+1&255,b=b+4+z,y[b++]=0,b}function f(y,g,N,b,H){if(Number.isInteger(N)&&N>=G.BSON_INT32_MIN&&N<=G.BSON_INT32_MAX){y[b++]=G.BSON_DATA_INT;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0,y[b++]=N&255,y[b++]=N>>8&255,y[b++]=N>>16&255,y[b++]=N>>24&255}else{y[b++]=G.BSON_DATA_NUMBER;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0,Vl.writeIEEE754(y,N,b,"little",52,8),b=b+8}return b}function s(y,g,N,b,H){y[b++]=G.BSON_DATA_NULL;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,b}function l(y,g,N,b,H){y[b++]=G.BSON_DATA_BOOLEAN;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,y[b++]=N?1:0,b}function u(y,g,N,b,H){y[b++]=G.BSON_DATA_DATE;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=Se.Long.fromNumber(N.getTime()),oe=z.getLowBits(),A=z.getHighBits();return y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,y[b++]=A&255,y[b++]=A>>8&255,y[b++]=A>>16&255,y[b++]=A>>24&255,b}function c(y,g,N,b,H){y[b++]=G.BSON_DATA_REGEXP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,N.source&&N.source.match(r)!=null)throw Error("value "+N.source+" must not contain null bytes");return b=b+y.write(N.source,b,void 0,"utf8"),y[b++]=0,N.ignoreCase&&(y[b++]=105),N.global&&(y[b++]=115),N.multiline&&(y[b++]=109),y[b++]=0,b}function _(y,g,N,b,H){y[b++]=G.BSON_DATA_REGEXP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,N.pattern.match(r)!=null)throw Error("pattern "+N.pattern+" must not contain null bytes");return b=b+y.write(N.pattern,b,void 0,"utf8"),y[b++]=0,b=b+y.write(N.options.split("").sort().join(""),b,void 0,"utf8"),y[b++]=0,b}function p(y,g,N,b,H){N===null?y[b++]=G.BSON_DATA_NULL:N._bsontype==="MinKey"?y[b++]=G.BSON_DATA_MIN_KEY:y[b++]=G.BSON_DATA_MAX_KEY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,b}function j(y,g,N,b,H){y[b++]=G.BSON_DATA_OID;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,typeof N.id=="string")y.write(N.id,b,void 0,"binary");else if(N.id&&N.id.copy)N.id.copy(y,b,0,12);else throw new TypeError("object ["+JSON.stringify(N)+"] is not a valid ObjectId");return b+12}function S(y,g,N,b,H){y[b++]=G.BSON_DATA_BINARY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.length;return y[b++]=z&255,y[b++]=z>>8&255,y[b++]=z>>16&255,y[b++]=z>>24&255,y[b++]=G.BSON_BINARY_SUBTYPE_DEFAULT,y.set(Mo.ensureBuffer(N),b),b=b+z,b}function T(y,g,N,b,H=!1,K=0,z=!1,oe=!0,A=!1,Ye=[]){for(let X=0;X<Ye.length;X++)if(Ye[X]===N)throw new Error("cyclic dependency detected");Ye.push(N),y[b++]=Array.isArray(N)?G.BSON_DATA_ARRAY:G.BSON_DATA_OBJECT;let me=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+me,y[b++]=0;let V=de(y,N,H,b,K+1,z,oe,Ye);return Ye.pop(),V}function U(y,g,N,b,H){y[b++]=G.BSON_DATA_DECIMAL128;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,N.bytes.copy(y,b,0,16),b+16}function W(y,g,N,b,H){y[b++]=N._bsontype==="Long"?G.BSON_DATA_LONG:G.BSON_DATA_TIMESTAMP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.getLowBits(),oe=N.getHighBits();return y[b++]=z&255,y[b++]=z>>8&255,y[b++]=z>>16&255,y[b++]=z>>24&255,y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,b}function L(y,g,N,b,H){N=N.valueOf(),y[b++]=G.BSON_DATA_INT;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,y[b++]=N&255,y[b++]=N>>8&255,y[b++]=N>>16&255,y[b++]=N>>24&255,b}function te(y,g,N,b,H){y[b++]=G.BSON_DATA_NUMBER;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,Vl.writeIEEE754(y,N.value,b,"little",52,8),b=b+8,b}function pe(y,g,N,b,H=!1,K=0,z){y[b++]=G.BSON_DATA_CODE;let oe=z?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+oe,y[b++]=0;let A=jt.normalizedFunctionString(N),Ye=y.write(A,b+4,void 0,"utf8")+1;return y[b]=Ye&255,y[b+1]=Ye>>8&255,y[b+2]=Ye>>16&255,y[b+3]=Ye>>24&255,b=b+4+Ye-1,y[b++]=0,b}function J(y,g,N,b,H=!1,K=0,z=!1,oe=!0,A=!1){if(N.scope&&typeof N.scope=="object"){y[b++]=G.BSON_DATA_CODE_W_SCOPE;let Ye=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+Ye,y[b++]=0;let me=b,V=typeof N.code=="string"?N.code:N.code.toString();b=b+4;let X=y.write(V,b+4,void 0,"utf8")+1;y[b]=X&255,y[b+1]=X>>8&255,y[b+2]=X>>16&255,y[b+3]=X>>24&255,y[b+4+X-1]=0,b=b+X+4;let ze=de(y,N.scope,H,b,K+1,z,oe);b=ze-1;let we=ze-me;y[me++]=we&255,y[me++]=we>>8&255,y[me++]=we>>16&255,y[me++]=we>>24&255,y[b++]=0}else{y[b++]=G.BSON_DATA_CODE;let Ye=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+Ye,y[b++]=0;let me=N.code.toString(),V=y.write(me,b+4,void 0,"utf8")+1;y[b]=V&255,y[b+1]=V>>8&255,y[b+2]=V>>16&255,y[b+3]=V>>24&255,b=b+4+V-1,y[b++]=0}return b}function D(y,g,N,b,H){y[b++]=G.BSON_DATA_BINARY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.value(!0),oe=N.position;return N.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY&&(oe=oe+4),y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,y[b++]=N.sub_type,N.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY&&(oe=oe-4,y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255),y.set(z,b),b=b+N.position,b}function le(y,g,N,b,H){y[b++]=G.BSON_DATA_SYMBOL;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=y.write(N.value,b+4,void 0,"utf8")+1;return y[b]=z&255,y[b+1]=z>>8&255,y[b+2]=z>>16&255,y[b+3]=z>>24&255,b=b+4+z-1,y[b++]=0,b}function Y(y,g,N,b,H,K,z){y[b++]=G.BSON_DATA_OBJECT;let oe=z?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+oe,y[b++]=0;let A=b,Ye={$ref:N.collection||N.namespace,$id:N.oid};N.db!=null&&(Ye.$db=N.db),Ye=Object.assign(Ye,N.fields);let me=de(y,Ye,!1,b,H+1,K),V=me-A;return y[A++]=V&255,y[A++]=V>>8&255,y[A++]=V>>16&255,y[A++]=V>>24&255,me}function de(y,g,N=!1,b=0,H=0,K=!1,z=!0,oe=[]){b=b||0,oe=oe||[],oe.push(g);let A=b+4;if(Array.isArray(g))for(let me=0;me<g.length;me++){let V=""+me,X=g[me];if(X&&X.toBSON){if(typeof X.toBSON!="function")throw new TypeError("toBSON is not a function");X=X.toBSON()}if(typeof X=="string")A=o(y,V,X,A,!0);else if(typeof X=="number")A=f(y,V,X,A,!0);else{if(typeof X=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof X=="boolean")A=l(y,V,X,A,!0);else if(X instanceof Date||jt.isDate(X))A=u(y,V,X,A,!0);else if(X===void 0)A=s(y,V,X,A,!0);else if(X===null)A=s(y,V,X,A,!0);else if(X._bsontype==="ObjectId"||X._bsontype==="ObjectID")A=j(y,V,X,A,!0);else if(ye.Buffer.isBuffer(X)||jt.isUint8Array(X))A=S(y,V,X,A,!0);else if(X instanceof RegExp||i(X))A=c(y,V,X,A,!0);else if(typeof X=="object"&&X._bsontype==null)A=T(y,V,X,A,N,H,K,z,!0,oe);else if(typeof X=="object"&&Cl.isBSONType(X)&&X._bsontype==="Decimal128")A=U(y,V,X,A,!0);else if(X._bsontype==="Long"||X._bsontype==="Timestamp")A=W(y,V,X,A,!0);else if(X._bsontype==="Double")A=te(y,V,X,A,!0);else if(typeof X=="function"&&K)A=pe(y,V,X,A,N,H,!0);else if(X._bsontype==="Code")A=J(y,V,X,A,N,H,K,z,!0);else if(X._bsontype==="Binary")A=D(y,V,X,A,!0);else if(X._bsontype==="Symbol")A=le(y,V,X,A,!0);else if(X._bsontype==="DBRef")A=Y(y,V,X,A,H,K,!0);else if(X._bsontype==="BSONRegExp")A=_(y,V,X,A,!0);else if(X._bsontype==="Int32")A=L(y,V,X,A,!0);else if(X._bsontype==="MinKey"||X._bsontype==="MaxKey")A=p(y,V,X,A,!0);else if(typeof X._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+X._bsontype)}}else if(g instanceof qp.Map){let me=g.entries(),V=!1;for(;!V;){let X=me.next();if(V=!!X.done,V)continue;let ze=X.value[0],we=X.value[1],rt=typeof we;if(typeof ze=="string"&&!n.has(ze)){if(ze.match(r)!=null)throw Error("key "+ze+" must not contain null bytes");if(N){if(ze[0]==="$")throw Error("key "+ze+" must not start with '$'");if(~ze.indexOf("."))throw Error("key "+ze+" must not contain '.'")}}if(rt==="string")A=o(y,ze,we,A);else if(rt==="number")A=f(y,ze,we,A);else{if(rt==="bigint"||jt.isBigInt64Array(we)||jt.isBigUInt64Array(we))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(rt==="boolean")A=l(y,ze,we,A);else if(we instanceof Date||jt.isDate(we))A=u(y,ze,we,A);else if(we===null||we===void 0&&z===!1)A=s(y,ze,we,A);else if(we._bsontype==="ObjectId"||we._bsontype==="ObjectID")A=j(y,ze,we,A);else if(ye.Buffer.isBuffer(we)||jt.isUint8Array(we))A=S(y,ze,we,A);else if(we instanceof RegExp||i(we))A=c(y,ze,we,A);else if(rt==="object"&&we._bsontype==null)A=T(y,ze,we,A,N,H,K,z,!1,oe);else if(rt==="object"&&we._bsontype==="Decimal128")A=U(y,ze,we,A);else if(we._bsontype==="Long"||we._bsontype==="Timestamp")A=W(y,ze,we,A);else if(we._bsontype==="Double")A=te(y,ze,we,A);else if(we._bsontype==="Code")A=J(y,ze,we,A,N,H,K,z);else if(typeof we=="function"&&K)A=pe(y,ze,we,A,N,H,K);else if(we._bsontype==="Binary")A=D(y,ze,we,A);else if(we._bsontype==="Symbol")A=le(y,ze,we,A);else if(we._bsontype==="DBRef")A=Y(y,ze,we,A,H,K);else if(we._bsontype==="BSONRegExp")A=_(y,ze,we,A);else if(we._bsontype==="Int32")A=L(y,ze,we,A);else if(we._bsontype==="MinKey"||we._bsontype==="MaxKey")A=p(y,ze,we,A);else if(typeof we._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+we._bsontype)}}}else{if(g.toBSON){if(typeof g.toBSON!="function")throw new TypeError("toBSON is not a function");if(g=g.toBSON(),g!=null&&typeof g!="object")throw new TypeError("toBSON function did not return an object")}for(let me in g){let V=g[me];if(V&&V.toBSON){if(typeof V.toBSON!="function")throw new TypeError("toBSON is not a function");V=V.toBSON()}let X=typeof V;if(typeof me=="string"&&!n.has(me)){if(me.match(r)!=null)throw Error("key "+me+" must not contain null bytes");if(N){if(me[0]==="$")throw Error("key "+me+" must not start with '$'");if(~me.indexOf("."))throw Error("key "+me+" must not contain '.'")}}if(X==="string")A=o(y,me,V,A);else if(X==="number")A=f(y,me,V,A);else{if(X==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(X==="boolean")A=l(y,me,V,A);else if(V instanceof Date||jt.isDate(V))A=u(y,me,V,A);else if(V===void 0)z===!1&&(A=s(y,me,V,A));else if(V===null)A=s(y,me,V,A);else if(V._bsontype==="ObjectId"||V._bsontype==="ObjectID")A=j(y,me,V,A);else if(ye.Buffer.isBuffer(V)||jt.isUint8Array(V))A=S(y,me,V,A);else if(V instanceof RegExp||i(V))A=c(y,me,V,A);else if(X==="object"&&V._bsontype==null)A=T(y,me,V,A,N,H,K,z,!1,oe);else if(X==="object"&&V._bsontype==="Decimal128")A=U(y,me,V,A);else if(V._bsontype==="Long"||V._bsontype==="Timestamp")A=W(y,me,V,A);else if(V._bsontype==="Double")A=te(y,me,V,A);else if(V._bsontype==="Code")A=J(y,me,V,A,N,H,K,z);else if(typeof V=="function"&&K)A=pe(y,me,V,A,N,H,K);else if(V._bsontype==="Binary")A=D(y,me,V,A);else if(V._bsontype==="Symbol")A=le(y,me,V,A);else if(V._bsontype==="DBRef")A=Y(y,me,V,A,H,K);else if(V._bsontype==="BSONRegExp")A=_(y,me,V,A);else if(V._bsontype==="Int32")A=L(y,me,V,A);else if(V._bsontype==="MinKey"||V._bsontype==="MaxKey")A=p(y,me,V,A);else if(typeof V._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+V._bsontype)}}}oe.pop(),y[A++]=0;let Ye=A-b;return y[b++]=Ye&255,y[b++]=Ye>>8&255,y[b++]=Ye>>16&255,y[b++]=Ye>>24&255,A}e.serializeInto=de});Mt(Bp);vC=Bp.serializeInto,xe=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return ln.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return Uo.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return Kn.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return Ys.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return Yf.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return Kf.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return Se.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return qp.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return Ks.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return Gs.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return $i.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return $i.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return Lo.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return Js.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return Co.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return G.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return G.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return G.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return G.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return G.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return G.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return G.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return G.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return G.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return G.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return G.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return G.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return G.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return G.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return G.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return G.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return G.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return G.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return G.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return G.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return G.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return G.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return G.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return G.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return G.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return G.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return G.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return Cl.EJSON}});var r=Co;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return r.LongWithoutOverridesClass}});let n=1024*1024*17,i=ye.Buffer.alloc(n);function o(_){i.length<_&&(i=ye.Buffer.alloc(_))}e.setInternalBufferSize=o;function f(_,p={}){let j=typeof p.checkKeys=="boolean"?p.checkKeys:!1,S=typeof p.serializeFunctions=="boolean"?p.serializeFunctions:!1,T=typeof p.ignoreUndefined=="boolean"?p.ignoreUndefined:!0,U=typeof p.minInternalBufferSize=="number"?p.minInternalBufferSize:n;i.length<U&&(i=ye.Buffer.alloc(U));let W=Bp.serializeInto(i,_,j,0,0,S,T,[]),L=ye.Buffer.alloc(W);return i.copy(L,0,0,L.length),L}e.serialize=f;function s(_,p,j={}){let S=typeof j.checkKeys=="boolean"?j.checkKeys:!1,T=typeof j.serializeFunctions=="boolean"?j.serializeFunctions:!1,U=typeof j.ignoreUndefined=="boolean"?j.ignoreUndefined:!0,W=typeof j.index=="number"?j.index:0,L=Bp.serializeInto(i,_,S,0,0,T,U);return i.copy(p,W,0,L),W+L-1}e.serializeWithBufferAndIndex=s;function l(_,p={}){return Tp.deserialize(Mo.ensureBuffer(_),p)}e.deserialize=l;function u(_,p={}){p=p||{};let j=typeof p.serializeFunctions=="boolean"?p.serializeFunctions:!1,S=typeof p.ignoreUndefined=="boolean"?p.ignoreUndefined:!0;return yh.calculateObjectSize(_,j,S)}e.calculateObjectSize=u;function c(_,p,j,S,T,U){let W=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},U),L=Mo.ensureBuffer(_),te=p;for(let pe=0;pe<j;pe++){let J=L[te]|L[te+1]<<8|L[te+2]<<16|L[te+3]<<24;W.index=te,S[T+pe]=Tp.deserialize(L,W),te=te+J}return te}e.deserializeStream=c}),TC=Mt(xe),BC=xe.deserializeStream,kC=xe.calculateObjectSize,Kv=xe.deserialize,IC=xe.serializeWithBufferAndIndex,Gv=xe.serialize,SC=xe.setInternalBufferSize,xC=xe.ObjectID,EC=xe.Decimal128,AC=xe.BSONRegExp,OC=xe.MaxKey,NC=xe.MinKey,DC=xe.Int32,FC=xe.Double,PC=xe.Timestamp,RC=xe.Long,HC=xe.ObjectId,zC=xe.Binary,MC=xe.DBRef,UC=xe.BSONSymbol,LC=xe.Map,CC=xe.Code,VC=xe.LongWithoutOverridesClass,WC=xe.EJSON,YC=xe.JS_INT_MIN,KC=xe.JS_INT_MAX,GC=xe.BSON_INT64_MIN,JC=xe.BSON_INT64_MAX,ZC=xe.BSON_INT32_MIN,XC=xe.BSON_INT32_MAX,QC=xe.BSON_DATA_UNDEFINED,$C=xe.BSON_DATA_TIMESTAMP,eV=xe.BSON_DATA_SYMBOL,tV=xe.BSON_DATA_STRING,rV=xe.BSON_DATA_REGEXP,nV=xe.BSON_DATA_OID,iV=xe.BSON_DATA_OBJECT,oV=xe.BSON_DATA_NUMBER,fV=xe.BSON_DATA_NULL,sV=xe.BSON_DATA_MIN_KEY,aV=xe.BSON_DATA_MAX_KEY,lV=xe.BSON_DATA_LONG,uV=xe.BSON_DATA_INT,cV=xe.BSON_DATA_DECIMAL128,pV=xe.BSON_DATA_DBPOINTER,dV=xe.BSON_DATA_DATE,mV=xe.BSON_DATA_CODE_W_SCOPE,bV=xe.BSON_DATA_CODE,hV=xe.BSON_DATA_BOOLEAN,wV=xe.BSON_DATA_BINARY,gV=xe.BSON_DATA_ARRAY,yV=xe.BSON_BINARY_SUBTYPE_UUID_NEW,jV=xe.BSON_BINARY_SUBTYPE_UUID,_V=xe.BSON_BINARY_SUBTYPE_USER_DEFINED,qV=xe.BSON_BINARY_SUBTYPE_MD5,vV=xe.BSON_BINARY_SUBTYPE_FUNCTION,TV=xe.BSON_BINARY_SUBTYPE_DEFAULT,BV=xe.BSON_BINARY_SUBTYPE_BYTE_ARRAY});function _h(t,e){return Kv(new Uint8Array(t),e)}var Jv=re(()=>{jh()});async function F2(t,e){let r={...qh.bson,...e==null?void 0:e.bson};return _h(t,r)}function P2(t,e){let r={...qh.bson,...e==null?void 0:e.bson};return _h(t,r)}var D2,qh,vh,Zv=re(()=>{Jv();D2="3.4.0-alpha.5",qh={bson:{}},vh={name:"BSON",id:"bson",module:"bson",version:D2,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:F2,parseSync:P2,options:qh}});function Th(t,e){return Gv(t).buffer}var Xv=re(()=>{jh()});var R2,Bh,Qv=re(()=>{Xv();R2="3.4.0-alpha.5",Bh={name:"BSON",id:"bson",module:"bson",version:R2,extensions:["bson"],options:{image:{mimeType:"application/bson"}},async encode(t,e){return Th(t,{})},encodeSync(t,e){return Th(t,{})}}});var $v=re(()=>{Zv();Qv()});function eT(t,e,r){if(!(t in Gf))throw new Error(`invalid type: ${t}`);return Gf[t].toPrimitive(e,r)}function tT(t,e,r){if(!(t in Gf))throw new Error(`invalid type: ${t}`);return"fromPrimitive"in Gf[t]?Gf[t].fromPrimitive?.(e,r):e}function H2(t){return Boolean(t)}function z2(t){return Boolean(t)}function M2(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for FLOAT: ${t}`);return e}function U2(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for DOUBLE: ${t}`);return e}function L2(t){let e=parseInt(t,10);if(e<-128||e>127||isNaN(e))throw new Error(`invalid value for INT8: ${t}`);return e}function C2(t){let e=parseInt(t,10);if(e<0||e>255||isNaN(e))throw new Error(`invalid value for UINT8: ${t}`);return e}function V2(t){let e=parseInt(t,10);if(e<-32768||e>32767||isNaN(e))throw new Error(`invalid value for INT16: ${t}`);return e}function W2(t){let e=parseInt(t,10);if(e<0||e>65535||isNaN(e))throw new Error(`invalid value for UINT16: ${t}`);return e}function rT(t){let e=parseInt(t,10);if(e<-2147483648||e>2147483647||isNaN(e))throw new Error(`invalid value for INT32: ${t}`);return e}function Y2(t,e){let r=t*10**(e.scale||0),n=Math.round(r*10**-e.presision%1*10**e.presision);if(n<-2147483648||n>2147483647||isNaN(n))throw new Error(`invalid value for INT32: ${t}`);return n}function K2(t){let e=parseInt(t,10);if(e<0||e>281474976710655||isNaN(e))throw new Error(`invalid value for UINT32: ${t}`);return e}function nT(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT64: ${t}`);return e}function G2(t,e){let r=t*10**(e.scale||0),n=Math.round(r*10**-e.presision%1*10**e.presision);if(isNaN(n))throw new Error(`invalid value for INT64: ${t}`);return n}function J2(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for UINT64: ${t}`);return e}function Z2(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT96: ${t}`);return e}function iT(t){return Buffer.from(t)}function oT(t){return Buffer.from(t)}function X2(t){return Buffer.from(t,"utf8")}function Q2(t){return t.toString()}function $2(t){return Buffer.from(JSON.stringify(t))}function eN(t){return JSON.parse(t)}function tN(t){let e=Bh.encodeSync?.(t);return Buffer.from(e)}function rN(t){return vh.parseSync?.(t)}function nN(t){let e=parseInt(t,10);if(e<0||e>18446744073709552e3||isNaN(e))throw new Error(`invalid value for TIME_MILLIS: ${t}`);return e}function iN(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIME_MICROS: ${t}`);return e}function oN(t){if(t instanceof Date)return t.getTime()/fT;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for DATE: ${t}`);return e}}function fN(t){return new Date(t*fT)}function sN(t){if(t instanceof Date)return t.getTime();{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MILLIS: ${t}`);return e}}function aN(t){return new Date(t)}function lN(t){if(t instanceof Date)return t.getTime()*1e3;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MICROS: ${t}`);return e}}function uN(t){return new Date(t/1e3)}function cN(t){if(!t.months||!t.days||!t.milliseconds)throw new Error("value for INTERVAL must be object { months: ..., days: ..., milliseconds: ... }");let e=Buffer.alloc(12);return e.writeUInt32LE(t.months,0),e.writeUInt32LE(t.days,4),e.writeUInt32LE(t.milliseconds,8),e}function pN(t){let e=Buffer.from(t),r=e.readUInt32LE(0),n=e.readUInt32LE(4),i=e.readUInt32LE(8);return{months:r,days:n,milliseconds:i}}function sT(t,e){return Math.round(t*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}function aT(t,e){let r=0;if(t.length<=4)for(let i=0;i<t.length;i++)r+=t[i]<<8*(t.length-i-1);else for(let i=0;i<t.length;i++)r+=t[i]*2**(8*(t.length-1-i));return Math.round(r*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}var Gf,fT,kh=re(()=>{$v();Gf={BOOLEAN:{primitiveType:"BOOLEAN",toPrimitive:H2,fromPrimitive:z2},INT32:{primitiveType:"INT32",toPrimitive:rT},INT64:{primitiveType:"INT64",toPrimitive:nT},INT96:{primitiveType:"INT96",toPrimitive:Z2},FLOAT:{primitiveType:"FLOAT",toPrimitive:M2},DOUBLE:{primitiveType:"DOUBLE",toPrimitive:U2},BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",toPrimitive:iT},FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",toPrimitive:iT},UTF8:{primitiveType:"BYTE_ARRAY",originalType:"UTF8",toPrimitive:X2,fromPrimitive:Q2},TIME_MILLIS:{primitiveType:"INT32",originalType:"TIME_MILLIS",toPrimitive:nN},TIME_MICROS:{primitiveType:"INT64",originalType:"TIME_MICROS",toPrimitive:iN},DATE:{primitiveType:"INT32",originalType:"DATE",toPrimitive:oN,fromPrimitive:fN},TIMESTAMP_MILLIS:{primitiveType:"INT64",originalType:"TIMESTAMP_MILLIS",toPrimitive:sN,fromPrimitive:aN},TIMESTAMP_MICROS:{primitiveType:"INT64",originalType:"TIMESTAMP_MICROS",toPrimitive:lN,fromPrimitive:uN},UINT_8:{primitiveType:"INT32",originalType:"UINT_8",toPrimitive:C2},UINT_16:{primitiveType:"INT32",originalType:"UINT_16",toPrimitive:W2},UINT_32:{primitiveType:"INT32",originalType:"UINT_32",toPrimitive:K2},UINT_64:{primitiveType:"INT64",originalType:"UINT_64",toPrimitive:J2},INT_8:{primitiveType:"INT32",originalType:"INT_8",toPrimitive:L2},INT_16:{primitiveType:"INT32",originalType:"INT_16",toPrimitive:V2},INT_32:{primitiveType:"INT32",originalType:"INT_32",toPrimitive:rT},INT_64:{primitiveType:"INT64",originalType:"INT_64",toPrimitive:nT},JSON:{primitiveType:"BYTE_ARRAY",originalType:"JSON",toPrimitive:$2,fromPrimitive:eN},BSON:{primitiveType:"BYTE_ARRAY",originalType:"BSON",toPrimitive:tN,fromPrimitive:rN},INTERVAL:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"INTERVAL",typeLength:12,toPrimitive:cN,fromPrimitive:pN},DECIMAL_INT32:{primitiveType:"INT32",originalType:"DECIMAL_INT32",toPrimitive:Y2,fromPrimitive:sT},DECIMAL_INT64:{primitiveType:"INT64",originalType:"DECIMAL_INT64",toPrimitive:G2,fromPrimitive:sT},DECIMAL_BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",originalType:"DECIMAL_BYTE_ARRAY",toPrimitive:oT,fromPrimitive:aT},DECIMAL_FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"DECIMAL_FIXED_LEN_BYTE_ARRAY",toPrimitive:oT,fromPrimitive:aT}};fT=864e5});function Ih(t){let e={};for(let r of t.fieldList)e[r.key]={dlevels:[],rlevels:[],values:[],pageHeaders:[],count:0};return{rowCount:0,columnData:e}}function kp(t,e,r){let n=Ih(t).columnData;if(Sh(t.fields,e,n,0,0),r.rowCount===0){r.rowCount=1,r.columnData=n;return}r.rowCount+=1;for(let i of t.fieldList)Array.prototype.push.apply(r.columnData[i.key].rlevels,n[i.key].rlevels),Array.prototype.push.apply(r.columnData[i.key].dlevels,n[i.key].dlevels),Array.prototype.push.apply(r.columnData[i.key].values,n[i.key].values),r.columnData[i.key].count+=n[i.key].count}function Sh(t,e,r,n,i){for(let o in t){let f=t[o],s=[];if(e&&f.name in e&&e[f.name]!==void 0&&e[f.name]!==null&&(e[f.name].constructor===Array?s=e[f.name]:s.push(e[f.name])),s.length===0&&Boolean(e)&&f.repetitionType==="REQUIRED")throw new Error(`missing required field: ${f.name}`);if(s.length>1&&f.repetitionType!=="REPEATED")throw new Error(`too many values for field: ${f.name}`);if(s.length===0){f.isNested?Sh(f.fields,null,r,n,i):(r[f.key].count+=1,r[f.key].rlevels.push(n),r[f.key].dlevels.push(i));continue}for(let l=0;l<s.length;l++){let u=l===0?n:f.rLevelMax;f.isNested?Sh(f.fields,s[l],r,u,f.dLevelMax):(r[f.key].count+=1,r[f.key].rlevels.push(u),r[f.key].dlevels.push(f.dLevelMax),r[f.key].values.push(eT(f.originalType||f.primitiveType,s[l])))}}}function Ip(t,e){let r=[];for(let n=0;n<e.rowCount;n++)r.push({});for(let n in e.columnData){let i=e.columnData[n];i.count&&dN(t,i,n,r)}return r}function dN(t,e,r,n){let i=t.findField(r),o=t.findFieldBranch(r),f=new Array(i.rLevelMax+1).fill(0),s=0;for(let l=0;l<e.count;l++){let u=e.dlevels[l],c=e.rlevels[l];f[c]++,f.fill(0,c+1);let _=0,p=n[f[_++]-1];for(let j of o){if(j===i||u<j.dLevelMax)break;switch(j.repetitionType){case"REPEATED":j.name in p||(p[j.name]=[]);let S=f[_++];for(;p[j.name].length<=S;)p[j.name].push({});p=p[j.name][S];break;default:p[j.name]=p[j.name]||{},p=p[j.name]}}if(u===i.dLevelMax){let j=tT(i.originalType||i.primitiveType,e.values[s],i);switch(s++,i.repetitionType){case"REPEATED":i.name in p||(p[i.name]=[]);let S=f[_];for(;p[i.name].length<=S;)p[i.name].push(null);p[i.name][S]=j;break;default:p[i.name]=j}}}}var Sp=re(()=>{kh()});function xh(t,e){for(let r in t){let n=t[r];n.fields?xh(n.fields,e):n.compression=e}}function lT(t,e,r,n){let i={};for(let o in t){let f=t[o],s=!f.optional,l=Boolean(f.repeated),u=e,c=r,_="REQUIRED";if(s||(_="OPTIONAL",c++),l&&(_="REPEATED",u++,s&&c++),f.fields){let S=n.concat([o]);i[o]={name:o,path:S,key:S.join(),repetitionType:_,rLevelMax:u,dLevelMax:c,isNested:!0,fieldCount:Object.keys(f.fields).length,fields:lT(f.fields,u,c,S)};continue}let p=Gf[f.type];if(!p)throw new Error(`invalid parquet type: ${f.type}`);if(f.encoding=f.encoding||"PLAIN",!(f.encoding in No))throw new Error(`unsupported parquet encoding: ${f.encoding}`);if(f.compression=f.compression||"UNCOMPRESSED",!(f.compression in Ul))throw new Error(`unsupported compression method: ${f.compression}`);let j=n.concat([o]);i[o]={name:o,primitiveType:p.primitiveType,originalType:p.originalType,path:j,key:j.join(),repetitionType:_,encoding:f.encoding,compression:f.compression,typeLength:f.typeLength||p.typeLength,presision:f.presision,scale:f.scale,rLevelMax:u,dLevelMax:c}}return i}function uT(t){let e=[];for(let r in t)e.push(t[r]),t[r].isNested&&(e=e.concat(uT(t[r].fields)));return e}var Wl,Eh=re(()=>{Nc();Ll();Sp();kh();Wl=class{constructor(e){this.schema=e,this.fields=lT(e,0,0,[]),this.fieldList=uT(this.fields)}findField(e){typeof e=="string"?e=e.split(","):e=e.slice(0);let r=this.fields;for(;e.length>1;e.shift())r=r[e[0]].fields;return r[e[0]]}findFieldBranch(e){typeof e=="string"&&(e=e.split(","));let r=[],n=this.fields;for(;e.length>0;e.shift())r.push(n[e[0]]),e.length>1&&(n=n[e[0]].fields);return r}shredRecord(e,r){kp(this,e,r)}materializeRecords(e){return Ip(this,e)}compress(e){return xh(this.schema,e),xh(this.fields,e),this}buffer(){return Ih(this)}}});var eo,cT=re(()=>{(function(l){l[l.BOOLEAN=0]="BOOLEAN",l[l.INT32=1]="INT32",l[l.INT64=2]="INT64",l[l.INT96=3]="INT96",l[l.FLOAT=4]="FLOAT",l[l.DOUBLE=5]="DOUBLE",l[l.BYTE_ARRAY=6]="BYTE_ARRAY",l[l.FIXED_LEN_BYTE_ARRAY=7]="FIXED_LEN_BYTE_ARRAY"})(eo||(eo={}))});var Zs,pT=re(()=>{(function(D){D[D.UTF8=0]="UTF8",D[D.MAP=1]="MAP",D[D.MAP_KEY_VALUE=2]="MAP_KEY_VALUE",D[D.LIST=3]="LIST",D[D.ENUM=4]="ENUM",D[D.DECIMAL=5]="DECIMAL",D[D.DATE=6]="DATE",D[D.TIME_MILLIS=7]="TIME_MILLIS",D[D.TIME_MICROS=8]="TIME_MICROS",D[D.TIMESTAMP_MILLIS=9]="TIMESTAMP_MILLIS",D[D.TIMESTAMP_MICROS=10]="TIMESTAMP_MICROS",D[D.UINT_8=11]="UINT_8",D[D.UINT_16=12]="UINT_16",D[D.UINT_32=13]="UINT_32",D[D.UINT_64=14]="UINT_64",D[D.INT_8=15]="INT_8",D[D.INT_16=16]="INT_16",D[D.INT_32=17]="INT_32",D[D.INT_64=18]="INT_64",D[D.JSON=19]="JSON",D[D.BSON=20]="BSON",D[D.INTERVAL=21]="INTERVAL"})(Zs||(Zs={}))});var Xs,dT=re(()=>{(function(n){n[n.REQUIRED=0]="REQUIRED",n[n.OPTIONAL=1]="OPTIONAL",n[n.REPEATED=2]="REPEATED"})(Xs||(Xs={}))});var Gr,mT=re(()=>{(function(l){l[l.PLAIN=0]="PLAIN",l[l.PLAIN_DICTIONARY=2]="PLAIN_DICTIONARY",l[l.RLE=3]="RLE",l[l.BIT_PACKED=4]="BIT_PACKED",l[l.DELTA_BINARY_PACKED=5]="DELTA_BINARY_PACKED",l[l.DELTA_LENGTH_BYTE_ARRAY=6]="DELTA_LENGTH_BYTE_ARRAY",l[l.DELTA_BYTE_ARRAY=7]="DELTA_BYTE_ARRAY",l[l.RLE_DICTIONARY=8]="RLE_DICTIONARY"})(Gr||(Gr={}))});var Qs,bT=re(()=>{(function(l){l[l.UNCOMPRESSED=0]="UNCOMPRESSED",l[l.SNAPPY=1]="SNAPPY",l[l.GZIP=2]="GZIP",l[l.LZO=3]="LZO",l[l.BROTLI=4]="BROTLI",l[l.LZ4=5]="LZ4",l[l.ZSTD=6]="ZSTD",l[l.LZ4_RAW=7]="LZ4_RAW"})(Qs||(Qs={}))});var Jf,hT=re(()=>{(function(i){i[i.DATA_PAGE=0]="DATA_PAGE",i[i.INDEX_PAGE=1]="INDEX_PAGE",i[i.DICTIONARY_PAGE=2]="DICTIONARY_PAGE",i[i.DATA_PAGE_V2=3]="DATA_PAGE_V2"})(Jf||(Jf={}))});var wT,gT=re(()=>{(function(n){n[n.UNORDERED=0]="UNORDERED",n[n.ASCENDING=1]="ASCENDING",n[n.DESCENDING=2]="DESCENDING"})(wT||(wT={}))});var zr=M((e5,jT)=>{var Ah=4294967296,yT=[];for($s=0;$s<256;$s++)yT[$s]=($s>15?"":"0")+$s.toString(16);var $s,Yl=jT.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):Object.prototype.toString.call(t)=="[object Uint8Array]"?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};Yl.MAX_INT=Math.pow(2,53);Yl.MIN_INT=-Math.pow(2,53);Yl.prototype={constructor:Yl,_2scomp:function(){for(var t=this.buffer,e=this.offset,r=1,n=e+7;n>=e;n--){var i=(t[n]^255)+r;t[n]=i&255,r=i>>8}},setValue:function(t,e){var r=!1;if(arguments.length==1)if(typeof t=="number"){if(r=t<0,t=Math.abs(t),e=t%Ah,t=t/Ah,t>Ah)throw new RangeError(t+" is outside Int64 range");t=t|0}else if(typeof t=="string")t=(t+"").replace(/^0x/,""),e=t.substr(-8),t=t.length>8?t.substr(0,t.length-8):"",t=parseInt(t,16),e=parseInt(e,16);else throw new Error(t+" must be a Number or String");for(var n=this.buffer,i=this.offset,o=7;o>=0;o--)n[i+o]=e&255,e=o==4?t:e>>>8;r&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,r=this.offset,n=e[r]&128,i=0,o=1,f=7,s=1;f>=0;f--,s*=256){var l=e[r+f];n&&(l=(l^255)+o,o=l>>8,l=l&255),i+=l*s}return!t&&i>=Yl.MAX_INT?n?-1/0:1/0:n?-i:i},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var e=new Array(8),r=this.buffer,n=this.offset,i=0;i<8;i++)e[i]=yT[r[n+i]];return e.join(t||"")},toBuffer:function(t){if(t&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((this.buffer[this.offset]&128)!=(t.buffer[t.offset]&128))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return this.compare(t)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var Vo=M((mi,Oh)=>{var xp=Ci("util"),Kl=mi.Type={STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,UTF7:11,STRUCT:12,MAP:13,SET:14,LIST:15,UTF8:16,UTF16:17};mi.MessageType={CALL:1,REPLY:2,EXCEPTION:3,ONEWAY:4};mi.TException=Ep;function Ep(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}xp.inherits(Ep,Error);var mN=mi.TApplicationExceptionType={UNKNOWN:0,UNKNOWN_METHOD:1,INVALID_MESSAGE_TYPE:2,WRONG_METHOD_NAME:3,BAD_SEQUENCE_ID:4,MISSING_RESULT:5,INTERNAL_ERROR:6,PROTOCOL_ERROR:7,INVALID_TRANSFORM:8,INVALID_PROTOCOL:9,UNSUPPORTED_CLIENT_TYPE:10};mi.TApplicationException=Ap;function Ap(t,e){Ep.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.type=t||mN.UNKNOWN,this.name=this.constructor.name,this.message=e}xp.inherits(Ap,Ep);Ap.prototype.read=function(t){for(var e,r=t.readStructBegin("TApplicationException");r=t.readFieldBegin(),r.ftype!=Kl.STOP;){switch(r.fid){case 1:r.ftype==Kl.STRING?(r=t.readString(),this.message=r):r=t.skip(r.ftype);break;case 2:r.ftype==Kl.I32?(r=t.readI32(),this.type=r):r=t.skip(r.ftype);break;default:r=t.skip(r.ftype);break}t.readFieldEnd()}t.readStructEnd()};Ap.prototype.write=function(t){t.writeStructBegin("TApplicationException"),this.message&&(t.writeFieldBegin("message",Kl.STRING,1),t.writeString(this.message),t.writeFieldEnd()),this.code&&(t.writeFieldBegin("type",Kl.I32,2),t.writeI32(this.code),t.writeFieldEnd()),t.writeFieldStop(),t.writeStructEnd()};var t5=mi.TProtocolExceptionType={UNKNOWN:0,INVALID_DATA:1,NEGATIVE_SIZE:2,SIZE_LIMIT:3,BAD_VERSION:4,NOT_IMPLEMENTED:5,DEPTH_LIMIT:6};mi.TProtocolException=_T;function _T(t,e){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.type=t,this.message=e}xp.inherits(_T,Error);mi.objectLength=function(t){return Object.keys(t).length};mi.inherits=function(t,e){xp.inherits(t,e)};var Op,Np;Op=function(t,e){if(!t)return t;var r;e.shift===void 0?r=e:r=e[0];var n=r,i=t.length,o=[],f,s;for(f=0;f<i;f++)s=t[f],r===null?o.push(s):r===Np||r===Op?o.push(r(s,e.slice(1))):o.push(new n(s));return o};Np=function(t,e){if(!t)return t;var r;e.shift===void 0?r=e:r=e[0];var n=r,i={},o;for(var f in t)t.hasOwnProperty(f)&&(o=t[f],r===null?i[f]=o:r===Np||r===Op?i[f]=r(o,e.slice(1)):i[f]=new n(o));return i};Oh.exports.copyMap=Np;Oh.exports.copyList=Op});var vT=M((r5,qT)=>{var ea=null;typeof WebSocket!="undefined"?ea=WebSocket:typeof MozWebSocket!="undefined"?ea=MozWebSocket:typeof global!="undefined"?ea=global.WebSocket||global.MozWebSocket:typeof window!="undefined"?ea=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(ea=self.WebSocket||self.MozWebSocket);qT.exports=ea});var Dh=M((n5,Nh)=>{"use strict";var ta=typeof Reflect=="object"?Reflect:null,TT=ta&&typeof ta.apply=="function"?ta.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Dp;ta&&typeof ta.ownKeys=="function"?Dp=ta.ownKeys:Object.getOwnPropertySymbols?Dp=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Dp=function(e){return Object.getOwnPropertyNames(e)};function bN(t){console&&console.warn&&console.warn(t)}var BT=Number.isNaN||function(e){return e!==e};function kt(){kt.init.call(this)}Nh.exports=kt;Nh.exports.once=yN;kt.EventEmitter=kt;kt.prototype._events=void 0;kt.prototype._eventsCount=0;kt.prototype._maxListeners=void 0;var kT=10;function Fp(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(kt,"defaultMaxListeners",{enumerable:!0,get:function(){return kT},set:function(t){if(typeof t!="number"||t<0||BT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");kT=t}});kt.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};kt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||BT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function IT(t){return t._maxListeners===void 0?kt.defaultMaxListeners:t._maxListeners}kt.prototype.getMaxListeners=function(){return IT(this)};kt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var f;if(r.length>0&&(f=r[0]),f instanceof Error)throw f;var s=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw s.context=f,s}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")TT(l,this,r);else for(var u=l.length,c=OT(l,u),n=0;n<u;++n)TT(c[n],this,r);return!0};function ST(t,e,r,n){var i,o,f;if(Fp(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),f=o[e]),f===void 0)f=o[e]=r,++t._eventsCount;else if(typeof f=="function"?f=o[e]=n?[r,f]:[f,r]:n?f.unshift(r):f.push(r),i=IT(t),i>0&&f.length>i&&!f.warned){f.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=f.length,bN(s)}return t}kt.prototype.addListener=function(e,r){return ST(this,e,r,!1)};kt.prototype.on=kt.prototype.addListener;kt.prototype.prependListener=function(e,r){return ST(this,e,r,!0)};function hN(){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 xT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=hN.bind(n);return i.listener=r,n.wrapFn=i,i}kt.prototype.once=function(e,r){return Fp(r),this.on(e,xT(this,e,r)),this};kt.prototype.prependOnceListener=function(e,r){return Fp(r),this.prependListener(e,xT(this,e,r)),this};kt.prototype.removeListener=function(e,r){var n,i,o,f,s;if(Fp(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,f=n.length-1;f>=0;f--)if(n[f]===r||n[f].listener===r){s=n[f].listener,o=f;break}if(o<0)return this;o===0?n.shift():wN(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};kt.prototype.off=kt.prototype.removeListener;kt.prototype.removeAllListeners=function(e){var r,n,i;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[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),f;for(i=0;i<o.length;++i)f=o[i],f!=="removeListener"&&this.removeAllListeners(f);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ET(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?gN(i):OT(i,i.length)}kt.prototype.listeners=function(e){return ET(this,e,!0)};kt.prototype.rawListeners=function(e){return ET(this,e,!1)};kt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):AT.call(t,e)};kt.prototype.listenerCount=AT;function AT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}kt.prototype.eventNames=function(){return this._eventsCount>0?Dp(this._events):[]};function OT(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function wN(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function gN(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function yN(t,e){return new Promise(function(r,n){function i(f){t.removeListener(e,o),n(f)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}NT(t,e,o,{once:!0}),e!=="error"&&jN(t,i,{once:!0})})}function jN(t,e,r){typeof t.on=="function"&&NT(t,"error",e,r)}function NT(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Pp=M(Wo=>{var Fh=Math.pow(2,8),_N=Math.pow(2,16),DT=Math.pow(2,24),FT=Math.pow(2,32),qN=Math.pow(2,40),vN=Math.pow(2,48),Ph=Math.pow(2,52),TN=Math.pow(2,1022);Wo.readByte=function(t){return t>127?t-256:t};Wo.readI16=function(t,e){e=e||0;var r=t[e+1];return r+=t[e]<<8,t[e]&128&&(r-=_N),r};Wo.readI32=function(t,e){e=e||0;var r=t[e+3];return r+=t[e+2]<<8,r+=t[e+1]<<16,r+=t[e]*DT,t[e]&128&&(r-=FT),r};Wo.writeI16=function(t,e){return t[1]=e&255,e>>=8,t[0]=e&255,t};Wo.writeI32=function(t,e){return t[3]=e&255,e>>=8,t[2]=e&255,e>>=8,t[1]=e&255,e>>=8,t[0]=e&255,t};Wo.readDouble=function(t,e){e=e||0;var r=t[e]&128,n=(t[e+1]&240)>>4;n+=(t[e]&127)<<4;var i=t[e+7];switch(i+=t[e+6]<<8,i+=t[e+5]<<16,i+=t[e+4]*DT,i+=t[e+3]*FT,i+=t[e+2]*qN,i+=(t[e+1]&15)*vN,n){case 0:n=-1022;break;case 2047:return i?NaN:r?-1/0:1/0;default:i+=Ph,n-=1023}return r&&(i*=-1),i*Math.pow(2,n-52)};Wo.writeDouble=function(t,e){var r,n,i;return t[0]=e<0?128:0,e=Math.abs(e),e!==e?(r=2251799813685248,n=2047):e===1/0?(r=0,n=2047):(n=Math.floor(Math.log(e)/Math.LN2),i=Math.pow(2,-n),e*i<1&&(n--,i*=2),n+1023>=2047?(r=0,n=2047):n+1023>=1?(r=(e*i-1)*Ph,n+=1023):(r=e*TN*Ph,n=0)),t[1]=n<<4&240,t[0]|=n>>4&127,t[7]=r&255,r=Math.floor(r/Fh),t[6]=r&255,r=Math.floor(r/Fh),t[5]=r&255,r=Math.floor(r/Fh),t[4]=r&255,r>>=8,t[3]=r&255,r>>=8,t[2]=r&255,r>>=8,t[1]|=r&15,t}});var Zf=M((o5,RT)=>{var BN=Ci("util");RT.exports=PT;function PT(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}BN.inherits(PT,Error)});var Hp=M(to=>{var kN=Ci("util"),ra=function(){},HT=console.log,Rp="error";function Gl(t){return function(){var e=["thrift: ["+t+"] "].concat(Array.from(arguments));return HT(kN.format.apply(null,e))}}var Rh=ra,Hh=ra,zh=ra,Mh=ra,Uh=ra;to.setLogFunc=function(t){HT=t};var IN=to.setLogLevel=function(t){switch(Rh=Hh=zh=Mh=Uh=ra,Rp=t,Rp){case"trace":Rh=Gl("TRACE");case"debug":Hh=Gl("DEBUG");case"error":zh=Gl("ERROR");case"warning":Mh=Gl("WARN");case"info":Uh=Gl("INFO")}};IN(Rp);to.getLogLevel=function(){return Rp};to.trace=function(){return Rh.apply(null,arguments)};to.debug=function(){return Hh.apply(null,arguments)};to.error=function(){return zh.apply(null,arguments)};to.warning=function(){return Mh.apply(null,arguments)};to.info=function(){return Uh.apply(null,arguments)}});var Vh=M((s5,zT)=>{var SN=Hp(),ro=zr(),Yt=Vo(),At=Yt.Type;zT.exports=ee;var Lh=Math.pow(2,8),xN=Math.pow(2,24),EN=Math.pow(2,32),AN=Math.pow(2,40),ON=Math.pow(2,48),Ch=Math.pow(2,52),NN=Math.pow(2,1022);function ee(t){this.trans=t,this.lastField_=[],this.lastFieldId_=0,this.string_limit_=0,this.string_buf_=null,this.string_buf_size_=0,this.container_limit_=0,this.booleanField_={name:null,hasBoolValue:!1},this.boolValue_={hasBoolValue:!1,boolValue:!1}}ee.PROTOCOL_ID=-126;ee.VERSION_N=1;ee.VERSION_MASK=31;ee.TYPE_MASK=-32;ee.TYPE_BITS=7;ee.TYPE_SHIFT_AMOUNT=5;ee.Types={CT_STOP:0,CT_BOOLEAN_TRUE:1,CT_BOOLEAN_FALSE:2,CT_BYTE:3,CT_I16:4,CT_I32:5,CT_I64:6,CT_DOUBLE:7,CT_BINARY:8,CT_LIST:9,CT_SET:10,CT_MAP:11,CT_STRUCT:12};ee.TTypeToCType=[ee.Types.CT_STOP,0,ee.Types.CT_BOOLEAN_TRUE,ee.Types.CT_BYTE,ee.Types.CT_DOUBLE,0,ee.Types.CT_I16,0,ee.Types.CT_I32,0,ee.Types.CT_I64,ee.Types.CT_BINARY,ee.Types.CT_STRUCT,ee.Types.CT_MAP,ee.Types.CT_SET,ee.Types.CT_LIST];ee.prototype.getTransport=function(){return this.trans};ee.prototype.getCompactType=function(t){return ee.TTypeToCType[t]};ee.prototype.getTType=function(t){switch(t){case At.STOP:return At.STOP;case ee.Types.CT_BOOLEAN_FALSE:case ee.Types.CT_BOOLEAN_TRUE:return At.BOOL;case ee.Types.CT_BYTE:return At.BYTE;case ee.Types.CT_I16:return At.I16;case ee.Types.CT_I32:return At.I32;case ee.Types.CT_I64:return At.I64;case ee.Types.CT_DOUBLE:return At.DOUBLE;case ee.Types.CT_BINARY:return At.STRING;case ee.Types.CT_LIST:return At.LIST;case ee.Types.CT_SET:return At.SET;case ee.Types.CT_MAP:return At.MAP;case ee.Types.CT_STRUCT:return At.STRUCT;default:throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Unknown type: "+t)}return At.STOP};ee.prototype.flush=function(){return this.trans.flush()};ee.prototype.writeMessageBegin=function(t,e,r){this.writeByte(ee.PROTOCOL_ID),this.writeByte(ee.VERSION_N&ee.VERSION_MASK|e<<ee.TYPE_SHIFT_AMOUNT&ee.TYPE_MASK),this.writeVarint32(r),this.writeString(t),this._seqid?SN.warning("SeqId already set",{name:t}):(this._seqid=r,this.trans.setCurrSeqId(r))};ee.prototype.writeMessageEnd=function(){};ee.prototype.writeStructBegin=function(t){this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0};ee.prototype.writeStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};ee.prototype.writeFieldBegin=function(t,e,r){if(e!=At.BOOL)return this.writeFieldBeginInternal(t,e,r,-1);this.booleanField_.name=t,this.booleanField_.fieldType=e,this.booleanField_.fieldId=r};ee.prototype.writeFieldEnd=function(){};ee.prototype.writeFieldStop=function(){this.writeByte(ee.Types.CT_STOP)};ee.prototype.writeMapBegin=function(t,e,r){r===0?this.writeByte(0):(this.writeVarint32(r),this.writeByte(this.getCompactType(t)<<4|this.getCompactType(e)))};ee.prototype.writeMapEnd=function(){};ee.prototype.writeListBegin=function(t,e){this.writeCollectionBegin(t,e)};ee.prototype.writeListEnd=function(){};ee.prototype.writeSetBegin=function(t,e){this.writeCollectionBegin(t,e)};ee.prototype.writeSetEnd=function(){};ee.prototype.writeBool=function(t){this.booleanField_.name!==null?(this.writeFieldBeginInternal(this.booleanField_.name,this.booleanField_.fieldType,this.booleanField_.fieldId,t?ee.Types.CT_BOOLEAN_TRUE:ee.Types.CT_BOOLEAN_FALSE),this.booleanField_.name=null):this.writeByte(t?ee.Types.CT_BOOLEAN_TRUE:ee.Types.CT_BOOLEAN_FALSE)};ee.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};ee.prototype.writeI16=function(t){this.writeVarint32(this.i32ToZigzag(t))};ee.prototype.writeI32=function(t){this.writeVarint32(this.i32ToZigzag(t))};ee.prototype.writeI64=function(t){this.writeVarint64(this.i64ToZigzag(t))};ee.prototype.writeDouble=function(t){var e=new Buffer(8),r,n,i;e[7]=t<0?128:0,t=Math.abs(t),t!==t?(r=2251799813685248,n=2047):t===1/0?(r=0,n=2047):(n=Math.floor(Math.log(t)/Math.LN2),i=Math.pow(2,-n),t*i<1&&(n--,i*=2),n+1023>=2047?(r=0,n=2047):n+1023>=1?(r=(t*i-1)*Ch,n+=1023):(r=t*NN*Ch,n=0)),e[6]=n<<4&240,e[7]|=n>>4&127,e[0]=r&255,r=Math.floor(r/Lh),e[1]=r&255,r=Math.floor(r/Lh),e[2]=r&255,r=Math.floor(r/Lh),e[3]=r&255,r>>=8,e[4]=r&255,r>>=8,e[5]=r&255,r>>=8,e[6]|=r&15,this.trans.write(e)};ee.prototype.writeStringOrBinary=function(t,e,r){if(typeof r=="string")this.writeVarint32(Buffer.byteLength(r,e)),this.trans.write(new Buffer(r,e));else if(r instanceof Buffer||Object.prototype.toString.call(r)=="[object Uint8Array]")this.writeVarint32(r.length),this.trans.write(r);else throw new Error(t+" called without a string/Buffer argument: "+r)};ee.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};ee.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};ee.prototype.writeFieldBeginInternal=function(t,e,r,n){var i=n==-1?this.getCompactType(e):n;r>this.lastFieldId_&&r-this.lastFieldId_<=15?this.writeByte(r-this.lastFieldId_<<4|i):(this.writeByte(i),this.writeI16(r)),this.lastFieldId_=r};ee.prototype.writeCollectionBegin=function(t,e){e<=14?this.writeByte(e<<4|this.getCompactType(t)):(this.writeByte(240|this.getCompactType(t)),this.writeVarint32(e))};ee.prototype.writeVarint32=function(t){for(var e=new Buffer(5),r=0;;)if((t&~127)==0){e[r++]=t;break}else e[r++]=t&127|128,t=t>>>7;var n=new Buffer(r);e.copy(n,0,0,r),this.trans.write(n)};ee.prototype.writeVarint64=function(t){if(typeof t=="number"&&(t=new ro(t)),!(t instanceof ro))throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);for(var e=new Buffer(10),r=0,n=t.buffer.readUInt32BE(0,!0),i=t.buffer.readUInt32BE(4,!0),o=0;;)if((i&~127)==0&&n===0){e[r++]=i;break}else e[r++]=i&127|128,o=n<<25,i=i>>>7,n=n>>>7,i=i|o;var f=new Buffer(r);e.copy(f,0,0,r),this.trans.write(f)};ee.prototype.i64ToZigzag=function(t){if(typeof t=="string"?t=new ro(parseInt(t,10)):typeof t=="number"&&(t=new ro(t)),!(t instanceof ro))throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);var e=t.buffer.readUInt32BE(0,!0),r=t.buffer.readUInt32BE(4,!0),n=e>>>31;return e=(e<<1|r>>>31)^(n?4294967295:0),r=r<<1^(n?4294967295:0),new ro(e,r)};ee.prototype.i32ToZigzag=function(t){return t<<1^(t&2147483648?4294967295:0)};ee.prototype.readMessageBegin=function(){var t=this.trans.readByte();if(t!=ee.PROTOCOL_ID)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.BAD_VERSION,"Bad protocol identifier "+t);var e=this.trans.readByte(),r=e&ee.VERSION_MASK;if(r!=ee.VERSION_N)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.BAD_VERSION,"Bad protocol version "+r);var n=e>>ee.TYPE_SHIFT_AMOUNT&ee.TYPE_BITS,i=this.readVarint32(),o=this.readString();return{fname:o,mtype:n,rseqid:i}};ee.prototype.readMessageEnd=function(){};ee.prototype.readStructBegin=function(){return this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0,{fname:""}};ee.prototype.readStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};ee.prototype.readFieldBegin=function(){var t=0,e=this.trans.readByte(e),r=e&15;if(r==ee.Types.CT_STOP)return{fname:null,ftype:Yt.Type.STOP,fid:0};var n=(e&240)>>>4;n===0?t=this.readI16():t=this.lastFieldId_+n;var i=this.getTType(r);return(r==ee.Types.CT_BOOLEAN_TRUE||r==ee.Types.CT_BOOLEAN_FALSE)&&(this.boolValue_.hasBoolValue=!0,this.boolValue_.boolValue=r==ee.Types.CT_BOOLEAN_TRUE),this.lastFieldId_=t,{fname:null,ftype:i,fid:t}};ee.prototype.readFieldEnd=function(){};ee.prototype.readMapBegin=function(){var t=this.readVarint32();if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative map size");var e=0;t!==0&&(e=this.trans.readByte());var r=this.getTType((e&240)>>>4),n=this.getTType(e&15);return{ktype:r,vtype:n,size:t}};ee.prototype.readMapEnd=function(){};ee.prototype.readListBegin=function(){var t=this.trans.readByte(),e=t>>>4&15;if(e==15&&(e=this.readVarint32()),e<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative list size");var r=this.getTType(t&15);return{etype:r,size:e}};ee.prototype.readListEnd=function(){};ee.prototype.readSetBegin=function(){return this.readListBegin()};ee.prototype.readSetEnd=function(){};ee.prototype.readBool=function(){var t=!1,e=0;if(this.boolValue_.hasBoolValue===!0)t=this.boolValue_.boolValue,this.boolValue_.hasBoolValue=!1;else{var r=this.trans.readByte();e=r.rsize,t=r.value==ee.Types.CT_BOOLEAN_TRUE}return t};ee.prototype.readByte=function(){return this.trans.readByte()};ee.prototype.readI16=function(){return this.readI32()};ee.prototype.readI32=function(){return this.zigzagToI32(this.readVarint32())};ee.prototype.readI64=function(){return this.zigzagToI64(this.readVarint64())};ee.prototype.readDouble=function(){var t=this.trans.read(8),e=0,r=t[e+7]&128,n=(t[e+6]&240)>>4;n+=(t[e+7]&127)<<4;var i=t[e];switch(i+=t[e+1]<<8,i+=t[e+2]<<16,i+=t[e+3]*xN,i+=t[e+4]*EN,i+=t[e+5]*AN,i+=(t[e+6]&15)*ON,n){case 0:n=-1022;break;case 2047:return i?NaN:r?-1/0:1/0;default:i+=Ch,n-=1023}return r&&(i*=-1),i*Math.pow(2,n-52)};ee.prototype.readBinary=function(){var t=this.readVarint32();if(t===0)return new Buffer(0);if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};ee.prototype.readString=function(){var t=this.readVarint32();if(t===0)return"";if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};ee.prototype.readVarint32=function(){return this.readVarint64().toNumber()};ee.prototype.readVarint64=function(){for(var t=0,e=0,r=0,n=0;;){var i=this.trans.readByte();if(t++,n<=25?e=e|(i&127)<<n:25<n&&n<32?(e=e|(i&127)<<n,r=r|(i&127)>>>32-n):r=r|(i&127)<<n-32,n+=7,!(i&128))break;if(t>=10)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Variable-length int over 10 bytes.")}return new ro(r,e)};ee.prototype.zigzagToI32=function(t){return t>>>1^-1*(t&1)};ee.prototype.zigzagToI64=function(t){var e=t.buffer.readUInt32BE(0,!0),r=t.buffer.readUInt32BE(4,!0),n=new ro(e&0,r&1);n._2scomp();var i=n.buffer.readUInt32BE(0,!0),o=n.buffer.readUInt32BE(4,!0),f=e<<31;return e=e>>>1^i,r=(r>>>1|f)^o,new ro(e,r)};ee.prototype.skip=function(t){switch(t){case At.BOOL:this.readBool();break;case At.BYTE:this.readByte();break;case At.I16:this.readI16();break;case At.I32:this.readI32();break;case At.I64:this.readI64();break;case At.DOUBLE:this.readDouble();break;case At.STRING:this.readString();break;case At.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===At.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case At.MAP:for(var r=this.readMapBegin(),n=0;n<r.size;++n)this.skip(r.ktype),this.skip(r.vtype);this.readMapEnd();break;case At.SET:for(var i=this.readSetBegin(),o=0;o<i.size;++o)this.skip(i.etype);this.readSetEnd();break;case At.LIST:for(var f=this.readListBegin(),s=0;s<f.size;++s)this.skip(f.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Kh=M((a5,VT)=>{var MT=Hp(),Wh=Pp(),UT=zr(),no=Vo(),Jr=no.Type;VT.exports=Pe;var LT=-65536,Yh=-2147418112,CT=255;Pe.VERSION_MASK=LT;Pe.VERSION_1=Yh;Pe.TYPE_MASK=CT;function Pe(t,e,r){this.trans=t,this.strictRead=e!==void 0?e:!1,this.strictWrite=r!==void 0?r:!0,this._seqid=null}Pe.prototype.flush=function(){return this.trans.flush()};Pe.prototype.writeMessageBegin=function(t,e,r){this.strictWrite?(this.writeI32(Yh|e),this.writeString(t),this.writeI32(r)):(this.writeString(t),this.writeByte(e),this.writeI32(r)),this._seqid!==null?MT.warning("SeqId already set",{name:t}):(this._seqid=r,this.trans.setCurrSeqId(r))};Pe.prototype.writeMessageEnd=function(){this._seqid!==null?this._seqid=null:MT.warning("No seqid to unset")};Pe.prototype.writeStructBegin=function(t){};Pe.prototype.writeStructEnd=function(){};Pe.prototype.writeFieldBegin=function(t,e,r){this.writeByte(e),this.writeI16(r)};Pe.prototype.writeFieldEnd=function(){};Pe.prototype.writeFieldStop=function(){this.writeByte(Jr.STOP)};Pe.prototype.writeMapBegin=function(t,e,r){this.writeByte(t),this.writeByte(e),this.writeI32(r)};Pe.prototype.writeMapEnd=function(){};Pe.prototype.writeListBegin=function(t,e){this.writeByte(t),this.writeI32(e)};Pe.prototype.writeListEnd=function(){};Pe.prototype.writeSetBegin=function(t,e){this.writeByte(t),this.writeI32(e)};Pe.prototype.writeSetEnd=function(){};Pe.prototype.writeBool=function(t){t?this.writeByte(1):this.writeByte(0)};Pe.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};Pe.prototype.writeI16=function(t){this.trans.write(Wh.writeI16(new Buffer(2),t))};Pe.prototype.writeI32=function(t){this.trans.write(Wh.writeI32(new Buffer(4),t))};Pe.prototype.writeI64=function(t){t.buffer?this.trans.write(t.buffer):this.trans.write(new UT(t).buffer)};Pe.prototype.writeDouble=function(t){this.trans.write(Wh.writeDouble(new Buffer(8),t))};Pe.prototype.writeStringOrBinary=function(t,e,r){if(typeof r=="string")this.writeI32(Buffer.byteLength(r,e)),this.trans.write(new Buffer(r,e));else if(r instanceof Buffer||Object.prototype.toString.call(r)=="[object Uint8Array]")this.writeI32(r.length),this.trans.write(r);else throw new Error(t+" called without a string/Buffer argument: "+r)};Pe.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};Pe.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};Pe.prototype.readMessageBegin=function(){var t=this.readI32(),e,r,n;if(t<0){var i=t&LT;if(i!=Yh)throw new no.TProtocolException(no.TProtocolExceptionType.BAD_VERSION,"Bad version in readMessageBegin: "+t);e=t&CT,r=this.readString(),n=this.readI32()}else{if(this.strictRead)throw new no.TProtocolException(no.TProtocolExceptionType.BAD_VERSION,"No protocol version header");r=this.trans.read(t),e=this.readByte(),n=this.readI32()}return{fname:r,mtype:e,rseqid:n}};Pe.prototype.readMessageEnd=function(){};Pe.prototype.readStructBegin=function(){return{fname:""}};Pe.prototype.readStructEnd=function(){};Pe.prototype.readFieldBegin=function(){var t=this.readByte();if(t==Jr.STOP)return{fname:null,ftype:t,fid:0};var e=this.readI16();return{fname:null,ftype:t,fid:e}};Pe.prototype.readFieldEnd=function(){};Pe.prototype.readMapBegin=function(){var t=this.readByte(),e=this.readByte(),r=this.readI32();return{ktype:t,vtype:e,size:r}};Pe.prototype.readMapEnd=function(){};Pe.prototype.readListBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};Pe.prototype.readListEnd=function(){};Pe.prototype.readSetBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};Pe.prototype.readSetEnd=function(){};Pe.prototype.readBool=function(){var t=this.readByte();return t!==0};Pe.prototype.readByte=function(){return this.trans.readByte()};Pe.prototype.readI16=function(){return this.trans.readI16()};Pe.prototype.readI32=function(){return this.trans.readI32()};Pe.prototype.readI64=function(){var t=this.trans.read(8);return new UT(t)};Pe.prototype.readDouble=function(){return this.trans.readDouble()};Pe.prototype.readBinary=function(){var t=this.readI32();if(t===0)return new Buffer(0);if(t<0)throw new no.TProtocolException(no.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};Pe.prototype.readString=function(){var t=this.readI32();if(t===0)return"";if(t<0)throw new no.TProtocolException(no.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};Pe.prototype.getTransport=function(){return this.trans};Pe.prototype.skip=function(t){switch(t){case Jr.BOOL:this.readBool();break;case Jr.BYTE:this.readByte();break;case Jr.I16:this.readI16();break;case Jr.I32:this.readI32();break;case Jr.I64:this.readI64();break;case Jr.DOUBLE:this.readDouble();break;case Jr.STRING:this.readString();break;case Jr.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===Jr.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case Jr.MAP:for(var r=this.readMapBegin(),n=0;n<r.size;++n)this.skip(r.ktype),this.skip(r.vtype);this.readMapEnd();break;case Jr.SET:for(var i=this.readSetBegin(),o=0;o<i.size;++o)this.skip(i.etype);this.readSetEnd();break;case Jr.LIST:for(var f=this.readListBegin(),s=0;s<f.size;++s)this.skip(f.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Gh=M((l5,ZT)=>{var DN=Ci("util"),zp=Vh(),WT=Kh(),FN=Zf();function Jl(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}DN.inherits(Jl,Error);ZT.exports=nr;var PN=0,RN=1,HN=0,zN=32/8,MN=48/8,UN=64/8,LN=96/8,YT=112/8,KT=4095,GT=1,CN=1073741823;function io(t){var e=Zl();this.outputBuffer=null;var r=this;this.transport=new e(null,function(n){r.outputBuffer=n}),this.transport.inBuf=t||Buffer.alloc(0),this.transport.writeCursor=this.transport.inBuf.length,this.protocol=new zp(this.transport)}io.prototype.readVarint32=function(){return this.protocol.readVarint32()};io.prototype.writeVarint32=function(t){this.protocol.writeVarint32(t)};io.prototype.readString=function(){return this.protocol.readString()};io.prototype.writeString=function(t){this.protocol.writeString(t)};io.prototype.getOutCount=function(){return this.transport.outCount};io.prototype.write=function(t){this.transport.write(t)};io.prototype.toBuffer=function(){return this.transport.flush(),this.outputBuffer};nr.SubprotocolId={BINARY:0,JSON:1,COMPACT:2};function nr(){this.maxFrameSize=CN,this.protocolId=nr.SubprotocolId.BINARY,this.rheaders={},this.wheaders={},this.inBuf=Buffer.alloc(0),this.outCount=0,this.flags=null,this.seqid=0,this.shouldWriteHeaders=!0}var JT=function(t,e){if(typeof t!="string"||typeof e!="string")throw new Jl("Header key and values must be strings")},VN=function(t){for(var e=Object.keys(nr.SubprotocolId),r=0;r<e.length;r++)if(t===nr.SubprotocolId[e[r]])return!0;throw new Error(t+" is not a valid protocol id")};nr.prototype.setSeqId=function(t){this.seqid=t};nr.prototype.getSeqId=function(t){return this.seqid};nr.prototype.setFlags=function(t){this.flags=t};nr.prototype.getReadHeaders=function(){return this.rheaders};nr.prototype.setReadHeader=function(t,e){JT(t,e),this.rheaders[t]=e};nr.prototype.clearReadHeaders=function(){this.rheaders={}};nr.prototype.getWriteHeaders=function(){return this.wheaders};nr.prototype.setWriteHeader=function(t,e){JT(t,e),this.wheaders[t]=e};nr.prototype.clearWriteHeaders=function(){this.wheaders={}};nr.prototype.setMaxFrameSize=function(t){this.maxFrameSize=t};nr.prototype.setProtocolId=function(t){VN(t),this.protocolId=t};nr.prototype.getProtocolId=function(){return this.protocolId};var WN=function(t){var e=t.readInt32BE();return(e&WT.VERSION_MASK)===WT.VERSION_1},YN=function(t){var e=t.readInt8(PN),r=t.readInt8(RN);return e===zp.PROTOCOL_ID&&(r&zp.VERSION_MASK)===zp.VERSION_N};nr.prototype.readHeaders=function(){var t=this.inBuf,e=!1;if(WN(t)&&(this.setProtocolId(nr.SubprotocolId.BINARY),e=!0),YN(t)&&(this.setProtocolId(nr.SubprotocolId.COMPACT),e=!0),e){this.shouldWriteHeaders=!1;return}var r=t.readInt32BE(HN);if(r>this.maxFrameSize)throw new Jl("Frame exceeds maximum frame size");var n=t.readInt16BE(zN);if(this.shouldWriteHeaders=n===KT,!!this.shouldWriteHeaders){this.setFlags(t.readInt16BE(MN)),this.setSeqId(t.readInt32BE(UN));var i=t.readInt16BE(LN)*4,o=YT+i;if(o>t.length)throw new Jl("Header size is greater than frame size");var f=Buffer.alloc(i);t.copy(f,0,YT,o);var s=new io(f);this.setProtocolId(s.readVarint32());var l=s.readVarint32();if(l>0)throw new Jl("Transforms are not yet supported");for(;;)try{var u=s.readVarint32();if(u!==GT)break;for(var c=s.readVarint32(),_=0;_<c;_++){var p=s.readString(),j=s.readString();this.setReadHeader(p,j)}}catch(S){if(S instanceof FN)break;throw S}return this.read(o),this.getReadHeaders()}};nr.prototype.writeHeaders=function(){if(!!this.shouldWriteHeaders){var t=this.getWriteHeaders(),e=new io;e.writeVarint32(this.protocolId),e.writeVarint32(0);var r=Object.keys(t);if(r.length>0){e.writeVarint32(GT),e.writeVarint32(r.length);for(var n=0;n<r.length;n++){var i=r[n],o=t[i];e.writeString(i),e.writeString(o)}}var f=e.getOutCount(),s=(4-f%4)%4,l=Buffer.alloc(2);l.writeInt16BE(Math.floor((f+s)/4));var u=Buffer.alloc(s);u.fill(0),e.write(u);var c=e.toBuffer(),_=Buffer.alloc(4);_.writeInt32BE(10+this.outCount+c.length);var p=Buffer.alloc(2);p.writeInt16BE(KT);var j=Buffer.alloc(2);j.writeInt16BE(0);var S=Buffer.alloc(4);S.writeInt32BE(this.getSeqId());var T=Buffer.concat([_,p,j,S,l,c]);this.outBuffers.unshift(T),this.outCount+=T.length}}});var Zl=M((u5,XT)=>{var Mp=Pp(),KN=Zf(),GN=Gh();XT.exports=Kt;function Kt(t,e){this.defaultReadBufferSize=1024,this.writeBufferSize=512,this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0,this.onFlush=e}Kt.prototype=new GN;Kt.prototype.reset=function(){this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0};Kt.receiver=function(t,e){var r=new Kt;return function(n){if(r.writeCursor+n.length>r.inBuf.length){var i=new Buffer(r.writeCursor+n.length);r.inBuf.copy(i,0,0,r.writeCursor),r.inBuf=i}n.copy(r.inBuf,r.writeCursor,0),r.writeCursor+=n.length,t(r,e)}};Kt.prototype.commitPosition=function(){var t=this.writeCursor-this.readCursor,e=t*2>this.defaultReadBufferSize?t*2:this.defaultReadBufferSize,r=new Buffer(e);t>0&&this.inBuf.copy(r,0,this.readCursor,this.writeCursor),this.readCursor=0,this.writeCursor=t,this.inBuf=r};Kt.prototype.rollbackPosition=function(){this.readCursor=0};Kt.prototype.isOpen=function(){return!0};Kt.prototype.open=function(){};Kt.prototype.close=function(){};Kt.prototype.setCurrSeqId=function(t){this._seqid=t};Kt.prototype.ensureAvailable=function(t){if(this.readCursor+t>this.writeCursor)throw new KN};Kt.prototype.read=function(t){this.ensureAvailable(t);var e=new Buffer(t);return this.inBuf.copy(e,0,this.readCursor,this.readCursor+t),this.readCursor+=t,e};Kt.prototype.readByte=function(){return this.ensureAvailable(1),Mp.readByte(this.inBuf[this.readCursor++])};Kt.prototype.readI16=function(){this.ensureAvailable(2);var t=Mp.readI16(this.inBuf,this.readCursor);return this.readCursor+=2,t};Kt.prototype.readI32=function(){this.ensureAvailable(4);var t=Mp.readI32(this.inBuf,this.readCursor);return this.readCursor+=4,t};Kt.prototype.readDouble=function(){this.ensureAvailable(8);var t=Mp.readDouble(this.inBuf,this.readCursor);return this.readCursor+=8,t};Kt.prototype.readString=function(t){this.ensureAvailable(t);var e=this.inBuf.toString("utf8",this.readCursor,this.readCursor+t);return this.readCursor+=t,e};Kt.prototype.borrow=function(){var t={buf:this.inBuf,readIndex:this.readCursor,writeIndex:this.writeCursor};return t};Kt.prototype.consume=function(t){this.readCursor+=t};Kt.prototype.write=function(t){typeof t=="string"&&(t=new Buffer(t,"utf8")),this.outBuffers.push(t),this.outCount+=t.length};Kt.prototype.flush=function(){var t=this._seqid;if(this._seqid=null,!(this.outCount<1)){var e=new Buffer(this.outCount),r=0;this.outBuffers.forEach(function(n){n.copy(e,r,0),r+=n.length}),this.onFlush&&this.onFlush(e,t),this.outBuffers=[],this.outCount=0}}});var Zh=M((c5,rB)=>{var QT=zr(),$T=rB.exports={},JN=Math.pow(2,24),eB=Math.pow(2,31),Jh=Math.pow(2,32),tB=Math.pow(10,11);$T.toDecimalString=function(t){var e=t.buffer,r=t.offset;if(!e[r]&&!(e[r+1]&224)||!~e[r]&&!~(e[r+1]&224))return t.toString();var n=e[r]&128;if(n){for(var i=!1,o=new Buffer(8),f=7;f>=0;--f)o[f]=~e[r+f]+(i?0:1)&255,i|=e[r+f];e=o}var s=e[r+1]+(e[r]<<8),l=e[r+7]+(e[r+6]<<8)+(e[r+5]<<16)+e[r+4]*JN+(e[r+3]+(e[r+2]<<8))*Jh+s*74976710656,u=Math.floor(l/tB)+s*2814;return l=("00000000000"+String(l%tB)).slice(-11),(n?"-":"")+String(u)+l};$T.fromDecimalString=function(t){var e=t.charAt(0)==="-";if(t.length<(e?17:16))return new QT(+t);if(t.length>(e?20:19))throw new RangeError("Too many digits for Int64: "+t);var r=+t.slice(e?1:0,-15),n=+t.slice(-15)+r*2764472320,i=Math.floor(n/Jh)+r*232830;if(n=n%Jh,i>=eB&&!(e&&i==eB&&n==0))throw new RangeError("The magnitude is too large for Int64.");return e&&(i=~i,n===0?i=i+1&4294967295:n=~n+1,i=2147483648|i),new QT(i,n)}});var oB=M((m5,iB)=>{var nB=zr(),p5=Zh(),d5=iB.exports=function(){"use strict";var t,e,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
12
+ `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Cv(t){return Array.isArray(t)}function bh(t){return typeof t=="boolean"}function wp(t){return t===null}function k2(t){return t==null}function Vv(t){return typeof t=="number"}function gp(t){return typeof t=="string"}function I2(t){return babelHelpers.typeof(t)==="symbol"}function Qi(t){return t===void 0}function yp(t){return Ws(t)&&wh(t)==="[object RegExp]"}function Ws(t){return babelHelpers.typeof(t)==="object"&&t!==null}function hh(t){return Ws(t)&&wh(t)==="[object Date]"}function jp(t){return Ws(t)&&(wh(t)==="[object Error]"||t instanceof Error)}function _p(t){return typeof t=="function"}function S2(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||babelHelpers.typeof(t)==="symbol"||typeof t=="undefined"}function x2(t){return Buffer.isBuffer(t)}function wh(t){return Object.prototype.toString.call(t)}function gh(t){return t<10?"0"+t.toString(10):t.toString(10)}function A2(){var t=new Date,e=[gh(t.getHours()),gh(t.getMinutes()),gh(t.getSeconds())].join(":");return[t.getDate(),E2[t.getMonth()],e].join(" ")}function O2(){console.log("%s - %s",A2(),ch.apply(null,arguments))}function Wv(t,e){if(!e||!Ws(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function Yv(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var mp,i2,o2,f2,di,gn,s2,sh,Wf,Mv,ah,m2,b2,Vs,ye,n8,i8,o8,f8,Mo,s8,lh,a8,ln,l8,Uo,u8,h2,uh,w2,g2,bp,ph,E2,N2,jt,c8,p8,d8,m8,b8,h8,w8,g8,y8,j8,Kn,_8,q8,Se,v8,Ys,T8,Yf,B8,Kf,k8,qp,S8,Ks,x8,Gs,E8,$i,A8,G,O8,N8,D8,F8,P8,R8,H8,z8,M8,U8,L8,C8,V8,W8,Y8,K8,G8,J8,Z8,X8,Q8,$8,eC,tC,rC,nC,iC,oC,fC,sC,aC,lC,uC,cC,yh,pC,Lo,dC,Js,mC,Co,bC,hC,vp,wC,Tp,gC,Cl,yC,jC,Vl,_C,qC,Bp,vC,xe,TC,BC,kC,Kv,IC,Gv,SC,xC,EC,AC,OC,NC,DC,FC,PC,RC,HC,zC,MC,UC,LC,CC,VC,WC,YC,KC,GC,JC,ZC,XC,QC,$C,eV,tV,rV,nV,iV,oV,fV,sV,aV,lV,uV,cV,pV,dV,mV,bV,hV,wV,gV,yV,jV,_V,qV,vV,TV,BV,jh=re(()=>{mp=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};i2=a2,o2=u2,f2=d2,di=[],gn=[],s2=typeof Uint8Array!="undefined"?Uint8Array:Array,sh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Wf=0,Mv=sh.length;Wf<Mv;++Wf)di[Wf]=sh[Wf],gn[sh.charCodeAt(Wf)]=Wf;gn["-".charCodeAt(0)]=62;gn["_".charCodeAt(0)]=63;ah={byteLength:i2,toByteArray:o2,fromByteArray:f2},m2=function(e,r,n,i,o){var f,s,l=o*8-i-1,u=(1<<l)-1,c=u>>1,_=-7,p=n?o-1:0,j=n?-1:1,S=e[r+p];for(p+=j,f=S&(1<<-_)-1,S>>=-_,_+=l;_>0;f=f*256+e[r+p],p+=j,_-=8);for(s=f&(1<<-_)-1,f>>=-_,_+=i;_>0;s=s*256+e[r+p],p+=j,_-=8);if(f===0)f=1-c;else{if(f===u)return s?NaN:(S?-1:1)*(1/0);s=s+Math.pow(2,i),f=f-c}return(S?-1:1)*s*Math.pow(2,f-i)},b2=function(e,r,n,i,o,f){var s,l,u,c=f*8-o-1,_=(1<<c)-1,p=_>>1,j=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=i?0:f-1,T=i?1:-1,U=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,s=_):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?r+=j/u:r+=j*Math.pow(2,1-p),r*u>=2&&(s++,u/=2),s+p>=_?(l=0,s=_):s+p>=1?(l=(r*u-1)*Math.pow(2,o),s=s+p):(l=r*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;e[n+S]=l&255,S+=T,l/=256,o-=8);for(s=s<<o|l,c+=o;c>0;e[n+S]=s&255,S+=T,s/=256,c-=8);e[n+S-T]|=U*128},Vs={read:m2,write:b2},ye=Dt(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=f,e.SlowBuffer=U,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,f.TYPED_ARRAY_SUPPORT=i(),!f.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var q=new Uint8Array(1),d={foo:function(){return 42}};return Object.setPrototypeOf(d,Uint8Array.prototype),Object.setPrototypeOf(q,d),q.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.byteOffset}});function o(q){if(q>n)throw new RangeError('The value "'+q+'" is invalid for option "size"');var d=new Uint8Array(q);return Object.setPrototypeOf(d,f.prototype),d}function f(q,d,m){if(typeof q=="number"){if(typeof d=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return c(q)}return s(q,d,m)}f.poolSize=8192;function s(q,d,m){if(typeof q=="string")return _(q,d);if(ArrayBuffer.isView(q))return p(q);if(q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q));if(Ke(q,ArrayBuffer)||q&&Ke(q.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ke(q,SharedArrayBuffer)||q&&Ke(q.buffer,SharedArrayBuffer)))return j(q,d,m);if(typeof q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var B=q.valueOf&&q.valueOf();if(B!=null&&B!==q)return f.from(B,d,m);var R=S(q);if(R)return R;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]=="function")return f.from(q[Symbol.toPrimitive]("string"),d,m);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q))}f.from=function(q,d,m){return s(q,d,m)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array);function l(q){if(typeof q!="number")throw new TypeError('"size" argument must be of type number');if(q<0)throw new RangeError('The value "'+q+'" is invalid for option "size"')}function u(q,d,m){return l(q),q<=0?o(q):d!==void 0?typeof m=="string"?o(q).fill(d,m):o(q).fill(d):o(q)}f.alloc=function(q,d,m){return u(q,d,m)};function c(q){return l(q),o(q<0?0:T(q)|0)}f.allocUnsafe=function(q){return c(q)},f.allocUnsafeSlow=function(q){return c(q)};function _(q,d){if((typeof d!="string"||d==="")&&(d="utf8"),!f.isEncoding(d))throw new TypeError("Unknown encoding: "+d);var m=W(q,d)|0,B=o(m),R=B.write(q,d);return R!==m&&(B=B.slice(0,R)),B}function p(q){for(var d=q.length<0?0:T(q.length)|0,m=o(d),B=0;B<d;B+=1)m[B]=q[B]&255;return m}function j(q,d,m){if(d<0||q.byteLength<d)throw new RangeError('"offset" is outside of buffer bounds');if(q.byteLength<d+(m||0))throw new RangeError('"length" is outside of buffer bounds');var B;return d===void 0&&m===void 0?B=new Uint8Array(q):m===void 0?B=new Uint8Array(q,d):B=new Uint8Array(q,d,m),Object.setPrototypeOf(B,f.prototype),B}function S(q){if(f.isBuffer(q)){var d=T(q.length)|0,m=o(d);return m.length===0||q.copy(m,0,0,d),m}if(q.length!==void 0)return typeof q.length!="number"||Ht(q.length)?o(0):p(q);if(q.type==="Buffer"&&Array.isArray(q.data))return p(q.data)}function T(q){if(q>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return q|0}function U(q){return+q!=q&&(q=0),f.alloc(+q)}f.isBuffer=function(d){return d!=null&&d._isBuffer===!0&&d!==f.prototype},f.compare=function(d,m){if(Ke(d,Uint8Array)&&(d=f.from(d,d.offset,d.byteLength)),Ke(m,Uint8Array)&&(m=f.from(m,m.offset,m.byteLength)),!f.isBuffer(d)||!f.isBuffer(m))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(d===m)return 0;for(var B=d.length,R=m.length,fe=0,se=Math.min(B,R);fe<se;++fe)if(d[fe]!==m[fe]){B=d[fe],R=m[fe];break}return B<R?-1:R<B?1:0},f.isEncoding=function(d){switch(String(d).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}},f.concat=function(d,m){if(!Array.isArray(d))throw new TypeError('"list" argument must be an Array of Buffers');if(d.length===0)return f.alloc(0);var B;if(m===void 0)for(m=0,B=0;B<d.length;++B)m+=d[B].length;var R=f.allocUnsafe(m),fe=0;for(B=0;B<d.length;++B){var se=d[B];if(Ke(se,Uint8Array)&&(se=f.from(se)),!f.isBuffer(se))throw new TypeError('"list" argument must be an Array of Buffers');se.copy(R,fe),fe+=se.length}return R};function W(q,d){if(f.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||Ke(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(q));var m=q.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&m===0)return 0;for(var R=!1;;)switch(d){case"ascii":case"latin1":case"binary":return m;case"utf8":case"utf-8":return _e(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m*2;case"hex":return m>>>1;case"base64":return So(q).length;default:if(R)return B?-1:_e(q).length;d=(""+d).toLowerCase(),R=!0}}f.byteLength=W;function L(q,d,m){var B=!1;if((d===void 0||d<0)&&(d=0),d>this.length||((m===void 0||m>this.length)&&(m=this.length),m<=0)||(m>>>=0,d>>>=0,m<=d))return"";for(q||(q="utf8");;)switch(q){case"hex":return A(this,d,m);case"utf8":case"utf-8":return b(this,d,m);case"ascii":return z(this,d,m);case"latin1":case"binary":return oe(this,d,m);case"base64":return N(this,d,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ye(this,d,m);default:if(B)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),B=!0}}f.prototype._isBuffer=!0;function te(q,d,m){var B=q[d];q[d]=q[m],q[m]=B}f.prototype.swap16=function(){var d=this.length;if(d%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var m=0;m<d;m+=2)te(this,m,m+1);return this},f.prototype.swap32=function(){var d=this.length;if(d%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var m=0;m<d;m+=4)te(this,m,m+3),te(this,m+1,m+2);return this},f.prototype.swap64=function(){var d=this.length;if(d%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var m=0;m<d;m+=8)te(this,m,m+7),te(this,m+1,m+6),te(this,m+2,m+5),te(this,m+3,m+4);return this},f.prototype.toString=function(){var d=this.length;return d===0?"":arguments.length===0?b(this,0,d):L.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(d){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");return this===d?!0:f.compare(this,d)===0},f.prototype.inspect=function(){var d="",m=e.INSPECT_MAX_BYTES;return d=this.toString("hex",0,m).replace(/(.{2})/g,"$1 ").trim(),this.length>m&&(d+=" ... "),"<Buffer "+d+">"},r&&(f.prototype[r]=f.prototype.inspect),f.prototype.compare=function(d,m,B,R,fe){if(Ke(d,Uint8Array)&&(d=f.from(d,d.offset,d.byteLength)),!f.isBuffer(d))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(d));if(m===void 0&&(m=0),B===void 0&&(B=d?d.length:0),R===void 0&&(R=0),fe===void 0&&(fe=this.length),m<0||B>d.length||R<0||fe>this.length)throw new RangeError("out of range index");if(R>=fe&&m>=B)return 0;if(R>=fe)return-1;if(m>=B)return 1;if(m>>>=0,B>>>=0,R>>>=0,fe>>>=0,this===d)return 0;for(var se=fe-R,nt=B-m,Ze=Math.min(se,nt),vt=this.slice(R,fe),br=d.slice(m,B),ke=0;ke<Ze;++ke)if(vt[ke]!==br[ke]){se=vt[ke],nt=br[ke];break}return se<nt?-1:nt<se?1:0};function pe(q,d,m,B,R){if(q.length===0)return-1;if(typeof m=="string"?(B=m,m=0):m>2147483647?m=2147483647:m<-2147483648&&(m=-2147483648),m=+m,Ht(m)&&(m=R?0:q.length-1),m<0&&(m=q.length+m),m>=q.length){if(R)return-1;m=q.length-1}else if(m<0)if(R)m=0;else return-1;if(typeof d=="string"&&(d=f.from(d,B)),f.isBuffer(d))return d.length===0?-1:J(q,d,m,B,R);if(typeof d=="number")return d=d&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(q,d,m):Uint8Array.prototype.lastIndexOf.call(q,d,m):J(q,[d],m,B,R);throw new TypeError("val must be string, number or Buffer")}function J(q,d,m,B,R){var fe=1,se=q.length,nt=d.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(q.length<2||d.length<2)return-1;fe=2,se/=2,nt/=2,m/=2}function Ze(v,I){return fe===1?v[I]:v.readUInt16BE(I*fe)}var vt;if(R){var br=-1;for(vt=m;vt<se;vt++)if(Ze(q,vt)===Ze(d,br===-1?0:vt-br)){if(br===-1&&(br=vt),vt-br+1===nt)return br*fe}else br!==-1&&(vt-=vt-br),br=-1}else for(m+nt>se&&(m=se-nt),vt=m;vt>=0;vt--){for(var ke=!0,Cn=0;Cn<nt;Cn++)if(Ze(q,vt+Cn)!==Ze(d,Cn)){ke=!1;break}if(ke)return vt}return-1}f.prototype.includes=function(d,m,B){return this.indexOf(d,m,B)!==-1},f.prototype.indexOf=function(d,m,B){return pe(this,d,m,B,!0)},f.prototype.lastIndexOf=function(d,m,B){return pe(this,d,m,B,!1)};function D(q,d,m,B){m=Number(m)||0;var R=q.length-m;B?(B=Number(B),B>R&&(B=R)):B=R;var fe=d.length;B>fe/2&&(B=fe/2);for(var se=0;se<B;++se){var nt=parseInt(d.substr(se*2,2),16);if(Ht(nt))return se;q[m+se]=nt}return se}function le(q,d,m,B){return It(_e(d,q.length-m),q,m,B)}function Y(q,d,m,B){return It($(d),q,m,B)}function de(q,d,m,B){return Y(q,d,m,B)}function y(q,d,m,B){return It(So(d),q,m,B)}function g(q,d,m,B){return It(Io(d,q.length-m),q,m,B)}f.prototype.write=function(d,m,B,R){if(m===void 0)R="utf8",B=this.length,m=0;else if(B===void 0&&typeof m=="string")R=m,B=this.length,m=0;else if(isFinite(m))m=m>>>0,isFinite(B)?(B=B>>>0,R===void 0&&(R="utf8")):(R=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var fe=this.length-m;if((B===void 0||B>fe)&&(B=fe),d.length>0&&(B<0||m<0)||m>this.length)throw new RangeError("Attempt to write outside buffer bounds");R||(R="utf8");for(var se=!1;;)switch(R){case"hex":return D(this,d,m,B);case"utf8":case"utf-8":return le(this,d,m,B);case"ascii":return Y(this,d,m,B);case"latin1":case"binary":return de(this,d,m,B);case"base64":return y(this,d,m,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,d,m,B);default:if(se)throw new TypeError("Unknown encoding: "+R);R=(""+R).toLowerCase(),se=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function N(q,d,m){return d===0&&m===q.length?ah.fromByteArray(q):ah.fromByteArray(q.slice(d,m))}function b(q,d,m){m=Math.min(q.length,m);for(var B=[],R=d;R<m;){var fe=q[R],se=null,nt=fe>239?4:fe>223?3:fe>191?2:1;if(R+nt<=m){var Ze,vt,br,ke;switch(nt){case 1:fe<128&&(se=fe);break;case 2:Ze=q[R+1],(Ze&192)==128&&(ke=(fe&31)<<6|Ze&63,ke>127&&(se=ke));break;case 3:Ze=q[R+1],vt=q[R+2],(Ze&192)==128&&(vt&192)==128&&(ke=(fe&15)<<12|(Ze&63)<<6|vt&63,ke>2047&&(ke<55296||ke>57343)&&(se=ke));break;case 4:Ze=q[R+1],vt=q[R+2],br=q[R+3],(Ze&192)==128&&(vt&192)==128&&(br&192)==128&&(ke=(fe&15)<<18|(Ze&63)<<12|(vt&63)<<6|br&63,ke>65535&&ke<1114112&&(se=ke))}}se===null?(se=65533,nt=1):se>65535&&(se-=65536,B.push(se>>>10&1023|55296),se=56320|se&1023),B.push(se),R+=nt}return K(B)}var H=4096;function K(q){var d=q.length;if(d<=H)return String.fromCharCode.apply(String,q);for(var m="",B=0;B<d;)m+=String.fromCharCode.apply(String,q.slice(B,B+=H));return m}function z(q,d,m){var B="";m=Math.min(q.length,m);for(var R=d;R<m;++R)B+=String.fromCharCode(q[R]&127);return B}function oe(q,d,m){var B="";m=Math.min(q.length,m);for(var R=d;R<m;++R)B+=String.fromCharCode(q[R]);return B}function A(q,d,m){var B=q.length;(!d||d<0)&&(d=0),(!m||m<0||m>B)&&(m=B);for(var R="",fe=d;fe<m;++fe)R+=bt[q[fe]];return R}function Ye(q,d,m){for(var B=q.slice(d,m),R="",fe=0;fe<B.length;fe+=2)R+=String.fromCharCode(B[fe]+B[fe+1]*256);return R}f.prototype.slice=function(d,m){var B=this.length;d=~~d,m=m===void 0?B:~~m,d<0?(d+=B,d<0&&(d=0)):d>B&&(d=B),m<0?(m+=B,m<0&&(m=0)):m>B&&(m=B),m<d&&(m=d);var R=this.subarray(d,m);return Object.setPrototypeOf(R,f.prototype),R};function me(q,d,m){if(q%1!=0||q<0)throw new RangeError("offset is not uint");if(q+d>m)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d],fe=1,se=0;++se<m&&(fe*=256);)R+=this[d+se]*fe;return R},f.prototype.readUIntBE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d+--m],fe=1;m>0&&(fe*=256);)R+=this[d+--m]*fe;return R},f.prototype.readUInt8=function(d,m){return d=d>>>0,m||me(d,1,this.length),this[d]},f.prototype.readUInt16LE=function(d,m){return d=d>>>0,m||me(d,2,this.length),this[d]|this[d+1]<<8},f.prototype.readUInt16BE=function(d,m){return d=d>>>0,m||me(d,2,this.length),this[d]<<8|this[d+1]},f.prototype.readUInt32LE=function(d,m){return d=d>>>0,m||me(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+this[d+3]*16777216},f.prototype.readUInt32BE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]*16777216+(this[d+1]<<16|this[d+2]<<8|this[d+3])},f.prototype.readIntLE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=this[d],fe=1,se=0;++se<m&&(fe*=256);)R+=this[d+se]*fe;return fe*=128,R>=fe&&(R-=Math.pow(2,8*m)),R},f.prototype.readIntBE=function(d,m,B){d=d>>>0,m=m>>>0,B||me(d,m,this.length);for(var R=m,fe=1,se=this[d+--R];R>0&&(fe*=256);)se+=this[d+--R]*fe;return fe*=128,se>=fe&&(se-=Math.pow(2,8*m)),se},f.prototype.readInt8=function(d,m){return d=d>>>0,m||me(d,1,this.length),this[d]&128?(255-this[d]+1)*-1:this[d]},f.prototype.readInt16LE=function(d,m){d=d>>>0,m||me(d,2,this.length);var B=this[d]|this[d+1]<<8;return B&32768?B|4294901760:B},f.prototype.readInt16BE=function(d,m){d=d>>>0,m||me(d,2,this.length);var B=this[d+1]|this[d]<<8;return B&32768?B|4294901760:B},f.prototype.readInt32LE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},f.prototype.readInt32BE=function(d,m){return d=d>>>0,m||me(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},f.prototype.readFloatLE=function(d,m){return d=d>>>0,m||me(d,4,this.length),Vs.read(this,d,!0,23,4)},f.prototype.readFloatBE=function(d,m){return d=d>>>0,m||me(d,4,this.length),Vs.read(this,d,!1,23,4)},f.prototype.readDoubleLE=function(d,m){return d=d>>>0,m||me(d,8,this.length),Vs.read(this,d,!0,52,8)},f.prototype.readDoubleBE=function(d,m){return d=d>>>0,m||me(d,8,this.length),Vs.read(this,d,!1,52,8)};function V(q,d,m,B,R,fe){if(!f.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(d>R||d<fe)throw new RangeError('"value" argument is out of bounds');if(m+B>q.length)throw new RangeError("Index out of range")}f.prototype.writeUIntLE=function(d,m,B,R){if(d=+d,m=m>>>0,B=B>>>0,!R){var fe=Math.pow(2,8*B)-1;V(this,d,m,B,fe,0)}var se=1,nt=0;for(this[m]=d&255;++nt<B&&(se*=256);)this[m+nt]=d/se&255;return m+B},f.prototype.writeUIntBE=function(d,m,B,R){if(d=+d,m=m>>>0,B=B>>>0,!R){var fe=Math.pow(2,8*B)-1;V(this,d,m,B,fe,0)}var se=B-1,nt=1;for(this[m+se]=d&255;--se>=0&&(nt*=256);)this[m+se]=d/nt&255;return m+B},f.prototype.writeUInt8=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,1,255,0),this[m]=d&255,m+1},f.prototype.writeUInt16LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,65535,0),this[m]=d&255,this[m+1]=d>>>8,m+2},f.prototype.writeUInt16BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,65535,0),this[m]=d>>>8,this[m+1]=d&255,m+2},f.prototype.writeUInt32LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,4294967295,0),this[m+3]=d>>>24,this[m+2]=d>>>16,this[m+1]=d>>>8,this[m]=d&255,m+4},f.prototype.writeUInt32BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,4294967295,0),this[m]=d>>>24,this[m+1]=d>>>16,this[m+2]=d>>>8,this[m+3]=d&255,m+4},f.prototype.writeIntLE=function(d,m,B,R){if(d=+d,m=m>>>0,!R){var fe=Math.pow(2,8*B-1);V(this,d,m,B,fe-1,-fe)}var se=0,nt=1,Ze=0;for(this[m]=d&255;++se<B&&(nt*=256);)d<0&&Ze===0&&this[m+se-1]!==0&&(Ze=1),this[m+se]=(d/nt>>0)-Ze&255;return m+B},f.prototype.writeIntBE=function(d,m,B,R){if(d=+d,m=m>>>0,!R){var fe=Math.pow(2,8*B-1);V(this,d,m,B,fe-1,-fe)}var se=B-1,nt=1,Ze=0;for(this[m+se]=d&255;--se>=0&&(nt*=256);)d<0&&Ze===0&&this[m+se+1]!==0&&(Ze=1),this[m+se]=(d/nt>>0)-Ze&255;return m+B},f.prototype.writeInt8=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,1,127,-128),d<0&&(d=255+d+1),this[m]=d&255,m+1},f.prototype.writeInt16LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,32767,-32768),this[m]=d&255,this[m+1]=d>>>8,m+2},f.prototype.writeInt16BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,2,32767,-32768),this[m]=d>>>8,this[m+1]=d&255,m+2},f.prototype.writeInt32LE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,2147483647,-2147483648),this[m]=d&255,this[m+1]=d>>>8,this[m+2]=d>>>16,this[m+3]=d>>>24,m+4},f.prototype.writeInt32BE=function(d,m,B){return d=+d,m=m>>>0,B||V(this,d,m,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),this[m]=d>>>24,this[m+1]=d>>>16,this[m+2]=d>>>8,this[m+3]=d&255,m+4};function X(q,d,m,B,R,fe){if(m+B>q.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("Index out of range")}function ze(q,d,m,B,R){return d=+d,m=m>>>0,R||X(q,d,m,4),Vs.write(q,d,m,B,23,4),m+4}f.prototype.writeFloatLE=function(d,m,B){return ze(this,d,m,!0,B)},f.prototype.writeFloatBE=function(d,m,B){return ze(this,d,m,!1,B)};function we(q,d,m,B,R){return d=+d,m=m>>>0,R||X(q,d,m,8),Vs.write(q,d,m,B,52,8),m+8}f.prototype.writeDoubleLE=function(d,m,B){return we(this,d,m,!0,B)},f.prototype.writeDoubleBE=function(d,m,B){return we(this,d,m,!1,B)},f.prototype.copy=function(d,m,B,R){if(!f.isBuffer(d))throw new TypeError("argument should be a Buffer");if(B||(B=0),!R&&R!==0&&(R=this.length),m>=d.length&&(m=d.length),m||(m=0),R>0&&R<B&&(R=B),R===B||d.length===0||this.length===0)return 0;if(m<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(R<0)throw new RangeError("sourceEnd out of bounds");R>this.length&&(R=this.length),d.length-m<R-B&&(R=d.length-m+B);var fe=R-B;if(this===d&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(m,B,R);else if(this===d&&B<m&&m<R)for(var se=fe-1;se>=0;--se)d[se+m]=this[se+B];else Uint8Array.prototype.set.call(d,this.subarray(B,R),m);return fe},f.prototype.fill=function(d,m,B,R){if(typeof d=="string"){if(typeof m=="string"?(R=m,m=0,B=this.length):typeof B=="string"&&(R=B,B=this.length),R!==void 0&&typeof R!="string")throw new TypeError("encoding must be a string");if(typeof R=="string"&&!f.isEncoding(R))throw new TypeError("Unknown encoding: "+R);if(d.length===1){var fe=d.charCodeAt(0);(R==="utf8"&&fe<128||R==="latin1")&&(d=fe)}}else typeof d=="number"?d=d&255:typeof d=="boolean"&&(d=Number(d));if(m<0||this.length<m||this.length<B)throw new RangeError("Out of range index");if(B<=m)return this;m=m>>>0,B=B===void 0?this.length:B>>>0,d||(d=0);var se;if(typeof d=="number")for(se=m;se<B;++se)this[se]=d;else{var nt=f.isBuffer(d)?d:f.from(d,R),Ze=nt.length;if(Ze===0)throw new TypeError('The value "'+d+'" is invalid for argument "value"');for(se=0;se<B-m;++se)this[se+m]=nt[se%Ze]}return this};var rt=/[^+/0-9A-Za-z-_]/g;function kr(q){if(q=q.split("=")[0],q=q.trim().replace(rt,""),q.length<2)return"";for(;q.length%4!=0;)q=q+"=";return q}function _e(q,d){d=d||1/0;for(var m,B=q.length,R=null,fe=[],se=0;se<B;++se){if(m=q.charCodeAt(se),m>55295&&m<57344){if(!R){if(m>56319){(d-=3)>-1&&fe.push(239,191,189);continue}else if(se+1===B){(d-=3)>-1&&fe.push(239,191,189);continue}R=m;continue}if(m<56320){(d-=3)>-1&&fe.push(239,191,189),R=m;continue}m=(R-55296<<10|m-56320)+65536}else R&&(d-=3)>-1&&fe.push(239,191,189);if(R=null,m<128){if((d-=1)<0)break;fe.push(m)}else if(m<2048){if((d-=2)<0)break;fe.push(m>>6|192,m&63|128)}else if(m<65536){if((d-=3)<0)break;fe.push(m>>12|224,m>>6&63|128,m&63|128)}else if(m<1114112){if((d-=4)<0)break;fe.push(m>>18|240,m>>12&63|128,m>>6&63|128,m&63|128)}else throw new Error("Invalid code point")}return fe}function $(q){for(var d=[],m=0;m<q.length;++m)d.push(q.charCodeAt(m)&255);return d}function Io(q,d){for(var m,B,R,fe=[],se=0;se<q.length&&!((d-=2)<0);++se)m=q.charCodeAt(se),B=m>>8,R=m%256,fe.push(R),fe.push(B);return fe}function So(q){return ah.toByteArray(kr(q))}function It(q,d,m,B){for(var R=0;R<B&&!(R+m>=d.length||R>=q.length);++R)d[R+m]=q[R];return R}function Ke(q,d){return q instanceof d||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===d.name}function Ht(q){return q!==q}var bt=function(){for(var q="0123456789abcdef",d=new Array(256),m=0;m<16;++m)for(var B=m*16,R=0;R<16;++R)d[B+R]=q[m]+q[R];return d}()}),n8=ye.Buffer,i8=ye.SlowBuffer,o8=ye.INSPECT_MAX_BYTES,f8=ye.kMaxLength,Mo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function r(n){if(ye.Buffer.isBuffer(n))return n;if(ArrayBuffer.isView(n))return ye.Buffer.from(n.buffer);if(n instanceof ArrayBuffer)return ye.Buffer.from(n);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=r});Mt(Mo);s8=Mo.ensureBuffer,lh=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function n(i){if(typeof i!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof i);if(!r.test(i))throw new TypeError("Invalid format for UUID: "+i);let o,f=new Uint8Array(16);return f[0]=(o=parseInt(i.slice(0,8),16))>>>24,f[1]=o>>>16&255,f[2]=o>>>8&255,f[3]=o&255,f[4]=(o=parseInt(i.slice(9,13),16))>>>8,f[5]=o&255,f[6]=(o=parseInt(i.slice(14,18),16))>>>8,f[7]=o&255,f[8]=(o=parseInt(i.slice(19,23),16))>>>8,f[9]=o&255,f[10]=(o=parseInt(i.slice(24,36),16))/1099511627776&255,f[11]=o/4294967296&255,f[12]=o>>>24&255,f[13]=o>>>16&255,f[14]=o>>>8&255,f[15]=o&255,f}e.parseUUID=n});Mt(lh);a8=lh.parseUUID,ln=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class r{constructor(i,o){if(i!=null&&typeof i!="string"&&!ArrayBuffer.isView(i)&&!(i instanceof ArrayBuffer)&&!Array.isArray(i))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=o??r.BSON_BINARY_SUBTYPE_DEFAULT,i==null?(this.buffer=ye.Buffer.alloc(r.BUFFER_SIZE),this.position=0):(typeof i=="string"?this.buffer=ye.Buffer.from(i,"binary"):Array.isArray(i)?this.buffer=ye.Buffer.from(i):this.buffer=Mo.ensureBuffer(i),this.position=this.buffer.byteLength)}put(i){if(typeof i=="string"&&i.length!==1)throw new TypeError("only accepts single character String");if(typeof i!="number"&&i.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let o;if(typeof i=="string"?o=i.charCodeAt(0):typeof i=="number"?o=i:o=i[0],o<0||o>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=o;else{let f=ye.Buffer.alloc(r.BUFFER_SIZE+this.buffer.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f,this.buffer[this.position++]=o}}write(i,o){if(o=typeof o=="number"?o:this.position,this.buffer.length<o+i.length){let f=ye.Buffer.alloc(this.buffer.length+i.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f}ArrayBuffer.isView(i)?(this.buffer.set(Mo.ensureBuffer(i),o),this.position=o+i.byteLength>this.position?o+i.length:this.position):typeof i=="string"&&(this.buffer.write(i,o,i.length,"binary"),this.position=o+i.length>this.position?o+i.length:this.position)}read(i,o){return o=o&&o>0?o:this.position,this.buffer.slice(i,i+o)}value(i){return i=!!i,i&&this.buffer.length===this.position?this.buffer:i?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(i){return this.buffer.toString(i)}toExtendedJSON(i){i=i||{};let o=this.buffer.toString("base64"),f=Number(this.sub_type).toString(16);return i.legacy?{$binary:o,$type:f.length===1?"0"+f:f}:{$binary:{base64:o,subType:f.length===1?"0"+f:f}}}static fromExtendedJSON(i,o){o=o||{};let f,s;if("$binary"in i?o.legacy&&typeof i.$binary=="string"&&"$type"in i?(s=i.$type?parseInt(i.$type,16):0,f=ye.Buffer.from(i.$binary,"base64")):typeof i.$binary!="string"&&(s=i.$binary.subType?parseInt(i.$binary.subType,16):0,f=ye.Buffer.from(i.$binary.base64,"base64")):"$uuid"in i&&(s=4,f=ye.Buffer.from(lh.parseUUID(i.$uuid))),!f)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(i)}`);return new r(f,s)}}e.Binary=r,r.BSON_BINARY_SUBTYPE_DEFAULT=0,r.BUFFER_SIZE=256,r.SUBTYPE_DEFAULT=0,r.SUBTYPE_FUNCTION=1,r.SUBTYPE_BYTE_ARRAY=2,r.SUBTYPE_UUID_OLD=3,r.SUBTYPE_UUID=4,r.SUBTYPE_MD5=5,r.SUBTYPE_USER_DEFINED=128,Object.defineProperty(r.prototype,"_bsontype",{value:"Binary"})});Mt(ln);l8=ln.Binary,Uo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class r{constructor(i,o){this.code=i,this.scope=o}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(i){return new r(i.$code,i.$scope)}}e.Code=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Code"})});Mt(Uo);u8=Uo.Code,h2={};typeof Object.create=="function"?uh=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:uh=function(e,r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e};w2=uh,g2=/%[sdj%]/g;bp={};Xi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Xi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};E2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];N2={inherits:w2,_extend:Wv,log:O2,isBuffer:x2,isPrimitive:S2,isFunction:_p,isError:jp,isDate:hh,isObject:Ws,isRegExp:yp,isUndefined:Qi,isSymbol:I2,isString:gp,isNumber:Vv,isNullOrUndefined:k2,isNull:wp,isBoolean:bh,isArray:Cv,inspect:Xi,deprecate:Lv,format:ch,debuglog:y2},jt=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.isBuffer=e.haveBuffer=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.randomBytes=e.normalizedFunctionString=void 0;function r(p){return p.toString().replace("function(","function (")}e.normalizedFunctionString=r;function n(p){let j=ye.Buffer.alloc(p);for(let S=0;S<p;++S)j[S]=Math.floor(Math.random()*256);return j}if(e.randomBytes=n,typeof window!="undefined"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=p=>window.crypto.getRandomValues(ye.Buffer.alloc(p));else{try{e.randomBytes=h2.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=n)}function i(p){return Object.prototype.toString.call(p)==="[object Uint8Array]"}e.isUint8Array=i;function o(p){return Object.prototype.toString.call(p)==="[object BigInt64Array]"}e.isBigInt64Array=o;function f(p){return Object.prototype.toString.call(p)==="[object BigUint64Array]"}e.isBigUInt64Array=f;function s(){return typeof mp!="undefined"&&typeof mp.Buffer!="undefined"}e.haveBuffer=s;function l(p){return s()&&ye.Buffer.isBuffer(p)}e.isBuffer=l;function u(p){return c(p)&&Object.prototype.toString.call(p)==="[object Date]"}e.isDate=u;function c(p){return typeof p=="object"&&p!==null}e.isObjectLike=c;function _(p,j){if(typeof window=="undefined"||typeof self=="undefined")return N2.deprecate(p,j);let S=!1;function T(...U){return S||(console.warn(j),S=!0),p.apply(this,...U)}return T}e.deprecate=_});Mt(jt);c8=jt.deprecate,p8=jt.isObjectLike,d8=jt.isDate,m8=jt.isBuffer,b8=jt.haveBuffer,h8=jt.isBigUInt64Array,w8=jt.isBigInt64Array,g8=jt.isUint8Array,y8=jt.randomBytes,j8=jt.normalizedFunctionString,Kn=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function r(i){return jt.isObjectLike(i)&&i.$id!=null&&i.$ref!=null}e.isDBRefLike=r;class n{constructor(o,f,s,l){let u=o.split(".");u.length===2&&(s=u.shift(),o=u.shift()),this.collection=o,this.oid=f,this.db=s,this.fields=l||{}}get namespace(){return this.collection}set namespace(o){this.collection=o}toJSON(){let o=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(o.$db=this.db),o}toExtendedJSON(o){o=o||{};let f={$ref:this.collection,$id:this.oid};return o.legacy||(this.db&&(f.$db=this.db),f=Object.assign(f,this.fields)),f}static fromExtendedJSON(o){let f=Object.assign({},o);return delete f.$ref,delete f.$id,delete f.$db,new n(o.$ref,o.$id,o.$db,f)}}e.DBRef=n,Object.defineProperty(n.prototype,"_bsontype",{value:"DBRef"})});Mt(Kn);_8=Kn.DBRef,q8=Kn.isDBRefLike,Se=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let r;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}let n=1<<16,i=1<<24,o=n*n,f=o*o,s=f/2,l={},u={};class c{constructor(p=0,j=0,S){this.comp=c.prototype.compare,this.div=c.prototype.divide,this.eq=c.prototype.equals,this.gt=c.prototype.greaterThan,this.gte=c.prototype.greaterThanOrEqual,this.ge=c.prototype.greaterThanOrEqual,this.lt=c.prototype.lessThan,this.lte=c.prototype.lessThanOrEqual,this.mod=c.prototype.modulo,this.rem=c.prototype.modulo,this.mul=c.prototype.multiply,this.neg=c.prototype.negate,this.neq=c.prototype.notEquals,this.ne=c.prototype.notEquals,this.shl=c.prototype.shiftLeft,this.shr=c.prototype.shiftRight,this.shr_u=c.prototype.shiftRightUnsigned,this.shru=c.prototype.shiftRightUnsigned,this.sub=c.prototype.subtract,this.eqz=c.prototype.isZero,this.le=c.prototype.lessThanOrEqual,this.low=p|0,this.high=j|0,this.unsigned=!!S,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(p,j,S){return new c(p,j,S)}static fromInt(p,j){let S,T,U;return j?(p>>>=0,(U=0<=p&&p<256)&&(T=u[p],T)?T:(S=c.fromBits(p,(p|0)<0?-1:0,!0),U&&(u[p]=S),S)):(p|=0,(U=-128<=p&&p<128)&&(T=l[p],T)?T:(S=c.fromBits(p,p<0?-1:0,!1),U&&(l[p]=S),S))}static fromNumber(p,j){if(isNaN(p))return j?c.UZERO:c.ZERO;if(j){if(p<0)return c.UZERO;if(p>=f)return c.MAX_UNSIGNED_VALUE}else{if(p<=-s)return c.MIN_VALUE;if(p+1>=s)return c.MAX_VALUE}return p<0?c.fromNumber(-p,j).neg():c.fromBits(p%o|0,p/o|0,j)}static fromBigInt(p,j){return c.fromString(p.toString(),j)}static fromString(p,j,S){if(p.length===0)throw Error("empty string");if(p==="NaN"||p==="Infinity"||p==="+Infinity"||p==="-Infinity")return c.ZERO;if(typeof j=="number"?(S=j,j=!1):j=!!j,S=S||10,S<2||36<S)throw RangeError("radix");let T;if((T=p.indexOf("-"))>0)throw Error("interior hyphen");if(T===0)return c.fromString(p.substring(1),j,S).neg();let U=c.fromNumber(Math.pow(S,8)),W=c.ZERO;for(let L=0;L<p.length;L+=8){let te=Math.min(8,p.length-L),pe=parseInt(p.substring(L,L+te),S);if(te<8){let J=c.fromNumber(Math.pow(S,te));W=W.mul(J).add(c.fromNumber(pe))}else W=W.mul(U),W=W.add(c.fromNumber(pe))}return W.unsigned=j,W}static fromBytes(p,j,S){return S?c.fromBytesLE(p,j):c.fromBytesBE(p,j)}static fromBytesLE(p,j){return new c(p[0]|p[1]<<8|p[2]<<16|p[3]<<24,p[4]|p[5]<<8|p[6]<<16|p[7]<<24,j)}static fromBytesBE(p,j){return new c(p[4]<<24|p[5]<<16|p[6]<<8|p[7],p[0]<<24|p[1]<<16|p[2]<<8|p[3],j)}static isLong(p){return jt.isObjectLike(p)&&p.__isLong__===!0}static fromValue(p,j){return typeof p=="number"?c.fromNumber(p,j):typeof p=="string"?c.fromString(p,j):c.fromBits(p.low,p.high,typeof j=="boolean"?j:p.unsigned)}add(p){c.isLong(p)||(p=c.fromValue(p));let j=this.high>>>16,S=this.high&65535,T=this.low>>>16,U=this.low&65535,W=p.high>>>16,L=p.high&65535,te=p.low>>>16,pe=p.low&65535,J=0,D=0,le=0,Y=0;return Y+=U+pe,le+=Y>>>16,Y&=65535,le+=T+te,D+=le>>>16,le&=65535,D+=S+L,J+=D>>>16,D&=65535,J+=j+W,J&=65535,c.fromBits(le<<16|Y,J<<16|D,this.unsigned)}and(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low&p.low,this.high&p.high,this.unsigned)}compare(p){if(c.isLong(p)||(p=c.fromValue(p)),this.eq(p))return 0;let j=this.isNegative(),S=p.isNegative();return j&&!S?-1:!j&&S?1:this.unsigned?p.high>>>0>this.high>>>0||p.high===this.high&&p.low>>>0>this.low>>>0?-1:1:this.sub(p).isNegative()?-1:1}divide(p){if(c.isLong(p)||(p=c.fromValue(p)),p.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&this.high===-2147483648&&p.low===-1&&p.high===-1)return this;let U=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,p.low,p.high);return c.fromBits(U,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?c.UZERO:c.ZERO;let j,S,T;if(this.unsigned){if(p.unsigned||(p=p.toUnsigned()),p.gt(this))return c.UZERO;if(p.gt(this.shru(1)))return c.UONE;T=c.UZERO}else{if(this.eq(c.MIN_VALUE))return p.eq(c.ONE)||p.eq(c.NEG_ONE)?c.MIN_VALUE:p.eq(c.MIN_VALUE)?c.ONE:(j=this.shr(1).div(p).shl(1),j.eq(c.ZERO)?p.isNegative()?c.ONE:c.NEG_ONE:(S=this.sub(p.mul(j)),T=j.add(S.div(p)),T));if(p.eq(c.MIN_VALUE))return this.unsigned?c.UZERO:c.ZERO;if(this.isNegative())return p.isNegative()?this.neg().div(p.neg()):this.neg().div(p).neg();if(p.isNegative())return this.div(p.neg()).neg();T=c.ZERO}for(S=this;S.gte(p);){j=Math.max(1,Math.floor(S.toNumber()/p.toNumber()));let U=Math.ceil(Math.log(j)/Math.LN2),W=U<=48?1:Math.pow(2,U-48),L=c.fromNumber(j),te=L.mul(p);for(;te.isNegative()||te.gt(S);)j-=W,L=c.fromNumber(j,this.unsigned),te=L.mul(p);L.isZero()&&(L=c.ONE),T=T.add(L),S=S.sub(te)}return T}equals(p){return c.isLong(p)||(p=c.fromValue(p)),this.unsigned!==p.unsigned&&this.high>>>31==1&&p.high>>>31==1?!1:this.high===p.high&&this.low===p.low}getHighBits(){return this.high}getHighBitsUnsigned(){return this.high>>>0}getLowBits(){return this.low}getLowBitsUnsigned(){return this.low>>>0}getNumBitsAbs(){if(this.isNegative())return this.eq(c.MIN_VALUE)?64:this.neg().getNumBitsAbs();let p=this.high!==0?this.high:this.low,j;for(j=31;j>0&&(p&1<<j)==0;j--);return this.high!==0?j+33:j+1}greaterThan(p){return this.comp(p)>0}greaterThanOrEqual(p){return this.comp(p)>=0}isEven(){return(this.low&1)==0}isNegative(){return!this.unsigned&&this.high<0}isOdd(){return(this.low&1)==1}isPositive(){return this.unsigned||this.high>=0}isZero(){return this.high===0&&this.low===0}lessThan(p){return this.comp(p)<0}lessThanOrEqual(p){return this.comp(p)<=0}modulo(p){if(c.isLong(p)||(p=c.fromValue(p)),r){let j=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,p.low,p.high);return c.fromBits(j,r.get_high(),this.unsigned)}return this.sub(this.div(p).mul(p))}multiply(p){if(this.isZero())return c.ZERO;if(c.isLong(p)||(p=c.fromValue(p)),r){let de=r.mul(this.low,this.high,p.low,p.high);return c.fromBits(de,r.get_high(),this.unsigned)}if(p.isZero())return c.ZERO;if(this.eq(c.MIN_VALUE))return p.isOdd()?c.MIN_VALUE:c.ZERO;if(p.eq(c.MIN_VALUE))return this.isOdd()?c.MIN_VALUE:c.ZERO;if(this.isNegative())return p.isNegative()?this.neg().mul(p.neg()):this.neg().mul(p).neg();if(p.isNegative())return this.mul(p.neg()).neg();if(this.lt(c.TWO_PWR_24)&&p.lt(c.TWO_PWR_24))return c.fromNumber(this.toNumber()*p.toNumber(),this.unsigned);let j=this.high>>>16,S=this.high&65535,T=this.low>>>16,U=this.low&65535,W=p.high>>>16,L=p.high&65535,te=p.low>>>16,pe=p.low&65535,J=0,D=0,le=0,Y=0;return Y+=U*pe,le+=Y>>>16,Y&=65535,le+=T*pe,D+=le>>>16,le&=65535,le+=U*te,D+=le>>>16,le&=65535,D+=S*pe,J+=D>>>16,D&=65535,D+=T*te,J+=D>>>16,D&=65535,D+=U*L,J+=D>>>16,D&=65535,J+=j*pe+S*te+T*L+U*W,J&=65535,c.fromBits(le<<16|Y,J<<16|D,this.unsigned)}negate(){return!this.unsigned&&this.eq(c.MIN_VALUE)?c.MIN_VALUE:this.not().add(c.ONE)}not(){return c.fromBits(~this.low,~this.high,this.unsigned)}notEquals(p){return!this.equals(p)}or(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low|p.low,this.high|p.high,this.unsigned)}shiftLeft(p){return c.isLong(p)&&(p=p.toInt()),(p&=63)==0?this:p<32?c.fromBits(this.low<<p,this.high<<p|this.low>>>32-p,this.unsigned):c.fromBits(0,this.low<<p-32,this.unsigned)}shiftRight(p){return c.isLong(p)&&(p=p.toInt()),(p&=63)==0?this:p<32?c.fromBits(this.low>>>p|this.high<<32-p,this.high>>p,this.unsigned):c.fromBits(this.high>>p-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(p){if(c.isLong(p)&&(p=p.toInt()),p&=63,p===0)return this;{let j=this.high;if(p<32){let S=this.low;return c.fromBits(S>>>p|j<<32-p,j>>>p,this.unsigned)}else return p===32?c.fromBits(j,0,this.unsigned):c.fromBits(j>>>p-32,0,this.unsigned)}}subtract(p){return c.isLong(p)||(p=c.fromValue(p)),this.add(p.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(p){return p?this.toBytesLE():this.toBytesBE()}toBytesLE(){let p=this.high,j=this.low;return[j&255,j>>>8&255,j>>>16&255,j>>>24,p&255,p>>>8&255,p>>>16&255,p>>>24]}toBytesBE(){let p=this.high,j=this.low;return[p>>>24,p>>>16&255,p>>>8&255,p&255,j>>>24,j>>>16&255,j>>>8&255,j&255]}toSigned(){return this.unsigned?c.fromBits(this.low,this.high,!1):this}toString(p){if(p=p||10,p<2||36<p)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(c.MIN_VALUE)){let U=c.fromNumber(p),W=this.div(U),L=W.mul(U).sub(this);return W.toString(p)+L.toInt().toString(p)}else return"-"+this.neg().toString(p);let j=c.fromNumber(Math.pow(p,6),this.unsigned),S=this,T="";for(;;){let U=S.div(j),L=(S.sub(U.mul(j)).toInt()>>>0).toString(p);if(S=U,S.isZero())return L+T;for(;L.length<6;)L="0"+L;T=""+L+T}}toUnsigned(){return this.unsigned?this:c.fromBits(this.low,this.high,!0)}xor(p){return c.isLong(p)||(p=c.fromValue(p)),c.fromBits(this.low^p.low,this.high^p.high,this.unsigned)}toExtendedJSON(p){return p&&p.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(p,j){let S=c.fromString(p.$numberLong);return j&&j.relaxed?S.toNumber():S}}e.Long=c,c.TWO_PWR_24=c.fromInt(i),c.MAX_UNSIGNED_VALUE=c.fromBits(4294967295|0,4294967295|0,!0),c.ZERO=c.fromInt(0),c.UZERO=c.fromInt(0,!0),c.ONE=c.fromInt(1),c.UONE=c.fromInt(1,!0),c.NEG_ONE=c.fromInt(-1),c.MAX_VALUE=c.fromBits(4294967295|0,2147483647|0,!1),c.MIN_VALUE=c.fromBits(0,2147483648|0,!1),Object.defineProperty(c.prototype,"__isLong__",{value:!0}),Object.defineProperty(c.prototype,"_bsontype",{value:"Long"})});Mt(Se);v8=Se.Long,Ys=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let r=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,n=/^(\+|-)?(Infinity|inf)$/i,i=/^(\+|-)?NaN$/i,o=6111,f=-6176,s=6176,l=34,u=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),c=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),_=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),p=/^([-+])?(\d+)?$/,j=31,S=16383,T=30,U=31;function W(le){return!isNaN(parseInt(le,10))}function L(le){let Y=Se.Long.fromNumber(1e3*1e3*1e3),de=Se.Long.fromNumber(0);if(!le.parts[0]&&!le.parts[1]&&!le.parts[2]&&!le.parts[3])return{quotient:le,rem:de};for(let y=0;y<=3;y++)de=de.shiftLeft(32),de=de.add(new Se.Long(le.parts[y],0)),le.parts[y]=de.div(Y).low,de=de.modulo(Y);return{quotient:le,rem:de}}function te(le,Y){if(!le&&!Y)return{high:Se.Long.fromNumber(0),low:Se.Long.fromNumber(0)};let de=le.shiftRightUnsigned(32),y=new Se.Long(le.getLowBits(),0),g=Y.shiftRightUnsigned(32),N=new Se.Long(Y.getLowBits(),0),b=de.multiply(g),H=de.multiply(N),K=y.multiply(g),z=y.multiply(N);return b=b.add(H.shiftRightUnsigned(32)),H=new Se.Long(H.getLowBits(),0).add(K).add(z.shiftRightUnsigned(32)),b=b.add(H.shiftRightUnsigned(32)),z=H.shiftLeft(32).add(new Se.Long(z.getLowBits(),0)),{high:b,low:z}}function pe(le,Y){let de=le.high>>>0,y=Y.high>>>0;if(de<y)return!0;if(de===y){let g=le.low>>>0,N=Y.low>>>0;if(g<N)return!0}return!1}function J(le,Y){throw new TypeError(`"${le}" is not a valid Decimal128 string - ${Y}`)}class D{constructor(Y){this.bytes=Y}static fromString(Y){let de=!1,y=!1,g=!1,N=0,b=0,H=0,K=0,z=0,oe=[0],A=0,Ye=0,me=0,V=0,X=0,ze=0,we=new Se.Long(0,0),rt=new Se.Long(0,0),kr=0,_e=0;if(Y.length>=7e3)throw new TypeError(""+Y+" not a valid Decimal128 string");let $=Y.match(r),Io=Y.match(n),So=Y.match(i);if(!$&&!Io&&!So||Y.length===0)throw new TypeError(""+Y+" not a valid Decimal128 string");if($){let bt=$[2],q=$[4],d=$[5],m=$[6];q&&m===void 0&&J(Y,"missing exponent power"),q&&bt===void 0&&J(Y,"missing exponent base"),q===void 0&&(d||m)&&J(Y,"missing e before exponent")}if((Y[_e]==="+"||Y[_e]==="-")&&(de=Y[_e++]==="-"),!W(Y[_e])&&Y[_e]!=="."){if(Y[_e]==="i"||Y[_e]==="I")return new D(ye.Buffer.from(de?c:_));if(Y[_e]==="N")return new D(ye.Buffer.from(u))}for(;W(Y[_e])||Y[_e]===".";){if(Y[_e]==="."){y&&J(Y,"contains multiple periods"),y=!0,_e=_e+1;continue}A<34&&(Y[_e]!=="0"||g)&&(g||(z=b),g=!0,oe[Ye++]=parseInt(Y[_e],10),A=A+1),g&&(H=H+1),y&&(K=K+1),b=b+1,_e=_e+1}if(y&&!b)throw new TypeError(""+Y+" not a valid Decimal128 string");if(Y[_e]==="e"||Y[_e]==="E"){let bt=Y.substr(++_e).match(p);if(!bt||!bt[2])return new D(ye.Buffer.from(u));X=parseInt(bt[0],10),_e=_e+bt[0].length}if(Y[_e])return new D(ye.Buffer.from(u));if(me=0,!A)me=0,V=0,oe[0]=0,H=1,A=1,N=0;else if(V=A-1,N=H,N!==1)for(;Y[z+N-1]==="0";)N=N-1;for(X<=K&&K-X>1<<14?X=f:X=X-K;X>o;){if(V=V+1,V-me>l){if(oe.join("").match(/^0+$/)){X=o;break}J(Y,"overflow")}X=X-1}for(;X<f||A<H;){if(V===0&&N<A){X=f,N=0;break}if(A<H?H=H-1:V=V-1,X<o)X=X+1;else{if(oe.join("").match(/^0+$/)){X=o;break}J(Y,"overflow")}}if(V-me+1<N){let bt=b;y&&(z=z+1,bt=bt+1),de&&(z=z+1,bt=bt+1);let q=parseInt(Y[z+V+1],10),d=0;if(q>=5&&(d=1,q===5)){for(d=oe[V]%2==1?1:0,ze=z+V+2;ze<bt;ze++)if(parseInt(Y[ze],10)){d=1;break}}if(d){let m=V;for(;m>=0;m--)if(++oe[m]>9&&(oe[m]=0,m===0))if(X<o)X=X+1,oe[m]=1;else return new D(ye.Buffer.from(de?c:_))}}if(we=Se.Long.fromNumber(0),rt=Se.Long.fromNumber(0),N===0)we=Se.Long.fromNumber(0),rt=Se.Long.fromNumber(0);else if(V-me<17){let bt=me;for(rt=Se.Long.fromNumber(oe[bt++]),we=new Se.Long(0,0);bt<=V;bt++)rt=rt.multiply(Se.Long.fromNumber(10)),rt=rt.add(Se.Long.fromNumber(oe[bt]))}else{let bt=me;for(we=Se.Long.fromNumber(oe[bt++]);bt<=V-17;bt++)we=we.multiply(Se.Long.fromNumber(10)),we=we.add(Se.Long.fromNumber(oe[bt]));for(rt=Se.Long.fromNumber(oe[bt++]);bt<=V;bt++)rt=rt.multiply(Se.Long.fromNumber(10)),rt=rt.add(Se.Long.fromNumber(oe[bt]))}let It=te(we,Se.Long.fromString("100000000000000000"));It.low=It.low.add(rt),pe(It.low,rt)&&(It.high=It.high.add(Se.Long.fromNumber(1))),kr=X+s;let Ke={low:Se.Long.fromNumber(0),high:Se.Long.fromNumber(0)};It.high.shiftRightUnsigned(49).and(Se.Long.fromNumber(1)).equals(Se.Long.fromNumber(1))?(Ke.high=Ke.high.or(Se.Long.fromNumber(3).shiftLeft(61)),Ke.high=Ke.high.or(Se.Long.fromNumber(kr).and(Se.Long.fromNumber(16383).shiftLeft(47))),Ke.high=Ke.high.or(It.high.and(Se.Long.fromNumber(140737488355327)))):(Ke.high=Ke.high.or(Se.Long.fromNumber(kr&16383).shiftLeft(49)),Ke.high=Ke.high.or(It.high.and(Se.Long.fromNumber(562949953421311)))),Ke.low=It.low,de&&(Ke.high=Ke.high.or(Se.Long.fromString("9223372036854775808")));let Ht=ye.Buffer.alloc(16);return _e=0,Ht[_e++]=Ke.low.low&255,Ht[_e++]=Ke.low.low>>8&255,Ht[_e++]=Ke.low.low>>16&255,Ht[_e++]=Ke.low.low>>24&255,Ht[_e++]=Ke.low.high&255,Ht[_e++]=Ke.low.high>>8&255,Ht[_e++]=Ke.low.high>>16&255,Ht[_e++]=Ke.low.high>>24&255,Ht[_e++]=Ke.high.low&255,Ht[_e++]=Ke.high.low>>8&255,Ht[_e++]=Ke.high.low>>16&255,Ht[_e++]=Ke.high.low>>24&255,Ht[_e++]=Ke.high.high&255,Ht[_e++]=Ke.high.high>>8&255,Ht[_e++]=Ke.high.high>>16&255,Ht[_e++]=Ke.high.high>>24&255,new D(Ht)}toString(){let Y,de=0,y=new Array(36);for(let _e=0;_e<y.length;_e++)y[_e]=0;let g=0,N=!1,b,H={parts:[0,0,0,0]},K,z,oe=[];g=0;let A=this.bytes,Ye=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,me=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,V=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24,X=A[g++]|A[g++]<<8|A[g++]<<16|A[g++]<<24;g=0,{low:new Se.Long(Ye,me),high:new Se.Long(V,X)}.high.lessThan(Se.Long.ZERO)&&oe.push("-");let we=X>>26&j;if(we>>3==3){if(we===T)return oe.join("")+"Infinity";if(we===U)return"NaN";Y=X>>15&S,b=8+(X>>14&1)}else b=X>>14&7,Y=X>>17&S;let rt=Y-s;if(H.parts[0]=(X&16383)+((b&15)<<14),H.parts[1]=V,H.parts[2]=me,H.parts[3]=Ye,H.parts[0]===0&&H.parts[1]===0&&H.parts[2]===0&&H.parts[3]===0)N=!0;else for(z=3;z>=0;z--){let _e=0,$=L(H);if(H=$.quotient,_e=$.rem.low,!!_e)for(K=8;K>=0;K--)y[z*9+K]=_e%10,_e=Math.floor(_e/10)}if(N)de=1,y[g]=0;else for(de=36;!y[g];)de=de-1,g=g+1;let kr=de-1+rt;if(kr>=34||kr<=-7||rt>0){if(de>34)return oe.push(`${0}`),rt>0?oe.push("E+"+rt):rt<0&&oe.push("E"+rt),oe.join("");oe.push(`${y[g++]}`),de=de-1,de&&oe.push(".");for(let _e=0;_e<de;_e++)oe.push(`${y[g++]}`);oe.push("E"),kr>0?oe.push("+"+kr):oe.push(`${kr}`)}else if(rt>=0)for(let _e=0;_e<de;_e++)oe.push(`${y[g++]}`);else{let _e=de+rt;if(_e>0)for(let $=0;$<_e;$++)oe.push(`${y[g++]}`);else oe.push("0");for(oe.push(".");_e++<0;)oe.push("0");for(let $=0;$<de-Math.max(_e-1,0);$++)oe.push(`${y[g++]}`)}return oe.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(Y){return D.fromString(Y.$numberDecimal)}}e.Decimal128=D,Object.defineProperty(D.prototype,"_bsontype",{value:"Decimal128"})});Mt(Ys);T8=Ys.Decimal128,Yf=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class r{constructor(i){i instanceof Number&&(i=i.valueOf()),this.value=+i}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(i){if(i&&(i.legacy||i.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let o;return Number.isInteger(this.value)?(o=this.value.toFixed(1),o.length>=13&&(o=this.value.toExponential(13).toUpperCase())):o=this.value.toString(),{$numberDouble:o}}static fromExtendedJSON(i,o){let f=parseFloat(i.$numberDouble);return o&&o.relaxed?f:new r(f)}}e.Double=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Double"})});Mt(Yf);B8=Yf.Double,Kf=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class r{constructor(i){i instanceof Number&&(i=i.valueOf()),this.value=+i}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(i){return i&&(i.relaxed||i.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(i,o){return o&&o.relaxed?parseInt(i.$numberInt,10):new r(i.$numberInt)}}e.Int32=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Int32"})});Mt(Kf);k8=Kf.Int32,qp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let r;e.Map=r;let n=function(f){return f&&f.Math==Math&&f};function i(){return n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof mp=="object"&&mp)||Function("return this")()}let o=i();Object.prototype.hasOwnProperty.call(o,"Map")?e.Map=r=o.Map:e.Map=r=class{constructor(s=[]){this._keys=[],this._values={};for(let l=0;l<s.length;l++){if(s[l]==null)continue;let u=s[l],c=u[0],_=u[1];this._keys.push(c),this._values[c]={v:_,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(s){let l=this._values[s];return l==null?!1:(delete this._values[s],this._keys.splice(l.i,1),!0)}entries(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?[l,this._values[l].v]:void 0,done:l===void 0}}}}forEach(s,l){l=l||this;for(let u=0;u<this._keys.length;u++){let c=this._keys[u];s.call(l,this._values[c].v,c,l)}}get(s){return this._values[s]?this._values[s].v:void 0}has(s){return this._values[s]!=null}keys(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?l:void 0,done:l===void 0}}}}set(s,l){return this._values[s]?(this._values[s].v=l,this):(this._keys.push(s),this._values[s]={v:l,i:this._keys.length-1},this)}values(){let s=0;return{next:()=>{let l=this._keys[s++];return{value:l!==void 0?this._values[l].v:void 0,done:l===void 0}}}}get size(){return this._keys.length}}});Mt(qp);S8=qp.Map,Ks=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class r{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new r}}e.MaxKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MaxKey"})});Mt(Ks);x8=Ks.MaxKey,Gs=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class r{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new r}}e.MinKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MinKey"})});Mt(Gs);E8=Gs.MinKey,$i=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let r=jt.randomBytes(5),n=new RegExp("^[0-9a-fA-F]{24}$"),i=[];for(let c=0;c<256;c++)i[c]=(c<=15?"0":"")+c.toString(16);let o=[],f=0;for(;f<10;)o[48+f]=f++;for(;f<16;)o[65-10+f]=o[97-10+f]=f++;let s=Symbol("id");class l{constructor(_){if(_ instanceof l&&(this[s]=_.id,this.__id=_.__id),typeof _=="object"&&_&&"id"in _&&("toHexString"in _&&typeof _.toHexString=="function"?this[s]=ye.Buffer.from(_.toHexString(),"hex"):this[s]=typeof _.id=="string"?ye.Buffer.from(_.id):_.id),(_==null||typeof _=="number")&&(this[s]=l.generate(typeof _=="number"?_:void 0),l.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(_)&&_.byteLength===12&&(this[s]=Mo.ensureBuffer(_)),typeof _=="string")if(_.length===12){let p=ye.Buffer.from(_);p.byteLength===12&&(this[s]=p)}else if(_.length===24&&n.test(_))this[s]=ye.Buffer.from(_,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");l.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[s]}set id(_){this[s]=_,l.cacheHexString&&(this.__id=_.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(_){this.id.writeUInt32BE(_,0)}toHexString(){if(l.cacheHexString&&this.__id)return this.__id;let _=this.id.toString("hex");return l.cacheHexString&&!this.__id&&(this.__id=_),_}static getInc(){return l.index=(l.index+1)%16777215}static generate(_){typeof _!="number"&&(_=~~(Date.now()/1e3));let p=l.getInc(),j=ye.Buffer.alloc(12);return j.writeUInt32BE(_,0),j[4]=r[0],j[5]=r[1],j[6]=r[2],j[7]=r[3],j[8]=r[4],j[11]=p&255,j[10]=p>>8&255,j[9]=p>>16&255,j}toString(_){return _?this.id.toString(_):this.toHexString()}toJSON(){return this.toHexString()}equals(_){return _==null?!1:_ instanceof l?this.toString()===_.toString():typeof _=="string"&&l.isValid(_)&&_.length===12&&this.id instanceof ye.Buffer?_===this.id.toString("binary"):typeof _=="string"&&l.isValid(_)&&_.length===24?_.toLowerCase()===this.toHexString():typeof _=="string"&&l.isValid(_)&&_.length===12?ye.Buffer.from(_).equals(this.id):typeof _=="object"&&"toHexString"in _&&typeof _.toHexString=="function"?_.toHexString()===this.toHexString():!1}getTimestamp(){let _=new Date,p=this.id.readUInt32BE(0);return _.setTime(Math.floor(p)*1e3),_}static createPk(){return new l}static createFromTime(_){let p=ye.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return p.writeUInt32BE(_,0),new l(p)}static createFromHexString(_){if(typeof _=="undefined"||_!=null&&_.length!==24)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new l(ye.Buffer.from(_,"hex"))}static isValid(_){return _==null?!1:typeof _=="number"?!0:typeof _=="string"?_.length===12||_.length===24&&n.test(_):_ instanceof l||_ instanceof ye.Buffer&&_.length===12?!0:typeof _=="object"&&"toHexString"in _&&typeof _.toHexString=="function"?typeof _.id=="string"?_.id.length===12:_.toHexString().length===24&&n.test(_.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(_){return new l(_.$oid)}}e.ObjectId=l,l.index=~~(Math.random()*16777215),Object.defineProperty(l.prototype,"generate",{value:jt.deprecate(c=>l.generate(c),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(l.prototype,"getInc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(l.prototype,"get_inc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(l,"get_inc",{value:jt.deprecate(()=>l.getInc(),"Please use the static `ObjectId.getInc()` instead")});let u=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(l.prototype,u,l.prototype.toString),Object.defineProperty(l.prototype,"inspect",l.prototype.toString),Object.defineProperty(l.prototype,"_bsontype",{value:"ObjectID"})});Mt($i);A8=$i.ObjectId,G=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128});Mt(G);O8=G.BSON_BINARY_SUBTYPE_USER_DEFINED,N8=G.BSON_BINARY_SUBTYPE_MD5,D8=G.BSON_BINARY_SUBTYPE_UUID_NEW,F8=G.BSON_BINARY_SUBTYPE_UUID,P8=G.BSON_BINARY_SUBTYPE_BYTE_ARRAY,R8=G.BSON_BINARY_SUBTYPE_FUNCTION,H8=G.BSON_BINARY_SUBTYPE_DEFAULT,z8=G.BSON_DATA_MAX_KEY,M8=G.BSON_DATA_MIN_KEY,U8=G.BSON_DATA_DECIMAL128,L8=G.BSON_DATA_LONG,C8=G.BSON_DATA_TIMESTAMP,V8=G.BSON_DATA_INT,W8=G.BSON_DATA_CODE_W_SCOPE,Y8=G.BSON_DATA_SYMBOL,K8=G.BSON_DATA_CODE,G8=G.BSON_DATA_DBPOINTER,J8=G.BSON_DATA_REGEXP,Z8=G.BSON_DATA_NULL,X8=G.BSON_DATA_DATE,Q8=G.BSON_DATA_BOOLEAN,$8=G.BSON_DATA_OID,eC=G.BSON_DATA_UNDEFINED,tC=G.BSON_DATA_BINARY,rC=G.BSON_DATA_ARRAY,nC=G.BSON_DATA_OBJECT,iC=G.BSON_DATA_STRING,oC=G.BSON_DATA_NUMBER,fC=G.JS_INT_MIN,sC=G.JS_INT_MAX,aC=G.BSON_INT64_MIN,lC=G.BSON_INT64_MAX,uC=G.BSON_INT32_MIN,cC=G.BSON_INT32_MAX,yh=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function r(i,o,f){let s=4+1;if(Array.isArray(i))for(let l=0;l<i.length;l++)s+=n(l.toString(),i[l],o,!0,f);else{i.toBSON&&(i=i.toBSON());for(let l in i)s+=n(l,i[l],o,!1,f)}return s}e.calculateObjectSize=r;function n(i,o,f=!1,s=!1,l=!1){switch(o&&o.toBSON&&(o=o.toBSON()),typeof o){case"string":return 1+ye.Buffer.byteLength(i,"utf8")+1+4+ye.Buffer.byteLength(o,"utf8")+1;case"number":return Math.floor(o)===o&&o>=G.JS_INT_MIN&&o<=G.JS_INT_MAX&&o>=G.BSON_INT32_MIN&&o<=G.BSON_INT32_MAX?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(4+1):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);case"undefined":return s||!l?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1:0;case"boolean":return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(1+1);case"object":if(o==null||o._bsontype==="MinKey"||o._bsontype==="MaxKey")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1;if(o._bsontype==="ObjectId"||o._bsontype==="ObjectID")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(12+1);if(o instanceof Date||jt.isDate(o))return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(o)||o instanceof ArrayBuffer)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(1+4+1)+o.byteLength;if(o._bsontype==="Long"||o._bsontype==="Double"||o._bsontype==="Timestamp")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(8+1);if(o._bsontype==="Decimal128")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(16+1);if(o._bsontype==="Code")return o.scope!=null&&Object.keys(o.scope).length>0?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+4+ye.Buffer.byteLength(o.code.toString(),"utf8")+1+r(o.scope,f,l):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+ye.Buffer.byteLength(o.code.toString(),"utf8")+1;if(o._bsontype==="Binary")return o.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(o.position+1+4+1+4):(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+(o.position+1+4+1);if(o._bsontype==="Symbol")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+ye.Buffer.byteLength(o.value,"utf8")+4+1+1;if(o._bsontype==="DBRef"){let u=Object.assign({$ref:o.collection,$id:o.oid},o.fields);return o.db!=null&&(u.$db=o.db),(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+r(u,f,l)}else return o instanceof RegExp||Object.prototype.toString.call(o)==="[object RegExp]"?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.source,"utf8")+1+(o.global?1:0)+(o.ignoreCase?1:0)+(o.multiline?1:0)+1:o._bsontype==="BSONRegExp"?(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.pattern,"utf8")+1+ye.Buffer.byteLength(o.options,"utf8")+1:(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+r(o,f,l)+1;case"function":if(o instanceof RegExp||Object.prototype.toString.call(o)==="[object RegExp]"||String.call(o)==="[object RegExp]")return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+ye.Buffer.byteLength(o.source,"utf8")+1+(o.global?1:0)+(o.ignoreCase?1:0)+(o.multiline?1:0)+1;if(f&&o.scope!=null&&Object.keys(o.scope).length>0)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+4+ye.Buffer.byteLength(jt.normalizedFunctionString(o),"utf8")+1+r(o.scope,f,l);if(f)return(i!=null?ye.Buffer.byteLength(i,"utf8")+1:0)+1+4+ye.Buffer.byteLength(jt.normalizedFunctionString(o),"utf8")+1}return 0}});Mt(yh);pC=yh.calculateObjectSize,Lo=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function r(i){return i.split("").sort().join("")}class n{constructor(o,f){this.pattern=o,this.options=f??"",r(this.options);for(let s=0;s<this.options.length;s++)if(!(this.options[s]==="i"||this.options[s]==="m"||this.options[s]==="x"||this.options[s]==="l"||this.options[s]==="s"||this.options[s]==="u"))throw new Error(`The regular expression option [${this.options[s]}] is not supported`)}static parseOptions(o){return o?o.split("").sort().join(""):""}toExtendedJSON(o){return o=o||{},o.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(o){if("$regex"in o)if(typeof o.$regex!="string"){if(o.$regex._bsontype==="BSONRegExp")return o}else return new n(o.$regex,n.parseOptions(o.$options));if("$regularExpression"in o)return new n(o.$regularExpression.pattern,n.parseOptions(o.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(o)}`)}}e.BSONRegExp=n,Object.defineProperty(n.prototype,"_bsontype",{value:"BSONRegExp"})});Mt(Lo);dC=Lo.BSONRegExp,Js=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class r{constructor(i){this.value=i}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(i){return new r(i.$symbol)}}e.BSONSymbol=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Symbol"})});Mt(Js);mC=Js.BSONSymbol,Co=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=Se.Long;class r extends e.LongWithoutOverridesClass{constructor(i,o){Se.Long.isLong(i)?super(i.low,i.high,!0):super(i,o,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(i){return new r(Se.Long.fromInt(i,!0))}static fromNumber(i){return new r(Se.Long.fromNumber(i,!0))}static fromBits(i,o){return new r(i,o)}static fromString(i,o){return new r(Se.Long.fromString(i,!0,o))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(i){return new r(i.$timestamp.i,i.$timestamp.t)}}e.Timestamp=r,r.MAX_VALUE=Se.Long.MAX_UNSIGNED_VALUE});Mt(Co);bC=Co.Timestamp,hC=Co.LongWithoutOverridesClass,vp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let r=128,n=192,i=224,o=240,f=248,s=192,l=224,u=240,c=128;function _(p,j,S){let T=0;for(let U=j;U<S;U+=1){let W=p[U];if(T){if((W&n)!==c)return!1;T-=1}else if(W&r)if((W&i)===s)T=1;else if((W&o)===l)T=2;else if((W&f)===u)T=3;else return!1}return!T}e.validateUtf8=_});Mt(vp);wC=vp.validateUtf8,Tp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let r=Se.Long.fromNumber(G.JS_INT_MAX),n=Se.Long.fromNumber(G.JS_INT_MIN),i={};function o(l,u,c){u=u??{};let _=u&&u.index?u.index:0,p=l[_]|l[_+1]<<8|l[_+2]<<16|l[_+3]<<24;if(p<5)throw new Error(`bson size must be >= 5, is ${p}`);if(u.allowObjectSmallerThanBufferSize&&l.length<p)throw new Error(`buffer length ${l.length} must be >= bson size ${p}`);if(!u.allowObjectSmallerThanBufferSize&&l.length!==p)throw new Error(`buffer length ${l.length} must === bson size ${p}`);if(p+_>l.byteLength)throw new Error(`(bson size ${p} + options.index ${_} must be <= buffer length ${l.byteLength})`);if(l[_+p-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return f(l,_,u,c)}e.deserialize=o;function f(l,u,c,_=!1){let p=c.evalFunctions==null?!1:c.evalFunctions,j=c.cacheFunctions==null?!1:c.cacheFunctions,S=c.fieldsAsRaw==null?null:c.fieldsAsRaw,T=c.raw==null?!1:c.raw,U=typeof c.bsonRegExp=="boolean"?c.bsonRegExp:!1,W=c.promoteBuffers==null?!1:c.promoteBuffers,L=c.promoteLongs==null?!0:c.promoteLongs,te=c.promoteValues==null?!0:c.promoteValues,pe=u;if(l.length<5)throw new Error("corrupt bson message < 5 bytes long");let J=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(J<5||J>l.length)throw new Error("corrupt bson message");let D=_?[]:{},le=0,Y=!1;for(;!Y;){let g=l[u++];if(g===0)break;let N=u;for(;l[N]!==0&&N<l.length;)N++;if(N>=l.byteLength)throw new Error("Bad BSON Document: illegal CString");let b=_?le++:l.toString("utf8",u,N);if(u=N+1,g===G.BSON_DATA_STRING){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");if(!vp.validateUtf8(l,u,u+H-1))throw new Error("Invalid UTF-8 string in BSON document");let K=l.toString("utf8",u,u+H-1);D[b]=K,u=u+H}else if(g===G.BSON_DATA_OID){let H=ye.Buffer.alloc(12);l.copy(H,0,u,u+12),D[b]=new $i.ObjectId(H),u=u+12}else if(g===G.BSON_DATA_INT&&te===!1)D[b]=new Kf.Int32(l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24);else if(g===G.BSON_DATA_INT)D[b]=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;else if(g===G.BSON_DATA_NUMBER&&te===!1)D[b]=new Yf.Double(l.readDoubleLE(u)),u=u+8;else if(g===G.BSON_DATA_NUMBER)D[b]=l.readDoubleLE(u),u=u+8;else if(g===G.BSON_DATA_DATE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;D[b]=new Date(new Se.Long(H,K).toNumber())}else if(g===G.BSON_DATA_BOOLEAN){if(l[u]!==0&&l[u]!==1)throw new Error("illegal boolean type value");D[b]=l[u++]===1}else if(g===G.BSON_DATA_OBJECT){let H=u,K=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24;if(K<=0||K>l.length-u)throw new Error("bad embedded document length in bson");T?D[b]=l.slice(u,u+K):D[b]=f(l,H,c,!1),u=u+K}else if(g===G.BSON_DATA_ARRAY){let H=u,K=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24,z=c,oe=u+K;if(S&&S[b]){z={};for(let A in c)z[A]=c[A];z.raw=!0}if(D[b]=f(l,H,z,!0),u=u+K,l[u-1]!==0)throw new Error("invalid array terminator byte");if(u!==oe)throw new Error("corrupted array bson")}else if(g===G.BSON_DATA_UNDEFINED)D[b]=void 0;else if(g===G.BSON_DATA_NULL)D[b]=null;else if(g===G.BSON_DATA_LONG){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,z=new Se.Long(H,K);L&&te===!0?D[b]=z.lessThanOrEqual(r)&&z.greaterThanOrEqual(n)?z.toNumber():z:D[b]=z}else if(g===G.BSON_DATA_DECIMAL128){let H=ye.Buffer.alloc(16);l.copy(H,0,u,u+16),u=u+16;let K=new Ys.Decimal128(H);"toObject"in K&&typeof K.toObject=="function"?D[b]=K.toObject():D[b]=K}else if(g===G.BSON_DATA_BINARY){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=H,z=l[u++];if(H<0)throw new Error("Negative binary type element size found");if(H>l.byteLength)throw new Error("Binary type size larger than document size");if(l.slice!=null){if(z===ln.Binary.SUBTYPE_BYTE_ARRAY){if(H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,H<0)throw new Error("Negative binary type element size found for subtype 0x02");if(H>K-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(H<K-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}W&&te?D[b]=l.slice(u,u+H):D[b]=new ln.Binary(l.slice(u,u+H),z)}else{let oe=ye.Buffer.alloc(H);if(z===ln.Binary.SUBTYPE_BYTE_ARRAY){if(H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,H<0)throw new Error("Negative binary type element size found for subtype 0x02");if(H>K-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(H<K-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(N=0;N<H;N++)oe[N]=l[u+N];W&&te?D[b]=oe:D[b]=new ln.Binary(oe,z)}u=u+H}else if(g===G.BSON_DATA_REGEXP&&U===!1){for(N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let H=l.toString("utf8",u,N);for(u=N+1,N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let K=l.toString("utf8",u,N);u=N+1;let z=new Array(K.length);for(N=0;N<K.length;N++)switch(K[N]){case"m":z[N]="m";break;case"s":z[N]="g";break;case"i":z[N]="i";break}D[b]=new RegExp(H,z.join(""))}else if(g===G.BSON_DATA_REGEXP&&U===!0){for(N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let H=l.toString("utf8",u,N);for(u=N+1,N=u;l[N]!==0&&N<l.length;)N++;if(N>=l.length)throw new Error("Bad BSON Document: illegal CString");let K=l.toString("utf8",u,N);u=N+1,D[b]=new Lo.BSONRegExp(H,K)}else if(g===G.BSON_DATA_SYMBOL){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");let K=l.toString("utf8",u,u+H-1);D[b]=te?K:new Js.BSONSymbol(K),u=u+H}else if(g===G.BSON_DATA_TIMESTAMP){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;D[b]=new Co.Timestamp(H,K)}else if(g===G.BSON_DATA_MIN_KEY)D[b]=new Gs.MinKey;else if(g===G.BSON_DATA_MAX_KEY)D[b]=new Ks.MaxKey;else if(g===G.BSON_DATA_CODE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");let K=l.toString("utf8",u,u+H-1);p?j?D[b]=s(K,i,D):D[b]=s(K):D[b]=new Uo.Code(K),u=u+H}else if(g===G.BSON_DATA_CODE_W_SCOPE){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let K=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(K<=0||K>l.length-u||l[u+K-1]!==0)throw new Error("bad string length in bson");let z=l.toString("utf8",u,u+K-1);u=u+K;let oe=u,A=l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24,Ye=f(l,oe,c,!1);if(u=u+A,H<4+4+A+K)throw new Error("code_w_scope total size is too short, truncating scope");if(H>4+4+A+K)throw new Error("code_w_scope total size is too long, clips outer document");p?(j?D[b]=s(z,i,D):D[b]=s(z),D[b].scope=Ye):D[b]=new Uo.Code(z,Ye)}else if(g===G.BSON_DATA_DBPOINTER){let H=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;if(H<=0||H>l.length-u||l[u+H-1]!==0)throw new Error("bad string length in bson");if(!vp.validateUtf8(l,u,u+H-1))throw new Error("Invalid UTF-8 string in BSON document");let K=l.toString("utf8",u,u+H-1);u=u+H;let z=ye.Buffer.alloc(12);l.copy(z,0,u,u+12);let oe=new $i.ObjectId(z);u=u+12,D[b]=new Kn.DBRef(K,oe)}else throw new Error("Detected unknown BSON type "+g.toString(16)+' for fieldname "'+b+'"')}if(J!==u-pe)throw _?new Error("corrupt array bson"):new Error("corrupt object bson");let de=Object.keys(D).filter(g=>g.startsWith("$")),y=!0;if(de.forEach(g=>{["$ref","$id","$db"].indexOf(g)===-1&&(y=!1)}),!y)return D;if(Kn.isDBRefLike(D)){let g=Object.assign({},D);return delete g.$ref,delete g.$id,delete g.$db,new Kn.DBRef(D.$ref,D.$id,D.$db,g)}return D}function s(l,u,c){return u?(u[l]==null&&(u[l]=new Function(l)),u[l].bind(c)):new Function(l)}});Mt(Tp);gC=Tp.deserialize,Cl=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function r(T){return jt.isObjectLike(T)&&Reflect.has(T,"_bsontype")&&typeof T._bsontype=="string"}e.isBSONType=r;let n=2147483647,i=-2147483648,o=9223372036854776e3,f=-9223372036854776e3,s={$oid:$i.ObjectId,$binary:ln.Binary,$uuid:ln.Binary,$symbol:Js.BSONSymbol,$numberInt:Kf.Int32,$numberDecimal:Ys.Decimal128,$numberDouble:Yf.Double,$numberLong:Se.Long,$minKey:Gs.MinKey,$maxKey:Ks.MaxKey,$regex:Lo.BSONRegExp,$regularExpression:Lo.BSONRegExp,$timestamp:Co.Timestamp};function l(T,U={}){if(typeof T=="number"){if(U.relaxed||U.legacy)return T;if(Math.floor(T)===T){if(T>=i&&T<=n)return new Kf.Int32(T);if(T>=f&&T<=o)return Se.Long.fromNumber(T)}return new Yf.Double(T)}if(T==null||typeof T!="object")return T;if(T.$undefined)return null;let W=Object.keys(T).filter(L=>L.startsWith("$")&&T[L]!=null);for(let L=0;L<W.length;L++){let te=s[W[L]];if(te)return te.fromExtendedJSON(T,U)}if(T.$date!=null){let L=T.$date,te=new Date;return U.legacy?typeof L=="number"?te.setTime(L):typeof L=="string"&&te.setTime(Date.parse(L)):typeof L=="string"?te.setTime(Date.parse(L)):Se.Long.isLong(L)?te.setTime(L.toNumber()):typeof L=="number"&&U.relaxed&&te.setTime(L),te}if(T.$code!=null){let L=Object.assign({},T);return T.$scope&&(L.$scope=l(T.$scope)),Uo.Code.fromExtendedJSON(T)}if(T.$ref!=null||T.$dbPointer!=null){let L=T.$ref?T:T.$dbPointer;if(L instanceof Kn.DBRef)return L;let te=Object.keys(L).filter(J=>J.startsWith("$")),pe=!0;if(te.forEach(J=>{["$ref","$id","$db"].indexOf(J)===-1&&(pe=!1)}),pe)return Kn.DBRef.fromExtendedJSON(L)}return T}function u(T,U){return T.map(W=>_(W,U))}function c(T){let U=T.toISOString();return T.getUTCMilliseconds()!==0?U:U.slice(0,-5)+"Z"}function _(T,U){if(Array.isArray(T))return u(T,U);if(T===void 0)return null;if(T instanceof Date){let W=T.getTime(),L=W>-1&&W<2534023188e5;return U.legacy?U.relaxed&&L?{$date:T.getTime()}:{$date:c(T)}:U.relaxed&&L?{$date:c(T)}:{$date:{$numberLong:T.getTime().toString()}}}if(typeof T=="number"&&!U.relaxed){if(Math.floor(T)===T){let W=T>=i&&T<=n,L=T>=f&&T<=o;if(W)return{$numberInt:T.toString()};if(L)return{$numberLong:T.toString()}}return{$numberDouble:T.toString()}}if(T instanceof RegExp){let W=T.flags;if(W===void 0){let te=T.toString().match(/[gimuy]*$/);te&&(W=te[0])}return new Lo.BSONRegExp(T.source,W).toExtendedJSON(U)}return T!=null&&typeof T=="object"?j(T,U):T}let p={Binary:T=>new ln.Binary(T.value(),T.sub_type),Code:T=>new Uo.Code(T.code,T.scope),DBRef:T=>new Kn.DBRef(T.collection||T.namespace,T.oid,T.db,T.fields),Decimal128:T=>new Ys.Decimal128(T.bytes),Double:T=>new Yf.Double(T.value),Int32:T=>new Kf.Int32(T.value),Long:T=>Se.Long.fromBits(T.low!=null?T.low:T.low_,T.low!=null?T.high:T.high_,T.low!=null?T.unsigned:T.unsigned_),MaxKey:()=>new Ks.MaxKey,MinKey:()=>new Gs.MinKey,ObjectID:T=>new $i.ObjectId(T),ObjectId:T=>new $i.ObjectId(T),BSONRegExp:T=>new Lo.BSONRegExp(T.pattern,T.options),Symbol:T=>new Js.BSONSymbol(T.value),Timestamp:T=>Co.Timestamp.fromBits(T.low,T.high)};function j(T,U){if(T==null||typeof T!="object")throw new Error("not an object instance");let W=T._bsontype;if(typeof W=="undefined"){let L={};for(let te in T)L[te]=_(T[te],U);return L}else if(r(T)){let L=T;if(typeof L.toExtendedJSON!="function"){let te=p[T._bsontype];if(!te)throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype);L=te(L)}return W==="Code"&&L.scope?L=new Uo.Code(L.code,_(L.scope,U)):W==="DBRef"&&L.oid&&(L=new Kn.DBRef(L.collection,_(L.oid,U),L.db,L.fields)),L.toExtendedJSON(U)}else throw new Error("_bsontype must be a string, but was: "+typeof W)}var S;(function(T){function U(pe,J){let D=Object.assign({},{relaxed:!0,legacy:!1},J);return typeof D.relaxed=="boolean"&&(D.strict=!D.relaxed),typeof D.strict=="boolean"&&(D.relaxed=!D.strict),JSON.parse(pe,(le,Y)=>l(Y,D))}T.parse=U;function W(pe,J,D,le){D!=null&&typeof D=="object"&&(le=D,D=0),J!=null&&typeof J=="object"&&!Array.isArray(J)&&(le=J,J=void 0,D=0),le=Object.assign({},{relaxed:!0,legacy:!1},le);let Y=_(pe,le);return JSON.stringify(Y,J,D)}T.stringify=W;function L(pe,J){return J=J||{},JSON.parse(W(pe,J))}T.serialize=L;function te(pe,J){return J=J||{},U(JSON.stringify(pe),J)}T.deserialize=te})(S=e.EJSON||(e.EJSON={}))});Mt(Cl);yC=Cl.EJSON,jC=Cl.isBSONType,Vl=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function r(i,o,f,s,l){let u,c,_=f==="big",p=l*8-s-1,j=(1<<p)-1,S=j>>1,T=-7,U=_?0:l-1,W=_?1:-1,L=i[o+U];for(U+=W,u=L&(1<<-T)-1,L>>=-T,T+=p;T>0;u=u*256+i[o+U],U+=W,T-=8);for(c=u&(1<<-T)-1,u>>=-T,T+=s;T>0;c=c*256+i[o+U],U+=W,T-=8);if(u===0)u=1-S;else{if(u===j)return c?NaN:(L?-1:1)*(1/0);c=c+Math.pow(2,s),u=u-S}return(L?-1:1)*c*Math.pow(2,u-s)}e.readIEEE754=r;function n(i,o,f,s,l,u){let c,_,p,j=s==="big",S=u*8-l-1,T=(1<<S)-1,U=T>>1,W=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=j?u-1:0,te=j?-1:1,pe=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(_=isNaN(o)?1:0,c=T):(c=Math.floor(Math.log(o)/Math.LN2),o*(p=Math.pow(2,-c))<1&&(c--,p*=2),c+U>=1?o+=W/p:o+=W*Math.pow(2,1-U),o*p>=2&&(c++,p/=2),c+U>=T?(_=0,c=T):c+U>=1?(_=(o*p-1)*Math.pow(2,l),c=c+U):(_=o*Math.pow(2,U-1)*Math.pow(2,l),c=0)),isNaN(o)&&(_=0);l>=8;)i[f+L]=_&255,L+=te,_/=256,l-=8;for(c=c<<l|_,isNaN(o)&&(c+=8),S+=l;S>0;)i[f+L]=c&255,L+=te,c/=256,S-=8;i[f+L-te]|=pe*128}e.writeIEEE754=n});Mt(Vl);_C=Vl.writeIEEE754,qC=Vl.readIEEE754,Bp=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function i(y){return Object.prototype.toString.call(y)==="[object RegExp]"}function o(y,g,N,b,H){y[b++]=G.BSON_DATA_STRING;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K+1,y[b-1]=0;let z=y.write(N,b+4,void 0,"utf8");return y[b+3]=z+1>>24&255,y[b+2]=z+1>>16&255,y[b+1]=z+1>>8&255,y[b]=z+1&255,b=b+4+z,y[b++]=0,b}function f(y,g,N,b,H){if(Number.isInteger(N)&&N>=G.BSON_INT32_MIN&&N<=G.BSON_INT32_MAX){y[b++]=G.BSON_DATA_INT;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0,y[b++]=N&255,y[b++]=N>>8&255,y[b++]=N>>16&255,y[b++]=N>>24&255}else{y[b++]=G.BSON_DATA_NUMBER;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0,Vl.writeIEEE754(y,N,b,"little",52,8),b=b+8}return b}function s(y,g,N,b,H){y[b++]=G.BSON_DATA_NULL;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,b}function l(y,g,N,b,H){y[b++]=G.BSON_DATA_BOOLEAN;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,y[b++]=N?1:0,b}function u(y,g,N,b,H){y[b++]=G.BSON_DATA_DATE;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=Se.Long.fromNumber(N.getTime()),oe=z.getLowBits(),A=z.getHighBits();return y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,y[b++]=A&255,y[b++]=A>>8&255,y[b++]=A>>16&255,y[b++]=A>>24&255,b}function c(y,g,N,b,H){y[b++]=G.BSON_DATA_REGEXP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,N.source&&N.source.match(r)!=null)throw Error("value "+N.source+" must not contain null bytes");return b=b+y.write(N.source,b,void 0,"utf8"),y[b++]=0,N.ignoreCase&&(y[b++]=105),N.global&&(y[b++]=115),N.multiline&&(y[b++]=109),y[b++]=0,b}function _(y,g,N,b,H){y[b++]=G.BSON_DATA_REGEXP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,N.pattern.match(r)!=null)throw Error("pattern "+N.pattern+" must not contain null bytes");return b=b+y.write(N.pattern,b,void 0,"utf8"),y[b++]=0,b=b+y.write(N.options.split("").sort().join(""),b,void 0,"utf8"),y[b++]=0,b}function p(y,g,N,b,H){N===null?y[b++]=G.BSON_DATA_NULL:N._bsontype==="MinKey"?y[b++]=G.BSON_DATA_MIN_KEY:y[b++]=G.BSON_DATA_MAX_KEY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,b}function j(y,g,N,b,H){y[b++]=G.BSON_DATA_OID;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");if(b=b+K,y[b++]=0,typeof N.id=="string")y.write(N.id,b,void 0,"binary");else if(N.id&&N.id.copy)N.id.copy(y,b,0,12);else throw new TypeError("object ["+JSON.stringify(N)+"] is not a valid ObjectId");return b+12}function S(y,g,N,b,H){y[b++]=G.BSON_DATA_BINARY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.length;return y[b++]=z&255,y[b++]=z>>8&255,y[b++]=z>>16&255,y[b++]=z>>24&255,y[b++]=G.BSON_BINARY_SUBTYPE_DEFAULT,y.set(Mo.ensureBuffer(N),b),b=b+z,b}function T(y,g,N,b,H=!1,K=0,z=!1,oe=!0,A=!1,Ye=[]){for(let X=0;X<Ye.length;X++)if(Ye[X]===N)throw new Error("cyclic dependency detected");Ye.push(N),y[b++]=Array.isArray(N)?G.BSON_DATA_ARRAY:G.BSON_DATA_OBJECT;let me=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+me,y[b++]=0;let V=de(y,N,H,b,K+1,z,oe,Ye);return Ye.pop(),V}function U(y,g,N,b,H){y[b++]=G.BSON_DATA_DECIMAL128;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,N.bytes.copy(y,b,0,16),b+16}function W(y,g,N,b,H){y[b++]=N._bsontype==="Long"?G.BSON_DATA_LONG:G.BSON_DATA_TIMESTAMP;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.getLowBits(),oe=N.getHighBits();return y[b++]=z&255,y[b++]=z>>8&255,y[b++]=z>>16&255,y[b++]=z>>24&255,y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,b}function L(y,g,N,b,H){N=N.valueOf(),y[b++]=G.BSON_DATA_INT;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,y[b++]=N&255,y[b++]=N>>8&255,y[b++]=N>>16&255,y[b++]=N>>24&255,b}function te(y,g,N,b,H){y[b++]=G.BSON_DATA_NUMBER;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");return b=b+K,y[b++]=0,Vl.writeIEEE754(y,N.value,b,"little",52,8),b=b+8,b}function pe(y,g,N,b,H=!1,K=0,z){y[b++]=G.BSON_DATA_CODE;let oe=z?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+oe,y[b++]=0;let A=jt.normalizedFunctionString(N),Ye=y.write(A,b+4,void 0,"utf8")+1;return y[b]=Ye&255,y[b+1]=Ye>>8&255,y[b+2]=Ye>>16&255,y[b+3]=Ye>>24&255,b=b+4+Ye-1,y[b++]=0,b}function J(y,g,N,b,H=!1,K=0,z=!1,oe=!0,A=!1){if(N.scope&&typeof N.scope=="object"){y[b++]=G.BSON_DATA_CODE_W_SCOPE;let Ye=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+Ye,y[b++]=0;let me=b,V=typeof N.code=="string"?N.code:N.code.toString();b=b+4;let X=y.write(V,b+4,void 0,"utf8")+1;y[b]=X&255,y[b+1]=X>>8&255,y[b+2]=X>>16&255,y[b+3]=X>>24&255,y[b+4+X-1]=0,b=b+X+4;let ze=de(y,N.scope,H,b,K+1,z,oe);b=ze-1;let we=ze-me;y[me++]=we&255,y[me++]=we>>8&255,y[me++]=we>>16&255,y[me++]=we>>24&255,y[b++]=0}else{y[b++]=G.BSON_DATA_CODE;let Ye=A?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+Ye,y[b++]=0;let me=N.code.toString(),V=y.write(me,b+4,void 0,"utf8")+1;y[b]=V&255,y[b+1]=V>>8&255,y[b+2]=V>>16&255,y[b+3]=V>>24&255,b=b+4+V-1,y[b++]=0}return b}function D(y,g,N,b,H){y[b++]=G.BSON_DATA_BINARY;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=N.value(!0),oe=N.position;return N.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY&&(oe=oe+4),y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255,y[b++]=N.sub_type,N.sub_type===ln.Binary.SUBTYPE_BYTE_ARRAY&&(oe=oe-4,y[b++]=oe&255,y[b++]=oe>>8&255,y[b++]=oe>>16&255,y[b++]=oe>>24&255),y.set(z,b),b=b+N.position,b}function le(y,g,N,b,H){y[b++]=G.BSON_DATA_SYMBOL;let K=H?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+K,y[b++]=0;let z=y.write(N.value,b+4,void 0,"utf8")+1;return y[b]=z&255,y[b+1]=z>>8&255,y[b+2]=z>>16&255,y[b+3]=z>>24&255,b=b+4+z-1,y[b++]=0,b}function Y(y,g,N,b,H,K,z){y[b++]=G.BSON_DATA_OBJECT;let oe=z?y.write(g,b,void 0,"ascii"):y.write(g,b,void 0,"utf8");b=b+oe,y[b++]=0;let A=b,Ye={$ref:N.collection||N.namespace,$id:N.oid};N.db!=null&&(Ye.$db=N.db),Ye=Object.assign(Ye,N.fields);let me=de(y,Ye,!1,b,H+1,K),V=me-A;return y[A++]=V&255,y[A++]=V>>8&255,y[A++]=V>>16&255,y[A++]=V>>24&255,me}function de(y,g,N=!1,b=0,H=0,K=!1,z=!0,oe=[]){b=b||0,oe=oe||[],oe.push(g);let A=b+4;if(Array.isArray(g))for(let me=0;me<g.length;me++){let V=""+me,X=g[me];if(X&&X.toBSON){if(typeof X.toBSON!="function")throw new TypeError("toBSON is not a function");X=X.toBSON()}if(typeof X=="string")A=o(y,V,X,A,!0);else if(typeof X=="number")A=f(y,V,X,A,!0);else{if(typeof X=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof X=="boolean")A=l(y,V,X,A,!0);else if(X instanceof Date||jt.isDate(X))A=u(y,V,X,A,!0);else if(X===void 0)A=s(y,V,X,A,!0);else if(X===null)A=s(y,V,X,A,!0);else if(X._bsontype==="ObjectId"||X._bsontype==="ObjectID")A=j(y,V,X,A,!0);else if(ye.Buffer.isBuffer(X)||jt.isUint8Array(X))A=S(y,V,X,A,!0);else if(X instanceof RegExp||i(X))A=c(y,V,X,A,!0);else if(typeof X=="object"&&X._bsontype==null)A=T(y,V,X,A,N,H,K,z,!0,oe);else if(typeof X=="object"&&Cl.isBSONType(X)&&X._bsontype==="Decimal128")A=U(y,V,X,A,!0);else if(X._bsontype==="Long"||X._bsontype==="Timestamp")A=W(y,V,X,A,!0);else if(X._bsontype==="Double")A=te(y,V,X,A,!0);else if(typeof X=="function"&&K)A=pe(y,V,X,A,N,H,!0);else if(X._bsontype==="Code")A=J(y,V,X,A,N,H,K,z,!0);else if(X._bsontype==="Binary")A=D(y,V,X,A,!0);else if(X._bsontype==="Symbol")A=le(y,V,X,A,!0);else if(X._bsontype==="DBRef")A=Y(y,V,X,A,H,K,!0);else if(X._bsontype==="BSONRegExp")A=_(y,V,X,A,!0);else if(X._bsontype==="Int32")A=L(y,V,X,A,!0);else if(X._bsontype==="MinKey"||X._bsontype==="MaxKey")A=p(y,V,X,A,!0);else if(typeof X._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+X._bsontype)}}else if(g instanceof qp.Map){let me=g.entries(),V=!1;for(;!V;){let X=me.next();if(V=!!X.done,V)continue;let ze=X.value[0],we=X.value[1],rt=typeof we;if(typeof ze=="string"&&!n.has(ze)){if(ze.match(r)!=null)throw Error("key "+ze+" must not contain null bytes");if(N){if(ze[0]==="$")throw Error("key "+ze+" must not start with '$'");if(~ze.indexOf("."))throw Error("key "+ze+" must not contain '.'")}}if(rt==="string")A=o(y,ze,we,A);else if(rt==="number")A=f(y,ze,we,A);else{if(rt==="bigint"||jt.isBigInt64Array(we)||jt.isBigUInt64Array(we))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(rt==="boolean")A=l(y,ze,we,A);else if(we instanceof Date||jt.isDate(we))A=u(y,ze,we,A);else if(we===null||we===void 0&&z===!1)A=s(y,ze,we,A);else if(we._bsontype==="ObjectId"||we._bsontype==="ObjectID")A=j(y,ze,we,A);else if(ye.Buffer.isBuffer(we)||jt.isUint8Array(we))A=S(y,ze,we,A);else if(we instanceof RegExp||i(we))A=c(y,ze,we,A);else if(rt==="object"&&we._bsontype==null)A=T(y,ze,we,A,N,H,K,z,!1,oe);else if(rt==="object"&&we._bsontype==="Decimal128")A=U(y,ze,we,A);else if(we._bsontype==="Long"||we._bsontype==="Timestamp")A=W(y,ze,we,A);else if(we._bsontype==="Double")A=te(y,ze,we,A);else if(we._bsontype==="Code")A=J(y,ze,we,A,N,H,K,z);else if(typeof we=="function"&&K)A=pe(y,ze,we,A,N,H,K);else if(we._bsontype==="Binary")A=D(y,ze,we,A);else if(we._bsontype==="Symbol")A=le(y,ze,we,A);else if(we._bsontype==="DBRef")A=Y(y,ze,we,A,H,K);else if(we._bsontype==="BSONRegExp")A=_(y,ze,we,A);else if(we._bsontype==="Int32")A=L(y,ze,we,A);else if(we._bsontype==="MinKey"||we._bsontype==="MaxKey")A=p(y,ze,we,A);else if(typeof we._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+we._bsontype)}}}else{if(g.toBSON){if(typeof g.toBSON!="function")throw new TypeError("toBSON is not a function");if(g=g.toBSON(),g!=null&&typeof g!="object")throw new TypeError("toBSON function did not return an object")}for(let me in g){let V=g[me];if(V&&V.toBSON){if(typeof V.toBSON!="function")throw new TypeError("toBSON is not a function");V=V.toBSON()}let X=typeof V;if(typeof me=="string"&&!n.has(me)){if(me.match(r)!=null)throw Error("key "+me+" must not contain null bytes");if(N){if(me[0]==="$")throw Error("key "+me+" must not start with '$'");if(~me.indexOf("."))throw Error("key "+me+" must not contain '.'")}}if(X==="string")A=o(y,me,V,A);else if(X==="number")A=f(y,me,V,A);else{if(X==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(X==="boolean")A=l(y,me,V,A);else if(V instanceof Date||jt.isDate(V))A=u(y,me,V,A);else if(V===void 0)z===!1&&(A=s(y,me,V,A));else if(V===null)A=s(y,me,V,A);else if(V._bsontype==="ObjectId"||V._bsontype==="ObjectID")A=j(y,me,V,A);else if(ye.Buffer.isBuffer(V)||jt.isUint8Array(V))A=S(y,me,V,A);else if(V instanceof RegExp||i(V))A=c(y,me,V,A);else if(X==="object"&&V._bsontype==null)A=T(y,me,V,A,N,H,K,z,!1,oe);else if(X==="object"&&V._bsontype==="Decimal128")A=U(y,me,V,A);else if(V._bsontype==="Long"||V._bsontype==="Timestamp")A=W(y,me,V,A);else if(V._bsontype==="Double")A=te(y,me,V,A);else if(V._bsontype==="Code")A=J(y,me,V,A,N,H,K,z);else if(typeof V=="function"&&K)A=pe(y,me,V,A,N,H,K);else if(V._bsontype==="Binary")A=D(y,me,V,A);else if(V._bsontype==="Symbol")A=le(y,me,V,A);else if(V._bsontype==="DBRef")A=Y(y,me,V,A,H,K);else if(V._bsontype==="BSONRegExp")A=_(y,me,V,A);else if(V._bsontype==="Int32")A=L(y,me,V,A);else if(V._bsontype==="MinKey"||V._bsontype==="MaxKey")A=p(y,me,V,A);else if(typeof V._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+V._bsontype)}}}oe.pop(),y[A++]=0;let Ye=A-b;return y[b++]=Ye&255,y[b++]=Ye>>8&255,y[b++]=Ye>>16&255,y[b++]=Ye>>24&255,A}e.serializeInto=de});Mt(Bp);vC=Bp.serializeInto,xe=Dt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return ln.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return Uo.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return Kn.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return Ys.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return Yf.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return Kf.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return Se.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return qp.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return Ks.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return Gs.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return $i.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return $i.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return Lo.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return Js.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return Co.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return G.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return G.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return G.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return G.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return G.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return G.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return G.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return G.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return G.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return G.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return G.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return G.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return G.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return G.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return G.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return G.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return G.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return G.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return G.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return G.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return G.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return G.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return G.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return G.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return G.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return G.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return G.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return G.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return Cl.EJSON}});var r=Co;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return r.LongWithoutOverridesClass}});let n=1024*1024*17,i=ye.Buffer.alloc(n);function o(_){i.length<_&&(i=ye.Buffer.alloc(_))}e.setInternalBufferSize=o;function f(_,p={}){let j=typeof p.checkKeys=="boolean"?p.checkKeys:!1,S=typeof p.serializeFunctions=="boolean"?p.serializeFunctions:!1,T=typeof p.ignoreUndefined=="boolean"?p.ignoreUndefined:!0,U=typeof p.minInternalBufferSize=="number"?p.minInternalBufferSize:n;i.length<U&&(i=ye.Buffer.alloc(U));let W=Bp.serializeInto(i,_,j,0,0,S,T,[]),L=ye.Buffer.alloc(W);return i.copy(L,0,0,L.length),L}e.serialize=f;function s(_,p,j={}){let S=typeof j.checkKeys=="boolean"?j.checkKeys:!1,T=typeof j.serializeFunctions=="boolean"?j.serializeFunctions:!1,U=typeof j.ignoreUndefined=="boolean"?j.ignoreUndefined:!0,W=typeof j.index=="number"?j.index:0,L=Bp.serializeInto(i,_,S,0,0,T,U);return i.copy(p,W,0,L),W+L-1}e.serializeWithBufferAndIndex=s;function l(_,p={}){return Tp.deserialize(Mo.ensureBuffer(_),p)}e.deserialize=l;function u(_,p={}){p=p||{};let j=typeof p.serializeFunctions=="boolean"?p.serializeFunctions:!1,S=typeof p.ignoreUndefined=="boolean"?p.ignoreUndefined:!0;return yh.calculateObjectSize(_,j,S)}e.calculateObjectSize=u;function c(_,p,j,S,T,U){let W=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},U),L=Mo.ensureBuffer(_),te=p;for(let pe=0;pe<j;pe++){let J=L[te]|L[te+1]<<8|L[te+2]<<16|L[te+3]<<24;W.index=te,S[T+pe]=Tp.deserialize(L,W),te=te+J}return te}e.deserializeStream=c}),TC=Mt(xe),BC=xe.deserializeStream,kC=xe.calculateObjectSize,Kv=xe.deserialize,IC=xe.serializeWithBufferAndIndex,Gv=xe.serialize,SC=xe.setInternalBufferSize,xC=xe.ObjectID,EC=xe.Decimal128,AC=xe.BSONRegExp,OC=xe.MaxKey,NC=xe.MinKey,DC=xe.Int32,FC=xe.Double,PC=xe.Timestamp,RC=xe.Long,HC=xe.ObjectId,zC=xe.Binary,MC=xe.DBRef,UC=xe.BSONSymbol,LC=xe.Map,CC=xe.Code,VC=xe.LongWithoutOverridesClass,WC=xe.EJSON,YC=xe.JS_INT_MIN,KC=xe.JS_INT_MAX,GC=xe.BSON_INT64_MIN,JC=xe.BSON_INT64_MAX,ZC=xe.BSON_INT32_MIN,XC=xe.BSON_INT32_MAX,QC=xe.BSON_DATA_UNDEFINED,$C=xe.BSON_DATA_TIMESTAMP,eV=xe.BSON_DATA_SYMBOL,tV=xe.BSON_DATA_STRING,rV=xe.BSON_DATA_REGEXP,nV=xe.BSON_DATA_OID,iV=xe.BSON_DATA_OBJECT,oV=xe.BSON_DATA_NUMBER,fV=xe.BSON_DATA_NULL,sV=xe.BSON_DATA_MIN_KEY,aV=xe.BSON_DATA_MAX_KEY,lV=xe.BSON_DATA_LONG,uV=xe.BSON_DATA_INT,cV=xe.BSON_DATA_DECIMAL128,pV=xe.BSON_DATA_DBPOINTER,dV=xe.BSON_DATA_DATE,mV=xe.BSON_DATA_CODE_W_SCOPE,bV=xe.BSON_DATA_CODE,hV=xe.BSON_DATA_BOOLEAN,wV=xe.BSON_DATA_BINARY,gV=xe.BSON_DATA_ARRAY,yV=xe.BSON_BINARY_SUBTYPE_UUID_NEW,jV=xe.BSON_BINARY_SUBTYPE_UUID,_V=xe.BSON_BINARY_SUBTYPE_USER_DEFINED,qV=xe.BSON_BINARY_SUBTYPE_MD5,vV=xe.BSON_BINARY_SUBTYPE_FUNCTION,TV=xe.BSON_BINARY_SUBTYPE_DEFAULT,BV=xe.BSON_BINARY_SUBTYPE_BYTE_ARRAY});function _h(t,e){return Kv(new Uint8Array(t),e)}var Jv=re(()=>{jh()});async function F2(t,e){let r={...qh.bson,...e==null?void 0:e.bson};return _h(t,r)}function P2(t,e){let r={...qh.bson,...e==null?void 0:e.bson};return _h(t,r)}var D2,qh,vh,Zv=re(()=>{Jv();D2="3.4.1",qh={bson:{}},vh={name:"BSON",id:"bson",module:"bson",version:D2,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:F2,parseSync:P2,options:qh}});function Th(t,e){return Gv(t).buffer}var Xv=re(()=>{jh()});var R2,Bh,Qv=re(()=>{Xv();R2="3.4.1",Bh={name:"BSON",id:"bson",module:"bson",version:R2,extensions:["bson"],options:{image:{mimeType:"application/bson"}},async encode(t,e){return Th(t,{})},encodeSync(t,e){return Th(t,{})}}});var $v=re(()=>{Zv();Qv()});function eT(t,e,r){if(!(t in Gf))throw new Error(`invalid type: ${t}`);return Gf[t].toPrimitive(e,r)}function tT(t,e,r){if(!(t in Gf))throw new Error(`invalid type: ${t}`);return"fromPrimitive"in Gf[t]?Gf[t].fromPrimitive?.(e,r):e}function H2(t){return Boolean(t)}function z2(t){return Boolean(t)}function M2(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for FLOAT: ${t}`);return e}function U2(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for DOUBLE: ${t}`);return e}function L2(t){let e=parseInt(t,10);if(e<-128||e>127||isNaN(e))throw new Error(`invalid value for INT8: ${t}`);return e}function C2(t){let e=parseInt(t,10);if(e<0||e>255||isNaN(e))throw new Error(`invalid value for UINT8: ${t}`);return e}function V2(t){let e=parseInt(t,10);if(e<-32768||e>32767||isNaN(e))throw new Error(`invalid value for INT16: ${t}`);return e}function W2(t){let e=parseInt(t,10);if(e<0||e>65535||isNaN(e))throw new Error(`invalid value for UINT16: ${t}`);return e}function rT(t){let e=parseInt(t,10);if(e<-2147483648||e>2147483647||isNaN(e))throw new Error(`invalid value for INT32: ${t}`);return e}function Y2(t,e){let r=t*10**(e.scale||0),n=Math.round(r*10**-e.presision%1*10**e.presision);if(n<-2147483648||n>2147483647||isNaN(n))throw new Error(`invalid value for INT32: ${t}`);return n}function K2(t){let e=parseInt(t,10);if(e<0||e>281474976710655||isNaN(e))throw new Error(`invalid value for UINT32: ${t}`);return e}function nT(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT64: ${t}`);return e}function G2(t,e){let r=t*10**(e.scale||0),n=Math.round(r*10**-e.presision%1*10**e.presision);if(isNaN(n))throw new Error(`invalid value for INT64: ${t}`);return n}function J2(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for UINT64: ${t}`);return e}function Z2(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT96: ${t}`);return e}function iT(t){return Buffer.from(t)}function oT(t){return Buffer.from(t)}function X2(t){return Buffer.from(t,"utf8")}function Q2(t){return t.toString()}function $2(t){return Buffer.from(JSON.stringify(t))}function eN(t){return JSON.parse(t)}function tN(t){let e=Bh.encodeSync?.(t);return Buffer.from(e)}function rN(t){return vh.parseSync?.(t)}function nN(t){let e=parseInt(t,10);if(e<0||e>18446744073709552e3||isNaN(e))throw new Error(`invalid value for TIME_MILLIS: ${t}`);return e}function iN(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIME_MICROS: ${t}`);return e}function oN(t){if(t instanceof Date)return t.getTime()/fT;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for DATE: ${t}`);return e}}function fN(t){return new Date(t*fT)}function sN(t){if(t instanceof Date)return t.getTime();{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MILLIS: ${t}`);return e}}function aN(t){return new Date(t)}function lN(t){if(t instanceof Date)return t.getTime()*1e3;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MICROS: ${t}`);return e}}function uN(t){return new Date(t/1e3)}function cN(t){if(!t.months||!t.days||!t.milliseconds)throw new Error("value for INTERVAL must be object { months: ..., days: ..., milliseconds: ... }");let e=Buffer.alloc(12);return e.writeUInt32LE(t.months,0),e.writeUInt32LE(t.days,4),e.writeUInt32LE(t.milliseconds,8),e}function pN(t){let e=Buffer.from(t),r=e.readUInt32LE(0),n=e.readUInt32LE(4),i=e.readUInt32LE(8);return{months:r,days:n,milliseconds:i}}function sT(t,e){return Math.round(t*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}function aT(t,e){let r=0;if(t.length<=4)for(let i=0;i<t.length;i++)r+=t[i]<<8*(t.length-i-1);else for(let i=0;i<t.length;i++)r+=t[i]*2**(8*(t.length-1-i));return Math.round(r*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}var Gf,fT,kh=re(()=>{$v();Gf={BOOLEAN:{primitiveType:"BOOLEAN",toPrimitive:H2,fromPrimitive:z2},INT32:{primitiveType:"INT32",toPrimitive:rT},INT64:{primitiveType:"INT64",toPrimitive:nT},INT96:{primitiveType:"INT96",toPrimitive:Z2},FLOAT:{primitiveType:"FLOAT",toPrimitive:M2},DOUBLE:{primitiveType:"DOUBLE",toPrimitive:U2},BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",toPrimitive:iT},FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",toPrimitive:iT},UTF8:{primitiveType:"BYTE_ARRAY",originalType:"UTF8",toPrimitive:X2,fromPrimitive:Q2},TIME_MILLIS:{primitiveType:"INT32",originalType:"TIME_MILLIS",toPrimitive:nN},TIME_MICROS:{primitiveType:"INT64",originalType:"TIME_MICROS",toPrimitive:iN},DATE:{primitiveType:"INT32",originalType:"DATE",toPrimitive:oN,fromPrimitive:fN},TIMESTAMP_MILLIS:{primitiveType:"INT64",originalType:"TIMESTAMP_MILLIS",toPrimitive:sN,fromPrimitive:aN},TIMESTAMP_MICROS:{primitiveType:"INT64",originalType:"TIMESTAMP_MICROS",toPrimitive:lN,fromPrimitive:uN},UINT_8:{primitiveType:"INT32",originalType:"UINT_8",toPrimitive:C2},UINT_16:{primitiveType:"INT32",originalType:"UINT_16",toPrimitive:W2},UINT_32:{primitiveType:"INT32",originalType:"UINT_32",toPrimitive:K2},UINT_64:{primitiveType:"INT64",originalType:"UINT_64",toPrimitive:J2},INT_8:{primitiveType:"INT32",originalType:"INT_8",toPrimitive:L2},INT_16:{primitiveType:"INT32",originalType:"INT_16",toPrimitive:V2},INT_32:{primitiveType:"INT32",originalType:"INT_32",toPrimitive:rT},INT_64:{primitiveType:"INT64",originalType:"INT_64",toPrimitive:nT},JSON:{primitiveType:"BYTE_ARRAY",originalType:"JSON",toPrimitive:$2,fromPrimitive:eN},BSON:{primitiveType:"BYTE_ARRAY",originalType:"BSON",toPrimitive:tN,fromPrimitive:rN},INTERVAL:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"INTERVAL",typeLength:12,toPrimitive:cN,fromPrimitive:pN},DECIMAL_INT32:{primitiveType:"INT32",originalType:"DECIMAL_INT32",toPrimitive:Y2,fromPrimitive:sT},DECIMAL_INT64:{primitiveType:"INT64",originalType:"DECIMAL_INT64",toPrimitive:G2,fromPrimitive:sT},DECIMAL_BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",originalType:"DECIMAL_BYTE_ARRAY",toPrimitive:oT,fromPrimitive:aT},DECIMAL_FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"DECIMAL_FIXED_LEN_BYTE_ARRAY",toPrimitive:oT,fromPrimitive:aT}};fT=864e5});function Ih(t){let e={};for(let r of t.fieldList)e[r.key]={dlevels:[],rlevels:[],values:[],pageHeaders:[],count:0};return{rowCount:0,columnData:e}}function kp(t,e,r){let n=Ih(t).columnData;if(Sh(t.fields,e,n,0,0),r.rowCount===0){r.rowCount=1,r.columnData=n;return}r.rowCount+=1;for(let i of t.fieldList)Array.prototype.push.apply(r.columnData[i.key].rlevels,n[i.key].rlevels),Array.prototype.push.apply(r.columnData[i.key].dlevels,n[i.key].dlevels),Array.prototype.push.apply(r.columnData[i.key].values,n[i.key].values),r.columnData[i.key].count+=n[i.key].count}function Sh(t,e,r,n,i){for(let o in t){let f=t[o],s=[];if(e&&f.name in e&&e[f.name]!==void 0&&e[f.name]!==null&&(e[f.name].constructor===Array?s=e[f.name]:s.push(e[f.name])),s.length===0&&Boolean(e)&&f.repetitionType==="REQUIRED")throw new Error(`missing required field: ${f.name}`);if(s.length>1&&f.repetitionType!=="REPEATED")throw new Error(`too many values for field: ${f.name}`);if(s.length===0){f.isNested?Sh(f.fields,null,r,n,i):(r[f.key].count+=1,r[f.key].rlevels.push(n),r[f.key].dlevels.push(i));continue}for(let l=0;l<s.length;l++){let u=l===0?n:f.rLevelMax;f.isNested?Sh(f.fields,s[l],r,u,f.dLevelMax):(r[f.key].count+=1,r[f.key].rlevels.push(u),r[f.key].dlevels.push(f.dLevelMax),r[f.key].values.push(eT(f.originalType||f.primitiveType,s[l])))}}}function Ip(t,e){let r=[];for(let n=0;n<e.rowCount;n++)r.push({});for(let n in e.columnData){let i=e.columnData[n];i.count&&dN(t,i,n,r)}return r}function dN(t,e,r,n){let i=t.findField(r),o=t.findFieldBranch(r),f=new Array(i.rLevelMax+1).fill(0),s=0;for(let l=0;l<e.count;l++){let u=e.dlevels[l],c=e.rlevels[l];f[c]++,f.fill(0,c+1);let _=0,p=n[f[_++]-1];for(let j of o){if(j===i||u<j.dLevelMax)break;switch(j.repetitionType){case"REPEATED":j.name in p||(p[j.name]=[]);let S=f[_++];for(;p[j.name].length<=S;)p[j.name].push({});p=p[j.name][S];break;default:p[j.name]=p[j.name]||{},p=p[j.name]}}if(u===i.dLevelMax){let j=tT(i.originalType||i.primitiveType,e.values[s],i);switch(s++,i.repetitionType){case"REPEATED":i.name in p||(p[i.name]=[]);let S=f[_];for(;p[i.name].length<=S;)p[i.name].push(null);p[i.name][S]=j;break;default:p[i.name]=j}}}}var Sp=re(()=>{kh()});function xh(t,e){for(let r in t){let n=t[r];n.fields?xh(n.fields,e):n.compression=e}}function lT(t,e,r,n){let i={};for(let o in t){let f=t[o],s=!f.optional,l=Boolean(f.repeated),u=e,c=r,_="REQUIRED";if(s||(_="OPTIONAL",c++),l&&(_="REPEATED",u++,s&&c++),f.fields){let S=n.concat([o]);i[o]={name:o,path:S,key:S.join(),repetitionType:_,rLevelMax:u,dLevelMax:c,isNested:!0,fieldCount:Object.keys(f.fields).length,fields:lT(f.fields,u,c,S)};continue}let p=Gf[f.type];if(!p)throw new Error(`invalid parquet type: ${f.type}`);if(f.encoding=f.encoding||"PLAIN",!(f.encoding in No))throw new Error(`unsupported parquet encoding: ${f.encoding}`);if(f.compression=f.compression||"UNCOMPRESSED",!(f.compression in Ul))throw new Error(`unsupported compression method: ${f.compression}`);let j=n.concat([o]);i[o]={name:o,primitiveType:p.primitiveType,originalType:p.originalType,path:j,key:j.join(),repetitionType:_,encoding:f.encoding,compression:f.compression,typeLength:f.typeLength||p.typeLength,presision:f.presision,scale:f.scale,rLevelMax:u,dLevelMax:c}}return i}function uT(t){let e=[];for(let r in t)e.push(t[r]),t[r].isNested&&(e=e.concat(uT(t[r].fields)));return e}var Wl,Eh=re(()=>{Nc();Ll();Sp();kh();Wl=class{constructor(e){this.schema=e,this.fields=lT(e,0,0,[]),this.fieldList=uT(this.fields)}findField(e){typeof e=="string"?e=e.split(","):e=e.slice(0);let r=this.fields;for(;e.length>1;e.shift())r=r[e[0]].fields;return r[e[0]]}findFieldBranch(e){typeof e=="string"&&(e=e.split(","));let r=[],n=this.fields;for(;e.length>0;e.shift())r.push(n[e[0]]),e.length>1&&(n=n[e[0]].fields);return r}shredRecord(e,r){kp(this,e,r)}materializeRecords(e){return Ip(this,e)}compress(e){return xh(this.schema,e),xh(this.fields,e),this}buffer(){return Ih(this)}}});var eo,cT=re(()=>{(function(l){l[l.BOOLEAN=0]="BOOLEAN",l[l.INT32=1]="INT32",l[l.INT64=2]="INT64",l[l.INT96=3]="INT96",l[l.FLOAT=4]="FLOAT",l[l.DOUBLE=5]="DOUBLE",l[l.BYTE_ARRAY=6]="BYTE_ARRAY",l[l.FIXED_LEN_BYTE_ARRAY=7]="FIXED_LEN_BYTE_ARRAY"})(eo||(eo={}))});var Zs,pT=re(()=>{(function(D){D[D.UTF8=0]="UTF8",D[D.MAP=1]="MAP",D[D.MAP_KEY_VALUE=2]="MAP_KEY_VALUE",D[D.LIST=3]="LIST",D[D.ENUM=4]="ENUM",D[D.DECIMAL=5]="DECIMAL",D[D.DATE=6]="DATE",D[D.TIME_MILLIS=7]="TIME_MILLIS",D[D.TIME_MICROS=8]="TIME_MICROS",D[D.TIMESTAMP_MILLIS=9]="TIMESTAMP_MILLIS",D[D.TIMESTAMP_MICROS=10]="TIMESTAMP_MICROS",D[D.UINT_8=11]="UINT_8",D[D.UINT_16=12]="UINT_16",D[D.UINT_32=13]="UINT_32",D[D.UINT_64=14]="UINT_64",D[D.INT_8=15]="INT_8",D[D.INT_16=16]="INT_16",D[D.INT_32=17]="INT_32",D[D.INT_64=18]="INT_64",D[D.JSON=19]="JSON",D[D.BSON=20]="BSON",D[D.INTERVAL=21]="INTERVAL"})(Zs||(Zs={}))});var Xs,dT=re(()=>{(function(n){n[n.REQUIRED=0]="REQUIRED",n[n.OPTIONAL=1]="OPTIONAL",n[n.REPEATED=2]="REPEATED"})(Xs||(Xs={}))});var Gr,mT=re(()=>{(function(l){l[l.PLAIN=0]="PLAIN",l[l.PLAIN_DICTIONARY=2]="PLAIN_DICTIONARY",l[l.RLE=3]="RLE",l[l.BIT_PACKED=4]="BIT_PACKED",l[l.DELTA_BINARY_PACKED=5]="DELTA_BINARY_PACKED",l[l.DELTA_LENGTH_BYTE_ARRAY=6]="DELTA_LENGTH_BYTE_ARRAY",l[l.DELTA_BYTE_ARRAY=7]="DELTA_BYTE_ARRAY",l[l.RLE_DICTIONARY=8]="RLE_DICTIONARY"})(Gr||(Gr={}))});var Qs,bT=re(()=>{(function(l){l[l.UNCOMPRESSED=0]="UNCOMPRESSED",l[l.SNAPPY=1]="SNAPPY",l[l.GZIP=2]="GZIP",l[l.LZO=3]="LZO",l[l.BROTLI=4]="BROTLI",l[l.LZ4=5]="LZ4",l[l.ZSTD=6]="ZSTD",l[l.LZ4_RAW=7]="LZ4_RAW"})(Qs||(Qs={}))});var Jf,hT=re(()=>{(function(i){i[i.DATA_PAGE=0]="DATA_PAGE",i[i.INDEX_PAGE=1]="INDEX_PAGE",i[i.DICTIONARY_PAGE=2]="DICTIONARY_PAGE",i[i.DATA_PAGE_V2=3]="DATA_PAGE_V2"})(Jf||(Jf={}))});var wT,gT=re(()=>{(function(n){n[n.UNORDERED=0]="UNORDERED",n[n.ASCENDING=1]="ASCENDING",n[n.DESCENDING=2]="DESCENDING"})(wT||(wT={}))});var zr=M((e5,jT)=>{var Ah=4294967296,yT=[];for($s=0;$s<256;$s++)yT[$s]=($s>15?"":"0")+$s.toString(16);var $s,Yl=jT.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):Object.prototype.toString.call(t)=="[object Uint8Array]"?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};Yl.MAX_INT=Math.pow(2,53);Yl.MIN_INT=-Math.pow(2,53);Yl.prototype={constructor:Yl,_2scomp:function(){for(var t=this.buffer,e=this.offset,r=1,n=e+7;n>=e;n--){var i=(t[n]^255)+r;t[n]=i&255,r=i>>8}},setValue:function(t,e){var r=!1;if(arguments.length==1)if(typeof t=="number"){if(r=t<0,t=Math.abs(t),e=t%Ah,t=t/Ah,t>Ah)throw new RangeError(t+" is outside Int64 range");t=t|0}else if(typeof t=="string")t=(t+"").replace(/^0x/,""),e=t.substr(-8),t=t.length>8?t.substr(0,t.length-8):"",t=parseInt(t,16),e=parseInt(e,16);else throw new Error(t+" must be a Number or String");for(var n=this.buffer,i=this.offset,o=7;o>=0;o--)n[i+o]=e&255,e=o==4?t:e>>>8;r&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,r=this.offset,n=e[r]&128,i=0,o=1,f=7,s=1;f>=0;f--,s*=256){var l=e[r+f];n&&(l=(l^255)+o,o=l>>8,l=l&255),i+=l*s}return!t&&i>=Yl.MAX_INT?n?-1/0:1/0:n?-i:i},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var e=new Array(8),r=this.buffer,n=this.offset,i=0;i<8;i++)e[i]=yT[r[n+i]];return e.join(t||"")},toBuffer:function(t){if(t&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((this.buffer[this.offset]&128)!=(t.buffer[t.offset]&128))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return this.compare(t)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var Vo=M((mi,Oh)=>{var xp=Ci("util"),Kl=mi.Type={STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,UTF7:11,STRUCT:12,MAP:13,SET:14,LIST:15,UTF8:16,UTF16:17};mi.MessageType={CALL:1,REPLY:2,EXCEPTION:3,ONEWAY:4};mi.TException=Ep;function Ep(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}xp.inherits(Ep,Error);var mN=mi.TApplicationExceptionType={UNKNOWN:0,UNKNOWN_METHOD:1,INVALID_MESSAGE_TYPE:2,WRONG_METHOD_NAME:3,BAD_SEQUENCE_ID:4,MISSING_RESULT:5,INTERNAL_ERROR:6,PROTOCOL_ERROR:7,INVALID_TRANSFORM:8,INVALID_PROTOCOL:9,UNSUPPORTED_CLIENT_TYPE:10};mi.TApplicationException=Ap;function Ap(t,e){Ep.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.type=t||mN.UNKNOWN,this.name=this.constructor.name,this.message=e}xp.inherits(Ap,Ep);Ap.prototype.read=function(t){for(var e,r=t.readStructBegin("TApplicationException");r=t.readFieldBegin(),r.ftype!=Kl.STOP;){switch(r.fid){case 1:r.ftype==Kl.STRING?(r=t.readString(),this.message=r):r=t.skip(r.ftype);break;case 2:r.ftype==Kl.I32?(r=t.readI32(),this.type=r):r=t.skip(r.ftype);break;default:r=t.skip(r.ftype);break}t.readFieldEnd()}t.readStructEnd()};Ap.prototype.write=function(t){t.writeStructBegin("TApplicationException"),this.message&&(t.writeFieldBegin("message",Kl.STRING,1),t.writeString(this.message),t.writeFieldEnd()),this.code&&(t.writeFieldBegin("type",Kl.I32,2),t.writeI32(this.code),t.writeFieldEnd()),t.writeFieldStop(),t.writeStructEnd()};var t5=mi.TProtocolExceptionType={UNKNOWN:0,INVALID_DATA:1,NEGATIVE_SIZE:2,SIZE_LIMIT:3,BAD_VERSION:4,NOT_IMPLEMENTED:5,DEPTH_LIMIT:6};mi.TProtocolException=_T;function _T(t,e){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.type=t,this.message=e}xp.inherits(_T,Error);mi.objectLength=function(t){return Object.keys(t).length};mi.inherits=function(t,e){xp.inherits(t,e)};var Op,Np;Op=function(t,e){if(!t)return t;var r;e.shift===void 0?r=e:r=e[0];var n=r,i=t.length,o=[],f,s;for(f=0;f<i;f++)s=t[f],r===null?o.push(s):r===Np||r===Op?o.push(r(s,e.slice(1))):o.push(new n(s));return o};Np=function(t,e){if(!t)return t;var r;e.shift===void 0?r=e:r=e[0];var n=r,i={},o;for(var f in t)t.hasOwnProperty(f)&&(o=t[f],r===null?i[f]=o:r===Np||r===Op?i[f]=r(o,e.slice(1)):i[f]=new n(o));return i};Oh.exports.copyMap=Np;Oh.exports.copyList=Op});var vT=M((r5,qT)=>{var ea=null;typeof WebSocket!="undefined"?ea=WebSocket:typeof MozWebSocket!="undefined"?ea=MozWebSocket:typeof global!="undefined"?ea=global.WebSocket||global.MozWebSocket:typeof window!="undefined"?ea=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(ea=self.WebSocket||self.MozWebSocket);qT.exports=ea});var Dh=M((n5,Nh)=>{"use strict";var ta=typeof Reflect=="object"?Reflect:null,TT=ta&&typeof ta.apply=="function"?ta.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Dp;ta&&typeof ta.ownKeys=="function"?Dp=ta.ownKeys:Object.getOwnPropertySymbols?Dp=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Dp=function(e){return Object.getOwnPropertyNames(e)};function bN(t){console&&console.warn&&console.warn(t)}var BT=Number.isNaN||function(e){return e!==e};function kt(){kt.init.call(this)}Nh.exports=kt;Nh.exports.once=yN;kt.EventEmitter=kt;kt.prototype._events=void 0;kt.prototype._eventsCount=0;kt.prototype._maxListeners=void 0;var kT=10;function Fp(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(kt,"defaultMaxListeners",{enumerable:!0,get:function(){return kT},set:function(t){if(typeof t!="number"||t<0||BT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");kT=t}});kt.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};kt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||BT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function IT(t){return t._maxListeners===void 0?kt.defaultMaxListeners:t._maxListeners}kt.prototype.getMaxListeners=function(){return IT(this)};kt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var f;if(r.length>0&&(f=r[0]),f instanceof Error)throw f;var s=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw s.context=f,s}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")TT(l,this,r);else for(var u=l.length,c=OT(l,u),n=0;n<u;++n)TT(c[n],this,r);return!0};function ST(t,e,r,n){var i,o,f;if(Fp(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),f=o[e]),f===void 0)f=o[e]=r,++t._eventsCount;else if(typeof f=="function"?f=o[e]=n?[r,f]:[f,r]:n?f.unshift(r):f.push(r),i=IT(t),i>0&&f.length>i&&!f.warned){f.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=f.length,bN(s)}return t}kt.prototype.addListener=function(e,r){return ST(this,e,r,!1)};kt.prototype.on=kt.prototype.addListener;kt.prototype.prependListener=function(e,r){return ST(this,e,r,!0)};function hN(){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 xT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=hN.bind(n);return i.listener=r,n.wrapFn=i,i}kt.prototype.once=function(e,r){return Fp(r),this.on(e,xT(this,e,r)),this};kt.prototype.prependOnceListener=function(e,r){return Fp(r),this.prependListener(e,xT(this,e,r)),this};kt.prototype.removeListener=function(e,r){var n,i,o,f,s;if(Fp(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,f=n.length-1;f>=0;f--)if(n[f]===r||n[f].listener===r){s=n[f].listener,o=f;break}if(o<0)return this;o===0?n.shift():wN(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};kt.prototype.off=kt.prototype.removeListener;kt.prototype.removeAllListeners=function(e){var r,n,i;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[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),f;for(i=0;i<o.length;++i)f=o[i],f!=="removeListener"&&this.removeAllListeners(f);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ET(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?gN(i):OT(i,i.length)}kt.prototype.listeners=function(e){return ET(this,e,!0)};kt.prototype.rawListeners=function(e){return ET(this,e,!1)};kt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):AT.call(t,e)};kt.prototype.listenerCount=AT;function AT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}kt.prototype.eventNames=function(){return this._eventsCount>0?Dp(this._events):[]};function OT(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function wN(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function gN(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function yN(t,e){return new Promise(function(r,n){function i(f){t.removeListener(e,o),n(f)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}NT(t,e,o,{once:!0}),e!=="error"&&jN(t,i,{once:!0})})}function jN(t,e,r){typeof t.on=="function"&&NT(t,"error",e,r)}function NT(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Pp=M(Wo=>{var Fh=Math.pow(2,8),_N=Math.pow(2,16),DT=Math.pow(2,24),FT=Math.pow(2,32),qN=Math.pow(2,40),vN=Math.pow(2,48),Ph=Math.pow(2,52),TN=Math.pow(2,1022);Wo.readByte=function(t){return t>127?t-256:t};Wo.readI16=function(t,e){e=e||0;var r=t[e+1];return r+=t[e]<<8,t[e]&128&&(r-=_N),r};Wo.readI32=function(t,e){e=e||0;var r=t[e+3];return r+=t[e+2]<<8,r+=t[e+1]<<16,r+=t[e]*DT,t[e]&128&&(r-=FT),r};Wo.writeI16=function(t,e){return t[1]=e&255,e>>=8,t[0]=e&255,t};Wo.writeI32=function(t,e){return t[3]=e&255,e>>=8,t[2]=e&255,e>>=8,t[1]=e&255,e>>=8,t[0]=e&255,t};Wo.readDouble=function(t,e){e=e||0;var r=t[e]&128,n=(t[e+1]&240)>>4;n+=(t[e]&127)<<4;var i=t[e+7];switch(i+=t[e+6]<<8,i+=t[e+5]<<16,i+=t[e+4]*DT,i+=t[e+3]*FT,i+=t[e+2]*qN,i+=(t[e+1]&15)*vN,n){case 0:n=-1022;break;case 2047:return i?NaN:r?-1/0:1/0;default:i+=Ph,n-=1023}return r&&(i*=-1),i*Math.pow(2,n-52)};Wo.writeDouble=function(t,e){var r,n,i;return t[0]=e<0?128:0,e=Math.abs(e),e!==e?(r=2251799813685248,n=2047):e===1/0?(r=0,n=2047):(n=Math.floor(Math.log(e)/Math.LN2),i=Math.pow(2,-n),e*i<1&&(n--,i*=2),n+1023>=2047?(r=0,n=2047):n+1023>=1?(r=(e*i-1)*Ph,n+=1023):(r=e*TN*Ph,n=0)),t[1]=n<<4&240,t[0]|=n>>4&127,t[7]=r&255,r=Math.floor(r/Fh),t[6]=r&255,r=Math.floor(r/Fh),t[5]=r&255,r=Math.floor(r/Fh),t[4]=r&255,r>>=8,t[3]=r&255,r>>=8,t[2]=r&255,r>>=8,t[1]|=r&15,t}});var Zf=M((o5,RT)=>{var BN=Ci("util");RT.exports=PT;function PT(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}BN.inherits(PT,Error)});var Hp=M(to=>{var kN=Ci("util"),ra=function(){},HT=console.log,Rp="error";function Gl(t){return function(){var e=["thrift: ["+t+"] "].concat(Array.from(arguments));return HT(kN.format.apply(null,e))}}var Rh=ra,Hh=ra,zh=ra,Mh=ra,Uh=ra;to.setLogFunc=function(t){HT=t};var IN=to.setLogLevel=function(t){switch(Rh=Hh=zh=Mh=Uh=ra,Rp=t,Rp){case"trace":Rh=Gl("TRACE");case"debug":Hh=Gl("DEBUG");case"error":zh=Gl("ERROR");case"warning":Mh=Gl("WARN");case"info":Uh=Gl("INFO")}};IN(Rp);to.getLogLevel=function(){return Rp};to.trace=function(){return Rh.apply(null,arguments)};to.debug=function(){return Hh.apply(null,arguments)};to.error=function(){return zh.apply(null,arguments)};to.warning=function(){return Mh.apply(null,arguments)};to.info=function(){return Uh.apply(null,arguments)}});var Vh=M((s5,zT)=>{var SN=Hp(),ro=zr(),Yt=Vo(),At=Yt.Type;zT.exports=ee;var Lh=Math.pow(2,8),xN=Math.pow(2,24),EN=Math.pow(2,32),AN=Math.pow(2,40),ON=Math.pow(2,48),Ch=Math.pow(2,52),NN=Math.pow(2,1022);function ee(t){this.trans=t,this.lastField_=[],this.lastFieldId_=0,this.string_limit_=0,this.string_buf_=null,this.string_buf_size_=0,this.container_limit_=0,this.booleanField_={name:null,hasBoolValue:!1},this.boolValue_={hasBoolValue:!1,boolValue:!1}}ee.PROTOCOL_ID=-126;ee.VERSION_N=1;ee.VERSION_MASK=31;ee.TYPE_MASK=-32;ee.TYPE_BITS=7;ee.TYPE_SHIFT_AMOUNT=5;ee.Types={CT_STOP:0,CT_BOOLEAN_TRUE:1,CT_BOOLEAN_FALSE:2,CT_BYTE:3,CT_I16:4,CT_I32:5,CT_I64:6,CT_DOUBLE:7,CT_BINARY:8,CT_LIST:9,CT_SET:10,CT_MAP:11,CT_STRUCT:12};ee.TTypeToCType=[ee.Types.CT_STOP,0,ee.Types.CT_BOOLEAN_TRUE,ee.Types.CT_BYTE,ee.Types.CT_DOUBLE,0,ee.Types.CT_I16,0,ee.Types.CT_I32,0,ee.Types.CT_I64,ee.Types.CT_BINARY,ee.Types.CT_STRUCT,ee.Types.CT_MAP,ee.Types.CT_SET,ee.Types.CT_LIST];ee.prototype.getTransport=function(){return this.trans};ee.prototype.getCompactType=function(t){return ee.TTypeToCType[t]};ee.prototype.getTType=function(t){switch(t){case At.STOP:return At.STOP;case ee.Types.CT_BOOLEAN_FALSE:case ee.Types.CT_BOOLEAN_TRUE:return At.BOOL;case ee.Types.CT_BYTE:return At.BYTE;case ee.Types.CT_I16:return At.I16;case ee.Types.CT_I32:return At.I32;case ee.Types.CT_I64:return At.I64;case ee.Types.CT_DOUBLE:return At.DOUBLE;case ee.Types.CT_BINARY:return At.STRING;case ee.Types.CT_LIST:return At.LIST;case ee.Types.CT_SET:return At.SET;case ee.Types.CT_MAP:return At.MAP;case ee.Types.CT_STRUCT:return At.STRUCT;default:throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Unknown type: "+t)}return At.STOP};ee.prototype.flush=function(){return this.trans.flush()};ee.prototype.writeMessageBegin=function(t,e,r){this.writeByte(ee.PROTOCOL_ID),this.writeByte(ee.VERSION_N&ee.VERSION_MASK|e<<ee.TYPE_SHIFT_AMOUNT&ee.TYPE_MASK),this.writeVarint32(r),this.writeString(t),this._seqid?SN.warning("SeqId already set",{name:t}):(this._seqid=r,this.trans.setCurrSeqId(r))};ee.prototype.writeMessageEnd=function(){};ee.prototype.writeStructBegin=function(t){this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0};ee.prototype.writeStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};ee.prototype.writeFieldBegin=function(t,e,r){if(e!=At.BOOL)return this.writeFieldBeginInternal(t,e,r,-1);this.booleanField_.name=t,this.booleanField_.fieldType=e,this.booleanField_.fieldId=r};ee.prototype.writeFieldEnd=function(){};ee.prototype.writeFieldStop=function(){this.writeByte(ee.Types.CT_STOP)};ee.prototype.writeMapBegin=function(t,e,r){r===0?this.writeByte(0):(this.writeVarint32(r),this.writeByte(this.getCompactType(t)<<4|this.getCompactType(e)))};ee.prototype.writeMapEnd=function(){};ee.prototype.writeListBegin=function(t,e){this.writeCollectionBegin(t,e)};ee.prototype.writeListEnd=function(){};ee.prototype.writeSetBegin=function(t,e){this.writeCollectionBegin(t,e)};ee.prototype.writeSetEnd=function(){};ee.prototype.writeBool=function(t){this.booleanField_.name!==null?(this.writeFieldBeginInternal(this.booleanField_.name,this.booleanField_.fieldType,this.booleanField_.fieldId,t?ee.Types.CT_BOOLEAN_TRUE:ee.Types.CT_BOOLEAN_FALSE),this.booleanField_.name=null):this.writeByte(t?ee.Types.CT_BOOLEAN_TRUE:ee.Types.CT_BOOLEAN_FALSE)};ee.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};ee.prototype.writeI16=function(t){this.writeVarint32(this.i32ToZigzag(t))};ee.prototype.writeI32=function(t){this.writeVarint32(this.i32ToZigzag(t))};ee.prototype.writeI64=function(t){this.writeVarint64(this.i64ToZigzag(t))};ee.prototype.writeDouble=function(t){var e=new Buffer(8),r,n,i;e[7]=t<0?128:0,t=Math.abs(t),t!==t?(r=2251799813685248,n=2047):t===1/0?(r=0,n=2047):(n=Math.floor(Math.log(t)/Math.LN2),i=Math.pow(2,-n),t*i<1&&(n--,i*=2),n+1023>=2047?(r=0,n=2047):n+1023>=1?(r=(t*i-1)*Ch,n+=1023):(r=t*NN*Ch,n=0)),e[6]=n<<4&240,e[7]|=n>>4&127,e[0]=r&255,r=Math.floor(r/Lh),e[1]=r&255,r=Math.floor(r/Lh),e[2]=r&255,r=Math.floor(r/Lh),e[3]=r&255,r>>=8,e[4]=r&255,r>>=8,e[5]=r&255,r>>=8,e[6]|=r&15,this.trans.write(e)};ee.prototype.writeStringOrBinary=function(t,e,r){if(typeof r=="string")this.writeVarint32(Buffer.byteLength(r,e)),this.trans.write(new Buffer(r,e));else if(r instanceof Buffer||Object.prototype.toString.call(r)=="[object Uint8Array]")this.writeVarint32(r.length),this.trans.write(r);else throw new Error(t+" called without a string/Buffer argument: "+r)};ee.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};ee.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};ee.prototype.writeFieldBeginInternal=function(t,e,r,n){var i=n==-1?this.getCompactType(e):n;r>this.lastFieldId_&&r-this.lastFieldId_<=15?this.writeByte(r-this.lastFieldId_<<4|i):(this.writeByte(i),this.writeI16(r)),this.lastFieldId_=r};ee.prototype.writeCollectionBegin=function(t,e){e<=14?this.writeByte(e<<4|this.getCompactType(t)):(this.writeByte(240|this.getCompactType(t)),this.writeVarint32(e))};ee.prototype.writeVarint32=function(t){for(var e=new Buffer(5),r=0;;)if((t&~127)==0){e[r++]=t;break}else e[r++]=t&127|128,t=t>>>7;var n=new Buffer(r);e.copy(n,0,0,r),this.trans.write(n)};ee.prototype.writeVarint64=function(t){if(typeof t=="number"&&(t=new ro(t)),!(t instanceof ro))throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);for(var e=new Buffer(10),r=0,n=t.buffer.readUInt32BE(0,!0),i=t.buffer.readUInt32BE(4,!0),o=0;;)if((i&~127)==0&&n===0){e[r++]=i;break}else e[r++]=i&127|128,o=n<<25,i=i>>>7,n=n>>>7,i=i|o;var f=new Buffer(r);e.copy(f,0,0,r),this.trans.write(f)};ee.prototype.i64ToZigzag=function(t){if(typeof t=="string"?t=new ro(parseInt(t,10)):typeof t=="number"&&(t=new ro(t)),!(t instanceof ro))throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);var e=t.buffer.readUInt32BE(0,!0),r=t.buffer.readUInt32BE(4,!0),n=e>>>31;return e=(e<<1|r>>>31)^(n?4294967295:0),r=r<<1^(n?4294967295:0),new ro(e,r)};ee.prototype.i32ToZigzag=function(t){return t<<1^(t&2147483648?4294967295:0)};ee.prototype.readMessageBegin=function(){var t=this.trans.readByte();if(t!=ee.PROTOCOL_ID)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.BAD_VERSION,"Bad protocol identifier "+t);var e=this.trans.readByte(),r=e&ee.VERSION_MASK;if(r!=ee.VERSION_N)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.BAD_VERSION,"Bad protocol version "+r);var n=e>>ee.TYPE_SHIFT_AMOUNT&ee.TYPE_BITS,i=this.readVarint32(),o=this.readString();return{fname:o,mtype:n,rseqid:i}};ee.prototype.readMessageEnd=function(){};ee.prototype.readStructBegin=function(){return this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0,{fname:""}};ee.prototype.readStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};ee.prototype.readFieldBegin=function(){var t=0,e=this.trans.readByte(e),r=e&15;if(r==ee.Types.CT_STOP)return{fname:null,ftype:Yt.Type.STOP,fid:0};var n=(e&240)>>>4;n===0?t=this.readI16():t=this.lastFieldId_+n;var i=this.getTType(r);return(r==ee.Types.CT_BOOLEAN_TRUE||r==ee.Types.CT_BOOLEAN_FALSE)&&(this.boolValue_.hasBoolValue=!0,this.boolValue_.boolValue=r==ee.Types.CT_BOOLEAN_TRUE),this.lastFieldId_=t,{fname:null,ftype:i,fid:t}};ee.prototype.readFieldEnd=function(){};ee.prototype.readMapBegin=function(){var t=this.readVarint32();if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative map size");var e=0;t!==0&&(e=this.trans.readByte());var r=this.getTType((e&240)>>>4),n=this.getTType(e&15);return{ktype:r,vtype:n,size:t}};ee.prototype.readMapEnd=function(){};ee.prototype.readListBegin=function(){var t=this.trans.readByte(),e=t>>>4&15;if(e==15&&(e=this.readVarint32()),e<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative list size");var r=this.getTType(t&15);return{etype:r,size:e}};ee.prototype.readListEnd=function(){};ee.prototype.readSetBegin=function(){return this.readListBegin()};ee.prototype.readSetEnd=function(){};ee.prototype.readBool=function(){var t=!1,e=0;if(this.boolValue_.hasBoolValue===!0)t=this.boolValue_.boolValue,this.boolValue_.hasBoolValue=!1;else{var r=this.trans.readByte();e=r.rsize,t=r.value==ee.Types.CT_BOOLEAN_TRUE}return t};ee.prototype.readByte=function(){return this.trans.readByte()};ee.prototype.readI16=function(){return this.readI32()};ee.prototype.readI32=function(){return this.zigzagToI32(this.readVarint32())};ee.prototype.readI64=function(){return this.zigzagToI64(this.readVarint64())};ee.prototype.readDouble=function(){var t=this.trans.read(8),e=0,r=t[e+7]&128,n=(t[e+6]&240)>>4;n+=(t[e+7]&127)<<4;var i=t[e];switch(i+=t[e+1]<<8,i+=t[e+2]<<16,i+=t[e+3]*xN,i+=t[e+4]*EN,i+=t[e+5]*AN,i+=(t[e+6]&15)*ON,n){case 0:n=-1022;break;case 2047:return i?NaN:r?-1/0:1/0;default:i+=Ch,n-=1023}return r&&(i*=-1),i*Math.pow(2,n-52)};ee.prototype.readBinary=function(){var t=this.readVarint32();if(t===0)return new Buffer(0);if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};ee.prototype.readString=function(){var t=this.readVarint32();if(t===0)return"";if(t<0)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};ee.prototype.readVarint32=function(){return this.readVarint64().toNumber()};ee.prototype.readVarint64=function(){for(var t=0,e=0,r=0,n=0;;){var i=this.trans.readByte();if(t++,n<=25?e=e|(i&127)<<n:25<n&&n<32?(e=e|(i&127)<<n,r=r|(i&127)>>>32-n):r=r|(i&127)<<n-32,n+=7,!(i&128))break;if(t>=10)throw new Yt.TProtocolException(Yt.TProtocolExceptionType.INVALID_DATA,"Variable-length int over 10 bytes.")}return new ro(r,e)};ee.prototype.zigzagToI32=function(t){return t>>>1^-1*(t&1)};ee.prototype.zigzagToI64=function(t){var e=t.buffer.readUInt32BE(0,!0),r=t.buffer.readUInt32BE(4,!0),n=new ro(e&0,r&1);n._2scomp();var i=n.buffer.readUInt32BE(0,!0),o=n.buffer.readUInt32BE(4,!0),f=e<<31;return e=e>>>1^i,r=(r>>>1|f)^o,new ro(e,r)};ee.prototype.skip=function(t){switch(t){case At.BOOL:this.readBool();break;case At.BYTE:this.readByte();break;case At.I16:this.readI16();break;case At.I32:this.readI32();break;case At.I64:this.readI64();break;case At.DOUBLE:this.readDouble();break;case At.STRING:this.readString();break;case At.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===At.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case At.MAP:for(var r=this.readMapBegin(),n=0;n<r.size;++n)this.skip(r.ktype),this.skip(r.vtype);this.readMapEnd();break;case At.SET:for(var i=this.readSetBegin(),o=0;o<i.size;++o)this.skip(i.etype);this.readSetEnd();break;case At.LIST:for(var f=this.readListBegin(),s=0;s<f.size;++s)this.skip(f.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Kh=M((a5,VT)=>{var MT=Hp(),Wh=Pp(),UT=zr(),no=Vo(),Jr=no.Type;VT.exports=Pe;var LT=-65536,Yh=-2147418112,CT=255;Pe.VERSION_MASK=LT;Pe.VERSION_1=Yh;Pe.TYPE_MASK=CT;function Pe(t,e,r){this.trans=t,this.strictRead=e!==void 0?e:!1,this.strictWrite=r!==void 0?r:!0,this._seqid=null}Pe.prototype.flush=function(){return this.trans.flush()};Pe.prototype.writeMessageBegin=function(t,e,r){this.strictWrite?(this.writeI32(Yh|e),this.writeString(t),this.writeI32(r)):(this.writeString(t),this.writeByte(e),this.writeI32(r)),this._seqid!==null?MT.warning("SeqId already set",{name:t}):(this._seqid=r,this.trans.setCurrSeqId(r))};Pe.prototype.writeMessageEnd=function(){this._seqid!==null?this._seqid=null:MT.warning("No seqid to unset")};Pe.prototype.writeStructBegin=function(t){};Pe.prototype.writeStructEnd=function(){};Pe.prototype.writeFieldBegin=function(t,e,r){this.writeByte(e),this.writeI16(r)};Pe.prototype.writeFieldEnd=function(){};Pe.prototype.writeFieldStop=function(){this.writeByte(Jr.STOP)};Pe.prototype.writeMapBegin=function(t,e,r){this.writeByte(t),this.writeByte(e),this.writeI32(r)};Pe.prototype.writeMapEnd=function(){};Pe.prototype.writeListBegin=function(t,e){this.writeByte(t),this.writeI32(e)};Pe.prototype.writeListEnd=function(){};Pe.prototype.writeSetBegin=function(t,e){this.writeByte(t),this.writeI32(e)};Pe.prototype.writeSetEnd=function(){};Pe.prototype.writeBool=function(t){t?this.writeByte(1):this.writeByte(0)};Pe.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};Pe.prototype.writeI16=function(t){this.trans.write(Wh.writeI16(new Buffer(2),t))};Pe.prototype.writeI32=function(t){this.trans.write(Wh.writeI32(new Buffer(4),t))};Pe.prototype.writeI64=function(t){t.buffer?this.trans.write(t.buffer):this.trans.write(new UT(t).buffer)};Pe.prototype.writeDouble=function(t){this.trans.write(Wh.writeDouble(new Buffer(8),t))};Pe.prototype.writeStringOrBinary=function(t,e,r){if(typeof r=="string")this.writeI32(Buffer.byteLength(r,e)),this.trans.write(new Buffer(r,e));else if(r instanceof Buffer||Object.prototype.toString.call(r)=="[object Uint8Array]")this.writeI32(r.length),this.trans.write(r);else throw new Error(t+" called without a string/Buffer argument: "+r)};Pe.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};Pe.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};Pe.prototype.readMessageBegin=function(){var t=this.readI32(),e,r,n;if(t<0){var i=t&LT;if(i!=Yh)throw new no.TProtocolException(no.TProtocolExceptionType.BAD_VERSION,"Bad version in readMessageBegin: "+t);e=t&CT,r=this.readString(),n=this.readI32()}else{if(this.strictRead)throw new no.TProtocolException(no.TProtocolExceptionType.BAD_VERSION,"No protocol version header");r=this.trans.read(t),e=this.readByte(),n=this.readI32()}return{fname:r,mtype:e,rseqid:n}};Pe.prototype.readMessageEnd=function(){};Pe.prototype.readStructBegin=function(){return{fname:""}};Pe.prototype.readStructEnd=function(){};Pe.prototype.readFieldBegin=function(){var t=this.readByte();if(t==Jr.STOP)return{fname:null,ftype:t,fid:0};var e=this.readI16();return{fname:null,ftype:t,fid:e}};Pe.prototype.readFieldEnd=function(){};Pe.prototype.readMapBegin=function(){var t=this.readByte(),e=this.readByte(),r=this.readI32();return{ktype:t,vtype:e,size:r}};Pe.prototype.readMapEnd=function(){};Pe.prototype.readListBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};Pe.prototype.readListEnd=function(){};Pe.prototype.readSetBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};Pe.prototype.readSetEnd=function(){};Pe.prototype.readBool=function(){var t=this.readByte();return t!==0};Pe.prototype.readByte=function(){return this.trans.readByte()};Pe.prototype.readI16=function(){return this.trans.readI16()};Pe.prototype.readI32=function(){return this.trans.readI32()};Pe.prototype.readI64=function(){var t=this.trans.read(8);return new UT(t)};Pe.prototype.readDouble=function(){return this.trans.readDouble()};Pe.prototype.readBinary=function(){var t=this.readI32();if(t===0)return new Buffer(0);if(t<0)throw new no.TProtocolException(no.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};Pe.prototype.readString=function(){var t=this.readI32();if(t===0)return"";if(t<0)throw new no.TProtocolException(no.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};Pe.prototype.getTransport=function(){return this.trans};Pe.prototype.skip=function(t){switch(t){case Jr.BOOL:this.readBool();break;case Jr.BYTE:this.readByte();break;case Jr.I16:this.readI16();break;case Jr.I32:this.readI32();break;case Jr.I64:this.readI64();break;case Jr.DOUBLE:this.readDouble();break;case Jr.STRING:this.readString();break;case Jr.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===Jr.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case Jr.MAP:for(var r=this.readMapBegin(),n=0;n<r.size;++n)this.skip(r.ktype),this.skip(r.vtype);this.readMapEnd();break;case Jr.SET:for(var i=this.readSetBegin(),o=0;o<i.size;++o)this.skip(i.etype);this.readSetEnd();break;case Jr.LIST:for(var f=this.readListBegin(),s=0;s<f.size;++s)this.skip(f.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Gh=M((l5,ZT)=>{var DN=Ci("util"),zp=Vh(),WT=Kh(),FN=Zf();function Jl(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}DN.inherits(Jl,Error);ZT.exports=nr;var PN=0,RN=1,HN=0,zN=32/8,MN=48/8,UN=64/8,LN=96/8,YT=112/8,KT=4095,GT=1,CN=1073741823;function io(t){var e=Zl();this.outputBuffer=null;var r=this;this.transport=new e(null,function(n){r.outputBuffer=n}),this.transport.inBuf=t||Buffer.alloc(0),this.transport.writeCursor=this.transport.inBuf.length,this.protocol=new zp(this.transport)}io.prototype.readVarint32=function(){return this.protocol.readVarint32()};io.prototype.writeVarint32=function(t){this.protocol.writeVarint32(t)};io.prototype.readString=function(){return this.protocol.readString()};io.prototype.writeString=function(t){this.protocol.writeString(t)};io.prototype.getOutCount=function(){return this.transport.outCount};io.prototype.write=function(t){this.transport.write(t)};io.prototype.toBuffer=function(){return this.transport.flush(),this.outputBuffer};nr.SubprotocolId={BINARY:0,JSON:1,COMPACT:2};function nr(){this.maxFrameSize=CN,this.protocolId=nr.SubprotocolId.BINARY,this.rheaders={},this.wheaders={},this.inBuf=Buffer.alloc(0),this.outCount=0,this.flags=null,this.seqid=0,this.shouldWriteHeaders=!0}var JT=function(t,e){if(typeof t!="string"||typeof e!="string")throw new Jl("Header key and values must be strings")},VN=function(t){for(var e=Object.keys(nr.SubprotocolId),r=0;r<e.length;r++)if(t===nr.SubprotocolId[e[r]])return!0;throw new Error(t+" is not a valid protocol id")};nr.prototype.setSeqId=function(t){this.seqid=t};nr.prototype.getSeqId=function(t){return this.seqid};nr.prototype.setFlags=function(t){this.flags=t};nr.prototype.getReadHeaders=function(){return this.rheaders};nr.prototype.setReadHeader=function(t,e){JT(t,e),this.rheaders[t]=e};nr.prototype.clearReadHeaders=function(){this.rheaders={}};nr.prototype.getWriteHeaders=function(){return this.wheaders};nr.prototype.setWriteHeader=function(t,e){JT(t,e),this.wheaders[t]=e};nr.prototype.clearWriteHeaders=function(){this.wheaders={}};nr.prototype.setMaxFrameSize=function(t){this.maxFrameSize=t};nr.prototype.setProtocolId=function(t){VN(t),this.protocolId=t};nr.prototype.getProtocolId=function(){return this.protocolId};var WN=function(t){var e=t.readInt32BE();return(e&WT.VERSION_MASK)===WT.VERSION_1},YN=function(t){var e=t.readInt8(PN),r=t.readInt8(RN);return e===zp.PROTOCOL_ID&&(r&zp.VERSION_MASK)===zp.VERSION_N};nr.prototype.readHeaders=function(){var t=this.inBuf,e=!1;if(WN(t)&&(this.setProtocolId(nr.SubprotocolId.BINARY),e=!0),YN(t)&&(this.setProtocolId(nr.SubprotocolId.COMPACT),e=!0),e){this.shouldWriteHeaders=!1;return}var r=t.readInt32BE(HN);if(r>this.maxFrameSize)throw new Jl("Frame exceeds maximum frame size");var n=t.readInt16BE(zN);if(this.shouldWriteHeaders=n===KT,!!this.shouldWriteHeaders){this.setFlags(t.readInt16BE(MN)),this.setSeqId(t.readInt32BE(UN));var i=t.readInt16BE(LN)*4,o=YT+i;if(o>t.length)throw new Jl("Header size is greater than frame size");var f=Buffer.alloc(i);t.copy(f,0,YT,o);var s=new io(f);this.setProtocolId(s.readVarint32());var l=s.readVarint32();if(l>0)throw new Jl("Transforms are not yet supported");for(;;)try{var u=s.readVarint32();if(u!==GT)break;for(var c=s.readVarint32(),_=0;_<c;_++){var p=s.readString(),j=s.readString();this.setReadHeader(p,j)}}catch(S){if(S instanceof FN)break;throw S}return this.read(o),this.getReadHeaders()}};nr.prototype.writeHeaders=function(){if(!!this.shouldWriteHeaders){var t=this.getWriteHeaders(),e=new io;e.writeVarint32(this.protocolId),e.writeVarint32(0);var r=Object.keys(t);if(r.length>0){e.writeVarint32(GT),e.writeVarint32(r.length);for(var n=0;n<r.length;n++){var i=r[n],o=t[i];e.writeString(i),e.writeString(o)}}var f=e.getOutCount(),s=(4-f%4)%4,l=Buffer.alloc(2);l.writeInt16BE(Math.floor((f+s)/4));var u=Buffer.alloc(s);u.fill(0),e.write(u);var c=e.toBuffer(),_=Buffer.alloc(4);_.writeInt32BE(10+this.outCount+c.length);var p=Buffer.alloc(2);p.writeInt16BE(KT);var j=Buffer.alloc(2);j.writeInt16BE(0);var S=Buffer.alloc(4);S.writeInt32BE(this.getSeqId());var T=Buffer.concat([_,p,j,S,l,c]);this.outBuffers.unshift(T),this.outCount+=T.length}}});var Zl=M((u5,XT)=>{var Mp=Pp(),KN=Zf(),GN=Gh();XT.exports=Kt;function Kt(t,e){this.defaultReadBufferSize=1024,this.writeBufferSize=512,this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0,this.onFlush=e}Kt.prototype=new GN;Kt.prototype.reset=function(){this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0};Kt.receiver=function(t,e){var r=new Kt;return function(n){if(r.writeCursor+n.length>r.inBuf.length){var i=new Buffer(r.writeCursor+n.length);r.inBuf.copy(i,0,0,r.writeCursor),r.inBuf=i}n.copy(r.inBuf,r.writeCursor,0),r.writeCursor+=n.length,t(r,e)}};Kt.prototype.commitPosition=function(){var t=this.writeCursor-this.readCursor,e=t*2>this.defaultReadBufferSize?t*2:this.defaultReadBufferSize,r=new Buffer(e);t>0&&this.inBuf.copy(r,0,this.readCursor,this.writeCursor),this.readCursor=0,this.writeCursor=t,this.inBuf=r};Kt.prototype.rollbackPosition=function(){this.readCursor=0};Kt.prototype.isOpen=function(){return!0};Kt.prototype.open=function(){};Kt.prototype.close=function(){};Kt.prototype.setCurrSeqId=function(t){this._seqid=t};Kt.prototype.ensureAvailable=function(t){if(this.readCursor+t>this.writeCursor)throw new KN};Kt.prototype.read=function(t){this.ensureAvailable(t);var e=new Buffer(t);return this.inBuf.copy(e,0,this.readCursor,this.readCursor+t),this.readCursor+=t,e};Kt.prototype.readByte=function(){return this.ensureAvailable(1),Mp.readByte(this.inBuf[this.readCursor++])};Kt.prototype.readI16=function(){this.ensureAvailable(2);var t=Mp.readI16(this.inBuf,this.readCursor);return this.readCursor+=2,t};Kt.prototype.readI32=function(){this.ensureAvailable(4);var t=Mp.readI32(this.inBuf,this.readCursor);return this.readCursor+=4,t};Kt.prototype.readDouble=function(){this.ensureAvailable(8);var t=Mp.readDouble(this.inBuf,this.readCursor);return this.readCursor+=8,t};Kt.prototype.readString=function(t){this.ensureAvailable(t);var e=this.inBuf.toString("utf8",this.readCursor,this.readCursor+t);return this.readCursor+=t,e};Kt.prototype.borrow=function(){var t={buf:this.inBuf,readIndex:this.readCursor,writeIndex:this.writeCursor};return t};Kt.prototype.consume=function(t){this.readCursor+=t};Kt.prototype.write=function(t){typeof t=="string"&&(t=new Buffer(t,"utf8")),this.outBuffers.push(t),this.outCount+=t.length};Kt.prototype.flush=function(){var t=this._seqid;if(this._seqid=null,!(this.outCount<1)){var e=new Buffer(this.outCount),r=0;this.outBuffers.forEach(function(n){n.copy(e,r,0),r+=n.length}),this.onFlush&&this.onFlush(e,t),this.outBuffers=[],this.outCount=0}}});var Zh=M((c5,rB)=>{var QT=zr(),$T=rB.exports={},JN=Math.pow(2,24),eB=Math.pow(2,31),Jh=Math.pow(2,32),tB=Math.pow(10,11);$T.toDecimalString=function(t){var e=t.buffer,r=t.offset;if(!e[r]&&!(e[r+1]&224)||!~e[r]&&!~(e[r+1]&224))return t.toString();var n=e[r]&128;if(n){for(var i=!1,o=new Buffer(8),f=7;f>=0;--f)o[f]=~e[r+f]+(i?0:1)&255,i|=e[r+f];e=o}var s=e[r+1]+(e[r]<<8),l=e[r+7]+(e[r+6]<<8)+(e[r+5]<<16)+e[r+4]*JN+(e[r+3]+(e[r+2]<<8))*Jh+s*74976710656,u=Math.floor(l/tB)+s*2814;return l=("00000000000"+String(l%tB)).slice(-11),(n?"-":"")+String(u)+l};$T.fromDecimalString=function(t){var e=t.charAt(0)==="-";if(t.length<(e?17:16))return new QT(+t);if(t.length>(e?20:19))throw new RangeError("Too many digits for Int64: "+t);var r=+t.slice(e?1:0,-15),n=+t.slice(-15)+r*2764472320,i=Math.floor(n/Jh)+r*232830;if(n=n%Jh,i>=eB&&!(e&&i==eB&&n==0))throw new RangeError("The magnitude is too large for Int64.");return e&&(i=~i,n===0?i=i+1&4294967295:n=~n+1,i=2147483648|i),new QT(i,n)}});var oB=M((m5,iB)=>{var nB=zr(),p5=Zh(),d5=iB.exports=function(){"use strict";var t,e,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
13
13
  `,r:"\r",t:" "},n,i=function(j){throw new SyntaxError(j)},o=function(j){return j&&j!==e&&i("Expected '"+j+"' instead of '"+e+"'"),e=n.charAt(t),t+=1,e},f=function(){var j,S="";for(e==="-"&&(S="-",o("-"));e>="0"&&e<="9";)S+=e,o();if(e===".")for(S+=".";o()&&e>="0"&&e<="9";)S+=e;if(e==="e"||e==="E")for(S+=e,o(),(e==="-"||e==="+")&&(S+=e,o());e>="0"&&e<="9";)S+=e,o();if(j=+S,!isFinite(j))i("Bad number");else return j>=nB.MAX_INT||j<=nB.MIN_INT?S:j},s=function(){var j,S,T="",U;if(e==='"')for(;o();){if(e==='"')return o(),T;if(e==="\\")if(o(),e==="u"){for(U=0,S=0;S<4&&(j=parseInt(o(),16),!!isFinite(j));S+=1)U=U*16+j;T+=String.fromCharCode(U)}else if(typeof r[e]=="string")T+=r[e];else break;else T+=e}i("Bad string")},l=function(){for(;e&&e<=" ";)o()},u=function(){switch(e){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}i("Unexpected '"+e+"'")},c,_=function(){var j=[];if(e==="["){if(o("["),l(),e==="]")return o("]"),j;for(;e;){if(j.push(c()),l(),e==="]")return o("]"),j;o(","),l()}}i("Bad array")},p=function(){var j,S={};if(e==="{"){if(o("{"),l(),e==="}")return o("}"),S;for(;e;){if(j=s(),l(),o(":"),Object.hasOwnProperty.call(S,j)&&i('Duplicate key "'+j+'"'),S[j]=c(),l(),e==="}")return o("}"),S;o(","),l()}}i("Bad object")};return c=function(){switch(l(),e){case"{":return p();case"[":return _();case'"':return s();case"-":return f();default:return e>="0"&&e<="9"?f():u()}},function(j){var S;return n=j,t=0,e=" ",S=c(),l(),e&&i("Syntax error"),S}}()});var Xl=M((h5,aB)=>{var Xh=zr(),ZN=Vo(),pt=ZN.Type,b5=Ci("util"),fB=Zh(),XN=oB(),sB=Zf();aB.exports=be;function be(t){this.tstack=[],this.tpos=[],this.trans=t}be.Type={};be.Type[pt.BOOL]='"tf"';be.Type[pt.BYTE]='"i8"';be.Type[pt.I16]='"i16"';be.Type[pt.I32]='"i32"';be.Type[pt.I64]='"i64"';be.Type[pt.DOUBLE]='"dbl"';be.Type[pt.STRUCT]='"rec"';be.Type[pt.STRING]='"str"';be.Type[pt.MAP]='"map"';be.Type[pt.LIST]='"lst"';be.Type[pt.SET]='"set"';be.RType={};be.RType.tf=pt.BOOL;be.RType.i8=pt.BYTE;be.RType.i16=pt.I16;be.RType.i32=pt.I32;be.RType.i64=pt.I64;be.RType.dbl=pt.DOUBLE;be.RType.rec=pt.STRUCT;be.RType.str=pt.STRING;be.RType.map=pt.MAP;be.RType.lst=pt.LIST;be.RType.set=pt.SET;be.Version=1;be.prototype.flush=function(){return this.writeToTransportIfStackIsFlushable(),this.trans.flush()};be.prototype.writeToTransportIfStackIsFlushable=function(){this.tstack.length===1&&this.trans.write(this.tstack.pop())};be.prototype.writeMessageBegin=function(t,e,r){this.tstack.push([be.Version,'"'+t+'"',e,r])};be.prototype.writeMessageEnd=function(){var t=this.tstack.pop();this.wobj=this.tstack.pop(),this.wobj.push(t),this.wbuf="["+this.wobj.join(",")+"]",this.trans.write(this.wbuf)};be.prototype.writeStructBegin=function(t){this.tpos.push(this.tstack.length),this.tstack.push({})};be.prototype.writeStructEnd=function(){var t=this.tpos.pop(),e=this.tstack[t],r="{",n=!0;for(var i in e)n?n=!1:r+=",",r+=i+":"+e[i];r+="}",this.tstack[t]=r,this.writeToTransportIfStackIsFlushable()};be.prototype.writeFieldBegin=function(t,e,r){this.tpos.push(this.tstack.length),this.tstack.push({fieldId:'"'+r+'"',fieldType:be.Type[e]})};be.prototype.writeFieldEnd=function(){var t=this.tstack.pop(),e=this.tstack.pop();":"+t==":[object Object]"?this.tstack[this.tstack.length-1][e.fieldId]="{"+e.fieldType+":"+JSON.stringify(t)+"}":this.tstack[this.tstack.length-1][e.fieldId]="{"+e.fieldType+":"+t+"}",this.tpos.pop(),this.writeToTransportIfStackIsFlushable()};be.prototype.writeFieldStop=function(){};be.prototype.writeMapBegin=function(t,e,r){this.tpos.push(this.tstack.length),this.tstack.push([be.Type[t],be.Type[e],0])};be.prototype.writeMapEnd=function(){var t=this.tpos.pop();if(t!=this.tstack.length){(this.tstack.length-t-1)%2!=0&&this.tstack.push("");var e=(this.tstack.length-t-1)/2;this.tstack[t][this.tstack[t].length-1]=e;for(var r="}",n=!0;this.tstack.length>t+1;){var i=this.tstack.pop(),o=this.tstack.pop();n?n=!1:r=","+r,isNaN(o)||(o='"'+o+'"'),r=o+":"+i+r}r="{"+r,this.tstack[t].push(r),this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()}};be.prototype.writeListBegin=function(t,e){this.tpos.push(this.tstack.length),this.tstack.push([be.Type[t],e])};be.prototype.writeListEnd=function(){for(var t=this.tpos.pop();this.tstack.length>t+1;){var e=this.tstack[t+1];this.tstack.splice(t+1,1),this.tstack[t].push(e)}this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()};be.prototype.writeSetBegin=function(t,e){this.tpos.push(this.tstack.length),this.tstack.push([be.Type[t],e])};be.prototype.writeSetEnd=function(){for(var t=this.tpos.pop();this.tstack.length>t+1;){var e=this.tstack[t+1];this.tstack.splice(t+1,1),this.tstack[t].push(e)}this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()};be.prototype.writeBool=function(t){this.tstack.push(t?1:0)};be.prototype.writeByte=function(t){this.tstack.push(t)};be.prototype.writeI16=function(t){this.tstack.push(t)};be.prototype.writeI32=function(t){this.tstack.push(t)};be.prototype.writeI64=function(t){t instanceof Xh?this.tstack.push(fB.toDecimalString(t)):this.tstack.push(t)};be.prototype.writeDouble=function(t){this.tstack.push(t)};be.prototype.writeString=function(t){if(t===null)this.tstack.push(null);else{if(typeof t=="string")var e=t;else if(t instanceof Buffer)var e=t.toString("utf8");else throw new Error("writeString called without a string/Buffer argument: "+t);for(var r="",n=0;n<e.length;n++){var i=e.charAt(n);i==='"'?r+='\\"':i==="\\"?r+="\\\\":i==="\b"?r+="\\b":i==="\f"?r+="\\f":i===`
14
14
  `?r+="\\n":i==="\r"?r+="\\r":i===" "?r+="\\t":r+=i}this.tstack.push('"'+r+'"')}};be.prototype.writeBinary=function(t){if(typeof t=="string")var e=new Buffer(t,"binary");else if(t instanceof Buffer||Object.prototype.toString.call(t)=="[object Uint8Array]")var e=t;else throw new Error("writeBinary called without a string/Buffer argument: "+t);this.tstack.push('"'+e.toString("base64")+'"')};be.prototype.readMessageBegin=function(){this.rstack=[],this.rpos=[];var t=this.trans.borrow();if(t.readIndex>=t.writeIndex)throw new sB;var e=t.readIndex;if(t.buf[e]!==91)throw new Error("Malformed JSON input, no opening bracket");e++;for(var r=1,n=!1;e<t.writeIndex;e++){var i=t.buf[e];if(n)i===34?n=!1:i===92&&(e+=1);else if(i===91)r+=1;else if(i===93){if(r-=1,r===0)break}else i===34&&(n=!0)}if(r!==0)throw new sB;this.robj=XN(t.buf.slice(t.readIndex,e+1).toString()),this.trans.consume(e+1-t.readIndex);var o=this.robj.shift();if(o!=be.Version)throw new Error("Wrong thrift protocol version: "+o);var f={};return f.fname=this.robj.shift(),f.mtype=this.robj.shift(),f.rseqid=this.robj.shift(),this.rstack.push(this.robj.shift()),f};be.prototype.readMessageEnd=function(){};be.prototype.readStructBegin=function(){var t={};return t.fname="",this.rstack[this.rstack.length-1]instanceof Array&&this.rstack.push(this.rstack[this.rstack.length-1].shift()),t};be.prototype.readStructEnd=function(){this.rstack.pop()};be.prototype.readFieldBegin=function(){var t={},e=-1,r=pt.STOP;for(var n in this.rstack[this.rstack.length-1])if(n!==null){e=parseInt(n,10),this.rpos.push(this.rstack.length);var i=this.rstack[this.rstack.length-1][e];delete this.rstack[this.rstack.length-1][e],this.rstack.push(i);break}if(e!=-1)for(var o in this.rstack[this.rstack.length-1])be.RType[o]!==null&&(r=be.RType[o],this.rstack[this.rstack.length-1]=this.rstack[this.rstack.length-1][o]);return t.fname="",t.ftype=r,t.fid=e,t};be.prototype.readFieldEnd=function(){for(var t=this.rpos.pop();this.rstack.length>t;)this.rstack.pop()};be.prototype.readMapBegin=function(){var t=this.rstack.pop(),e=t.shift();e instanceof Array&&(this.rstack.push(t),t=e,e=t.shift());var r={};return r.ktype=be.RType[e],r.vtype=be.RType[t.shift()],r.size=t.shift(),this.rpos.push(this.rstack.length),this.rstack.push(t.shift()),r};be.prototype.readMapEnd=function(){this.readFieldEnd()};be.prototype.readListBegin=function(){var t=this.rstack[this.rstack.length-1],e={};return e.etype=be.RType[t.shift()],e.size=t.shift(),this.rpos.push(this.rstack.length),this.rstack.push(t.shift()),e};be.prototype.readListEnd=function(){var t=this.rpos.pop()-2,e=this.rstack;e.pop(),e instanceof Array&&e.length>t&&e[t].length>0&&e.push(e[t].shift())};be.prototype.readSetBegin=function(){return this.readListBegin()};be.prototype.readSetEnd=function(){return this.readListEnd()};be.prototype.readBool=function(){return this.readValue()=="1"};be.prototype.readByte=function(){return this.readI32()};be.prototype.readI16=function(){return this.readI32()};be.prototype.readI32=function(t){return+this.readValue()};be.prototype.readValue=function(t){t===void 0&&(t=this.rstack[this.rstack.length-1]);var e={};if(t instanceof Array)t.length===0?e.value=void 0:e.value=t.shift();else if(!(t instanceof Xh)&&t instanceof Object){for(var r in t)if(r!==null){this.rstack.push(t[r]),delete t[r],e.value=r;break}}else e.value=t,this.rstack.pop();return e.value};be.prototype.readI64=function(){var t=this.readValue();return typeof t=="string"?fB.fromDecimalString(t):new Xh(t)};be.prototype.readDouble=function(){return this.readI32()};be.prototype.readBinary=function(){return new Buffer(this.readValue(),"base64")};be.prototype.readString=function(){return this.readValue()};be.prototype.getTransport=function(){return this.trans};be.prototype.skip=function(t){switch(t){case pt.BOOL:this.readBool();break;case pt.BYTE:this.readByte();break;case pt.I16:this.readI16();break;case pt.I32:this.readI32();break;case pt.I64:this.readI64();break;case pt.DOUBLE:this.readDouble();break;case pt.STRING:this.readString();break;case pt.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===pt.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case pt.MAP:for(var r=this.readMapBegin(),n=0;n<r.size;++n)this.skip(r.ktype),this.skip(r.vtype);this.readMapEnd();break;case pt.SET:for(var i=this.readSetBegin(),o=0;o<i.size;++o)this.skip(i.etype);this.readSetEnd();break;case pt.LIST:for(var f=this.readListBegin(),s=0;s<f.size;++s)this.skip(f.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Qh=M((w5,lB)=>{lB.exports=QN;function QN(t,e){t.Client&&(t=t.Client);var r=function(o,f){e.write(o,f)},n=new e.transport(void 0,r),i=new t(n,e.protocol);return n.client=i,e.client=i,i}});var uB=M(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var $N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eD=typeof window!="undefined"&&typeof window.document!="undefined",tD=(typeof self=="undefined"?"undefined":$N(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",rD=typeof process!="undefined"&&process.versions!=null&&process.versions.node!=null,nD=function(){return typeof window!="undefined"&&window.name==="nodejs"||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")};na.isBrowser=eD;na.isWebWorker=tD;na.isNode=rD;na.isJsDom=nD});var mB=M(Up=>{var iD=Ci("util"),cB=vT(),pB=Dh().EventEmitter,dB=Vo(),oD=Zl(),fD=Xl(),sD=Zf(),aD=Qh(),lD=uB();Up.WSConnection=Mr;function Mr(t,e,r){pB.call(this),this.options=r||{},this.host=t,this.port=e,this.secure=this.options.secure||!1,this.transport=this.options.transport||oD,this.protocol=this.options.protocol||fD,this.path=this.options.path,this.send_pending=[],this.seqId2Service={},this.wsOptions={host:this.host,port:this.port||80,path:this.options.path||"/",headers:this.options.headers||{}};for(var n in this.options.wsOptions)this.wsOptions[n]=this.options.wsOptions[n]}iD.inherits(Mr,pB);Mr.prototype.__reset=function(){this.socket=null,this.send_pending=[]};Mr.prototype.__onOpen=function(){this.emit("open"),this.send_pending.length>0&&(this.send_pending.forEach(function(t){this.socket.send(t)},this),this.send_pending=[])};Mr.prototype.__onClose=function(t){this.emit("close"),this.__reset()};Mr.prototype.__decodeCallback=function(t){var e=new this.protocol(t);try{for(;;){var r=e.readMessageBegin(),n=r.rseqid*-1,i=this.client,o=this.seqId2Service[r.rseqid];o&&(i=this.client[o],delete this.seqId2Service[r.rseqid]),i._reqs[n]=function(f,s){t.commitPosition();var l=i._reqs[r.rseqid];delete i._reqs[r.rseqid],l&&l(f,s)},i["recv_"+r.fname]?i["recv_"+r.fname](e,r.mtype,n):(delete i._reqs[n],this.emit("error",new dB.TApplicationException(dB.TApplicationExceptionType.WRONG_METHOD_NAME,"Received a response to an unknown RPC function")))}}catch(f){if(f instanceof sD)t.rollbackPosition();else throw f}};Mr.prototype.__onData=function(t){Object.prototype.toString.call(t)==="[object ArrayBuffer]"&&(t=new Uint8Array(t));var e=new Buffer(t);this.transport.receiver(this.__decodeCallback.bind(this))(e)};Mr.prototype.__onMessage=function(t){this.__onData(t.data)};Mr.prototype.__onError=function(t){this.emit("error",t),this.socket.close()};Mr.prototype.isOpen=function(){return this.socket&&this.socket.readyState===this.socket.OPEN};Mr.prototype.open=function(){this.socket&&this.socket.readyState!==this.socket.CLOSED||(lD.isBrowser?this.socket=new cB(this.uri()):this.socket=new cB(this.uri(),"",this.wsOptions),this.socket.binaryType="arraybuffer",this.socket.onopen=this.__onOpen.bind(this),this.socket.onmessage=this.__onMessage.bind(this),this.socket.onerror=this.__onError.bind(this),this.socket.onclose=this.__onClose.bind(this))};Mr.prototype.close=function(){this.socket.close()};Mr.prototype.uri=function(){var t=this.secure?"wss":"ws",e="",r=this.path||"/",n=this.host;return this.port&&(t==="wss"&&this.port!==443||t==="ws"&&this.port!==80)&&(e=":"+this.port),t+"://"+n+e+r};Mr.prototype.write=function(t){this.isOpen()?this.socket.send(t):this.send_pending.push(t)};Up.createWSConnection=function(t,e,r){return new Mr(t,e,r)};Up.createWSClient=aD});var hB=M(Lp=>{var uD=Ci("util"),cD=Dh().EventEmitter,bB=Vo(),pD=Zl(),dD=Xl(),mD=Zf(),bD=Qh();Lp.XHRConnection=Zr;function Zr(t,e,r){this.options=r||{},this.wpos=0,this.rpos=0,this.useCORS=r&&r.useCORS,this.send_buf="",this.recv_buf="",this.transport=r.transport||pD,this.protocol=r.protocol||dD,this.headers=r.headers||{},t=t||window.location.host,e=e||window.location.port;var n=r.https?"https://":"http://",i=r.path||"/";e===""&&(e=void 0),!e||e===80||e==="80"?this.url=n+t+i:this.url=n+t+":"+e+i,this.seqId2Service={}}uD.inherits(Zr,cD);Zr.prototype.getXmlHttpRequestObject=function(){try{return new XMLHttpRequest}catch{}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch{}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}throw"Your browser doesn't support XHR."};Zr.prototype.flush=function(){var t=this;if(this.url===void 0||this.url==="")return this.send_buf;var e=this.getXmlHttpRequestObject();e.overrideMimeType&&e.overrideMimeType("application/json"),e.onreadystatechange=function(){this.readyState==4&&this.status==200&&t.setRecvBuffer(this.responseText)},e.open("POST",this.url,!0),Object.keys(this.headers).forEach(function(r){e.setRequestHeader(r,t.headers[r])}),e.send(this.send_buf)};Zr.prototype.setRecvBuffer=function(t){if(this.recv_buf=t,this.recv_buf_sz=this.recv_buf.length,this.wpos=this.recv_buf.length,this.rpos=0,Object.prototype.toString.call(t)=="[object ArrayBuffer]")var e=new Uint8Array(t);var r=new Buffer(e||t);this.transport.receiver(this.__decodeCallback.bind(this))(r)};Zr.prototype.__decodeCallback=function(t){var e=new this.protocol(t);try{for(;;){var r=e.readMessageBegin(),n=r.rseqid*-1,i=this.client,o=this.seqId2Service[r.rseqid];o&&(i=this.client[o],delete this.seqId2Service[r.rseqid]),i._reqs[n]=function(f,s){t.commitPosition();var l=i._reqs[r.rseqid];delete i._reqs[r.rseqid],l&&l(f,s)},i["recv_"+r.fname]?i["recv_"+r.fname](e,r.mtype,n):(delete i._reqs[n],this.emit("error",new bB.TApplicationException(bB.TApplicationExceptionType.WRONG_METHOD_NAME,"Received a response to an unknown RPC function")))}}catch(f){if(f instanceof mD)t.rollbackPosition();else throw f}};Zr.prototype.isOpen=function(){return!0};Zr.prototype.open=function(){};Zr.prototype.close=function(){};Zr.prototype.read=function(t){var e=this.wpos-this.rpos;if(e===0)return"";var r=t;e<t&&(r=e);var n=this.read_buf.substr(this.rpos,r);return this.rpos+=r,n};Zr.prototype.readAll=function(){return this.recv_buf};Zr.prototype.write=function(t){this.send_buf=t,this.flush()};Zr.prototype.getSendBuffer=function(){return this.send_buf};Lp.createXHRConnection=function(t,e,r){return new Zr(t,e,r)};Lp.createXHRClient=bD});var gB=M((wB,$h)=>{(function(t){"use strict";if(typeof bootstrap=="function")bootstrap("promise",t);else if(typeof wB=="object"&&typeof $h=="object")$h.exports=t();else if(typeof define=="function"&&define.amd)define(t);else if(typeof ses!="undefined")if(ses.ok())ses.makeQ=t;else return;else if(typeof window!="undefined"||typeof self!="undefined"){var e=typeof window!="undefined"?window:self,r=e.Q;e.Q=t(),e.Q.noConflict=function(){return e.Q=r,this}}else throw new Error("This environment was not anticipated by Q. Please file a bug.")})(function(){"use strict";var t=!1;try{throw new Error}catch(v){t=!!v.stack}var e=de(),r,n=function(){},i=function(){var v={task:void 0,next:null},I=v,P=!1,ie=void 0,De=!1,$e=[];function Re(){for(var Et,tr;v.next;)v=v.next,Et=v.task,v.task=void 0,tr=v.domain,tr&&(v.domain=void 0,tr.enter()),St(Et,tr);for(;$e.length;)Et=$e.pop(),St(Et);P=!1}function St(Et,tr){try{Et()}catch(xo){if(De)throw tr&&tr.exit(),setTimeout(Re,0),tr&&tr.enter(),xo;setTimeout(function(){throw xo},0)}tr&&tr.exit()}if(i=function(Et){I=I.next={task:Et,domain:De&&process.domain,next:null},P||(P=!0,ie())},typeof process=="object"&&process.toString()==="[object process]"&&process.nextTick)De=!0,ie=function(){process.nextTick(Re)};else if(typeof setImmediate=="function")typeof window!="undefined"?ie=setImmediate.bind(window,Re):ie=function(){setImmediate(Re)};else if(typeof MessageChannel!="undefined"){var yt=new MessageChannel;yt.port1.onmessage=function(){ie=xt,yt.port1.onmessage=Re,Re()};var xt=function(){yt.port2.postMessage(0)};ie=function(){setTimeout(Re,0),xt()}}else ie=function(){setTimeout(Re,0)};return i.runAfter=function(Et){$e.push(Et),P||(P=!0,ie())},i}(),o=Function.call;function f(v){return function(){return o.apply(v,arguments)}}var s=f(Array.prototype.slice),l=f(Array.prototype.reduce||function(v,I){var P=0,ie=this.length;if(arguments.length===1)do{if(P in this){I=this[P++];break}if(++P>=ie)throw new TypeError}while(1);for(;P<ie;P++)P in this&&(I=v(I,this[P],P));return I}),u=f(Array.prototype.indexOf||function(v){for(var I=0;I<this.length;I++)if(this[I]===v)return I;return-1}),c=f(Array.prototype.map||function(v,I){var P=this,ie=[];return l(P,function(De,$e,Re){ie.push(v.call(I,$e,Re,P))},void 0),ie}),_=Object.create||function(v){function I(){}return I.prototype=v,new I},p=Object.defineProperty||function(v,I,P){return v[I]=P.value,v},j=f(Object.prototype.hasOwnProperty),S=Object.keys||function(v){var I=[];for(var P in v)j(v,P)&&I.push(P);return I},T=f(Object.prototype.toString);function U(v){return v===Object(v)}function W(v){return T(v)==="[object StopIteration]"||v instanceof L}var L;typeof ReturnValue!="undefined"?L=ReturnValue:L=function(v){this.value=v};var te="From previous event:";function pe(v,I){if(t&&I.stack&&typeof v=="object"&&v!==null&&v.stack){for(var P=[],ie=I;ie;ie=ie.source)ie.stack&&(!v.__minimumStackCounter__||v.__minimumStackCounter__>ie.stackCounter)&&(p(v,"__minimumStackCounter__",{value:ie.stackCounter,configurable:!0}),P.unshift(ie.stack));P.unshift(v.stack);var De=P.join(`
15
15
  `+te+`