@loaders.gl/bson 4.4.0-alpha.2 → 4.4.0-alpha.9
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/bson-format.js +1 -0
- package/dist/bson-format.js.map +1 -0
- package/dist/bson-loader.js +2 -1
- package/dist/bson-loader.js.map +1 -0
- package/dist/bson-writer.js +2 -1
- package/dist/bson-writer.js.map +1 -0
- package/dist/dist.dev.js +28 -4
- package/dist/dist.min.js +7 -7
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/encoders/encode-bson.d.ts.map +1 -1
- package/dist/lib/encoders/encode-bson.js +3 -1
- package/dist/lib/encoders/encode-bson.js.map +1 -0
- package/dist/lib/parsers/parse-bson.js +1 -0
- package/dist/lib/parsers/parse-bson.js.map +1 -0
- package/package.json +5 -5
- package/src/lib/encoders/encode-bson.ts +2 -1
package/dist/bson-format.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bson-format.js","sourceRoot":"","sources":["../src/bson-format.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,kBAAkB,CAAC;IAC/B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,IAAI;CACa,CAAC"}
|
package/dist/bson-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseBSONSync } from "./lib/parsers/parse-bson.js";
|
|
|
5
5
|
import { BSONFormat } from "./bson-format.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.9" !== 'undefined' ? "4.4.0-alpha.9" : 'latest';
|
|
9
9
|
export const BSONLoader = {
|
|
10
10
|
...BSONFormat,
|
|
11
11
|
dataType: null,
|
|
@@ -32,3 +32,4 @@ function parseSync(arrayBuffer, options) {
|
|
|
32
32
|
const bsonOptions = { ...BSONLoader.options.bson, ...options?.bson };
|
|
33
33
|
return parseBSONSync(arrayBuffer, bsonOptions);
|
|
34
34
|
}
|
|
35
|
+
//# sourceMappingURL=bson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bson-loader.js","sourceRoot":"","sources":["../src/bson-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,aAAa,EAAC,oCAAiC;AACvD,OAAO,EAAC,UAAU,EAAC,yBAAsB;AAEzC,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAU5E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,UAAU;IACb,QAAQ,EAAE,IAA0C;IACpD,SAAS,EAAE,IAAa;IACxB,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,kBAAkB,CAAC;IAC/B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,IAAI;IACZ,KAAK;IACL,SAAS;IACT,OAAO,EAAE;QACP,IAAI,EAAE,EAAE;KACT;CACqF,CAAC;AAEzF,KAAK,UAAU,KAAK,CAAC,WAAwB,EAAE,OAA2B;IACxE,MAAM,WAAW,GAAG,EAAC,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,OAAO,EAAE,IAAI,EAAC,CAAC;IACnE,OAAO,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,SAAS,CAAC,WAAwB,EAAE,OAA2B;IACtE,MAAM,WAAW,GAAG,EAAC,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,OAAO,EAAE,IAAI,EAAC,CAAC;IACnE,OAAO,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/bson-writer.js
CHANGED
|
@@ -5,7 +5,7 @@ import { encodeBSONSync } from "./lib/encoders/encode-bson.js";
|
|
|
5
5
|
import { BSONFormat } from "./bson-format.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.9" !== 'undefined' ? "4.4.0-alpha.9" : 'latest';
|
|
9
9
|
export const BSONWriter = {
|
|
10
10
|
...BSONFormat,
|
|
11
11
|
name: 'BSON',
|
|
@@ -23,3 +23,4 @@ export const BSONWriter = {
|
|
|
23
23
|
return encodeBSONSync(data, {}); // options
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
+
//# sourceMappingURL=bson-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bson-writer.js","sourceRoot":"","sources":["../src/bson-writer.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,cAAc,EAAC,sCAAmC;AAC1D,OAAO,EAAC,UAAU,EAAC,yBAAsB;AAEzC,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAM5E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,UAAU;IACb,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,OAAO,EAAE;QACP,IAAI,EAAE,EAAE;KACT;IACD,KAAK,CAAC,MAAM,CAAC,IAA6B,EAAE,OAAuB;QACjE,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU;IAC7C,CAAC;IACD,UAAU,CAAC,IAA6B,EAAE,OAAuB;QAC/D,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU;IAC7C,CAAC;CACsF,CAAC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -437,7 +437,7 @@ var __exports__ = (() => {
|
|
|
437
437
|
}
|
|
438
438
|
return Buffer2.alloc(+length);
|
|
439
439
|
}
|
|
440
|
-
Buffer2.isBuffer = function
|
|
440
|
+
Buffer2.isBuffer = function isBuffer3(b) {
|
|
441
441
|
return b != null && b._isBuffer === true && b !== Buffer2.prototype;
|
|
442
442
|
};
|
|
443
443
|
Buffer2.compare = function compare(a, b) {
|
|
@@ -2412,10 +2412,10 @@ var __exports__ = (() => {
|
|
|
2412
2412
|
return typeof commonjsGlobal !== "undefined" && typeof commonjsGlobal.Buffer !== "undefined";
|
|
2413
2413
|
}
|
|
2414
2414
|
exports.haveBuffer = haveBuffer;
|
|
2415
|
-
function
|
|
2415
|
+
function isBuffer3(value) {
|
|
2416
2416
|
return haveBuffer() && buffer.Buffer.isBuffer(value);
|
|
2417
2417
|
}
|
|
2418
|
-
exports.isBuffer =
|
|
2418
|
+
exports.isBuffer = isBuffer3;
|
|
2419
2419
|
function isDate2(d) {
|
|
2420
2420
|
return isObjectLike(d) && Object.prototype.toString.call(d) === "[object Date]";
|
|
2421
2421
|
}
|
|
@@ -6175,10 +6175,34 @@ var __exports__ = (() => {
|
|
|
6175
6175
|
return parseBSONSync(arrayBuffer, bsonOptions);
|
|
6176
6176
|
}
|
|
6177
6177
|
|
|
6178
|
+
// ../loader-utils/src/lib/javascript-utils/is-type.ts
|
|
6179
|
+
var isSharedArrayBuffer = (value) => typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer;
|
|
6180
|
+
|
|
6181
|
+
// ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
|
|
6182
|
+
function ensureArrayBuffer(bufferSource) {
|
|
6183
|
+
if (bufferSource instanceof ArrayBuffer) {
|
|
6184
|
+
return bufferSource;
|
|
6185
|
+
}
|
|
6186
|
+
if (isSharedArrayBuffer(bufferSource)) {
|
|
6187
|
+
return copyToArrayBuffer(bufferSource);
|
|
6188
|
+
}
|
|
6189
|
+
const { buffer: buffer2, byteOffset, byteLength: byteLength2 } = bufferSource;
|
|
6190
|
+
if (buffer2 instanceof ArrayBuffer && byteOffset === 0 && byteLength2 === buffer2.byteLength) {
|
|
6191
|
+
return buffer2;
|
|
6192
|
+
}
|
|
6193
|
+
return copyToArrayBuffer(buffer2, byteOffset, byteLength2);
|
|
6194
|
+
}
|
|
6195
|
+
function copyToArrayBuffer(buffer2, byteOffset = 0, byteLength2 = buffer2.byteLength - byteOffset) {
|
|
6196
|
+
const view = new Uint8Array(buffer2, byteOffset, byteLength2);
|
|
6197
|
+
const copy = new Uint8Array(view.length);
|
|
6198
|
+
copy.set(view);
|
|
6199
|
+
return copy.buffer;
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6178
6202
|
// src/lib/encoders/encode-bson.ts
|
|
6179
6203
|
function encodeBSONSync(value, options) {
|
|
6180
6204
|
const uint8Array = bson_5(value);
|
|
6181
|
-
return uint8Array
|
|
6205
|
+
return ensureArrayBuffer(uint8Array);
|
|
6182
6206
|
}
|
|
6183
6207
|
|
|
6184
6208
|
// src/bson-writer.ts
|
package/dist/dist.min.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Pe=Object.create;var zt=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var Le=(B,e)=>()=>(e||B((e={exports:{}}).exports,e),e.exports),Ce=(B,e)=>{for(var y in e)zt(B,y,{get:e[y],enumerable:!0})},Ct=(B,e,y,D)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ye(e))!Fe.call(B,l)&&l!==y&&zt(B,l,{get:()=>e[l],enumerable:!(D=je(e,l))||D.enumerable});return B},Jt=(B,e,y)=>(Ct(B,e,"default"),y&&Ct(y,e,"default")),ze=(B,e,y)=>(y=B!=null?Pe(ve(B)):{},Ct(e||!B||!B.__esModule?zt(y,"default",{value:B,enumerable:!0}):y,B)),Je=B=>Ct(zt({},"__esModule",{value:!0}),B);var Ae=Le((mr,Se)=>{Se.exports=globalThis.loaders});var vt={};Ce(vt,{BSONLoader:()=>ee,BSONWriter:()=>Me});Jt(vt,ze(Ae(),1));var Ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function st(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function ot(B,e){return e={exports:{}},B(e,e.exports),e.exports}var We=He,Xe=Ve,ke=Qe,gt=[],yt=[],Ke=typeof Uint8Array<"u"?Uint8Array:Array,ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tt=0,Ee=ne.length;Tt<Ee;++Tt)gt[Tt]=ne[Tt],yt[ne.charCodeAt(Tt)]=Tt;var Tt,Ee;yt["-".charCodeAt(0)]=62;yt["_".charCodeAt(0)]=63;function me(B){var e=B.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=B.indexOf("=");y===-1&&(y=e);var D=y===e?0:4-y%4;return[y,D]}function He(B){var e=me(B),y=e[0],D=e[1];return(y+D)*3/4-D}function Ge(B,e,y){return(e+y)*3/4-y}function Ve(B){var e,y=me(B),D=y[0],l=y[1],f=new Ke(Ge(B,D,l)),u=0,E=l>0?D-4:D,o;for(o=0;o<E;o+=4)e=yt[B.charCodeAt(o)]<<18|yt[B.charCodeAt(o+1)]<<12|yt[B.charCodeAt(o+2)]<<6|yt[B.charCodeAt(o+3)],f[u++]=e>>16&255,f[u++]=e>>8&255,f[u++]=e&255;return l===2&&(e=yt[B.charCodeAt(o)]<<2|yt[B.charCodeAt(o+1)]>>4,f[u++]=e&255),l===1&&(e=yt[B.charCodeAt(o)]<<10|yt[B.charCodeAt(o+1)]<<4|yt[B.charCodeAt(o+2)]>>2,f[u++]=e>>8&255,f[u++]=e&255),f}function Ze(B){return gt[B>>18&63]+gt[B>>12&63]+gt[B>>6&63]+gt[B&63]}function qe(B,e,y){for(var D,l=[],f=e;f<y;f+=3)D=(B[f]<<16&16711680)+(B[f+1]<<8&65280)+(B[f+2]&255),l.push(Ze(D));return l.join("")}function Qe(B){for(var e,y=B.length,D=y%3,l=[],f=16383,u=0,E=y-D;u<E;u+=f)l.push(qe(B,u,u+f>E?E:u+f));return D===1?(e=B[y-1],l.push(gt[e>>2]+gt[e<<4&63]+"==")):D===2&&(e=(B[y-2]<<8)+B[y-1],l.push(gt[e>>10]+gt[e>>4&63]+gt[e<<2&63]+"=")),l.join("")}var ie={byteLength:We,toByteArray:Xe,fromByteArray:ke},xe=function(e,y,D,l,f){var u,E,o=f*8-l-1,c=(1<<o)-1,h=c>>1,p=-7,n=D?f-1:0,w=D?-1:1,U=e[y+n];for(n+=w,u=U&(1<<-p)-1,U>>=-p,p+=o;p>0;u=u*256+e[y+n],n+=w,p-=8);for(E=u&(1<<-p)-1,u>>=-p,p+=l;p>0;E=E*256+e[y+n],n+=w,p-=8);if(u===0)u=1-h;else{if(u===c)return E?NaN:(U?-1:1)*(1/0);E=E+Math.pow(2,l),u=u-h}return(U?-1:1)*E*Math.pow(2,u-l)},$e=function(e,y,D,l,f,u){var E,o,c,h=u*8-f-1,p=(1<<h)-1,n=p>>1,w=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,U=l?0:u-1,N=l?1:-1,Y=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===1/0?(o=isNaN(y)?1:0,E=p):(E=Math.floor(Math.log(y)/Math.LN2),y*(c=Math.pow(2,-E))<1&&(E--,c*=2),E+n>=1?y+=w/c:y+=w*Math.pow(2,1-n),y*c>=2&&(E++,c/=2),E+n>=p?(o=0,E=p):E+n>=1?(o=(y*c-1)*Math.pow(2,f),E=E+n):(o=y*Math.pow(2,n-1)*Math.pow(2,f),E=0));f>=8;e[D+U]=o&255,U+=N,o/=256,f-=8);for(E=E<<f|o,h+=f;h>0;e[D+U]=E&255,U+=N,E/=256,h-=8);e[D+U-N]|=Y*128},Dt={read:xe,write:$e},C=ot(function(B,e){var y=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=Y,e.INSPECT_MAX_BYTES=50;var D=2147483647;e.kMaxLength=D,u.TYPED_ARRAY_SUPPORT=l(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{var a=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(a,t),a.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function f(a){if(a>D)throw new RangeError('The value "'+a+'" is invalid for option "size"');var t=new Uint8Array(a);return Object.setPrototypeOf(t,u.prototype),t}function u(a,t,r){if(typeof a=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(a)}return E(a,t,r)}u.poolSize=8192;function E(a,t,r){if(typeof a=="string")return p(a,t);if(ArrayBuffer.isView(a))return n(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(Q(a,ArrayBuffer)||a&&Q(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(a,SharedArrayBuffer)||a&&Q(a.buffer,SharedArrayBuffer)))return w(a,t,r);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _=a.valueOf&&a.valueOf();if(_!=null&&_!==a)return u.from(_,t,r);var S=U(a);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return u.from(a[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}u.from=function(a,t,r){return E(a,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function o(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function c(a,t,r){return o(a),a<=0?f(a):t!==void 0?typeof r=="string"?f(a).fill(t,r):f(a).fill(t):f(a)}u.alloc=function(a,t,r){return c(a,t,r)};function h(a){return o(a),f(a<0?0:N(a)|0)}u.allocUnsafe=function(a){return h(a)},u.allocUnsafeSlow=function(a){return h(a)};function p(a,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=J(a,t)|0,_=f(r),S=_.write(a,t);return S!==r&&(_=_.slice(0,S)),_}function n(a){for(var t=a.length<0?0:N(a.length)|0,r=f(t),_=0;_<t;_+=1)r[_]=a[_]&255;return r}function w(a,t,r){if(t<0||a.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var _;return t===void 0&&r===void 0?_=new Uint8Array(a):r===void 0?_=new Uint8Array(a,t):_=new Uint8Array(a,t,r),Object.setPrototypeOf(_,u.prototype),_}function U(a){if(u.isBuffer(a)){var t=N(a.length)|0,r=f(t);return r.length===0||a.copy(r,0,0,t),r}if(a.length!==void 0)return typeof a.length!="number"||ut(a.length)?f(0):n(a);if(a.type==="Buffer"&&Array.isArray(a.data))return n(a.data)}function N(a){if(a>=D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");return a|0}function Y(a){return+a!=a&&(a=0),u.alloc(+a)}u.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==u.prototype},u.compare=function(t,r){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Q(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var _=t.length,S=r.length,P=0,v=Math.min(_,S);P<v;++P)if(t[P]!==r[P]){_=t[P],S=r[P];break}return _<S?-1:S<_?1:0},u.isEncoding=function(t){switch(String(t).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}},u.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);var _;if(r===void 0)for(r=0,_=0;_<t.length;++_)r+=t[_].length;var S=u.allocUnsafe(r),P=0;for(_=0;_<t.length;++_){var v=t[_];if(Q(v,Uint8Array)&&(v=u.from(v)),!u.isBuffer(v))throw new TypeError('"list" argument must be an Array of Buffers');v.copy(S,P),P+=v.length}return S};function J(a,t){if(u.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||Q(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var r=a.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&r===0)return 0;for(var S=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ft(a).length;default:if(S)return _?-1:k(a).length;t=(""+t).toLowerCase(),S=!0}}u.byteLength=J;function R(a,t,r){var _=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(a||(a="utf8");;)switch(a){case"hex":return g(this,t,r);case"utf8":case"utf-8":return i(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return F(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,t,r);default:if(_)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),_=!0}}u.prototype._isBuffer=!0;function W(a,t,r){var _=a[t];a[t]=a[r],a[r]=_}u.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)W(this,r,r+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this},u.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?i(this,0,t):R.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},y&&(u.prototype[y]=u.prototype.inspect),u.prototype.compare=function(t,r,_,S,P){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(r===void 0&&(r=0),_===void 0&&(_=t?t.length:0),S===void 0&&(S=0),P===void 0&&(P=this.length),r<0||_>t.length||S<0||P>this.length)throw new RangeError("out of range index");if(S>=P&&r>=_)return 0;if(S>=P)return-1;if(r>=_)return 1;if(r>>>=0,_>>>=0,S>>>=0,P>>>=0,this===t)return 0;for(var v=P-S,tt=_-r,it=Math.min(v,tt),ft=this.slice(S,P),ct=t.slice(r,_),at=0;at<it;++at)if(ft[at]!==ct[at]){v=ft[at],tt=ct[at];break}return v<tt?-1:tt<v?1:0};function x(a,t,r,_,S){if(a.length===0)return-1;if(typeof r=="string"?(_=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ut(r)&&(r=S?0:a.length-1),r<0&&(r=a.length+r),r>=a.length){if(S)return-1;r=a.length-1}else if(r<0)if(S)r=0;else return-1;if(typeof t=="string"&&(t=u.from(t,_)),u.isBuffer(t))return t.length===0?-1:G(a,t,r,_,S);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(a,t,r):Uint8Array.prototype.lastIndexOf.call(a,t,r):G(a,[t],r,_,S);throw new TypeError("val must be string, number or Buffer")}function G(a,t,r,_,S){var P=1,v=a.length,tt=t.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(a.length<2||t.length<2)return-1;P=2,v/=2,tt/=2,r/=2}function it(pe,Oe){return P===1?pe[Oe]:pe.readUInt16BE(Oe*P)}var ft;if(S){var ct=-1;for(ft=r;ft<v;ft++)if(it(a,ft)===it(t,ct===-1?0:ft-ct)){if(ct===-1&&(ct=ft),ft-ct+1===tt)return ct*P}else ct!==-1&&(ft-=ft-ct),ct=-1}else for(r+tt>v&&(r=v-tt),ft=r;ft>=0;ft--){for(var at=!0,Lt=0;Lt<tt;Lt++)if(it(a,ft+Lt)!==it(t,Lt)){at=!1;break}if(at)return ft}return-1}u.prototype.includes=function(t,r,_){return this.indexOf(t,r,_)!==-1},u.prototype.indexOf=function(t,r,_){return x(this,t,r,_,!0)},u.prototype.lastIndexOf=function(t,r,_){return x(this,t,r,_,!1)};function M(a,t,r,_){r=Number(r)||0;var S=a.length-r;_?(_=Number(_),_>S&&(_=S)):_=S;var P=t.length;_>P/2&&(_=P/2);for(var v=0;v<_;++v){var tt=parseInt(t.substr(v*2,2),16);if(ut(tt))return v;a[r+v]=tt}return v}function V(a,t,r,_){return ht(k(t,a.length-r),a,r,_)}function z(a,t,r,_){return ht(lt(t),a,r,_)}function Z(a,t,r,_){return z(a,t,r,_)}function s(a,t,r,_){return ht(Ft(t),a,r,_)}function A(a,t,r,_){return ht(re(t,a.length-r),a,r,_)}u.prototype.write=function(t,r,_,S){if(r===void 0)S="utf8",_=this.length,r=0;else if(_===void 0&&typeof r=="string")S=r,_=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(_)?(_=_>>>0,S===void 0&&(S="utf8")):(S=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var P=this.length-r;if((_===void 0||_>P)&&(_=P),t.length>0&&(_<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var v=!1;;)switch(S){case"hex":return M(this,t,r,_);case"utf8":case"utf-8":return V(this,t,r,_);case"ascii":return z(this,t,r,_);case"latin1":case"binary":return Z(this,t,r,_);case"base64":return s(this,t,r,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r,_);default:if(v)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(a,t,r){return t===0&&r===a.length?ie.fromByteArray(a):ie.fromByteArray(a.slice(t,r))}function i(a,t,r){r=Math.min(a.length,r);for(var _=[],S=t;S<r;){var P=a[S],v=null,tt=P>239?4:P>223?3:P>191?2:1;if(S+tt<=r){var it,ft,ct,at;switch(tt){case 1:P<128&&(v=P);break;case 2:it=a[S+1],(it&192)===128&&(at=(P&31)<<6|it&63,at>127&&(v=at));break;case 3:it=a[S+1],ft=a[S+2],(it&192)===128&&(ft&192)===128&&(at=(P&15)<<12|(it&63)<<6|ft&63,at>2047&&(at<55296||at>57343)&&(v=at));break;case 4:it=a[S+1],ft=a[S+2],ct=a[S+3],(it&192)===128&&(ft&192)===128&&(ct&192)===128&&(at=(P&15)<<18|(it&63)<<12|(ft&63)<<6|ct&63,at>65535&&at<1114112&&(v=at))}}v===null?(v=65533,tt=1):v>65535&&(v-=65536,_.push(v>>>10&1023|55296),v=56320|v&1023),_.push(v),S+=tt}return b(_)}var m=4096;function b(a){var t=a.length;if(t<=m)return String.fromCharCode.apply(String,a);for(var r="",_=0;_<t;)r+=String.fromCharCode.apply(String,a.slice(_,_+=m));return r}function j(a,t,r){var _="";r=Math.min(a.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(a[S]&127);return _}function F(a,t,r){var _="";r=Math.min(a.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(a[S]);return _}function g(a,t,r){var _=a.length;(!t||t<0)&&(t=0),(!r||r<0||r>_)&&(r=_);for(var S="",P=t;P<r;++P)S+=nt[a[P]];return S}function $(a,t,r){for(var _=a.slice(t,r),S="",P=0;P<_.length;P+=2)S+=String.fromCharCode(_[P]+_[P+1]*256);return S}u.prototype.slice=function(t,r){var _=this.length;t=~~t,r=r===void 0?_:~~r,t<0?(t+=_,t<0&&(t=0)):t>_&&(t=_),r<0?(r+=_,r<0&&(r=0)):r>_&&(r=_),r<t&&(r=t);var S=this.subarray(t,r);return Object.setPrototypeOf(S,u.prototype),S};function L(a,t,r){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+t>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return S},u.prototype.readUIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t+--r],P=1;r>0&&(P*=256);)S+=this[t+--r]*P;return S},u.prototype.readUInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},u.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return P*=128,S>=P&&(S-=Math.pow(2,8*r)),S},u.prototype.readIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=r,P=1,v=this[t+--S];S>0&&(P*=256);)v+=this[t+--S]*P;return P*=128,v>=P&&(v-=Math.pow(2,8*r)),v},u.prototype.readInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},u.prototype.readInt16LE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t]|this[t+1]<<8;return _&32768?_|4294901760:_},u.prototype.readInt16BE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t+1]|this[t]<<8;return _&32768?_|4294901760:_},u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,r){return t=t>>>0,r||L(t,4,this.length),Dt.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||L(t,4,this.length),Dt.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||L(t,8,this.length),Dt.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||L(t,8,this.length),Dt.read(this,t,!1,52,8)};function T(a,t,r,_,S,P){if(!u.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>S||t<P)throw new RangeError('"value" argument is out of bounds');if(r+_>a.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=1,tt=0;for(this[r]=t&255;++tt<_&&(v*=256);)this[r+tt]=t/v&255;return r+_},u.prototype.writeUIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=_-1,tt=1;for(this[r+v]=t&255;--v>=0&&(tt*=256);)this[r+v]=t/tt&255;return r+_},u.prototype.writeUInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,255,0),this[r]=t&255,r+1},u.prototype.writeUInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},u.prototype.writeUInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},u.prototype.writeUInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},u.prototype.writeUInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},u.prototype.writeIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=0,tt=1,it=0;for(this[r]=t&255;++v<_&&(tt*=256);)t<0&&it===0&&this[r+v-1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},u.prototype.writeIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=_-1,tt=1,it=0;for(this[r+v]=t&255;--v>=0&&(tt*=256);)t<0&&it===0&&this[r+v+1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},u.prototype.writeInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},u.prototype.writeInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},u.prototype.writeInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},u.prototype.writeInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},u.prototype.writeInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function d(a,t,r,_,S,P){if(r+_>a.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q(a,t,r,_,S){return t=+t,r=r>>>0,S||d(a,t,r,4),Dt.write(a,t,r,_,23,4),r+4}u.prototype.writeFloatLE=function(t,r,_){return q(this,t,r,!0,_)},u.prototype.writeFloatBE=function(t,r,_){return q(this,t,r,!1,_)};function X(a,t,r,_,S){return t=+t,r=r>>>0,S||d(a,t,r,8),Dt.write(a,t,r,_,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,_){return X(this,t,r,!0,_)},u.prototype.writeDoubleBE=function(t,r,_){return X(this,t,r,!1,_)},u.prototype.copy=function(t,r,_,S){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(_||(_=0),!S&&S!==0&&(S=this.length),r>=t.length&&(r=t.length),r||(r=0),S>0&&S<_&&(S=_),S===_||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),t.length-r<S-_&&(S=t.length-r+_);var P=S-_;if(this===t&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(r,_,S);else if(this===t&&_<r&&r<S)for(var v=P-1;v>=0;--v)t[v+r]=this[v+_];else Uint8Array.prototype.set.call(t,this.subarray(_,S),r);return P},u.prototype.fill=function(t,r,_,S){if(typeof t=="string"){if(typeof r=="string"?(S=r,r=0,_=this.length):typeof _=="string"&&(S=_,_=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!u.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(t.length===1){var P=t.charCodeAt(0);(S==="utf8"&&P<128||S==="latin1")&&(t=P)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<_)throw new RangeError("Out of range index");if(_<=r)return this;r=r>>>0,_=_===void 0?this.length:_>>>0,t||(t=0);var v;if(typeof t=="number")for(v=r;v<_;++v)this[v]=t;else{var tt=u.isBuffer(t)?t:u.from(t,S),it=tt.length;if(it===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<_-r;++v)this[v+r]=tt[v%it]}return this};var et=/[^+/0-9A-Za-z-_]/g;function Bt(a){if(a=a.split("=")[0],a=a.trim().replace(et,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function k(a,t){t=t||1/0;for(var r,_=a.length,S=null,P=[],v=0;v<_;++v){if(r=a.charCodeAt(v),r>55295&&r<57344){if(!S){if(r>56319){(t-=3)>-1&&P.push(239,191,189);continue}else if(v+1===_){(t-=3)>-1&&P.push(239,191,189);continue}S=r;continue}if(r<56320){(t-=3)>-1&&P.push(239,191,189),S=r;continue}r=(S-55296<<10|r-56320)+65536}else S&&(t-=3)>-1&&P.push(239,191,189);if(S=null,r<128){if((t-=1)<0)break;P.push(r)}else if(r<2048){if((t-=2)<0)break;P.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;P.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;P.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return P}function lt(a){for(var t=[],r=0;r<a.length;++r)t.push(a.charCodeAt(r)&255);return t}function re(a,t){for(var r,_,S,P=[],v=0;v<a.length&&!((t-=2)<0);++v)r=a.charCodeAt(v),_=r>>8,S=r%256,P.push(S),P.push(_);return P}function Ft(a){return ie.toByteArray(Bt(a))}function ht(a,t,r,_){for(var S=0;S<_&&!(S+r>=t.length||S>=a.length);++S)t[S+r]=a[S];return S}function Q(a,t){return a instanceof t||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===t.name}function ut(a){return a!==a}var nt=function(){for(var a="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var _=r*16,S=0;S<16;++S)t[_+S]=a[r]+a[S];return t}()}),wr=C.Buffer,Tr=C.SlowBuffer,Ir=C.INSPECT_MAX_BYTES,br=C.kMaxLength,mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function y(D){if(C.Buffer.isBuffer(D))return D;if(ArrayBuffer.isView(D))return C.Buffer.from(D.buffer);if(D instanceof ArrayBuffer)return C.Buffer.from(D);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=y});st(mt);var Dr=mt.ensureBuffer,ce=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let y=/^(?:[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 D(l){if(typeof l!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof l);if(!y.test(l))throw new TypeError("Invalid format for UUID: "+l);let f,u=new Uint8Array(16);return u[0]=(f=parseInt(l.slice(0,8),16))>>>24,u[1]=f>>>16&255,u[2]=f>>>8&255,u[3]=f&255,u[4]=(f=parseInt(l.slice(9,13),16))>>>8,u[5]=f&255,u[6]=(f=parseInt(l.slice(14,18),16))>>>8,u[7]=f&255,u[8]=(f=parseInt(l.slice(19,23),16))>>>8,u[9]=f&255,u[10]=(f=parseInt(l.slice(24,36),16))/1099511627776&255,u[11]=f/4294967296&255,u[12]=f>>>24&255,u[13]=f>>>16&255,u[14]=f>>>8&255,u[15]=f&255,u}e.parseUUID=D});st(ce);var dr=ce.parseUUID,_t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class y{constructor(l,f){if(l!=null&&typeof l!="string"&&!ArrayBuffer.isView(l)&&!(l instanceof ArrayBuffer)&&!Array.isArray(l))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=f??y.BSON_BINARY_SUBTYPE_DEFAULT,l==null?(this.buffer=C.Buffer.alloc(y.BUFFER_SIZE),this.position=0):(typeof l=="string"?this.buffer=C.Buffer.from(l,"binary"):Array.isArray(l)?this.buffer=C.Buffer.from(l):this.buffer=mt.ensureBuffer(l),this.position=this.buffer.byteLength)}put(l){if(typeof l=="string"&&l.length!==1)throw new TypeError("only accepts single character String");if(typeof l!="number"&&l.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let f;if(typeof l=="string"?f=l.charCodeAt(0):typeof l=="number"?f=l:f=l[0],f<0||f>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++]=f;else{let u=C.Buffer.alloc(y.BUFFER_SIZE+this.buffer.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u,this.buffer[this.position++]=f}}write(l,f){if(f=typeof f=="number"?f:this.position,this.buffer.length<f+l.length){let u=C.Buffer.alloc(this.buffer.length+l.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u}ArrayBuffer.isView(l)?(this.buffer.set(mt.ensureBuffer(l),f),this.position=f+l.byteLength>this.position?f+l.length:this.position):typeof l=="string"&&(this.buffer.write(l,f,l.length,"binary"),this.position=f+l.length>this.position?f+l.length:this.position)}read(l,f){return f=f&&f>0?f:this.position,this.buffer.slice(l,l+f)}value(l){return l=!!l,l&&this.buffer.length===this.position?this.buffer:l?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(l){return this.buffer.toString(l)}toExtendedJSON(l){l=l||{};let f=this.buffer.toString("base64"),u=Number(this.sub_type).toString(16);return l.legacy?{$binary:f,$type:u.length===1?"0"+u:u}:{$binary:{base64:f,subType:u.length===1?"0"+u:u}}}static fromExtendedJSON(l,f){f=f||{};let u,E;if("$binary"in l?f.legacy&&typeof l.$binary=="string"&&"$type"in l?(E=l.$type?parseInt(l.$type,16):0,u=C.Buffer.from(l.$binary,"base64")):typeof l.$binary!="string"&&(E=l.$binary.subType?parseInt(l.$binary.subType,16):0,u=C.Buffer.from(l.$binary.base64,"base64")):"$uuid"in l&&(E=4,u=C.Buffer.from(ce.parseUUID(l.$uuid))),!u)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(l)}`);return new y(u,E)}}e.Binary=y,y.BSON_BINARY_SUBTYPE_DEFAULT=0,y.BUFFER_SIZE=256,y.SUBTYPE_DEFAULT=0,y.SUBTYPE_FUNCTION=1,y.SUBTYPE_BYTE_ARRAY=2,y.SUBTYPE_UUID_OLD=3,y.SUBTYPE_UUID=4,y.SUBTYPE_MD5=5,y.SUBTYPE_USER_DEFINED=128,Object.defineProperty(y.prototype,"_bsontype",{value:"Binary"})});st(_t);var Rr=_t.Binary,Et=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class y{constructor(l,f){this.code=l,this.scope=f}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(l){return new y(l.$code,l.$scope)}}e.Code=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Code"})});st(Et);var Ur=Et.Code,tr={},ae;typeof Object.create=="function"?ae=function(e,y){e.super_=y,e.prototype=Object.create(y.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:ae=function(e,y){e.super_=y;var D=function(){};D.prototype=y.prototype,e.prototype=new D,e.prototype.constructor=e};var er=ae,rr=/%[sdj%]/g;function he(B){if(!xt(B)){for(var e=[],y=0;y<arguments.length;y++)e.push(Ot(arguments[y]));return e.join(" ")}for(var y=1,D=arguments,l=D.length,f=String(B).replace(rr,function(E){if(E==="%%")return"%";if(y>=l)return E;switch(E){case"%s":return String(D[y++]);case"%d":return Number(D[y++]);case"%j":try{return JSON.stringify(D[y++])}catch{return"[Circular]"}default:return E}}),u=D[y];y<l;u=D[++y])Qt(u)||!Pt(u)?f+=" "+u:f+=" "+Ot(u);return f}function we(B,e){if(pt(global.process))return function(){return we(B,e).apply(this,arguments)};var y=!1;function D(){return y||(console.error(e),y=!0),B.apply(this,arguments)}return D}var Wt={},oe;function nr(B){if(pt(oe)&&(oe=""),B=B.toUpperCase(),!Wt[B])if(new RegExp("\\b"+B+"\\b","i").test(oe)){var e=0;Wt[B]=function(){var y=he.apply(null,arguments);console.error("%s %d: %s",B,e,y)}}else Wt[B]=function(){};return Wt[B]}function Ot(B,e){var y={seen:[],stylize:or};return arguments.length>=3&&(y.depth=arguments[2]),arguments.length>=4&&(y.colors=arguments[3]),_e(e)?y.showHidden=e:e&&be(y,e),pt(y.showHidden)&&(y.showHidden=!1),pt(y.depth)&&(y.depth=2),pt(y.colors)&&(y.colors=!1),pt(y.customInspect)&&(y.customInspect=!0),y.colors&&(y.stylize=ir),Gt(y,B,y.depth)}Ot.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]};Ot.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ir(B,e){var y=Ot.styles[e];return y?"\x1B["+Ot.colors[y][0]+"m"+B+"\x1B["+Ot.colors[y][1]+"m":B}function or(B,e){return B}function sr(B){var e={};return B.forEach(function(y,D){e[y]=!0}),e}function Gt(B,e,y){if(B.customInspect&&e&&Kt(e.inspect)&&e.inspect!==Ot&&!(e.constructor&&e.constructor.prototype===e)){var D=e.inspect(y,B);return xt(D)||(D=Gt(B,D,y)),D}var l=fr(B,e);if(l)return l;var f=Object.keys(e),u=sr(f);if(B.showHidden&&(f=Object.getOwnPropertyNames(e)),kt(e)&&(f.indexOf("message")>=0||f.indexOf("description")>=0))return se(e);if(f.length===0){if(Kt(e)){var E=e.name?": "+e.name:"";return B.stylize("[Function"+E+"]","special")}if(Xt(e))return B.stylize(RegExp.prototype.toString.call(e),"regexp");if(le(e))return B.stylize(Date.prototype.toString.call(e),"date");if(kt(e))return se(e)}var o="",c=!1,h=["{","}"];if(Te(e)&&(c=!0,h=["[","]"]),Kt(e)){var p=e.name?": "+e.name:"";o=" [Function"+p+"]"}if(Xt(e)&&(o=" "+RegExp.prototype.toString.call(e)),le(e)&&(o=" "+Date.prototype.toUTCString.call(e)),kt(e)&&(o=" "+se(e)),f.length===0&&(!c||e.length==0))return h[0]+o+h[1];if(y<0)return Xt(e)?B.stylize(RegExp.prototype.toString.call(e),"regexp"):B.stylize("[Object]","special");B.seen.push(e);var n;return c?n=ar(B,e,y,u,f):n=f.map(function(w){return ue(B,e,y,u,w,c)}),B.seen.pop(),ur(n,o,h)}function fr(B,e){if(pt(e))return B.stylize("undefined","undefined");if(xt(e)){var y="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return B.stylize(y,"string")}if(Ie(e))return B.stylize(""+e,"number");if(_e(e))return B.stylize(""+e,"boolean");if(Qt(e))return B.stylize("null","null")}function se(B){return"["+Error.prototype.toString.call(B)+"]"}function ar(B,e,y,D,l){for(var f=[],u=0,E=e.length;u<E;++u)De(e,String(u))?f.push(ue(B,e,y,D,String(u),!0)):f.push("");return l.forEach(function(o){o.match(/^\d+$/)||f.push(ue(B,e,y,D,o,!0))}),f}function ue(B,e,y,D,l,f){var u,E,o;if(o=Object.getOwnPropertyDescriptor(e,l)||{value:e[l]},o.get?o.set?E=B.stylize("[Getter/Setter]","special"):E=B.stylize("[Getter]","special"):o.set&&(E=B.stylize("[Setter]","special")),De(D,l)||(u="["+l+"]"),E||(B.seen.indexOf(o.value)<0?(Qt(y)?E=Gt(B,o.value,null):E=Gt(B,o.value,y-1),E.indexOf(`
|
|
8
|
-
`)>-1&&(f?
|
|
7
|
+
"use strict";var __exports__=(()=>{var Ye=Object.create;var zt=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Je=(B,t)=>()=>(t||B((t={exports:{}}).exports,t),t.exports),We=(B,t)=>{for(var h in t)zt(B,h,{get:t[h],enumerable:!0})},Ct=(B,t,h,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ve(t))!ze.call(B,l)&&l!==h&&zt(B,l,{get:()=>t[l],enumerable:!(d=Le(t,l))||d.enumerable});return B},Jt=(B,t,h)=>(Ct(B,t,"default"),h&&Ct(h,t,"default")),ke=(B,t,h)=>(h=B!=null?Ye(Ce(B)):{},Ct(t||!B||!B.__esModule?zt(h,"default",{value:B,enumerable:!0}):h,B)),Xe=B=>Ct(zt({},"__esModule",{value:!0}),B);var Ee=Je((br,me)=>{me.exports=globalThis.loaders});var Yt={};We(Yt,{BSONLoader:()=>ee,BSONWriter:()=>Fe});Jt(Yt,ke(Ee(),1));var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function st(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function ot(B,t){return t={exports:{}},B(t,t.exports),t.exports}var Ke=xe,Ve=qe,He=tr,Nt=[],yt=[],Ge=typeof Uint8Array<"u"?Uint8Array:Array,ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tt=0,we=ne.length;Tt<we;++Tt)Nt[Tt]=ne[Tt],yt[ne.charCodeAt(Tt)]=Tt;var Tt,we;yt["-".charCodeAt(0)]=62;yt["_".charCodeAt(0)]=63;function Te(B){var t=B.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var h=B.indexOf("=");h===-1&&(h=t);var d=h===t?0:4-h%4;return[h,d]}function xe(B){var t=Te(B),h=t[0],d=t[1];return(h+d)*3/4-d}function Ze(B,t,h){return(t+h)*3/4-h}function qe(B){var t,h=Te(B),d=h[0],l=h[1],f=new Ge(Ze(B,d,l)),u=0,m=l>0?d-4:d,o;for(o=0;o<m;o+=4)t=yt[B.charCodeAt(o)]<<18|yt[B.charCodeAt(o+1)]<<12|yt[B.charCodeAt(o+2)]<<6|yt[B.charCodeAt(o+3)],f[u++]=t>>16&255,f[u++]=t>>8&255,f[u++]=t&255;return l===2&&(t=yt[B.charCodeAt(o)]<<2|yt[B.charCodeAt(o+1)]>>4,f[u++]=t&255),l===1&&(t=yt[B.charCodeAt(o)]<<10|yt[B.charCodeAt(o+1)]<<4|yt[B.charCodeAt(o+2)]>>2,f[u++]=t>>8&255,f[u++]=t&255),f}function Qe(B){return Nt[B>>18&63]+Nt[B>>12&63]+Nt[B>>6&63]+Nt[B&63]}function $e(B,t,h){for(var d,l=[],f=t;f<h;f+=3)d=(B[f]<<16&16711680)+(B[f+1]<<8&65280)+(B[f+2]&255),l.push(Qe(d));return l.join("")}function tr(B){for(var t,h=B.length,d=h%3,l=[],f=16383,u=0,m=h-d;u<m;u+=f)l.push($e(B,u,u+f>m?m:u+f));return d===1?(t=B[h-1],l.push(Nt[t>>2]+Nt[t<<4&63]+"==")):d===2&&(t=(B[h-2]<<8)+B[h-1],l.push(Nt[t>>10]+Nt[t>>4&63]+Nt[t<<2&63]+"=")),l.join("")}var ie={byteLength:Ke,toByteArray:Ve,fromByteArray:He},er=function(t,h,d,l,f){var u,m,o=f*8-l-1,c=(1<<o)-1,_=c>>1,g=-7,n=d?f-1:0,w=d?-1:1,U=t[h+n];for(n+=w,u=U&(1<<-g)-1,U>>=-g,g+=o;g>0;u=u*256+t[h+n],n+=w,g-=8);for(m=u&(1<<-g)-1,u>>=-g,g+=l;g>0;m=m*256+t[h+n],n+=w,g-=8);if(u===0)u=1-_;else{if(u===c)return m?NaN:(U?-1:1)*(1/0);m=m+Math.pow(2,l),u=u-_}return(U?-1:1)*m*Math.pow(2,u-l)},rr=function(t,h,d,l,f,u){var m,o,c,_=u*8-f-1,g=(1<<_)-1,n=g>>1,w=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,U=l?0:u-1,p=l?1:-1,F=h<0||h===0&&1/h<0?1:0;for(h=Math.abs(h),isNaN(h)||h===1/0?(o=isNaN(h)?1:0,m=g):(m=Math.floor(Math.log(h)/Math.LN2),h*(c=Math.pow(2,-m))<1&&(m--,c*=2),m+n>=1?h+=w/c:h+=w*Math.pow(2,1-n),h*c>=2&&(m++,c/=2),m+n>=g?(o=0,m=g):m+n>=1?(o=(h*c-1)*Math.pow(2,f),m=m+n):(o=h*Math.pow(2,n-1)*Math.pow(2,f),m=0));f>=8;t[d+U]=o&255,U+=p,o/=256,f-=8);for(m=m<<f|o,_+=f;_>0;t[d+U]=m&255,U+=p,m/=256,_-=8);t[d+U-p]|=F*128},It={read:er,write:rr},C=ot(function(B,t){var h=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=F,t.INSPECT_MAX_BYTES=50;var d=2147483647;t.kMaxLength=d,u.TYPED_ARRAY_SUPPORT=l(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{var a=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(a,e),a.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function f(a){if(a>d)throw new RangeError('The value "'+a+'" is invalid for option "size"');var e=new Uint8Array(a);return Object.setPrototypeOf(e,u.prototype),e}function u(a,e,r){if(typeof a=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(a)}return m(a,e,r)}u.poolSize=8192;function m(a,e,r){if(typeof a=="string")return g(a,e);if(ArrayBuffer.isView(a))return n(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(q(a,ArrayBuffer)||a&&q(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(a,SharedArrayBuffer)||a&&q(a.buffer,SharedArrayBuffer)))return w(a,e,r);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var y=a.valueOf&&a.valueOf();if(y!=null&&y!==a)return u.from(y,e,r);var S=U(a);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return u.from(a[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}u.from=function(a,e,r){return m(a,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function o(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function c(a,e,r){return o(a),a<=0?f(a):e!==void 0?typeof r=="string"?f(a).fill(e,r):f(a).fill(e):f(a)}u.alloc=function(a,e,r){return c(a,e,r)};function _(a){return o(a),f(a<0?0:p(a)|0)}u.allocUnsafe=function(a){return _(a)},u.allocUnsafeSlow=function(a){return _(a)};function g(a,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=J(a,e)|0,y=f(r),S=y.write(a,e);return S!==r&&(y=y.slice(0,S)),y}function n(a){for(var e=a.length<0?0:p(a.length)|0,r=f(e),y=0;y<e;y+=1)r[y]=a[y]&255;return r}function w(a,e,r){if(e<0||a.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var y;return e===void 0&&r===void 0?y=new Uint8Array(a):r===void 0?y=new Uint8Array(a,e):y=new Uint8Array(a,e,r),Object.setPrototypeOf(y,u.prototype),y}function U(a){if(u.isBuffer(a)){var e=p(a.length)|0,r=f(e);return r.length===0||a.copy(r,0,0,e),r}if(a.length!==void 0)return typeof a.length!="number"||ut(a.length)?f(0):n(a);if(a.type==="Buffer"&&Array.isArray(a.data))return n(a.data)}function p(a){if(a>=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return a|0}function F(a){return+a!=a&&(a=0),u.alloc(+a)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype},u.compare=function(e,r){if(q(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),q(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(e)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var y=e.length,S=r.length,P=0,Y=Math.min(y,S);P<Y;++P)if(e[P]!==r[P]){y=e[P],S=r[P];break}return y<S?-1:S<y?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);var y;if(r===void 0)for(r=0,y=0;y<e.length;++y)r+=e[y].length;var S=u.allocUnsafe(r),P=0;for(y=0;y<e.length;++y){var Y=e[y];if(q(Y,Uint8Array)&&(Y=u.from(Y)),!u.isBuffer(Y))throw new TypeError('"list" argument must be an Array of Buffers');Y.copy(S,P),P+=Y.length}return S};function J(a,e){if(u.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||q(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var r=a.length,y=arguments.length>2&&arguments[2]===!0;if(!y&&r===0)return 0;for(var S=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return X(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Lt(a).length;default:if(S)return y?-1:X(a).length;e=(""+e).toLowerCase(),S=!0}}u.byteLength=J;function R(a,e,r){var y=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(a||(a="utf8");;)switch(a){case"hex":return N(this,e,r);case"utf8":case"utf-8":return i(this,e,r);case"ascii":return j(this,e,r);case"latin1":case"binary":return L(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,e,r);default:if(y)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),y=!0}}u.prototype._isBuffer=!0;function W(a,e,r){var y=a[e];a[e]=a[r],a[r]=y}u.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)W(this,r,r+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this},u.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?i(this,0,e):R.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},h&&(u.prototype[h]=u.prototype.inspect),u.prototype.compare=function(e,r,y,S,P){if(q(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(e));if(r===void 0&&(r=0),y===void 0&&(y=e?e.length:0),S===void 0&&(S=0),P===void 0&&(P=this.length),r<0||y>e.length||S<0||P>this.length)throw new RangeError("out of range index");if(S>=P&&r>=y)return 0;if(S>=P)return-1;if(r>=y)return 1;if(r>>>=0,y>>>=0,S>>>=0,P>>>=0,this===e)return 0;for(var Y=P-S,tt=y-r,it=Math.min(Y,tt),ft=this.slice(S,P),ct=e.slice(r,y),at=0;at<it;++at)if(ft[at]!==ct[at]){Y=ft[at],tt=ct[at];break}return Y<tt?-1:tt<Y?1:0};function Q(a,e,r,y,S){if(a.length===0)return-1;if(typeof r=="string"?(y=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ut(r)&&(r=S?0:a.length-1),r<0&&(r=a.length+r),r>=a.length){if(S)return-1;r=a.length-1}else if(r<0)if(S)r=0;else return-1;if(typeof e=="string"&&(e=u.from(e,y)),u.isBuffer(e))return e.length===0?-1:H(a,e,r,y,S);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(a,e,r):Uint8Array.prototype.lastIndexOf.call(a,e,r):H(a,[e],r,y,S);throw new TypeError("val must be string, number or Buffer")}function H(a,e,r,y,S){var P=1,Y=a.length,tt=e.length;if(y!==void 0&&(y=String(y).toLowerCase(),y==="ucs2"||y==="ucs-2"||y==="utf16le"||y==="utf-16le")){if(a.length<2||e.length<2)return-1;P=2,Y/=2,tt/=2,r/=2}function it(Se,Oe){return P===1?Se[Oe]:Se.readUInt16BE(Oe*P)}var ft;if(S){var ct=-1;for(ft=r;ft<Y;ft++)if(it(a,ft)===it(e,ct===-1?0:ft-ct)){if(ct===-1&&(ct=ft),ft-ct+1===tt)return ct*P}else ct!==-1&&(ft-=ft-ct),ct=-1}else for(r+tt>Y&&(r=Y-tt),ft=r;ft>=0;ft--){for(var at=!0,vt=0;vt<tt;vt++)if(it(a,ft+vt)!==it(e,vt)){at=!1;break}if(at)return ft}return-1}u.prototype.includes=function(e,r,y){return this.indexOf(e,r,y)!==-1},u.prototype.indexOf=function(e,r,y){return Q(this,e,r,y,!0)},u.prototype.lastIndexOf=function(e,r,y){return Q(this,e,r,y,!1)};function M(a,e,r,y){r=Number(r)||0;var S=a.length-r;y?(y=Number(y),y>S&&(y=S)):y=S;var P=e.length;y>P/2&&(y=P/2);for(var Y=0;Y<y;++Y){var tt=parseInt(e.substr(Y*2,2),16);if(ut(tt))return Y;a[r+Y]=tt}return Y}function G(a,e,r,y){return ht(X(e,a.length-r),a,r,y)}function z(a,e,r,y){return ht(lt(e),a,r,y)}function x(a,e,r,y){return z(a,e,r,y)}function s(a,e,r,y){return ht(Lt(e),a,r,y)}function O(a,e,r,y){return ht(re(e,a.length-r),a,r,y)}u.prototype.write=function(e,r,y,S){if(r===void 0)S="utf8",y=this.length,r=0;else if(y===void 0&&typeof r=="string")S=r,y=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(y)?(y=y>>>0,S===void 0&&(S="utf8")):(S=y,y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var P=this.length-r;if((y===void 0||y>P)&&(y=P),e.length>0&&(y<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var Y=!1;;)switch(S){case"hex":return M(this,e,r,y);case"utf8":case"utf-8":return G(this,e,r,y);case"ascii":return z(this,e,r,y);case"latin1":case"binary":return x(this,e,r,y);case"base64":return s(this,e,r,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r,y);default:if(Y)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),Y=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(a,e,r){return e===0&&r===a.length?ie.fromByteArray(a):ie.fromByteArray(a.slice(e,r))}function i(a,e,r){r=Math.min(a.length,r);for(var y=[],S=e;S<r;){var P=a[S],Y=null,tt=P>239?4:P>223?3:P>191?2:1;if(S+tt<=r){var it,ft,ct,at;switch(tt){case 1:P<128&&(Y=P);break;case 2:it=a[S+1],(it&192)===128&&(at=(P&31)<<6|it&63,at>127&&(Y=at));break;case 3:it=a[S+1],ft=a[S+2],(it&192)===128&&(ft&192)===128&&(at=(P&15)<<12|(it&63)<<6|ft&63,at>2047&&(at<55296||at>57343)&&(Y=at));break;case 4:it=a[S+1],ft=a[S+2],ct=a[S+3],(it&192)===128&&(ft&192)===128&&(ct&192)===128&&(at=(P&15)<<18|(it&63)<<12|(ft&63)<<6|ct&63,at>65535&&at<1114112&&(Y=at))}}Y===null?(Y=65533,tt=1):Y>65535&&(Y-=65536,y.push(Y>>>10&1023|55296),Y=56320|Y&1023),y.push(Y),S+=tt}return I(y)}var E=4096;function I(a){var e=a.length;if(e<=E)return String.fromCharCode.apply(String,a);for(var r="",y=0;y<e;)r+=String.fromCharCode.apply(String,a.slice(y,y+=E));return r}function j(a,e,r){var y="";r=Math.min(a.length,r);for(var S=e;S<r;++S)y+=String.fromCharCode(a[S]&127);return y}function L(a,e,r){var y="";r=Math.min(a.length,r);for(var S=e;S<r;++S)y+=String.fromCharCode(a[S]);return y}function N(a,e,r){var y=a.length;(!e||e<0)&&(e=0),(!r||r<0||r>y)&&(r=y);for(var S="",P=e;P<r;++P)S+=nt[a[P]];return S}function $(a,e,r){for(var y=a.slice(e,r),S="",P=0;P<y.length;P+=2)S+=String.fromCharCode(y[P]+y[P+1]*256);return S}u.prototype.slice=function(e,r){var y=this.length;e=~~e,r=r===void 0?y:~~r,e<0?(e+=y,e<0&&(e=0)):e>y&&(e=y),r<0?(r+=y,r<0&&(r=0)):r>y&&(r=y),r<e&&(r=e);var S=this.subarray(e,r);return Object.setPrototypeOf(S,u.prototype),S};function v(a,e,r){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+e>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(e,r,y){e=e>>>0,r=r>>>0,y||v(e,r,this.length);for(var S=this[e],P=1,Y=0;++Y<r&&(P*=256);)S+=this[e+Y]*P;return S},u.prototype.readUIntBE=function(e,r,y){e=e>>>0,r=r>>>0,y||v(e,r,this.length);for(var S=this[e+--r],P=1;r>0&&(P*=256);)S+=this[e+--r]*P;return S},u.prototype.readUInt8=function(e,r){return e=e>>>0,r||v(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},u.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,r,y){e=e>>>0,r=r>>>0,y||v(e,r,this.length);for(var S=this[e],P=1,Y=0;++Y<r&&(P*=256);)S+=this[e+Y]*P;return P*=128,S>=P&&(S-=Math.pow(2,8*r)),S},u.prototype.readIntBE=function(e,r,y){e=e>>>0,r=r>>>0,y||v(e,r,this.length);for(var S=r,P=1,Y=this[e+--S];S>0&&(P*=256);)Y+=this[e+--S]*P;return P*=128,Y>=P&&(Y-=Math.pow(2,8*r)),Y},u.prototype.readInt8=function(e,r){return e=e>>>0,r||v(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},u.prototype.readInt16LE=function(e,r){e=e>>>0,r||v(e,2,this.length);var y=this[e]|this[e+1]<<8;return y&32768?y|4294901760:y},u.prototype.readInt16BE=function(e,r){e=e>>>0,r||v(e,2,this.length);var y=this[e+1]|this[e]<<8;return y&32768?y|4294901760:y},u.prototype.readInt32LE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,r){return e=e>>>0,r||v(e,4,this.length),It.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,r){return e=e>>>0,r||v(e,4,this.length),It.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||v(e,8,this.length),It.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||v(e,8,this.length),It.read(this,e,!1,52,8)};function T(a,e,r,y,S,P){if(!u.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>S||e<P)throw new RangeError('"value" argument is out of bounds');if(r+y>a.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(e,r,y,S){if(e=+e,r=r>>>0,y=y>>>0,!S){var P=Math.pow(2,8*y)-1;T(this,e,r,y,P,0)}var Y=1,tt=0;for(this[r]=e&255;++tt<y&&(Y*=256);)this[r+tt]=e/Y&255;return r+y},u.prototype.writeUIntBE=function(e,r,y,S){if(e=+e,r=r>>>0,y=y>>>0,!S){var P=Math.pow(2,8*y)-1;T(this,e,r,y,P,0)}var Y=y-1,tt=1;for(this[r+Y]=e&255;--Y>=0&&(tt*=256);)this[r+Y]=e/tt&255;return r+y},u.prototype.writeUInt8=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,1,255,0),this[r]=e&255,r+1},u.prototype.writeUInt16LE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2},u.prototype.writeUInt16BE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2},u.prototype.writeUInt32LE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4},u.prototype.writeUInt32BE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4},u.prototype.writeIntLE=function(e,r,y,S){if(e=+e,r=r>>>0,!S){var P=Math.pow(2,8*y-1);T(this,e,r,y,P-1,-P)}var Y=0,tt=1,it=0;for(this[r]=e&255;++Y<y&&(tt*=256);)e<0&&it===0&&this[r+Y-1]!==0&&(it=1),this[r+Y]=(e/tt>>0)-it&255;return r+y},u.prototype.writeIntBE=function(e,r,y,S){if(e=+e,r=r>>>0,!S){var P=Math.pow(2,8*y-1);T(this,e,r,y,P-1,-P)}var Y=y-1,tt=1,it=0;for(this[r+Y]=e&255;--Y>=0&&(tt*=256);)e<0&&it===0&&this[r+Y+1]!==0&&(it=1),this[r+Y]=(e/tt>>0)-it&255;return r+y},u.prototype.writeInt8=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1},u.prototype.writeInt16LE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2},u.prototype.writeInt16BE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2},u.prototype.writeInt32LE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},u.prototype.writeInt32BE=function(e,r,y){return e=+e,r=r>>>0,y||T(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function D(a,e,r,y,S,P){if(r+y>a.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Z(a,e,r,y,S){return e=+e,r=r>>>0,S||D(a,e,r,4),It.write(a,e,r,y,23,4),r+4}u.prototype.writeFloatLE=function(e,r,y){return Z(this,e,r,!0,y)},u.prototype.writeFloatBE=function(e,r,y){return Z(this,e,r,!1,y)};function k(a,e,r,y,S){return e=+e,r=r>>>0,S||D(a,e,r,8),It.write(a,e,r,y,52,8),r+8}u.prototype.writeDoubleLE=function(e,r,y){return k(this,e,r,!0,y)},u.prototype.writeDoubleBE=function(e,r,y){return k(this,e,r,!1,y)},u.prototype.copy=function(e,r,y,S){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(y||(y=0),!S&&S!==0&&(S=this.length),r>=e.length&&(r=e.length),r||(r=0),S>0&&S<y&&(S=y),S===y||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(y<0||y>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),e.length-r<S-y&&(S=e.length-r+y);var P=S-y;if(this===e&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(r,y,S);else if(this===e&&y<r&&r<S)for(var Y=P-1;Y>=0;--Y)e[Y+r]=this[Y+y];else Uint8Array.prototype.set.call(e,this.subarray(y,S),r);return P},u.prototype.fill=function(e,r,y,S){if(typeof e=="string"){if(typeof r=="string"?(S=r,r=0,y=this.length):typeof y=="string"&&(S=y,y=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!u.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(e.length===1){var P=e.charCodeAt(0);(S==="utf8"&&P<128||S==="latin1")&&(e=P)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<y)throw new RangeError("Out of range index");if(y<=r)return this;r=r>>>0,y=y===void 0?this.length:y>>>0,e||(e=0);var Y;if(typeof e=="number")for(Y=r;Y<y;++Y)this[Y]=e;else{var tt=u.isBuffer(e)?e:u.from(e,S),it=tt.length;if(it===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(Y=0;Y<y-r;++Y)this[Y+r]=tt[Y%it]}return this};var et=/[^+/0-9A-Za-z-_]/g;function Bt(a){if(a=a.split("=")[0],a=a.trim().replace(et,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function X(a,e){e=e||1/0;for(var r,y=a.length,S=null,P=[],Y=0;Y<y;++Y){if(r=a.charCodeAt(Y),r>55295&&r<57344){if(!S){if(r>56319){(e-=3)>-1&&P.push(239,191,189);continue}else if(Y+1===y){(e-=3)>-1&&P.push(239,191,189);continue}S=r;continue}if(r<56320){(e-=3)>-1&&P.push(239,191,189),S=r;continue}r=(S-55296<<10|r-56320)+65536}else S&&(e-=3)>-1&&P.push(239,191,189);if(S=null,r<128){if((e-=1)<0)break;P.push(r)}else if(r<2048){if((e-=2)<0)break;P.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;P.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;P.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return P}function lt(a){for(var e=[],r=0;r<a.length;++r)e.push(a.charCodeAt(r)&255);return e}function re(a,e){for(var r,y,S,P=[],Y=0;Y<a.length&&!((e-=2)<0);++Y)r=a.charCodeAt(Y),y=r>>8,S=r%256,P.push(S),P.push(y);return P}function Lt(a){return ie.toByteArray(Bt(a))}function ht(a,e,r,y){for(var S=0;S<y&&!(S+r>=e.length||S>=a.length);++S)e[S+r]=a[S];return S}function q(a,e){return a instanceof e||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===e.name}function ut(a){return a!==a}var nt=function(){for(var a="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var y=r*16,S=0;S<16;++S)e[y+S]=a[r]+a[S];return e}()}),dr=C.Buffer,Ir=C.SlowBuffer,Dr=C.INSPECT_MAX_BYTES,Rr=C.kMaxLength,Et=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ensureBuffer=void 0;function h(d){if(C.Buffer.isBuffer(d))return d;if(ArrayBuffer.isView(d))return C.Buffer.from(d.buffer);if(d instanceof ArrayBuffer)return C.Buffer.from(d);throw new TypeError("Must use either Buffer or TypedArray")}t.ensureBuffer=h});st(Et);var Ur=Et.ensureBuffer,ce=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseUUID=void 0;let h=/^(?:[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 d(l){if(typeof l!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof l);if(!h.test(l))throw new TypeError("Invalid format for UUID: "+l);let f,u=new Uint8Array(16);return u[0]=(f=parseInt(l.slice(0,8),16))>>>24,u[1]=f>>>16&255,u[2]=f>>>8&255,u[3]=f&255,u[4]=(f=parseInt(l.slice(9,13),16))>>>8,u[5]=f&255,u[6]=(f=parseInt(l.slice(14,18),16))>>>8,u[7]=f&255,u[8]=(f=parseInt(l.slice(19,23),16))>>>8,u[9]=f&255,u[10]=(f=parseInt(l.slice(24,36),16))/1099511627776&255,u[11]=f/4294967296&255,u[12]=f>>>24&255,u[13]=f>>>16&255,u[14]=f>>>8&255,u[15]=f&255,u}t.parseUUID=d});st(ce);var Mr=ce.parseUUID,_t=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Binary=void 0;class h{constructor(l,f){if(l!=null&&typeof l!="string"&&!ArrayBuffer.isView(l)&&!(l instanceof ArrayBuffer)&&!Array.isArray(l))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=f??h.BSON_BINARY_SUBTYPE_DEFAULT,l==null?(this.buffer=C.Buffer.alloc(h.BUFFER_SIZE),this.position=0):(typeof l=="string"?this.buffer=C.Buffer.from(l,"binary"):Array.isArray(l)?this.buffer=C.Buffer.from(l):this.buffer=Et.ensureBuffer(l),this.position=this.buffer.byteLength)}put(l){if(typeof l=="string"&&l.length!==1)throw new TypeError("only accepts single character String");if(typeof l!="number"&&l.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let f;if(typeof l=="string"?f=l.charCodeAt(0):typeof l=="number"?f=l:f=l[0],f<0||f>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++]=f;else{let u=C.Buffer.alloc(h.BUFFER_SIZE+this.buffer.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u,this.buffer[this.position++]=f}}write(l,f){if(f=typeof f=="number"?f:this.position,this.buffer.length<f+l.length){let u=C.Buffer.alloc(this.buffer.length+l.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u}ArrayBuffer.isView(l)?(this.buffer.set(Et.ensureBuffer(l),f),this.position=f+l.byteLength>this.position?f+l.length:this.position):typeof l=="string"&&(this.buffer.write(l,f,l.length,"binary"),this.position=f+l.length>this.position?f+l.length:this.position)}read(l,f){return f=f&&f>0?f:this.position,this.buffer.slice(l,l+f)}value(l){return l=!!l,l&&this.buffer.length===this.position?this.buffer:l?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(l){return this.buffer.toString(l)}toExtendedJSON(l){l=l||{};let f=this.buffer.toString("base64"),u=Number(this.sub_type).toString(16);return l.legacy?{$binary:f,$type:u.length===1?"0"+u:u}:{$binary:{base64:f,subType:u.length===1?"0"+u:u}}}static fromExtendedJSON(l,f){f=f||{};let u,m;if("$binary"in l?f.legacy&&typeof l.$binary=="string"&&"$type"in l?(m=l.$type?parseInt(l.$type,16):0,u=C.Buffer.from(l.$binary,"base64")):typeof l.$binary!="string"&&(m=l.$binary.subType?parseInt(l.$binary.subType,16):0,u=C.Buffer.from(l.$binary.base64,"base64")):"$uuid"in l&&(m=4,u=C.Buffer.from(ce.parseUUID(l.$uuid))),!u)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(l)}`);return new h(u,m)}}t.Binary=h,h.BSON_BINARY_SUBTYPE_DEFAULT=0,h.BUFFER_SIZE=256,h.SUBTYPE_DEFAULT=0,h.SUBTYPE_FUNCTION=1,h.SUBTYPE_BYTE_ARRAY=2,h.SUBTYPE_UUID_OLD=3,h.SUBTYPE_UUID=4,h.SUBTYPE_MD5=5,h.SUBTYPE_USER_DEFINED=128,Object.defineProperty(h.prototype,"_bsontype",{value:"Binary"})});st(_t);var Pr=_t.Binary,mt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Code=void 0;class h{constructor(l,f){this.code=l,this.scope=f}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(l){return new h(l.$code,l.$scope)}}t.Code=h,Object.defineProperty(h.prototype,"_bsontype",{value:"Code"})});st(mt);var jr=mt.Code,nr={},ae;typeof Object.create=="function"?ae=function(t,h){t.super_=h,t.prototype=Object.create(h.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:ae=function(t,h){t.super_=h;var d=function(){};d.prototype=h.prototype,t.prototype=new d,t.prototype.constructor=t};var ir=ae,or=/%[sdj%]/g;function he(B){if(!Qt(B)){for(var t=[],h=0;h<arguments.length;h++)t.push(At(arguments[h]));return t.join(" ")}for(var h=1,d=arguments,l=d.length,f=String(B).replace(or,function(m){if(m==="%%")return"%";if(h>=l)return m;switch(m){case"%s":return String(d[h++]);case"%d":return Number(d[h++]);case"%j":try{return JSON.stringify(d[h++])}catch{return"[Circular]"}default:return m}}),u=d[h];h<l;u=d[++h])qt(u)||!Pt(u)?f+=" "+u:f+=" "+At(u);return f}function be(B,t){if(gt(global.process))return function(){return be(B,t).apply(this,arguments)};var h=!1;function d(){return h||(console.error(t),h=!0),B.apply(this,arguments)}return d}var Wt={},oe;function sr(B){if(gt(oe)&&(oe=""),B=B.toUpperCase(),!Wt[B])if(new RegExp("\\b"+B+"\\b","i").test(oe)){var t=0;Wt[B]=function(){var h=he.apply(null,arguments);console.error("%s %d: %s",B,t,h)}}else Wt[B]=function(){};return Wt[B]}function At(B,t){var h={seen:[],stylize:ar};return arguments.length>=3&&(h.depth=arguments[2]),arguments.length>=4&&(h.colors=arguments[3]),_e(t)?h.showHidden=t:t&&De(h,t),gt(h.showHidden)&&(h.showHidden=!1),gt(h.depth)&&(h.depth=2),gt(h.colors)&&(h.colors=!1),gt(h.customInspect)&&(h.customInspect=!0),h.colors&&(h.stylize=fr),Ht(h,B,h.depth)}At.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]};At.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function fr(B,t){var h=At.styles[t];return h?"\x1B["+At.colors[h][0]+"m"+B+"\x1B["+At.colors[h][1]+"m":B}function ar(B,t){return B}function ur(B){var t={};return B.forEach(function(h,d){t[h]=!0}),t}function Ht(B,t,h){if(B.customInspect&&t&&Kt(t.inspect)&&t.inspect!==At&&!(t.constructor&&t.constructor.prototype===t)){var d=t.inspect(h,B);return Qt(d)||(d=Ht(B,d,h)),d}var l=lr(B,t);if(l)return l;var f=Object.keys(t),u=ur(f);if(B.showHidden&&(f=Object.getOwnPropertyNames(t)),Xt(t)&&(f.indexOf("message")>=0||f.indexOf("description")>=0))return se(t);if(f.length===0){if(Kt(t)){var m=t.name?": "+t.name:"";return B.stylize("[Function"+m+"]","special")}if(kt(t))return B.stylize(RegExp.prototype.toString.call(t),"regexp");if(le(t))return B.stylize(Date.prototype.toString.call(t),"date");if(Xt(t))return se(t)}var o="",c=!1,_=["{","}"];if(de(t)&&(c=!0,_=["[","]"]),Kt(t)){var g=t.name?": "+t.name:"";o=" [Function"+g+"]"}if(kt(t)&&(o=" "+RegExp.prototype.toString.call(t)),le(t)&&(o=" "+Date.prototype.toUTCString.call(t)),Xt(t)&&(o=" "+se(t)),f.length===0&&(!c||t.length==0))return _[0]+o+_[1];if(h<0)return kt(t)?B.stylize(RegExp.prototype.toString.call(t),"regexp"):B.stylize("[Object]","special");B.seen.push(t);var n;return c?n=cr(B,t,h,u,f):n=f.map(function(w){return ue(B,t,h,u,w,c)}),B.seen.pop(),hr(n,o,_)}function lr(B,t){if(gt(t))return B.stylize("undefined","undefined");if(Qt(t)){var h="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return B.stylize(h,"string")}if(Ie(t))return B.stylize(""+t,"number");if(_e(t))return B.stylize(""+t,"boolean");if(qt(t))return B.stylize("null","null")}function se(B){return"["+Error.prototype.toString.call(B)+"]"}function cr(B,t,h,d,l){for(var f=[],u=0,m=t.length;u<m;++u)Re(t,String(u))?f.push(ue(B,t,h,d,String(u),!0)):f.push("");return l.forEach(function(o){o.match(/^\d+$/)||f.push(ue(B,t,h,d,o,!0))}),f}function ue(B,t,h,d,l,f){var u,m,o;if(o=Object.getOwnPropertyDescriptor(t,l)||{value:t[l]},o.get?o.set?m=B.stylize("[Getter/Setter]","special"):m=B.stylize("[Getter]","special"):o.set&&(m=B.stylize("[Setter]","special")),Re(d,l)||(u="["+l+"]"),m||(B.seen.indexOf(o.value)<0?(qt(h)?m=Ht(B,o.value,null):m=Ht(B,o.value,h-1),m.indexOf(`
|
|
8
|
+
`)>-1&&(f?m=m.split(`
|
|
9
9
|
`).map(function(c){return" "+c}).join(`
|
|
10
|
-
`).substr(2):
|
|
11
|
-
`+
|
|
10
|
+
`).substr(2):m=`
|
|
11
|
+
`+m.split(`
|
|
12
12
|
`).map(function(c){return" "+c}).join(`
|
|
13
|
-
`))):
|
|
14
|
-
`)>=0,l+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return
|
|
13
|
+
`))):m=B.stylize("[Circular]","special")),gt(u)){if(f&&l.match(/^\d+$/))return m;u=JSON.stringify(""+l),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=B.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=B.stylize(u,"string"))}return u+": "+m}function hr(B,t,h){var d=B.reduce(function(l,f){return f.indexOf(`
|
|
14
|
+
`)>=0,l+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return d>60?h[0]+(t===""?"":t+`
|
|
15
15
|
`)+" "+B.join(`,
|
|
16
|
-
`)+" "+y[1]:y[0]+e+" "+B.join(", ")+" "+y[1]}function Te(B){return Array.isArray(B)}function _e(B){return typeof B=="boolean"}function Qt(B){return B===null}function lr(B){return B==null}function Ie(B){return typeof B=="number"}function xt(B){return typeof B=="string"}function cr(B){return babelHelpers.typeof(B)==="symbol"}function pt(B){return B===void 0}function Xt(B){return Pt(B)&&ye(B)==="[object RegExp]"}function Pt(B){return babelHelpers.typeof(B)==="object"&&B!==null}function le(B){return Pt(B)&&ye(B)==="[object Date]"}function kt(B){return Pt(B)&&(ye(B)==="[object Error]"||B instanceof Error)}function Kt(B){return typeof B=="function"}function hr(B){return B===null||typeof B=="boolean"||typeof B=="number"||typeof B=="string"||babelHelpers.typeof(B)==="symbol"||typeof B>"u"}function _r(B){return Buffer.isBuffer(B)}function ye(B){return Object.prototype.toString.call(B)}function fe(B){return B<10?"0"+B.toString(10):B.toString(10)}var yr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Br(){var B=new Date,e=[fe(B.getHours()),fe(B.getMinutes()),fe(B.getSeconds())].join(":");return[B.getDate(),yr[B.getMonth()],e].join(" ")}function Nr(){console.log("%s - %s",Br(),he.apply(null,arguments))}function be(B,e){if(!e||!Pt(e))return B;for(var y=Object.keys(e),D=y.length;D--;)B[y[D]]=e[y[D]];return B}function De(B,e){return Object.prototype.hasOwnProperty.call(B,e)}var gr={inherits:er,_extend:be,log:Nr,isBuffer:_r,isPrimitive:hr,isFunction:Kt,isError:kt,isDate:le,isObject:Pt,isRegExp:Xt,isUndefined:pt,isSymbol:cr,isString:xt,isNumber:Ie,isNullOrUndefined:lr,isNull:Qt,isBoolean:_e,isArray:Te,inspect:Ot,deprecate:we,format:he,debuglog:nr},rt=ot(function(B,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 y(n){return n.toString().replace("function(","function (")}e.normalizedFunctionString=y;function D(n){let w=C.Buffer.alloc(n);for(let U=0;U<n;++U)w[U]=Math.floor(Math.random()*256);return w}if(e.randomBytes=D,typeof window<"u"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=n=>window.crypto.getRandomValues(C.Buffer.alloc(n));else{try{e.randomBytes=tr.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=D)}function l(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}e.isUint8Array=l;function f(n){return Object.prototype.toString.call(n)==="[object BigInt64Array]"}e.isBigInt64Array=f;function u(n){return Object.prototype.toString.call(n)==="[object BigUint64Array]"}e.isBigUInt64Array=u;function E(){return typeof Ht<"u"&&typeof Ht.Buffer<"u"}e.haveBuffer=E;function o(n){return E()&&C.Buffer.isBuffer(n)}e.isBuffer=o;function c(n){return h(n)&&Object.prototype.toString.call(n)==="[object Date]"}e.isDate=c;function h(n){return typeof n=="object"&&n!==null}e.isObjectLike=h;function p(n,w){if(typeof window>"u"||typeof self>"u")return gr.deprecate(n,w);let U=!1;function N(...Y){return U||(console.warn(w),U=!0),n.apply(this,...Y)}return N}e.deprecate=p});st(rt);var Mr=rt.deprecate,Pr=rt.isObjectLike,jr=rt.isDate,Yr=rt.isBuffer,vr=rt.haveBuffer,Fr=rt.isBigUInt64Array,Lr=rt.isBigInt64Array,Cr=rt.isUint8Array,zr=rt.randomBytes,Jr=rt.normalizedFunctionString,Nt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function y(l){return rt.isObjectLike(l)&&l.$id!=null&&l.$ref!=null}e.isDBRefLike=y;class D{constructor(f,u,E,o){let c=f.split(".");c.length===2&&(E=c.shift(),f=c.shift()),this.collection=f,this.oid=u,this.db=E,this.fields=o||{}}get namespace(){return this.collection}set namespace(f){this.collection=f}toJSON(){let f=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(f.$db=this.db),f}toExtendedJSON(f){f=f||{};let u={$ref:this.collection,$id:this.oid};return f.legacy||(this.db&&(u.$db=this.db),u=Object.assign(u,this.fields)),u}static fromExtendedJSON(f){let u=Object.assign({},f);return delete u.$ref,delete u.$id,delete u.$db,new D(f.$ref,f.$id,f.$db,u)}}e.DBRef=D,Object.defineProperty(D.prototype,"_bsontype",{value:"DBRef"})});st(Nt);var Wr=Nt.DBRef,Xr=Nt.isDBRefLike,K=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let y;try{y=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 D=1<<16,l=1<<24,f=D*D,u=f*f,E=u/2,o={},c={};class h{constructor(n=0,w=0,U){this.comp=h.prototype.compare,this.div=h.prototype.divide,this.eq=h.prototype.equals,this.gt=h.prototype.greaterThan,this.gte=h.prototype.greaterThanOrEqual,this.ge=h.prototype.greaterThanOrEqual,this.lt=h.prototype.lessThan,this.lte=h.prototype.lessThanOrEqual,this.mod=h.prototype.modulo,this.rem=h.prototype.modulo,this.mul=h.prototype.multiply,this.neg=h.prototype.negate,this.neq=h.prototype.notEquals,this.ne=h.prototype.notEquals,this.shl=h.prototype.shiftLeft,this.shr=h.prototype.shiftRight,this.shr_u=h.prototype.shiftRightUnsigned,this.shru=h.prototype.shiftRightUnsigned,this.sub=h.prototype.subtract,this.eqz=h.prototype.isZero,this.le=h.prototype.lessThanOrEqual,this.low=n|0,this.high=w|0,this.unsigned=!!U,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(n,w,U){return new h(n,w,U)}static fromInt(n,w){let U,N,Y;return w?(n>>>=0,(Y=0<=n&&n<256)&&(N=c[n],N)?N:(U=h.fromBits(n,(n|0)<0?-1:0,!0),Y&&(c[n]=U),U)):(n|=0,(Y=-128<=n&&n<128)&&(N=o[n],N)?N:(U=h.fromBits(n,n<0?-1:0,!1),Y&&(o[n]=U),U))}static fromNumber(n,w){if(isNaN(n))return w?h.UZERO:h.ZERO;if(w){if(n<0)return h.UZERO;if(n>=u)return h.MAX_UNSIGNED_VALUE}else{if(n<=-E)return h.MIN_VALUE;if(n+1>=E)return h.MAX_VALUE}return n<0?h.fromNumber(-n,w).neg():h.fromBits(n%f|0,n/f|0,w)}static fromBigInt(n,w){return h.fromString(n.toString(),w)}static fromString(n,w,U){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return h.ZERO;if(typeof w=="number"?(U=w,w=!1):w=!!w,U=U||10,U<2||36<U)throw RangeError("radix");let N;if((N=n.indexOf("-"))>0)throw Error("interior hyphen");if(N===0)return h.fromString(n.substring(1),w,U).neg();let Y=h.fromNumber(Math.pow(U,8)),J=h.ZERO;for(let R=0;R<n.length;R+=8){let W=Math.min(8,n.length-R),x=parseInt(n.substring(R,R+W),U);if(W<8){let G=h.fromNumber(Math.pow(U,W));J=J.mul(G).add(h.fromNumber(x))}else J=J.mul(Y),J=J.add(h.fromNumber(x))}return J.unsigned=w,J}static fromBytes(n,w,U){return U?h.fromBytesLE(n,w):h.fromBytesBE(n,w)}static fromBytesLE(n,w){return new h(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,w)}static fromBytesBE(n,w){return new h(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],w)}static isLong(n){return rt.isObjectLike(n)&&n.__isLong__===!0}static fromValue(n,w){return typeof n=="number"?h.fromNumber(n,w):typeof n=="string"?h.fromString(n,w):h.fromBits(n.low,n.high,typeof w=="boolean"?w:n.unsigned)}add(n){h.isLong(n)||(n=h.fromValue(n));let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y+x,V+=z>>>16,z&=65535,V+=N+W,M+=V>>>16,V&=65535,M+=U+R,G+=M>>>16,M&=65535,G+=w+J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}and(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low&n.low,this.high&n.high,this.unsigned)}compare(n){if(h.isLong(n)||(n=h.fromValue(n)),this.eq(n))return 0;let w=this.isNegative(),U=n.isNegative();return w&&!U?-1:!w&&U?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1}divide(n){if(h.isLong(n)||(n=h.fromValue(n)),n.isZero())throw Error("division by zero");if(y){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;let Y=(this.unsigned?y.div_u:y.div_s)(this.low,this.high,n.low,n.high);return h.fromBits(Y,y.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?h.UZERO:h.ZERO;let w,U,N;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return h.UZERO;if(n.gt(this.shru(1)))return h.UONE;N=h.UZERO}else{if(this.eq(h.MIN_VALUE))return n.eq(h.ONE)||n.eq(h.NEG_ONE)?h.MIN_VALUE:n.eq(h.MIN_VALUE)?h.ONE:(w=this.shr(1).div(n).shl(1),w.eq(h.ZERO)?n.isNegative()?h.ONE:h.NEG_ONE:(U=this.sub(n.mul(w)),N=w.add(U.div(n)),N));if(n.eq(h.MIN_VALUE))return this.unsigned?h.UZERO:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();N=h.ZERO}for(U=this;U.gte(n);){w=Math.max(1,Math.floor(U.toNumber()/n.toNumber()));let Y=Math.ceil(Math.log(w)/Math.LN2),J=Y<=48?1:Math.pow(2,Y-48),R=h.fromNumber(w),W=R.mul(n);for(;W.isNegative()||W.gt(U);)w-=J,R=h.fromNumber(w,this.unsigned),W=R.mul(n);R.isZero()&&(R=h.ONE),N=N.add(R),U=U.sub(W)}return N}equals(n){return h.isLong(n)||(n=h.fromValue(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.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(h.MIN_VALUE)?64:this.neg().getNumBitsAbs();let n=this.high!==0?this.high:this.low,w;for(w=31;w>0&&!(n&1<<w);w--);return this.high!==0?w+33:w+1}greaterThan(n){return this.comp(n)>0}greaterThanOrEqual(n){return this.comp(n)>=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(n){return this.comp(n)<0}lessThanOrEqual(n){return this.comp(n)<=0}modulo(n){if(h.isLong(n)||(n=h.fromValue(n)),y){let w=(this.unsigned?y.rem_u:y.rem_s)(this.low,this.high,n.low,n.high);return h.fromBits(w,y.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))}multiply(n){if(this.isZero())return h.ZERO;if(h.isLong(n)||(n=h.fromValue(n)),y){let Z=y.mul(this.low,this.high,n.low,n.high);return h.fromBits(Z,y.get_high(),this.unsigned)}if(n.isZero())return h.ZERO;if(this.eq(h.MIN_VALUE))return n.isOdd()?h.MIN_VALUE:h.ZERO;if(n.eq(h.MIN_VALUE))return this.isOdd()?h.MIN_VALUE:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(h.TWO_PWR_24)&&n.lt(h.TWO_PWR_24))return h.fromNumber(this.toNumber()*n.toNumber(),this.unsigned);let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y*x,V+=z>>>16,z&=65535,V+=N*x,M+=V>>>16,V&=65535,V+=Y*W,M+=V>>>16,V&=65535,M+=U*x,G+=M>>>16,M&=65535,M+=N*W,G+=M>>>16,M&=65535,M+=Y*R,G+=M>>>16,M&=65535,G+=w*x+U*W+N*R+Y*J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}negate(){return!this.unsigned&&this.eq(h.MIN_VALUE)?h.MIN_VALUE:this.not().add(h.ONE)}not(){return h.fromBits(~this.low,~this.high,this.unsigned)}notEquals(n){return!this.equals(n)}or(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low|n.low,this.high|n.high,this.unsigned)}shiftLeft(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):h.fromBits(0,this.low<<n-32,this.unsigned)}shiftRight(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):h.fromBits(this.high>>n-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(n){if(h.isLong(n)&&(n=n.toInt()),n&=63,n===0)return this;{let w=this.high;if(n<32){let U=this.low;return h.fromBits(U>>>n|w<<32-n,w>>>n,this.unsigned)}else return n===32?h.fromBits(w,0,this.unsigned):h.fromBits(w>>>n-32,0,this.unsigned)}}subtract(n){return h.isLong(n)||(n=h.fromValue(n)),this.add(n.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(n){return n?this.toBytesLE():this.toBytesBE()}toBytesLE(){let n=this.high,w=this.low;return[w&255,w>>>8&255,w>>>16&255,w>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]}toBytesBE(){let n=this.high,w=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,w>>>24,w>>>16&255,w>>>8&255,w&255]}toSigned(){return this.unsigned?h.fromBits(this.low,this.high,!1):this}toString(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(h.MIN_VALUE)){let Y=h.fromNumber(n),J=this.div(Y),R=J.mul(Y).sub(this);return J.toString(n)+R.toInt().toString(n)}else return"-"+this.neg().toString(n);let w=h.fromNumber(Math.pow(n,6),this.unsigned),U=this,N="";for(;;){let Y=U.div(w),R=(U.sub(Y.mul(w)).toInt()>>>0).toString(n);if(U=Y,U.isZero())return R+N;for(;R.length<6;)R="0"+R;N=""+R+N}}toUnsigned(){return this.unsigned?this:h.fromBits(this.low,this.high,!0)}xor(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low^n.low,this.high^n.high,this.unsigned)}toExtendedJSON(n){return n&&n.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(n,w){let U=h.fromString(n.$numberLong);return w&&w.relaxed?U.toNumber():U}}e.Long=h,h.TWO_PWR_24=h.fromInt(l),h.MAX_UNSIGNED_VALUE=h.fromBits(-1,-1,!0),h.ZERO=h.fromInt(0),h.UZERO=h.fromInt(0,!0),h.ONE=h.fromInt(1),h.UONE=h.fromInt(1,!0),h.NEG_ONE=h.fromInt(-1),h.MAX_VALUE=h.fromBits(-1,2147483647,!1),h.MIN_VALUE=h.fromBits(0,-2147483648,!1),Object.defineProperty(h.prototype,"__isLong__",{value:!0}),Object.defineProperty(h.prototype,"_bsontype",{value:"Long"})});st(K);var kr=K.Long,dt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let y=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,D=/^(\+|-)?(Infinity|inf)$/i,l=/^(\+|-)?NaN$/i,f=6111,u=-6176,E=6176,o=34,c=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),h=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),p=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),n=/^([-+])?(\d+)?$/,w=31,U=16383,N=30,Y=31;function J(V){return!isNaN(parseInt(V,10))}function R(V){let z=K.Long.fromNumber(1e9),Z=K.Long.fromNumber(0);if(!V.parts[0]&&!V.parts[1]&&!V.parts[2]&&!V.parts[3])return{quotient:V,rem:Z};for(let s=0;s<=3;s++)Z=Z.shiftLeft(32),Z=Z.add(new K.Long(V.parts[s],0)),V.parts[s]=Z.div(z).low,Z=Z.modulo(z);return{quotient:V,rem:Z}}function W(V,z){if(!V&&!z)return{high:K.Long.fromNumber(0),low:K.Long.fromNumber(0)};let Z=V.shiftRightUnsigned(32),s=new K.Long(V.getLowBits(),0),A=z.shiftRightUnsigned(32),O=new K.Long(z.getLowBits(),0),i=Z.multiply(A),m=Z.multiply(O),b=s.multiply(A),j=s.multiply(O);return i=i.add(m.shiftRightUnsigned(32)),m=new K.Long(m.getLowBits(),0).add(b).add(j.shiftRightUnsigned(32)),i=i.add(m.shiftRightUnsigned(32)),j=m.shiftLeft(32).add(new K.Long(j.getLowBits(),0)),{high:i,low:j}}function x(V,z){let Z=V.high>>>0,s=z.high>>>0;if(Z<s)return!0;if(Z===s){let A=V.low>>>0,O=z.low>>>0;if(A<O)return!0}return!1}function G(V,z){throw new TypeError(`"${V}" is not a valid Decimal128 string - ${z}`)}class M{constructor(z){this.bytes=z}static fromString(z){let Z=!1,s=!1,A=!1,O=0,i=0,m=0,b=0,j=0,F=[0],g=0,$=0,L=0,T=0,d=0,q=0,X=new K.Long(0,0),et=new K.Long(0,0),Bt=0,k=0;if(z.length>=7e3)throw new TypeError(""+z+" not a valid Decimal128 string");let lt=z.match(y),re=z.match(D),Ft=z.match(l);if(!lt&&!re&&!Ft||z.length===0)throw new TypeError(""+z+" not a valid Decimal128 string");if(lt){let nt=lt[2],a=lt[4],t=lt[5],r=lt[6];a&&r===void 0&&G(z,"missing exponent power"),a&&nt===void 0&&G(z,"missing exponent base"),a===void 0&&(t||r)&&G(z,"missing e before exponent")}if((z[k]==="+"||z[k]==="-")&&(Z=z[k++]==="-"),!J(z[k])&&z[k]!=="."){if(z[k]==="i"||z[k]==="I")return new M(C.Buffer.from(Z?h:p));if(z[k]==="N")return new M(C.Buffer.from(c))}for(;J(z[k])||z[k]===".";){if(z[k]==="."){s&&G(z,"contains multiple periods"),s=!0,k=k+1;continue}g<34&&(z[k]!=="0"||A)&&(A||(j=i),A=!0,F[$++]=parseInt(z[k],10),g=g+1),A&&(m=m+1),s&&(b=b+1),i=i+1,k=k+1}if(s&&!i)throw new TypeError(""+z+" not a valid Decimal128 string");if(z[k]==="e"||z[k]==="E"){let nt=z.substr(++k).match(n);if(!nt||!nt[2])return new M(C.Buffer.from(c));d=parseInt(nt[0],10),k=k+nt[0].length}if(z[k])return new M(C.Buffer.from(c));if(L=0,!g)L=0,T=0,F[0]=0,m=1,g=1,O=0;else if(T=g-1,O=m,O!==1)for(;z[j+O-1]==="0";)O=O-1;for(d<=b&&b-d>1<<14?d=u:d=d-b;d>f;){if(T=T+1,T-L>o){if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}d=d-1}for(;d<u||g<m;){if(T===0&&O<g){d=u,O=0;break}if(g<m?m=m-1:T=T-1,d<f)d=d+1;else{if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}}if(T-L+1<O){let nt=i;s&&(j=j+1,nt=nt+1),Z&&(j=j+1,nt=nt+1);let a=parseInt(z[j+T+1],10),t=0;if(a>=5&&(t=1,a===5)){for(t=F[T]%2===1?1:0,q=j+T+2;q<nt;q++)if(parseInt(z[q],10)){t=1;break}}if(t){let r=T;for(;r>=0;r--)if(++F[r]>9&&(F[r]=0,r===0))if(d<f)d=d+1,F[r]=1;else return new M(C.Buffer.from(Z?h:p))}}if(X=K.Long.fromNumber(0),et=K.Long.fromNumber(0),O===0)X=K.Long.fromNumber(0),et=K.Long.fromNumber(0);else if(T-L<17){let nt=L;for(et=K.Long.fromNumber(F[nt++]),X=new K.Long(0,0);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}else{let nt=L;for(X=K.Long.fromNumber(F[nt++]);nt<=T-17;nt++)X=X.multiply(K.Long.fromNumber(10)),X=X.add(K.Long.fromNumber(F[nt]));for(et=K.Long.fromNumber(F[nt++]);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}let ht=W(X,K.Long.fromString("100000000000000000"));ht.low=ht.low.add(et),x(ht.low,et)&&(ht.high=ht.high.add(K.Long.fromNumber(1))),Bt=d+E;let Q={low:K.Long.fromNumber(0),high:K.Long.fromNumber(0)};ht.high.shiftRightUnsigned(49).and(K.Long.fromNumber(1)).equals(K.Long.fromNumber(1))?(Q.high=Q.high.or(K.Long.fromNumber(3).shiftLeft(61)),Q.high=Q.high.or(K.Long.fromNumber(Bt).and(K.Long.fromNumber(16383).shiftLeft(47))),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(0x7fffffffffff)))):(Q.high=Q.high.or(K.Long.fromNumber(Bt&16383).shiftLeft(49)),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(562949953421311)))),Q.low=ht.low,Z&&(Q.high=Q.high.or(K.Long.fromString("9223372036854775808")));let ut=C.Buffer.alloc(16);return k=0,ut[k++]=Q.low.low&255,ut[k++]=Q.low.low>>8&255,ut[k++]=Q.low.low>>16&255,ut[k++]=Q.low.low>>24&255,ut[k++]=Q.low.high&255,ut[k++]=Q.low.high>>8&255,ut[k++]=Q.low.high>>16&255,ut[k++]=Q.low.high>>24&255,ut[k++]=Q.high.low&255,ut[k++]=Q.high.low>>8&255,ut[k++]=Q.high.low>>16&255,ut[k++]=Q.high.low>>24&255,ut[k++]=Q.high.high&255,ut[k++]=Q.high.high>>8&255,ut[k++]=Q.high.high>>16&255,ut[k++]=Q.high.high>>24&255,new M(ut)}toString(){let z,Z=0,s=new Array(36);for(let k=0;k<s.length;k++)s[k]=0;let A=0,O=!1,i,m={parts:[0,0,0,0]},b,j,F=[];A=0;let g=this.bytes,$=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,L=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,T=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,d=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24;A=0,{low:new K.Long($,L),high:new K.Long(T,d)}.high.lessThan(K.Long.ZERO)&&F.push("-");let X=d>>26&w;if(X>>3===3){if(X===N)return F.join("")+"Infinity";if(X===Y)return"NaN";z=d>>15&U,i=8+(d>>14&1)}else i=d>>14&7,z=d>>17&U;let et=z-E;if(m.parts[0]=(d&16383)+((i&15)<<14),m.parts[1]=T,m.parts[2]=L,m.parts[3]=$,m.parts[0]===0&&m.parts[1]===0&&m.parts[2]===0&&m.parts[3]===0)O=!0;else for(j=3;j>=0;j--){let k=0,lt=R(m);if(m=lt.quotient,k=lt.rem.low,!!k)for(b=8;b>=0;b--)s[j*9+b]=k%10,k=Math.floor(k/10)}if(O)Z=1,s[A]=0;else for(Z=36;!s[A];)Z=Z-1,A=A+1;let Bt=Z-1+et;if(Bt>=34||Bt<=-7||et>0){if(Z>34)return F.push(`${0}`),et>0?F.push("E+"+et):et<0&&F.push("E"+et),F.join("");F.push(`${s[A++]}`),Z=Z-1,Z&&F.push(".");for(let k=0;k<Z;k++)F.push(`${s[A++]}`);F.push("E"),Bt>0?F.push("+"+Bt):F.push(`${Bt}`)}else if(et>=0)for(let k=0;k<Z;k++)F.push(`${s[A++]}`);else{let k=Z+et;if(k>0)for(let lt=0;lt<k;lt++)F.push(`${s[A++]}`);else F.push("0");for(F.push(".");k++<0;)F.push("0");for(let lt=0;lt<Z-Math.max(k-1,0);lt++)F.push(`${s[A++]}`)}return F.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(z){return M.fromString(z.$numberDecimal)}}e.Decimal128=M,Object.defineProperty(M.prototype,"_bsontype",{value:"Decimal128"})});st(dt);var Kr=dt.Decimal128,It=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){if(l&&(l.legacy||l.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let f;return Number.isInteger(this.value)?(f=this.value.toFixed(1),f.length>=13&&(f=this.value.toExponential(13).toUpperCase())):f=this.value.toString(),{$numberDouble:f}}static fromExtendedJSON(l,f){let u=parseFloat(l.$numberDouble);return f&&f.relaxed?u:new y(u)}}e.Double=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Double"})});st(It);var Hr=It.Double,bt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){return l&&(l.relaxed||l.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(l,f){return f&&f.relaxed?parseInt(l.$numberInt,10):new y(l.$numberInt)}}e.Int32=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Int32"})});st(bt);var Gr=bt.Int32,$t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let y;e.Map=y;let D=function(u){return u&&u.Math==Math&&u};function l(){return D(typeof globalThis=="object"&&globalThis)||D(typeof window=="object"&&window)||D(typeof self=="object"&&self)||D(typeof Ht=="object"&&Ht)||Function("return this")()}let f=l();Object.prototype.hasOwnProperty.call(f,"Map")?e.Map=y=f.Map:e.Map=y=class{constructor(E=[]){this._keys=[],this._values={};for(let o=0;o<E.length;o++){if(E[o]==null)continue;let c=E[o],h=c[0],p=c[1];this._keys.push(h),this._values[h]={v:p,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(E){let o=this._values[E];return o==null?!1:(delete this._values[E],this._keys.splice(o.i,1),!0)}entries(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?[o,this._values[o].v]:void 0,done:o===void 0}}}}forEach(E,o){o=o||this;for(let c=0;c<this._keys.length;c++){let h=this._keys[c];E.call(o,this._values[h].v,h,o)}}get(E){return this._values[E]?this._values[E].v:void 0}has(E){return this._values[E]!=null}keys(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?o:void 0,done:o===void 0}}}}set(E,o){return this._values[E]?(this._values[E].v=o,this):(this._keys.push(E),this._values[E]={v:o,i:this._keys.length-1},this)}values(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?this._values[o].v:void 0,done:o===void 0}}}}get size(){return this._keys.length}}});st($t);var Zr=$t.Map,Rt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class y{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new y}}e.MaxKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MaxKey"})});st(Rt);var qr=Rt.MaxKey,Ut=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class y{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new y}}e.MinKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MinKey"})});st(Ut);var Qr=Ut.MinKey,St=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let y=rt.randomBytes(5),D=new RegExp("^[0-9a-fA-F]{24}$"),l=[];for(let h=0;h<256;h++)l[h]=(h<=15?"0":"")+h.toString(16);let f=[],u=0;for(;u<10;)f[48+u]=u++;for(;u<16;)f[65-10+u]=f[97-10+u]=u++;let E=Symbol("id");class o{constructor(p){if(p instanceof o&&(this[E]=p.id,this.__id=p.__id),typeof p=="object"&&p&&"id"in p&&("toHexString"in p&&typeof p.toHexString=="function"?this[E]=C.Buffer.from(p.toHexString(),"hex"):this[E]=typeof p.id=="string"?C.Buffer.from(p.id):p.id),(p==null||typeof p=="number")&&(this[E]=o.generate(typeof p=="number"?p:void 0),o.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(p)&&p.byteLength===12&&(this[E]=mt.ensureBuffer(p)),typeof p=="string")if(p.length===12){let n=C.Buffer.from(p);n.byteLength===12&&(this[E]=n)}else if(p.length===24&&D.test(p))this[E]=C.Buffer.from(p,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");o.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[E]}set id(p){this[E]=p,o.cacheHexString&&(this.__id=p.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(p){this.id.writeUInt32BE(p,0)}toHexString(){if(o.cacheHexString&&this.__id)return this.__id;let p=this.id.toString("hex");return o.cacheHexString&&!this.__id&&(this.__id=p),p}static getInc(){return o.index=(o.index+1)%16777215}static generate(p){typeof p!="number"&&(p=~~(Date.now()/1e3));let n=o.getInc(),w=C.Buffer.alloc(12);return w.writeUInt32BE(p,0),w[4]=y[0],w[5]=y[1],w[6]=y[2],w[7]=y[3],w[8]=y[4],w[11]=n&255,w[10]=n>>8&255,w[9]=n>>16&255,w}toString(p){return p?this.id.toString(p):this.toHexString()}toJSON(){return this.toHexString()}equals(p){return p==null?!1:p instanceof o?this.toString()===p.toString():typeof p=="string"&&o.isValid(p)&&p.length===12&&this.id instanceof C.Buffer?p===this.id.toString("binary"):typeof p=="string"&&o.isValid(p)&&p.length===24?p.toLowerCase()===this.toHexString():typeof p=="string"&&o.isValid(p)&&p.length===12?C.Buffer.from(p).equals(this.id):typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?p.toHexString()===this.toHexString():!1}getTimestamp(){let p=new Date,n=this.id.readUInt32BE(0);return p.setTime(Math.floor(n)*1e3),p}static createPk(){return new o}static createFromTime(p){let n=C.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(p,0),new o(n)}static createFromHexString(p){if(typeof p>"u"||p!=null&&p.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 o(C.Buffer.from(p,"hex"))}static isValid(p){return p==null?!1:typeof p=="number"?!0:typeof p=="string"?p.length===12||p.length===24&&D.test(p):p instanceof o||p instanceof C.Buffer&&p.length===12?!0:typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?typeof p.id=="string"?p.id.length===12:p.toHexString().length===24&&D.test(p.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(p){return new o(p.$oid)}}e.ObjectId=o,o.index=~~(Math.random()*16777215),Object.defineProperty(o.prototype,"generate",{value:rt.deprecate(h=>o.generate(h),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(o.prototype,"getInc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o.prototype,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")});let c=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(o.prototype,c,o.prototype.toString),Object.defineProperty(o.prototype,"inspect",o.prototype.toString),Object.defineProperty(o.prototype,"_bsontype",{value:"ObjectID"})});st(St);var xr=St.ObjectId,I=ot(function(B,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});st(I);var $r=I.BSON_BINARY_SUBTYPE_USER_DEFINED,tn=I.BSON_BINARY_SUBTYPE_MD5,en=I.BSON_BINARY_SUBTYPE_UUID_NEW,rn=I.BSON_BINARY_SUBTYPE_UUID,nn=I.BSON_BINARY_SUBTYPE_BYTE_ARRAY,on=I.BSON_BINARY_SUBTYPE_FUNCTION,sn=I.BSON_BINARY_SUBTYPE_DEFAULT,fn=I.BSON_DATA_MAX_KEY,an=I.BSON_DATA_MIN_KEY,un=I.BSON_DATA_DECIMAL128,ln=I.BSON_DATA_LONG,cn=I.BSON_DATA_TIMESTAMP,hn=I.BSON_DATA_INT,_n=I.BSON_DATA_CODE_W_SCOPE,yn=I.BSON_DATA_SYMBOL,Bn=I.BSON_DATA_CODE,Nn=I.BSON_DATA_DBPOINTER,gn=I.BSON_DATA_REGEXP,pn=I.BSON_DATA_NULL,On=I.BSON_DATA_DATE,Sn=I.BSON_DATA_BOOLEAN,An=I.BSON_DATA_OID,En=I.BSON_DATA_UNDEFINED,mn=I.BSON_DATA_BINARY,wn=I.BSON_DATA_ARRAY,Tn=I.BSON_DATA_OBJECT,In=I.BSON_DATA_STRING,bn=I.BSON_DATA_NUMBER,Dn=I.JS_INT_MIN,dn=I.JS_INT_MAX,Rn=I.BSON_INT64_MIN,Un=I.BSON_INT64_MAX,Mn=I.BSON_INT32_MIN,Pn=I.BSON_INT32_MAX,Be=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function y(l,f,u){let E=5;if(Array.isArray(l))for(let o=0;o<l.length;o++)E+=D(o.toString(),l[o],f,!0,u);else{l.toBSON&&(l=l.toBSON());for(let o in l)E+=D(o,l[o],f,!1,u)}return E}e.calculateObjectSize=y;function D(l,f,u=!1,E=!1,o=!1){switch(f&&f.toBSON&&(f=f.toBSON()),typeof f){case"string":return 1+C.Buffer.byteLength(l,"utf8")+1+4+C.Buffer.byteLength(f,"utf8")+1;case"number":return Math.floor(f)===f&&f>=I.JS_INT_MIN&&f<=I.JS_INT_MAX&&f>=I.BSON_INT32_MIN&&f<=I.BSON_INT32_MAX?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(4+1):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);case"undefined":return E||!o?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1:0;case"boolean":return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+1);case"object":if(f==null||f._bsontype==="MinKey"||f._bsontype==="MaxKey")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1;if(f._bsontype==="ObjectId"||f._bsontype==="ObjectID")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(12+1);if(f instanceof Date||rt.isDate(f))return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(f)||f instanceof ArrayBuffer)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+4+1)+f.byteLength;if(f._bsontype==="Long"||f._bsontype==="Double"||f._bsontype==="Timestamp")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(f._bsontype==="Decimal128")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(16+1);if(f._bsontype==="Code")return f.scope!=null&&Object.keys(f.scope).length>0?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1+y(f.scope,u,o):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1;if(f._bsontype==="Binary")return f.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1+4):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1);if(f._bsontype==="Symbol")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+C.Buffer.byteLength(f.value,"utf8")+4+1+1;if(f._bsontype==="DBRef"){let c=Object.assign({$ref:f.collection,$id:f.oid},f.fields);return f.db!=null&&(c.$db=f.db),(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+y(c,u,o)}else return f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1:f._bsontype==="BSONRegExp"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.pattern,"utf8")+1+C.Buffer.byteLength(f.options,"utf8")+1:(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+y(f,u,o)+1;case"function":if(f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"||String.call(f)==="[object RegExp]")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1;if(u&&f.scope!=null&&Object.keys(f.scope).length>0)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1+y(f.scope,u,o);if(u)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1}return 0}});st(Be);var jn=Be.calculateObjectSize,At=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function y(l){return l.split("").sort().join("")}class D{constructor(f,u){this.pattern=f,this.options=u??"",y(this.options);for(let E=0;E<this.options.length;E++)if(!(this.options[E]==="i"||this.options[E]==="m"||this.options[E]==="x"||this.options[E]==="l"||this.options[E]==="s"||this.options[E]==="u"))throw new Error(`The regular expression option [${this.options[E]}] is not supported`)}static parseOptions(f){return f?f.split("").sort().join(""):""}toExtendedJSON(f){return f=f||{},f.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(f){if("$regex"in f)if(typeof f.$regex!="string"){if(f.$regex._bsontype==="BSONRegExp")return f}else return new D(f.$regex,D.parseOptions(f.$options));if("$regularExpression"in f)return new D(f.$regularExpression.pattern,D.parseOptions(f.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(f)}`)}}e.BSONRegExp=D,Object.defineProperty(D.prototype,"_bsontype",{value:"BSONRegExp"})});st(At);var Yn=At.BSONRegExp,Mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class y{constructor(l){this.value=l}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(l){return new y(l.$symbol)}}e.BSONSymbol=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Symbol"})});st(Mt);var vn=Mt.BSONSymbol,wt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=K.Long;class y extends e.LongWithoutOverridesClass{constructor(l,f){K.Long.isLong(l)?super(l.low,l.high,!0):super(l,f,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(l){return new y(K.Long.fromInt(l,!0))}static fromNumber(l){return new y(K.Long.fromNumber(l,!0))}static fromBits(l,f){return new y(l,f)}static fromString(l,f){return new y(K.Long.fromString(l,!0,f))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(l){return new y(l.$timestamp.i,l.$timestamp.t)}}e.Timestamp=y,y.MAX_VALUE=K.Long.MAX_UNSIGNED_VALUE});st(wt);var Fn=wt.Timestamp,Ln=wt.LongWithoutOverridesClass,Vt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let y=128,D=192,l=224,f=240,u=248,E=192,o=224,c=240,h=128;function p(n,w,U){let N=0;for(let Y=w;Y<U;Y+=1){let J=n[Y];if(N){if((J&D)!==h)return!1;N-=1}else if(J&y)if((J&l)===E)N=1;else if((J&f)===o)N=2;else if((J&u)===c)N=3;else return!1}return!N}e.validateUtf8=p});st(Vt);var Cn=Vt.validateUtf8,Zt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let y=K.Long.fromNumber(I.JS_INT_MAX),D=K.Long.fromNumber(I.JS_INT_MIN),l={};function f(o,c,h){c=c??{};let p=c&&c.index?c.index:0,n=o[p]|o[p+1]<<8|o[p+2]<<16|o[p+3]<<24;if(n<5)throw new Error(`bson size must be >= 5, is ${n}`);if(c.allowObjectSmallerThanBufferSize&&o.length<n)throw new Error(`buffer length ${o.length} must be >= bson size ${n}`);if(!c.allowObjectSmallerThanBufferSize&&o.length!==n)throw new Error(`buffer length ${o.length} must === bson size ${n}`);if(n+p>o.byteLength)throw new Error(`(bson size ${n} + options.index ${p} must be <= buffer length ${o.byteLength})`);if(o[p+n-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return u(o,p,c,h)}e.deserialize=f;function u(o,c,h,p=!1){let n=h.evalFunctions==null?!1:h.evalFunctions,w=h.cacheFunctions==null?!1:h.cacheFunctions,U=h.fieldsAsRaw==null?null:h.fieldsAsRaw,N=h.raw==null?!1:h.raw,Y=typeof h.bsonRegExp=="boolean"?h.bsonRegExp:!1,J=h.promoteBuffers==null?!1:h.promoteBuffers,R=h.promoteLongs==null?!0:h.promoteLongs,W=h.promoteValues==null?!0:h.promoteValues,x=c;if(o.length<5)throw new Error("corrupt bson message < 5 bytes long");let G=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(G<5||G>o.length)throw new Error("corrupt bson message");let M=p?[]:{},V=0,z=!1;for(;!z;){let A=o[c++];if(A===0)break;let O=c;for(;o[O]!==0&&O<o.length;)O++;if(O>=o.byteLength)throw new Error("Bad BSON Document: illegal CString");let i=p?V++:o.toString("utf8",c,O);if(c=O+1,A===I.BSON_DATA_STRING){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let b=o.toString("utf8",c,c+m-1);M[i]=b,c=c+m}else if(A===I.BSON_DATA_OID){let m=C.Buffer.alloc(12);o.copy(m,0,c,c+12),M[i]=new St.ObjectId(m),c=c+12}else if(A===I.BSON_DATA_INT&&W===!1)M[i]=new bt.Int32(o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24);else if(A===I.BSON_DATA_INT)M[i]=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;else if(A===I.BSON_DATA_NUMBER&&W===!1)M[i]=new It.Double(o.readDoubleLE(c)),c=c+8;else if(A===I.BSON_DATA_NUMBER)M[i]=o.readDoubleLE(c),c=c+8;else if(A===I.BSON_DATA_DATE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new Date(new K.Long(m,b).toNumber())}else if(A===I.BSON_DATA_BOOLEAN){if(o[c]!==0&&o[c]!==1)throw new Error("illegal boolean type value");M[i]=o[c++]===1}else if(A===I.BSON_DATA_OBJECT){let m=c,b=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24;if(b<=0||b>o.length-c)throw new Error("bad embedded document length in bson");N?M[i]=o.slice(c,c+b):M[i]=u(o,m,h,!1),c=c+b}else if(A===I.BSON_DATA_ARRAY){let m=c,b=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,j=h,F=c+b;if(U&&U[i]){j={};for(let g in h)j[g]=h[g];j.raw=!0}if(M[i]=u(o,m,j,!0),c=c+b,o[c-1]!==0)throw new Error("invalid array terminator byte");if(c!==F)throw new Error("corrupted array bson")}else if(A===I.BSON_DATA_UNDEFINED)M[i]=void 0;else if(A===I.BSON_DATA_NULL)M[i]=null;else if(A===I.BSON_DATA_LONG){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,j=new K.Long(m,b);R&&W===!0?M[i]=j.lessThanOrEqual(y)&&j.greaterThanOrEqual(D)?j.toNumber():j:M[i]=j}else if(A===I.BSON_DATA_DECIMAL128){let m=C.Buffer.alloc(16);o.copy(m,0,c,c+16),c=c+16;let b=new dt.Decimal128(m);"toObject"in b&&typeof b.toObject=="function"?M[i]=b.toObject():M[i]=b}else if(A===I.BSON_DATA_BINARY){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=m,j=o[c++];if(m<0)throw new Error("Negative binary type element size found");if(m>o.byteLength)throw new Error("Binary type size larger than document size");if(o.slice!=null){if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>b-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<b-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}J&&W?M[i]=o.slice(c,c+m):M[i]=new _t.Binary(o.slice(c,c+m),j)}else{let F=C.Buffer.alloc(m);if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>b-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<b-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(O=0;O<m;O++)F[O]=o[c+O];J&&W?M[i]=F:M[i]=new _t.Binary(F,j)}c=c+m}else if(A===I.BSON_DATA_REGEXP&&Y===!1){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let b=o.toString("utf8",c,O);c=O+1;let j=new Array(b.length);for(O=0;O<b.length;O++)switch(b[O]){case"m":j[O]="m";break;case"s":j[O]="g";break;case"i":j[O]="i";break}M[i]=new RegExp(m,j.join(""))}else if(A===I.BSON_DATA_REGEXP&&Y===!0){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let b=o.toString("utf8",c,O);c=O+1,M[i]=new At.BSONRegExp(m,b)}else if(A===I.BSON_DATA_SYMBOL){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let b=o.toString("utf8",c,c+m-1);M[i]=W?b:new Mt.BSONSymbol(b),c=c+m}else if(A===I.BSON_DATA_TIMESTAMP){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new wt.Timestamp(m,b)}else if(A===I.BSON_DATA_MIN_KEY)M[i]=new Ut.MinKey;else if(A===I.BSON_DATA_MAX_KEY)M[i]=new Rt.MaxKey;else if(A===I.BSON_DATA_CODE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let b=o.toString("utf8",c,c+m-1);n?w?M[i]=E(b,l,M):M[i]=E(b):M[i]=new Et.Code(b),c=c+m}else if(A===I.BSON_DATA_CODE_W_SCOPE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(b<=0||b>o.length-c||o[c+b-1]!==0)throw new Error("bad string length in bson");let j=o.toString("utf8",c,c+b-1);c=c+b;let F=c,g=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,$=u(o,F,h,!1);if(c=c+g,m<4+4+g+b)throw new Error("code_w_scope total size is too short, truncating scope");if(m>4+4+g+b)throw new Error("code_w_scope total size is too long, clips outer document");n?(w?M[i]=E(j,l,M):M[i]=E(j),M[i].scope=$):M[i]=new Et.Code(j,$)}else if(A===I.BSON_DATA_DBPOINTER){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let b=o.toString("utf8",c,c+m-1);c=c+m;let j=C.Buffer.alloc(12);o.copy(j,0,c,c+12);let F=new St.ObjectId(j);c=c+12,M[i]=new Nt.DBRef(b,F)}else throw new Error("Detected unknown BSON type "+A.toString(16)+' for fieldname "'+i+'"')}if(G!==c-x)throw p?new Error("corrupt array bson"):new Error("corrupt object bson");let Z=Object.keys(M).filter(A=>A.startsWith("$")),s=!0;if(Z.forEach(A=>{["$ref","$id","$db"].indexOf(A)===-1&&(s=!1)}),!s)return M;if(Nt.isDBRefLike(M)){let A=Object.assign({},M);return delete A.$ref,delete A.$id,delete A.$db,new Nt.DBRef(M.$ref,M.$id,M.$db,A)}return M}function E(o,c,h){return c?(c[o]==null&&(c[o]=new Function(o)),c[o].bind(h)):new Function(o)}});st(Zt);var zn=Zt.deserialize,Yt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function y(N){return rt.isObjectLike(N)&&Reflect.has(N,"_bsontype")&&typeof N._bsontype=="string"}e.isBSONType=y;let D=2147483647,l=-2147483648,f=9223372036854776e3,u=-9223372036854776e3,E={$oid:St.ObjectId,$binary:_t.Binary,$uuid:_t.Binary,$symbol:Mt.BSONSymbol,$numberInt:bt.Int32,$numberDecimal:dt.Decimal128,$numberDouble:It.Double,$numberLong:K.Long,$minKey:Ut.MinKey,$maxKey:Rt.MaxKey,$regex:At.BSONRegExp,$regularExpression:At.BSONRegExp,$timestamp:wt.Timestamp};function o(N,Y={}){if(typeof N=="number"){if(Y.relaxed||Y.legacy)return N;if(Math.floor(N)===N){if(N>=l&&N<=D)return new bt.Int32(N);if(N>=u&&N<=f)return K.Long.fromNumber(N)}return new It.Double(N)}if(N==null||typeof N!="object")return N;if(N.$undefined)return null;let J=Object.keys(N).filter(R=>R.startsWith("$")&&N[R]!=null);for(let R=0;R<J.length;R++){let W=E[J[R]];if(W)return W.fromExtendedJSON(N,Y)}if(N.$date!=null){let R=N.$date,W=new Date;return Y.legacy?typeof R=="number"?W.setTime(R):typeof R=="string"&&W.setTime(Date.parse(R)):typeof R=="string"?W.setTime(Date.parse(R)):K.Long.isLong(R)?W.setTime(R.toNumber()):typeof R=="number"&&Y.relaxed&&W.setTime(R),W}if(N.$code!=null){let R=Object.assign({},N);return N.$scope&&(R.$scope=o(N.$scope)),Et.Code.fromExtendedJSON(N)}if(N.$ref!=null||N.$dbPointer!=null){let R=N.$ref?N:N.$dbPointer;if(R instanceof Nt.DBRef)return R;let W=Object.keys(R).filter(G=>G.startsWith("$")),x=!0;if(W.forEach(G=>{["$ref","$id","$db"].indexOf(G)===-1&&(x=!1)}),x)return Nt.DBRef.fromExtendedJSON(R)}return N}function c(N,Y){return N.map(J=>p(J,Y))}function h(N){let Y=N.toISOString();return N.getUTCMilliseconds()!==0?Y:Y.slice(0,-5)+"Z"}function p(N,Y){if(Array.isArray(N))return c(N,Y);if(N===void 0)return null;if(N instanceof Date){let J=N.getTime(),R=J>-1&&J<2534023188e5;return Y.legacy?Y.relaxed&&R?{$date:N.getTime()}:{$date:h(N)}:Y.relaxed&&R?{$date:h(N)}:{$date:{$numberLong:N.getTime().toString()}}}if(typeof N=="number"&&!Y.relaxed){if(Math.floor(N)===N){let J=N>=l&&N<=D,R=N>=u&&N<=f;if(J)return{$numberInt:N.toString()};if(R)return{$numberLong:N.toString()}}return{$numberDouble:N.toString()}}if(N instanceof RegExp){let J=N.flags;if(J===void 0){let W=N.toString().match(/[gimuy]*$/);W&&(J=W[0])}return new At.BSONRegExp(N.source,J).toExtendedJSON(Y)}return N!=null&&typeof N=="object"?w(N,Y):N}let n={Binary:N=>new _t.Binary(N.value(),N.sub_type),Code:N=>new Et.Code(N.code,N.scope),DBRef:N=>new Nt.DBRef(N.collection||N.namespace,N.oid,N.db,N.fields),Decimal128:N=>new dt.Decimal128(N.bytes),Double:N=>new It.Double(N.value),Int32:N=>new bt.Int32(N.value),Long:N=>K.Long.fromBits(N.low!=null?N.low:N.low_,N.low!=null?N.high:N.high_,N.low!=null?N.unsigned:N.unsigned_),MaxKey:()=>new Rt.MaxKey,MinKey:()=>new Ut.MinKey,ObjectID:N=>new St.ObjectId(N),ObjectId:N=>new St.ObjectId(N),BSONRegExp:N=>new At.BSONRegExp(N.pattern,N.options),Symbol:N=>new Mt.BSONSymbol(N.value),Timestamp:N=>wt.Timestamp.fromBits(N.low,N.high)};function w(N,Y){if(N==null||typeof N!="object")throw new Error("not an object instance");let J=N._bsontype;if(typeof J>"u"){let R={};for(let W in N)R[W]=p(N[W],Y);return R}else if(y(N)){let R=N;if(typeof R.toExtendedJSON!="function"){let W=n[N._bsontype];if(!W)throw new TypeError("Unrecognized or invalid _bsontype: "+N._bsontype);R=W(R)}return J==="Code"&&R.scope?R=new Et.Code(R.code,p(R.scope,Y)):J==="DBRef"&&R.oid&&(R=new Nt.DBRef(R.collection,p(R.oid,Y),R.db,R.fields)),R.toExtendedJSON(Y)}else throw new Error("_bsontype must be a string, but was: "+typeof J)}var U;(function(N){function Y(x,G){let M=Object.assign({},{relaxed:!0,legacy:!1},G);return typeof M.relaxed=="boolean"&&(M.strict=!M.relaxed),typeof M.strict=="boolean"&&(M.relaxed=!M.strict),JSON.parse(x,(V,z)=>o(z,M))}N.parse=Y;function J(x,G,M,V){M!=null&&typeof M=="object"&&(V=M,M=0),G!=null&&typeof G=="object"&&!Array.isArray(G)&&(V=G,G=void 0,M=0),V=Object.assign({},{relaxed:!0,legacy:!1},V);let z=p(x,V);return JSON.stringify(z,G,M)}N.stringify=J;function R(x,G){return G=G||{},JSON.parse(J(x,G))}N.serialize=R;function W(x,G){return G=G||{},Y(JSON.stringify(x),G)}N.deserialize=W})(U=e.EJSON||(e.EJSON={}))});st(Yt);var Jn=Yt.EJSON,Wn=Yt.isBSONType,jt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function y(l,f,u,E,o){let c,h,p=u==="big",n=o*8-E-1,w=(1<<n)-1,U=w>>1,N=-7,Y=p?0:o-1,J=p?1:-1,R=l[f+Y];for(Y+=J,c=R&(1<<-N)-1,R>>=-N,N+=n;N>0;c=c*256+l[f+Y],Y+=J,N-=8);for(h=c&(1<<-N)-1,c>>=-N,N+=E;N>0;h=h*256+l[f+Y],Y+=J,N-=8);if(c===0)c=1-U;else{if(c===w)return h?NaN:(R?-1:1)*(1/0);h=h+Math.pow(2,E),c=c-U}return(R?-1:1)*h*Math.pow(2,c-E)}e.readIEEE754=y;function D(l,f,u,E,o,c){let h,p,n,w=E==="big",U=c*8-o-1,N=(1<<U)-1,Y=N>>1,J=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=w?c-1:0,W=w?-1:1,x=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(p=isNaN(f)?1:0,h=N):(h=Math.floor(Math.log(f)/Math.LN2),f*(n=Math.pow(2,-h))<1&&(h--,n*=2),h+Y>=1?f+=J/n:f+=J*Math.pow(2,1-Y),f*n>=2&&(h++,n/=2),h+Y>=N?(p=0,h=N):h+Y>=1?(p=(f*n-1)*Math.pow(2,o),h=h+Y):(p=f*Math.pow(2,Y-1)*Math.pow(2,o),h=0)),isNaN(f)&&(p=0);o>=8;)l[u+R]=p&255,R+=W,p/=256,o-=8;for(h=h<<o|p,isNaN(f)&&(h+=8),U+=o;U>0;)l[u+R]=h&255,R+=W,h/=256,U-=8;l[u+R-W]|=x*128}e.writeIEEE754=D});st(jt);var Xn=jt.writeIEEE754,kn=jt.readIEEE754,qt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let y=/\x00/,D=new Set(["$db","$ref","$id","$clusterTime"]);function l(s){return Object.prototype.toString.call(s)==="[object RegExp]"}function f(s,A,O,i,m){s[i++]=I.BSON_DATA_STRING;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b+1,s[i-1]=0;let j=s.write(O,i+4,void 0,"utf8");return s[i+3]=j+1>>24&255,s[i+2]=j+1>>16&255,s[i+1]=j+1>>8&255,s[i]=j+1&255,i=i+4+j,s[i++]=0,i}function u(s,A,O,i,m){if(Number.isInteger(O)&&O>=I.BSON_INT32_MIN&&O<=I.BSON_INT32_MAX){s[i++]=I.BSON_DATA_INT;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255}else{s[i++]=I.BSON_DATA_NUMBER;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0,jt.writeIEEE754(s,O,i,"little",52,8),i=i+8}return i}function E(s,A,O,i,m){s[i++]=I.BSON_DATA_NULL;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,i}function o(s,A,O,i,m){s[i++]=I.BSON_DATA_BOOLEAN;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,s[i++]=O?1:0,i}function c(s,A,O,i,m){s[i++]=I.BSON_DATA_DATE;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=K.Long.fromNumber(O.getTime()),F=j.getLowBits(),g=j.getHighBits();return s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=g&255,s[i++]=g>>8&255,s[i++]=g>>16&255,s[i++]=g>>24&255,i}function h(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,O.source&&O.source.match(y)!=null)throw Error("value "+O.source+" must not contain null bytes");return i=i+s.write(O.source,i,void 0,"utf8"),s[i++]=0,O.ignoreCase&&(s[i++]=105),O.global&&(s[i++]=115),O.multiline&&(s[i++]=109),s[i++]=0,i}function p(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,O.pattern.match(y)!=null)throw Error("pattern "+O.pattern+" must not contain null bytes");return i=i+s.write(O.pattern,i,void 0,"utf8"),s[i++]=0,i=i+s.write(O.options.split("").sort().join(""),i,void 0,"utf8"),s[i++]=0,i}function n(s,A,O,i,m){O===null?s[i++]=I.BSON_DATA_NULL:O._bsontype==="MinKey"?s[i++]=I.BSON_DATA_MIN_KEY:s[i++]=I.BSON_DATA_MAX_KEY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,i}function w(s,A,O,i,m){s[i++]=I.BSON_DATA_OID;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,typeof O.id=="string")s.write(O.id,i,void 0,"binary");else if(O.id&&O.id.copy)O.id.copy(s,i,0,12);else throw new TypeError("object ["+JSON.stringify(O)+"] is not a valid ObjectId");return i+12}function U(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.length;return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=I.BSON_BINARY_SUBTYPE_DEFAULT,s.set(mt.ensureBuffer(O),i),i=i+j,i}function N(s,A,O,i,m=!1,b=0,j=!1,F=!0,g=!1,$=[]){for(let d=0;d<$.length;d++)if($[d]===O)throw new Error("cyclic dependency detected");$.push(O),s[i++]=Array.isArray(O)?I.BSON_DATA_ARRAY:I.BSON_DATA_OBJECT;let L=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+L,s[i++]=0;let T=Z(s,O,m,i,b+1,j,F,$);return $.pop(),T}function Y(s,A,O,i,m){s[i++]=I.BSON_DATA_DECIMAL128;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,O.bytes.copy(s,i,0,16),i+16}function J(s,A,O,i,m){s[i++]=O._bsontype==="Long"?I.BSON_DATA_LONG:I.BSON_DATA_TIMESTAMP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.getLowBits(),F=O.getHighBits();return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,i}function R(s,A,O,i,m){O=O.valueOf(),s[i++]=I.BSON_DATA_INT;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255,i}function W(s,A,O,i,m){s[i++]=I.BSON_DATA_NUMBER;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,jt.writeIEEE754(s,O.value,i,"little",52,8),i=i+8,i}function x(s,A,O,i,m=!1,b=0,j){s[i++]=I.BSON_DATA_CODE;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=rt.normalizedFunctionString(O),$=s.write(g,i+4,void 0,"utf8")+1;return s[i]=$&255,s[i+1]=$>>8&255,s[i+2]=$>>16&255,s[i+3]=$>>24&255,i=i+4+$-1,s[i++]=0,i}function G(s,A,O,i,m=!1,b=0,j=!1,F=!0,g=!1){if(O.scope&&typeof O.scope=="object"){s[i++]=I.BSON_DATA_CODE_W_SCOPE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=i,T=typeof O.code=="string"?O.code:O.code.toString();i=i+4;let d=s.write(T,i+4,void 0,"utf8")+1;s[i]=d&255,s[i+1]=d>>8&255,s[i+2]=d>>16&255,s[i+3]=d>>24&255,s[i+4+d-1]=0,i=i+d+4;let q=Z(s,O.scope,m,i,b+1,j,F);i=q-1;let X=q-L;s[L++]=X&255,s[L++]=X>>8&255,s[L++]=X>>16&255,s[L++]=X>>24&255,s[i++]=0}else{s[i++]=I.BSON_DATA_CODE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=O.code.toString(),T=s.write(L,i+4,void 0,"utf8")+1;s[i]=T&255,s[i+1]=T>>8&255,s[i+2]=T>>16&255,s[i+3]=T>>24&255,i=i+4+T-1,s[i++]=0}return i}function M(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.value(!0),F=O.position;return O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F+4),s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=O.sub_type,O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F-4,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255),s.set(j,i),i=i+O.position,i}function V(s,A,O,i,m){s[i++]=I.BSON_DATA_SYMBOL;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=s.write(O.value,i+4,void 0,"utf8")+1;return s[i]=j&255,s[i+1]=j>>8&255,s[i+2]=j>>16&255,s[i+3]=j>>24&255,i=i+4+j-1,s[i++]=0,i}function z(s,A,O,i,m,b,j){s[i++]=I.BSON_DATA_OBJECT;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=i,$={$ref:O.collection||O.namespace,$id:O.oid};O.db!=null&&($.$db=O.db),$=Object.assign($,O.fields);let L=Z(s,$,!1,i,m+1,b),T=L-g;return s[g++]=T&255,s[g++]=T>>8&255,s[g++]=T>>16&255,s[g++]=T>>24&255,L}function Z(s,A,O=!1,i=0,m=0,b=!1,j=!0,F=[]){i=i||0,F=F||[],F.push(A);let g=i+4;if(Array.isArray(A))for(let L=0;L<A.length;L++){let T=""+L,d=A[L];if(d&&d.toBSON){if(typeof d.toBSON!="function")throw new TypeError("toBSON is not a function");d=d.toBSON()}if(typeof d=="string")g=f(s,T,d,g,!0);else if(typeof d=="number")g=u(s,T,d,g,!0);else{if(typeof d=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof d=="boolean")g=o(s,T,d,g,!0);else if(d instanceof Date||rt.isDate(d))g=c(s,T,d,g,!0);else if(d===void 0)g=E(s,T,d,g,!0);else if(d===null)g=E(s,T,d,g,!0);else if(d._bsontype==="ObjectId"||d._bsontype==="ObjectID")g=w(s,T,d,g,!0);else if(C.Buffer.isBuffer(d)||rt.isUint8Array(d))g=U(s,T,d,g,!0);else if(d instanceof RegExp||l(d))g=h(s,T,d,g,!0);else if(typeof d=="object"&&d._bsontype==null)g=N(s,T,d,g,O,m,b,j,!0,F);else if(typeof d=="object"&&Yt.isBSONType(d)&&d._bsontype==="Decimal128")g=Y(s,T,d,g,!0);else if(d._bsontype==="Long"||d._bsontype==="Timestamp")g=J(s,T,d,g,!0);else if(d._bsontype==="Double")g=W(s,T,d,g,!0);else if(typeof d=="function"&&b)g=x(s,T,d,g,O,m,!0);else if(d._bsontype==="Code")g=G(s,T,d,g,O,m,b,j,!0);else if(d._bsontype==="Binary")g=M(s,T,d,g,!0);else if(d._bsontype==="Symbol")g=V(s,T,d,g,!0);else if(d._bsontype==="DBRef")g=z(s,T,d,g,m,b,!0);else if(d._bsontype==="BSONRegExp")g=p(s,T,d,g,!0);else if(d._bsontype==="Int32")g=R(s,T,d,g,!0);else if(d._bsontype==="MinKey"||d._bsontype==="MaxKey")g=n(s,T,d,g,!0);else if(typeof d._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+d._bsontype)}}else if(A instanceof $t.Map){let L=A.entries(),T=!1;for(;!T;){let d=L.next();if(T=!!d.done,T)continue;let q=d.value[0],X=d.value[1],et=typeof X;if(typeof q=="string"&&!D.has(q)){if(q.match(y)!=null)throw Error("key "+q+" must not contain null bytes");if(O){if(q[0]==="$")throw Error("key "+q+" must not start with '$'");if(~q.indexOf("."))throw Error("key "+q+" must not contain '.'")}}if(et==="string")g=f(s,q,X,g);else if(et==="number")g=u(s,q,X,g);else{if(et==="bigint"||rt.isBigInt64Array(X)||rt.isBigUInt64Array(X))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(et==="boolean")g=o(s,q,X,g);else if(X instanceof Date||rt.isDate(X))g=c(s,q,X,g);else if(X===null||X===void 0&&j===!1)g=E(s,q,X,g);else if(X._bsontype==="ObjectId"||X._bsontype==="ObjectID")g=w(s,q,X,g);else if(C.Buffer.isBuffer(X)||rt.isUint8Array(X))g=U(s,q,X,g);else if(X instanceof RegExp||l(X))g=h(s,q,X,g);else if(et==="object"&&X._bsontype==null)g=N(s,q,X,g,O,m,b,j,!1,F);else if(et==="object"&&X._bsontype==="Decimal128")g=Y(s,q,X,g);else if(X._bsontype==="Long"||X._bsontype==="Timestamp")g=J(s,q,X,g);else if(X._bsontype==="Double")g=W(s,q,X,g);else if(X._bsontype==="Code")g=G(s,q,X,g,O,m,b,j);else if(typeof X=="function"&&b)g=x(s,q,X,g,O,m,b);else if(X._bsontype==="Binary")g=M(s,q,X,g);else if(X._bsontype==="Symbol")g=V(s,q,X,g);else if(X._bsontype==="DBRef")g=z(s,q,X,g,m,b);else if(X._bsontype==="BSONRegExp")g=p(s,q,X,g);else if(X._bsontype==="Int32")g=R(s,q,X,g);else if(X._bsontype==="MinKey"||X._bsontype==="MaxKey")g=n(s,q,X,g);else if(typeof X._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+X._bsontype)}}}else{if(A.toBSON){if(typeof A.toBSON!="function")throw new TypeError("toBSON is not a function");if(A=A.toBSON(),A!=null&&typeof A!="object")throw new TypeError("toBSON function did not return an object")}for(let L in A){let T=A[L];if(T&&T.toBSON){if(typeof T.toBSON!="function")throw new TypeError("toBSON is not a function");T=T.toBSON()}let d=typeof T;if(typeof L=="string"&&!D.has(L)){if(L.match(y)!=null)throw Error("key "+L+" must not contain null bytes");if(O){if(L[0]==="$")throw Error("key "+L+" must not start with '$'");if(~L.indexOf("."))throw Error("key "+L+" must not contain '.'")}}if(d==="string")g=f(s,L,T,g);else if(d==="number")g=u(s,L,T,g);else{if(d==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(d==="boolean")g=o(s,L,T,g);else if(T instanceof Date||rt.isDate(T))g=c(s,L,T,g);else if(T===void 0)j===!1&&(g=E(s,L,T,g));else if(T===null)g=E(s,L,T,g);else if(T._bsontype==="ObjectId"||T._bsontype==="ObjectID")g=w(s,L,T,g);else if(C.Buffer.isBuffer(T)||rt.isUint8Array(T))g=U(s,L,T,g);else if(T instanceof RegExp||l(T))g=h(s,L,T,g);else if(d==="object"&&T._bsontype==null)g=N(s,L,T,g,O,m,b,j,!1,F);else if(d==="object"&&T._bsontype==="Decimal128")g=Y(s,L,T,g);else if(T._bsontype==="Long"||T._bsontype==="Timestamp")g=J(s,L,T,g);else if(T._bsontype==="Double")g=W(s,L,T,g);else if(T._bsontype==="Code")g=G(s,L,T,g,O,m,b,j);else if(typeof T=="function"&&b)g=x(s,L,T,g,O,m,b);else if(T._bsontype==="Binary")g=M(s,L,T,g);else if(T._bsontype==="Symbol")g=V(s,L,T,g);else if(T._bsontype==="DBRef")g=z(s,L,T,g,m,b);else if(T._bsontype==="BSONRegExp")g=p(s,L,T,g);else if(T._bsontype==="Int32")g=R(s,L,T,g);else if(T._bsontype==="MinKey"||T._bsontype==="MaxKey")g=n(s,L,T,g);else if(typeof T._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype)}}}F.pop(),s[g++]=0;let $=g-i;return s[i++]=$&255,s[i++]=$>>8&255,s[i++]=$>>16&255,s[i++]=$>>24&255,g}e.serializeInto=Z});st(qt);var Kn=qt.serializeInto,H=ot(function(B,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 _t.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return Et.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return Nt.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return dt.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return It.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return bt.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return K.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return $t.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return Rt.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return Ut.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return At.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return Mt.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return I.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return I.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return I.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return I.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return I.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return I.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return I.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return I.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return I.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return I.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return I.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return I.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return I.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return I.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return I.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return I.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return I.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return I.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return I.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return I.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return I.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return I.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return I.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return Yt.EJSON}});var y=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return y.LongWithoutOverridesClass}});let D=1024*1024*17,l=C.Buffer.alloc(D);function f(p){l.length<p&&(l=C.Buffer.alloc(p))}e.setInternalBufferSize=f;function u(p,n={}){let w=typeof n.checkKeys=="boolean"?n.checkKeys:!1,U=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,N=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0,Y=typeof n.minInternalBufferSize=="number"?n.minInternalBufferSize:D;l.length<Y&&(l=C.Buffer.alloc(Y));let J=qt.serializeInto(l,p,w,0,0,U,N,[]),R=C.Buffer.alloc(J);return l.copy(R,0,0,R.length),R}e.serialize=u;function E(p,n,w={}){let U=typeof w.checkKeys=="boolean"?w.checkKeys:!1,N=typeof w.serializeFunctions=="boolean"?w.serializeFunctions:!1,Y=typeof w.ignoreUndefined=="boolean"?w.ignoreUndefined:!0,J=typeof w.index=="number"?w.index:0,R=qt.serializeInto(l,p,U,0,0,N,Y);return l.copy(n,J,0,R),J+R-1}e.serializeWithBufferAndIndex=E;function o(p,n={}){return Zt.deserialize(mt.ensureBuffer(p),n)}e.deserialize=o;function c(p,n={}){n=n||{};let w=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,U=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0;return Be.calculateObjectSize(p,w,U)}e.calculateObjectSize=c;function h(p,n,w,U,N,Y){let J=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},Y),R=mt.ensureBuffer(p),W=n;for(let x=0;x<w;x++){let G=R[W]|R[W+1]<<8|R[W+2]<<16|R[W+3]<<24;J.index=W,U[N+x]=Zt.deserialize(R,J),W=W+G}return W}e.deserializeStream=h}),Hn=st(H),Gn=H.deserializeStream,Vn=H.calculateObjectSize,de=H.deserialize,Zn=H.serializeWithBufferAndIndex,Re=H.serialize,qn=H.setInternalBufferSize,Qn=H.ObjectID,xn=H.Decimal128,$n=H.BSONRegExp,ti=H.MaxKey,ei=H.MinKey,ri=H.Int32,ni=H.Double,ii=H.Timestamp,oi=H.Long,si=H.ObjectId,fi=H.Binary,ai=H.DBRef,ui=H.BSONSymbol,li=H.Map,ci=H.Code,hi=H.LongWithoutOverridesClass,_i=H.EJSON,yi=H.JS_INT_MIN,Bi=H.JS_INT_MAX,Ni=H.BSON_INT64_MIN,gi=H.BSON_INT64_MAX,pi=H.BSON_INT32_MIN,Oi=H.BSON_INT32_MAX,Si=H.BSON_DATA_UNDEFINED,Ai=H.BSON_DATA_TIMESTAMP,Ei=H.BSON_DATA_SYMBOL,mi=H.BSON_DATA_STRING,wi=H.BSON_DATA_REGEXP,Ti=H.BSON_DATA_OID,Ii=H.BSON_DATA_OBJECT,bi=H.BSON_DATA_NUMBER,Di=H.BSON_DATA_NULL,di=H.BSON_DATA_MIN_KEY,Ri=H.BSON_DATA_MAX_KEY,Ui=H.BSON_DATA_LONG,Mi=H.BSON_DATA_INT,Pi=H.BSON_DATA_DECIMAL128,ji=H.BSON_DATA_DBPOINTER,Yi=H.BSON_DATA_DATE,vi=H.BSON_DATA_CODE_W_SCOPE,Fi=H.BSON_DATA_CODE,Li=H.BSON_DATA_BOOLEAN,Ci=H.BSON_DATA_BINARY,zi=H.BSON_DATA_ARRAY,Ji=H.BSON_BINARY_SUBTYPE_UUID_NEW,Wi=H.BSON_BINARY_SUBTYPE_UUID,Xi=H.BSON_BINARY_SUBTYPE_USER_DEFINED,ki=H.BSON_BINARY_SUBTYPE_MD5,Ki=H.BSON_BINARY_SUBTYPE_FUNCTION,Hi=H.BSON_BINARY_SUBTYPE_DEFAULT,Gi=H.BSON_BINARY_SUBTYPE_BYTE_ARRAY;function Ne(B,e){return de(new Uint8Array(B),e)}var te={name:"BSON",id:"bson",module:"bson",extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0};var pr="4.4.0-alpha.1",ee={...te,dataType:null,batchType:null,name:"BSON",id:"bson",module:"bson",version:pr,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:Or,parseSync:Sr,options:{bson:{}}};async function Or(B,e){let y={...ee.options.bson,...e?.bson};return Ne(B,y)}function Sr(B,e){let y={...ee.options.bson,...e?.bson};return Ne(B,y)}function ge(B,e){return Re(B).buffer}var Ar="4.4.0-alpha.1",Me={...te,name:"BSON",id:"bson",module:"bson",version:Ar,extensions:["bson"],options:{bson:{}},async encode(B,e){return ge(B,{})},encodeSync(B,e){return ge(B,{})}};return Je(vt);})();
|
|
16
|
+
`)+" "+h[1]:h[0]+t+" "+B.join(", ")+" "+h[1]}function de(B){return Array.isArray(B)}function _e(B){return typeof B=="boolean"}function qt(B){return B===null}function _r(B){return B==null}function Ie(B){return typeof B=="number"}function Qt(B){return typeof B=="string"}function yr(B){return babelHelpers.typeof(B)==="symbol"}function gt(B){return B===void 0}function kt(B){return Pt(B)&&ye(B)==="[object RegExp]"}function Pt(B){return babelHelpers.typeof(B)==="object"&&B!==null}function le(B){return Pt(B)&&ye(B)==="[object Date]"}function Xt(B){return Pt(B)&&(ye(B)==="[object Error]"||B instanceof Error)}function Kt(B){return typeof B=="function"}function Br(B){return B===null||typeof B=="boolean"||typeof B=="number"||typeof B=="string"||babelHelpers.typeof(B)==="symbol"||typeof B>"u"}function pr(B){return Buffer.isBuffer(B)}function ye(B){return Object.prototype.toString.call(B)}function fe(B){return B<10?"0"+B.toString(10):B.toString(10)}var Nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function gr(){var B=new Date,t=[fe(B.getHours()),fe(B.getMinutes()),fe(B.getSeconds())].join(":");return[B.getDate(),Nr[B.getMonth()],t].join(" ")}function Ar(){console.log("%s - %s",gr(),he.apply(null,arguments))}function De(B,t){if(!t||!Pt(t))return B;for(var h=Object.keys(t),d=h.length;d--;)B[h[d]]=t[h[d]];return B}function Re(B,t){return Object.prototype.hasOwnProperty.call(B,t)}var Sr={inherits:ir,_extend:De,log:Ar,isBuffer:pr,isPrimitive:Br,isFunction:Kt,isError:Xt,isDate:le,isObject:Pt,isRegExp:kt,isUndefined:gt,isSymbol:yr,isString:Qt,isNumber:Ie,isNullOrUndefined:_r,isNull:qt,isBoolean:_e,isArray:de,inspect:At,deprecate:be,format:he,debuglog:sr},rt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.deprecate=t.isObjectLike=t.isDate=t.isBuffer=t.haveBuffer=t.isBigUInt64Array=t.isBigInt64Array=t.isUint8Array=t.randomBytes=t.normalizedFunctionString=void 0;function h(n){return n.toString().replace("function(","function (")}t.normalizedFunctionString=h;function d(n){let w=C.Buffer.alloc(n);for(let U=0;U<n;++U)w[U]=Math.floor(Math.random()*256);return w}if(t.randomBytes=d,typeof window<"u"&&window.crypto&&window.crypto.getRandomValues)t.randomBytes=n=>window.crypto.getRandomValues(C.Buffer.alloc(n));else{try{t.randomBytes=nr.randomBytes}catch{}t.randomBytes==null&&(t.randomBytes=d)}function l(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}t.isUint8Array=l;function f(n){return Object.prototype.toString.call(n)==="[object BigInt64Array]"}t.isBigInt64Array=f;function u(n){return Object.prototype.toString.call(n)==="[object BigUint64Array]"}t.isBigUInt64Array=u;function m(){return typeof Vt<"u"&&typeof Vt.Buffer<"u"}t.haveBuffer=m;function o(n){return m()&&C.Buffer.isBuffer(n)}t.isBuffer=o;function c(n){return _(n)&&Object.prototype.toString.call(n)==="[object Date]"}t.isDate=c;function _(n){return typeof n=="object"&&n!==null}t.isObjectLike=_;function g(n,w){if(typeof window>"u"||typeof self>"u")return Sr.deprecate(n,w);let U=!1;function p(...F){return U||(console.warn(w),U=!0),n.apply(this,...F)}return p}t.deprecate=g});st(rt);var Fr=rt.deprecate,Yr=rt.isObjectLike,Lr=rt.isDate,vr=rt.isBuffer,Cr=rt.haveBuffer,zr=rt.isBigUInt64Array,Jr=rt.isBigInt64Array,Wr=rt.isUint8Array,kr=rt.randomBytes,Xr=rt.normalizedFunctionString,pt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DBRef=t.isDBRefLike=void 0;function h(l){return rt.isObjectLike(l)&&l.$id!=null&&l.$ref!=null}t.isDBRefLike=h;class d{constructor(f,u,m,o){let c=f.split(".");c.length===2&&(m=c.shift(),f=c.shift()),this.collection=f,this.oid=u,this.db=m,this.fields=o||{}}get namespace(){return this.collection}set namespace(f){this.collection=f}toJSON(){let f=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(f.$db=this.db),f}toExtendedJSON(f){f=f||{};let u={$ref:this.collection,$id:this.oid};return f.legacy||(this.db&&(u.$db=this.db),u=Object.assign(u,this.fields)),u}static fromExtendedJSON(f){let u=Object.assign({},f);return delete u.$ref,delete u.$id,delete u.$db,new d(f.$ref,f.$id,f.$db,u)}}t.DBRef=d,Object.defineProperty(d.prototype,"_bsontype",{value:"DBRef"})});st(pt);var Kr=pt.DBRef,Vr=pt.isDBRefLike,K=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Long=void 0;let h;try{h=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 d=1<<16,l=1<<24,f=d*d,u=f*f,m=u/2,o={},c={};class _{constructor(n=0,w=0,U){this.comp=_.prototype.compare,this.div=_.prototype.divide,this.eq=_.prototype.equals,this.gt=_.prototype.greaterThan,this.gte=_.prototype.greaterThanOrEqual,this.ge=_.prototype.greaterThanOrEqual,this.lt=_.prototype.lessThan,this.lte=_.prototype.lessThanOrEqual,this.mod=_.prototype.modulo,this.rem=_.prototype.modulo,this.mul=_.prototype.multiply,this.neg=_.prototype.negate,this.neq=_.prototype.notEquals,this.ne=_.prototype.notEquals,this.shl=_.prototype.shiftLeft,this.shr=_.prototype.shiftRight,this.shr_u=_.prototype.shiftRightUnsigned,this.shru=_.prototype.shiftRightUnsigned,this.sub=_.prototype.subtract,this.eqz=_.prototype.isZero,this.le=_.prototype.lessThanOrEqual,this.low=n|0,this.high=w|0,this.unsigned=!!U,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(n,w,U){return new _(n,w,U)}static fromInt(n,w){let U,p,F;return w?(n>>>=0,(F=0<=n&&n<256)&&(p=c[n],p)?p:(U=_.fromBits(n,(n|0)<0?-1:0,!0),F&&(c[n]=U),U)):(n|=0,(F=-128<=n&&n<128)&&(p=o[n],p)?p:(U=_.fromBits(n,n<0?-1:0,!1),F&&(o[n]=U),U))}static fromNumber(n,w){if(isNaN(n))return w?_.UZERO:_.ZERO;if(w){if(n<0)return _.UZERO;if(n>=u)return _.MAX_UNSIGNED_VALUE}else{if(n<=-m)return _.MIN_VALUE;if(n+1>=m)return _.MAX_VALUE}return n<0?_.fromNumber(-n,w).neg():_.fromBits(n%f|0,n/f|0,w)}static fromBigInt(n,w){return _.fromString(n.toString(),w)}static fromString(n,w,U){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return _.ZERO;if(typeof w=="number"?(U=w,w=!1):w=!!w,U=U||10,U<2||36<U)throw RangeError("radix");let p;if((p=n.indexOf("-"))>0)throw Error("interior hyphen");if(p===0)return _.fromString(n.substring(1),w,U).neg();let F=_.fromNumber(Math.pow(U,8)),J=_.ZERO;for(let R=0;R<n.length;R+=8){let W=Math.min(8,n.length-R),Q=parseInt(n.substring(R,R+W),U);if(W<8){let H=_.fromNumber(Math.pow(U,W));J=J.mul(H).add(_.fromNumber(Q))}else J=J.mul(F),J=J.add(_.fromNumber(Q))}return J.unsigned=w,J}static fromBytes(n,w,U){return U?_.fromBytesLE(n,w):_.fromBytesBE(n,w)}static fromBytesLE(n,w){return new _(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,w)}static fromBytesBE(n,w){return new _(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],w)}static isLong(n){return rt.isObjectLike(n)&&n.__isLong__===!0}static fromValue(n,w){return typeof n=="number"?_.fromNumber(n,w):typeof n=="string"?_.fromString(n,w):_.fromBits(n.low,n.high,typeof w=="boolean"?w:n.unsigned)}add(n){_.isLong(n)||(n=_.fromValue(n));let w=this.high>>>16,U=this.high&65535,p=this.low>>>16,F=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,Q=n.low&65535,H=0,M=0,G=0,z=0;return z+=F+Q,G+=z>>>16,z&=65535,G+=p+W,M+=G>>>16,G&=65535,M+=U+R,H+=M>>>16,M&=65535,H+=w+J,H&=65535,_.fromBits(G<<16|z,H<<16|M,this.unsigned)}and(n){return _.isLong(n)||(n=_.fromValue(n)),_.fromBits(this.low&n.low,this.high&n.high,this.unsigned)}compare(n){if(_.isLong(n)||(n=_.fromValue(n)),this.eq(n))return 0;let w=this.isNegative(),U=n.isNegative();return w&&!U?-1:!w&&U?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1}divide(n){if(_.isLong(n)||(n=_.fromValue(n)),n.isZero())throw Error("division by zero");if(h){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;let F=(this.unsigned?h.div_u:h.div_s)(this.low,this.high,n.low,n.high);return _.fromBits(F,h.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?_.UZERO:_.ZERO;let w,U,p;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return _.UZERO;if(n.gt(this.shru(1)))return _.UONE;p=_.UZERO}else{if(this.eq(_.MIN_VALUE))return n.eq(_.ONE)||n.eq(_.NEG_ONE)?_.MIN_VALUE:n.eq(_.MIN_VALUE)?_.ONE:(w=this.shr(1).div(n).shl(1),w.eq(_.ZERO)?n.isNegative()?_.ONE:_.NEG_ONE:(U=this.sub(n.mul(w)),p=w.add(U.div(n)),p));if(n.eq(_.MIN_VALUE))return this.unsigned?_.UZERO:_.ZERO;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();p=_.ZERO}for(U=this;U.gte(n);){w=Math.max(1,Math.floor(U.toNumber()/n.toNumber()));let F=Math.ceil(Math.log(w)/Math.LN2),J=F<=48?1:Math.pow(2,F-48),R=_.fromNumber(w),W=R.mul(n);for(;W.isNegative()||W.gt(U);)w-=J,R=_.fromNumber(w,this.unsigned),W=R.mul(n);R.isZero()&&(R=_.ONE),p=p.add(R),U=U.sub(W)}return p}equals(n){return _.isLong(n)||(n=_.fromValue(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.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(_.MIN_VALUE)?64:this.neg().getNumBitsAbs();let n=this.high!==0?this.high:this.low,w;for(w=31;w>0&&!(n&1<<w);w--);return this.high!==0?w+33:w+1}greaterThan(n){return this.comp(n)>0}greaterThanOrEqual(n){return this.comp(n)>=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(n){return this.comp(n)<0}lessThanOrEqual(n){return this.comp(n)<=0}modulo(n){if(_.isLong(n)||(n=_.fromValue(n)),h){let w=(this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,n.low,n.high);return _.fromBits(w,h.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))}multiply(n){if(this.isZero())return _.ZERO;if(_.isLong(n)||(n=_.fromValue(n)),h){let x=h.mul(this.low,this.high,n.low,n.high);return _.fromBits(x,h.get_high(),this.unsigned)}if(n.isZero())return _.ZERO;if(this.eq(_.MIN_VALUE))return n.isOdd()?_.MIN_VALUE:_.ZERO;if(n.eq(_.MIN_VALUE))return this.isOdd()?_.MIN_VALUE:_.ZERO;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(_.TWO_PWR_24)&&n.lt(_.TWO_PWR_24))return _.fromNumber(this.toNumber()*n.toNumber(),this.unsigned);let w=this.high>>>16,U=this.high&65535,p=this.low>>>16,F=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,Q=n.low&65535,H=0,M=0,G=0,z=0;return z+=F*Q,G+=z>>>16,z&=65535,G+=p*Q,M+=G>>>16,G&=65535,G+=F*W,M+=G>>>16,G&=65535,M+=U*Q,H+=M>>>16,M&=65535,M+=p*W,H+=M>>>16,M&=65535,M+=F*R,H+=M>>>16,M&=65535,H+=w*Q+U*W+p*R+F*J,H&=65535,_.fromBits(G<<16|z,H<<16|M,this.unsigned)}negate(){return!this.unsigned&&this.eq(_.MIN_VALUE)?_.MIN_VALUE:this.not().add(_.ONE)}not(){return _.fromBits(~this.low,~this.high,this.unsigned)}notEquals(n){return!this.equals(n)}or(n){return _.isLong(n)||(n=_.fromValue(n)),_.fromBits(this.low|n.low,this.high|n.high,this.unsigned)}shiftLeft(n){return _.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?_.fromBits(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):_.fromBits(0,this.low<<n-32,this.unsigned)}shiftRight(n){return _.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?_.fromBits(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):_.fromBits(this.high>>n-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(n){if(_.isLong(n)&&(n=n.toInt()),n&=63,n===0)return this;{let w=this.high;if(n<32){let U=this.low;return _.fromBits(U>>>n|w<<32-n,w>>>n,this.unsigned)}else return n===32?_.fromBits(w,0,this.unsigned):_.fromBits(w>>>n-32,0,this.unsigned)}}subtract(n){return _.isLong(n)||(n=_.fromValue(n)),this.add(n.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(n){return n?this.toBytesLE():this.toBytesBE()}toBytesLE(){let n=this.high,w=this.low;return[w&255,w>>>8&255,w>>>16&255,w>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]}toBytesBE(){let n=this.high,w=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,w>>>24,w>>>16&255,w>>>8&255,w&255]}toSigned(){return this.unsigned?_.fromBits(this.low,this.high,!1):this}toString(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(_.MIN_VALUE)){let F=_.fromNumber(n),J=this.div(F),R=J.mul(F).sub(this);return J.toString(n)+R.toInt().toString(n)}else return"-"+this.neg().toString(n);let w=_.fromNumber(Math.pow(n,6),this.unsigned),U=this,p="";for(;;){let F=U.div(w),R=(U.sub(F.mul(w)).toInt()>>>0).toString(n);if(U=F,U.isZero())return R+p;for(;R.length<6;)R="0"+R;p=""+R+p}}toUnsigned(){return this.unsigned?this:_.fromBits(this.low,this.high,!0)}xor(n){return _.isLong(n)||(n=_.fromValue(n)),_.fromBits(this.low^n.low,this.high^n.high,this.unsigned)}toExtendedJSON(n){return n&&n.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(n,w){let U=_.fromString(n.$numberLong);return w&&w.relaxed?U.toNumber():U}}t.Long=_,_.TWO_PWR_24=_.fromInt(l),_.MAX_UNSIGNED_VALUE=_.fromBits(-1,-1,!0),_.ZERO=_.fromInt(0),_.UZERO=_.fromInt(0,!0),_.ONE=_.fromInt(1),_.UONE=_.fromInt(1,!0),_.NEG_ONE=_.fromInt(-1),_.MAX_VALUE=_.fromBits(-1,2147483647,!1),_.MIN_VALUE=_.fromBits(0,-2147483648,!1),Object.defineProperty(_.prototype,"__isLong__",{value:!0}),Object.defineProperty(_.prototype,"_bsontype",{value:"Long"})});st(K);var Hr=K.Long,Dt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Decimal128=void 0;let h=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,d=/^(\+|-)?(Infinity|inf)$/i,l=/^(\+|-)?NaN$/i,f=6111,u=-6176,m=6176,o=34,c=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),_=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),g=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),n=/^([-+])?(\d+)?$/,w=31,U=16383,p=30,F=31;function J(G){return!isNaN(parseInt(G,10))}function R(G){let z=K.Long.fromNumber(1e9),x=K.Long.fromNumber(0);if(!G.parts[0]&&!G.parts[1]&&!G.parts[2]&&!G.parts[3])return{quotient:G,rem:x};for(let s=0;s<=3;s++)x=x.shiftLeft(32),x=x.add(new K.Long(G.parts[s],0)),G.parts[s]=x.div(z).low,x=x.modulo(z);return{quotient:G,rem:x}}function W(G,z){if(!G&&!z)return{high:K.Long.fromNumber(0),low:K.Long.fromNumber(0)};let x=G.shiftRightUnsigned(32),s=new K.Long(G.getLowBits(),0),O=z.shiftRightUnsigned(32),A=new K.Long(z.getLowBits(),0),i=x.multiply(O),E=x.multiply(A),I=s.multiply(O),j=s.multiply(A);return i=i.add(E.shiftRightUnsigned(32)),E=new K.Long(E.getLowBits(),0).add(I).add(j.shiftRightUnsigned(32)),i=i.add(E.shiftRightUnsigned(32)),j=E.shiftLeft(32).add(new K.Long(j.getLowBits(),0)),{high:i,low:j}}function Q(G,z){let x=G.high>>>0,s=z.high>>>0;if(x<s)return!0;if(x===s){let O=G.low>>>0,A=z.low>>>0;if(O<A)return!0}return!1}function H(G,z){throw new TypeError(`"${G}" is not a valid Decimal128 string - ${z}`)}class M{constructor(z){this.bytes=z}static fromString(z){let x=!1,s=!1,O=!1,A=0,i=0,E=0,I=0,j=0,L=[0],N=0,$=0,v=0,T=0,D=0,Z=0,k=new K.Long(0,0),et=new K.Long(0,0),Bt=0,X=0;if(z.length>=7e3)throw new TypeError(""+z+" not a valid Decimal128 string");let lt=z.match(h),re=z.match(d),Lt=z.match(l);if(!lt&&!re&&!Lt||z.length===0)throw new TypeError(""+z+" not a valid Decimal128 string");if(lt){let nt=lt[2],a=lt[4],e=lt[5],r=lt[6];a&&r===void 0&&H(z,"missing exponent power"),a&&nt===void 0&&H(z,"missing exponent base"),a===void 0&&(e||r)&&H(z,"missing e before exponent")}if((z[X]==="+"||z[X]==="-")&&(x=z[X++]==="-"),!J(z[X])&&z[X]!=="."){if(z[X]==="i"||z[X]==="I")return new M(C.Buffer.from(x?_:g));if(z[X]==="N")return new M(C.Buffer.from(c))}for(;J(z[X])||z[X]===".";){if(z[X]==="."){s&&H(z,"contains multiple periods"),s=!0,X=X+1;continue}N<34&&(z[X]!=="0"||O)&&(O||(j=i),O=!0,L[$++]=parseInt(z[X],10),N=N+1),O&&(E=E+1),s&&(I=I+1),i=i+1,X=X+1}if(s&&!i)throw new TypeError(""+z+" not a valid Decimal128 string");if(z[X]==="e"||z[X]==="E"){let nt=z.substr(++X).match(n);if(!nt||!nt[2])return new M(C.Buffer.from(c));D=parseInt(nt[0],10),X=X+nt[0].length}if(z[X])return new M(C.Buffer.from(c));if(v=0,!N)v=0,T=0,L[0]=0,E=1,N=1,A=0;else if(T=N-1,A=E,A!==1)for(;z[j+A-1]==="0";)A=A-1;for(D<=I&&I-D>1<<14?D=u:D=D-I;D>f;){if(T=T+1,T-v>o){if(L.join("").match(/^0+$/)){D=f;break}H(z,"overflow")}D=D-1}for(;D<u||N<E;){if(T===0&&A<N){D=u,A=0;break}if(N<E?E=E-1:T=T-1,D<f)D=D+1;else{if(L.join("").match(/^0+$/)){D=f;break}H(z,"overflow")}}if(T-v+1<A){let nt=i;s&&(j=j+1,nt=nt+1),x&&(j=j+1,nt=nt+1);let a=parseInt(z[j+T+1],10),e=0;if(a>=5&&(e=1,a===5)){for(e=L[T]%2===1?1:0,Z=j+T+2;Z<nt;Z++)if(parseInt(z[Z],10)){e=1;break}}if(e){let r=T;for(;r>=0;r--)if(++L[r]>9&&(L[r]=0,r===0))if(D<f)D=D+1,L[r]=1;else return new M(C.Buffer.from(x?_:g))}}if(k=K.Long.fromNumber(0),et=K.Long.fromNumber(0),A===0)k=K.Long.fromNumber(0),et=K.Long.fromNumber(0);else if(T-v<17){let nt=v;for(et=K.Long.fromNumber(L[nt++]),k=new K.Long(0,0);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(L[nt]))}else{let nt=v;for(k=K.Long.fromNumber(L[nt++]);nt<=T-17;nt++)k=k.multiply(K.Long.fromNumber(10)),k=k.add(K.Long.fromNumber(L[nt]));for(et=K.Long.fromNumber(L[nt++]);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(L[nt]))}let ht=W(k,K.Long.fromString("100000000000000000"));ht.low=ht.low.add(et),Q(ht.low,et)&&(ht.high=ht.high.add(K.Long.fromNumber(1))),Bt=D+m;let q={low:K.Long.fromNumber(0),high:K.Long.fromNumber(0)};ht.high.shiftRightUnsigned(49).and(K.Long.fromNumber(1)).equals(K.Long.fromNumber(1))?(q.high=q.high.or(K.Long.fromNumber(3).shiftLeft(61)),q.high=q.high.or(K.Long.fromNumber(Bt).and(K.Long.fromNumber(16383).shiftLeft(47))),q.high=q.high.or(ht.high.and(K.Long.fromNumber(0x7fffffffffff)))):(q.high=q.high.or(K.Long.fromNumber(Bt&16383).shiftLeft(49)),q.high=q.high.or(ht.high.and(K.Long.fromNumber(562949953421311)))),q.low=ht.low,x&&(q.high=q.high.or(K.Long.fromString("9223372036854775808")));let ut=C.Buffer.alloc(16);return X=0,ut[X++]=q.low.low&255,ut[X++]=q.low.low>>8&255,ut[X++]=q.low.low>>16&255,ut[X++]=q.low.low>>24&255,ut[X++]=q.low.high&255,ut[X++]=q.low.high>>8&255,ut[X++]=q.low.high>>16&255,ut[X++]=q.low.high>>24&255,ut[X++]=q.high.low&255,ut[X++]=q.high.low>>8&255,ut[X++]=q.high.low>>16&255,ut[X++]=q.high.low>>24&255,ut[X++]=q.high.high&255,ut[X++]=q.high.high>>8&255,ut[X++]=q.high.high>>16&255,ut[X++]=q.high.high>>24&255,new M(ut)}toString(){let z,x=0,s=new Array(36);for(let X=0;X<s.length;X++)s[X]=0;let O=0,A=!1,i,E={parts:[0,0,0,0]},I,j,L=[];O=0;let N=this.bytes,$=N[O++]|N[O++]<<8|N[O++]<<16|N[O++]<<24,v=N[O++]|N[O++]<<8|N[O++]<<16|N[O++]<<24,T=N[O++]|N[O++]<<8|N[O++]<<16|N[O++]<<24,D=N[O++]|N[O++]<<8|N[O++]<<16|N[O++]<<24;O=0,{low:new K.Long($,v),high:new K.Long(T,D)}.high.lessThan(K.Long.ZERO)&&L.push("-");let k=D>>26&w;if(k>>3===3){if(k===p)return L.join("")+"Infinity";if(k===F)return"NaN";z=D>>15&U,i=8+(D>>14&1)}else i=D>>14&7,z=D>>17&U;let et=z-m;if(E.parts[0]=(D&16383)+((i&15)<<14),E.parts[1]=T,E.parts[2]=v,E.parts[3]=$,E.parts[0]===0&&E.parts[1]===0&&E.parts[2]===0&&E.parts[3]===0)A=!0;else for(j=3;j>=0;j--){let X=0,lt=R(E);if(E=lt.quotient,X=lt.rem.low,!!X)for(I=8;I>=0;I--)s[j*9+I]=X%10,X=Math.floor(X/10)}if(A)x=1,s[O]=0;else for(x=36;!s[O];)x=x-1,O=O+1;let Bt=x-1+et;if(Bt>=34||Bt<=-7||et>0){if(x>34)return L.push(`${0}`),et>0?L.push("E+"+et):et<0&&L.push("E"+et),L.join("");L.push(`${s[O++]}`),x=x-1,x&&L.push(".");for(let X=0;X<x;X++)L.push(`${s[O++]}`);L.push("E"),Bt>0?L.push("+"+Bt):L.push(`${Bt}`)}else if(et>=0)for(let X=0;X<x;X++)L.push(`${s[O++]}`);else{let X=x+et;if(X>0)for(let lt=0;lt<X;lt++)L.push(`${s[O++]}`);else L.push("0");for(L.push(".");X++<0;)L.push("0");for(let lt=0;lt<x-Math.max(X-1,0);lt++)L.push(`${s[O++]}`)}return L.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(z){return M.fromString(z.$numberDecimal)}}t.Decimal128=M,Object.defineProperty(M.prototype,"_bsontype",{value:"Decimal128"})});st(Dt);var Gr=Dt.Decimal128,bt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Double=void 0;class h{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){if(l&&(l.legacy||l.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let f;return Number.isInteger(this.value)?(f=this.value.toFixed(1),f.length>=13&&(f=this.value.toExponential(13).toUpperCase())):f=this.value.toString(),{$numberDouble:f}}static fromExtendedJSON(l,f){let u=parseFloat(l.$numberDouble);return f&&f.relaxed?u:new h(u)}}t.Double=h,Object.defineProperty(h.prototype,"_bsontype",{value:"Double"})});st(bt);var xr=bt.Double,dt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Int32=void 0;class h{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){return l&&(l.relaxed||l.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(l,f){return f&&f.relaxed?parseInt(l.$numberInt,10):new h(l.$numberInt)}}t.Int32=h,Object.defineProperty(h.prototype,"_bsontype",{value:"Int32"})});st(dt);var Zr=dt.Int32,$t=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Map=void 0;let h;t.Map=h;let d=function(u){return u&&u.Math==Math&&u};function l(){return d(typeof globalThis=="object"&&globalThis)||d(typeof window=="object"&&window)||d(typeof self=="object"&&self)||d(typeof Vt=="object"&&Vt)||Function("return this")()}let f=l();Object.prototype.hasOwnProperty.call(f,"Map")?t.Map=h=f.Map:t.Map=h=class{constructor(m=[]){this._keys=[],this._values={};for(let o=0;o<m.length;o++){if(m[o]==null)continue;let c=m[o],_=c[0],g=c[1];this._keys.push(_),this._values[_]={v:g,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(m){let o=this._values[m];return o==null?!1:(delete this._values[m],this._keys.splice(o.i,1),!0)}entries(){let m=0;return{next:()=>{let o=this._keys[m++];return{value:o!==void 0?[o,this._values[o].v]:void 0,done:o===void 0}}}}forEach(m,o){o=o||this;for(let c=0;c<this._keys.length;c++){let _=this._keys[c];m.call(o,this._values[_].v,_,o)}}get(m){return this._values[m]?this._values[m].v:void 0}has(m){return this._values[m]!=null}keys(){let m=0;return{next:()=>{let o=this._keys[m++];return{value:o!==void 0?o:void 0,done:o===void 0}}}}set(m,o){return this._values[m]?(this._values[m].v=o,this):(this._keys.push(m),this._values[m]={v:o,i:this._keys.length-1},this)}values(){let m=0;return{next:()=>{let o=this._keys[m++];return{value:o!==void 0?this._values[o].v:void 0,done:o===void 0}}}}get size(){return this._keys.length}}});st($t);var Qr=$t.Map,Rt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MaxKey=void 0;class h{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new h}}t.MaxKey=h,Object.defineProperty(h.prototype,"_bsontype",{value:"MaxKey"})});st(Rt);var $r=Rt.MaxKey,Ut=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MinKey=void 0;class h{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new h}}t.MinKey=h,Object.defineProperty(h.prototype,"_bsontype",{value:"MinKey"})});st(Ut);var tn=Ut.MinKey,St=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectId=void 0;let h=rt.randomBytes(5),d=new RegExp("^[0-9a-fA-F]{24}$"),l=[];for(let _=0;_<256;_++)l[_]=(_<=15?"0":"")+_.toString(16);let f=[],u=0;for(;u<10;)f[48+u]=u++;for(;u<16;)f[65-10+u]=f[97-10+u]=u++;let m=Symbol("id");class o{constructor(g){if(g instanceof o&&(this[m]=g.id,this.__id=g.__id),typeof g=="object"&&g&&"id"in g&&("toHexString"in g&&typeof g.toHexString=="function"?this[m]=C.Buffer.from(g.toHexString(),"hex"):this[m]=typeof g.id=="string"?C.Buffer.from(g.id):g.id),(g==null||typeof g=="number")&&(this[m]=o.generate(typeof g=="number"?g:void 0),o.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(g)&&g.byteLength===12&&(this[m]=Et.ensureBuffer(g)),typeof g=="string")if(g.length===12){let n=C.Buffer.from(g);n.byteLength===12&&(this[m]=n)}else if(g.length===24&&d.test(g))this[m]=C.Buffer.from(g,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");o.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[m]}set id(g){this[m]=g,o.cacheHexString&&(this.__id=g.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(g){this.id.writeUInt32BE(g,0)}toHexString(){if(o.cacheHexString&&this.__id)return this.__id;let g=this.id.toString("hex");return o.cacheHexString&&!this.__id&&(this.__id=g),g}static getInc(){return o.index=(o.index+1)%16777215}static generate(g){typeof g!="number"&&(g=~~(Date.now()/1e3));let n=o.getInc(),w=C.Buffer.alloc(12);return w.writeUInt32BE(g,0),w[4]=h[0],w[5]=h[1],w[6]=h[2],w[7]=h[3],w[8]=h[4],w[11]=n&255,w[10]=n>>8&255,w[9]=n>>16&255,w}toString(g){return g?this.id.toString(g):this.toHexString()}toJSON(){return this.toHexString()}equals(g){return g==null?!1:g instanceof o?this.toString()===g.toString():typeof g=="string"&&o.isValid(g)&&g.length===12&&this.id instanceof C.Buffer?g===this.id.toString("binary"):typeof g=="string"&&o.isValid(g)&&g.length===24?g.toLowerCase()===this.toHexString():typeof g=="string"&&o.isValid(g)&&g.length===12?C.Buffer.from(g).equals(this.id):typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?g.toHexString()===this.toHexString():!1}getTimestamp(){let g=new Date,n=this.id.readUInt32BE(0);return g.setTime(Math.floor(n)*1e3),g}static createPk(){return new o}static createFromTime(g){let n=C.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(g,0),new o(n)}static createFromHexString(g){if(typeof g>"u"||g!=null&&g.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 o(C.Buffer.from(g,"hex"))}static isValid(g){return g==null?!1:typeof g=="number"?!0:typeof g=="string"?g.length===12||g.length===24&&d.test(g):g instanceof o||g instanceof C.Buffer&&g.length===12?!0:typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?typeof g.id=="string"?g.id.length===12:g.toHexString().length===24&&d.test(g.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(g){return new o(g.$oid)}}t.ObjectId=o,o.index=~~(Math.random()*16777215),Object.defineProperty(o.prototype,"generate",{value:rt.deprecate(_=>o.generate(_),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(o.prototype,"getInc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o.prototype,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")});let c=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(o.prototype,c,o.prototype.toString),Object.defineProperty(o.prototype,"inspect",o.prototype.toString),Object.defineProperty(o.prototype,"_bsontype",{value:"ObjectID"})});st(St);var en=St.ObjectId,b=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BSON_BINARY_SUBTYPE_USER_DEFINED=t.BSON_BINARY_SUBTYPE_MD5=t.BSON_BINARY_SUBTYPE_UUID_NEW=t.BSON_BINARY_SUBTYPE_UUID=t.BSON_BINARY_SUBTYPE_BYTE_ARRAY=t.BSON_BINARY_SUBTYPE_FUNCTION=t.BSON_BINARY_SUBTYPE_DEFAULT=t.BSON_DATA_MAX_KEY=t.BSON_DATA_MIN_KEY=t.BSON_DATA_DECIMAL128=t.BSON_DATA_LONG=t.BSON_DATA_TIMESTAMP=t.BSON_DATA_INT=t.BSON_DATA_CODE_W_SCOPE=t.BSON_DATA_SYMBOL=t.BSON_DATA_CODE=t.BSON_DATA_DBPOINTER=t.BSON_DATA_REGEXP=t.BSON_DATA_NULL=t.BSON_DATA_DATE=t.BSON_DATA_BOOLEAN=t.BSON_DATA_OID=t.BSON_DATA_UNDEFINED=t.BSON_DATA_BINARY=t.BSON_DATA_ARRAY=t.BSON_DATA_OBJECT=t.BSON_DATA_STRING=t.BSON_DATA_NUMBER=t.JS_INT_MIN=t.JS_INT_MAX=t.BSON_INT64_MIN=t.BSON_INT64_MAX=t.BSON_INT32_MIN=t.BSON_INT32_MAX=void 0,t.BSON_INT32_MAX=2147483647,t.BSON_INT32_MIN=-2147483648,t.BSON_INT64_MAX=Math.pow(2,63)-1,t.BSON_INT64_MIN=-Math.pow(2,63),t.JS_INT_MAX=Math.pow(2,53),t.JS_INT_MIN=-Math.pow(2,53),t.BSON_DATA_NUMBER=1,t.BSON_DATA_STRING=2,t.BSON_DATA_OBJECT=3,t.BSON_DATA_ARRAY=4,t.BSON_DATA_BINARY=5,t.BSON_DATA_UNDEFINED=6,t.BSON_DATA_OID=7,t.BSON_DATA_BOOLEAN=8,t.BSON_DATA_DATE=9,t.BSON_DATA_NULL=10,t.BSON_DATA_REGEXP=11,t.BSON_DATA_DBPOINTER=12,t.BSON_DATA_CODE=13,t.BSON_DATA_SYMBOL=14,t.BSON_DATA_CODE_W_SCOPE=15,t.BSON_DATA_INT=16,t.BSON_DATA_TIMESTAMP=17,t.BSON_DATA_LONG=18,t.BSON_DATA_DECIMAL128=19,t.BSON_DATA_MIN_KEY=255,t.BSON_DATA_MAX_KEY=127,t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BSON_BINARY_SUBTYPE_FUNCTION=1,t.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,t.BSON_BINARY_SUBTYPE_UUID=3,t.BSON_BINARY_SUBTYPE_UUID_NEW=4,t.BSON_BINARY_SUBTYPE_MD5=5,t.BSON_BINARY_SUBTYPE_USER_DEFINED=128});st(b);var rn=b.BSON_BINARY_SUBTYPE_USER_DEFINED,nn=b.BSON_BINARY_SUBTYPE_MD5,on=b.BSON_BINARY_SUBTYPE_UUID_NEW,sn=b.BSON_BINARY_SUBTYPE_UUID,fn=b.BSON_BINARY_SUBTYPE_BYTE_ARRAY,an=b.BSON_BINARY_SUBTYPE_FUNCTION,un=b.BSON_BINARY_SUBTYPE_DEFAULT,ln=b.BSON_DATA_MAX_KEY,cn=b.BSON_DATA_MIN_KEY,hn=b.BSON_DATA_DECIMAL128,_n=b.BSON_DATA_LONG,yn=b.BSON_DATA_TIMESTAMP,Bn=b.BSON_DATA_INT,pn=b.BSON_DATA_CODE_W_SCOPE,Nn=b.BSON_DATA_SYMBOL,gn=b.BSON_DATA_CODE,An=b.BSON_DATA_DBPOINTER,Sn=b.BSON_DATA_REGEXP,On=b.BSON_DATA_NULL,mn=b.BSON_DATA_DATE,En=b.BSON_DATA_BOOLEAN,wn=b.BSON_DATA_OID,Tn=b.BSON_DATA_UNDEFINED,bn=b.BSON_DATA_BINARY,dn=b.BSON_DATA_ARRAY,In=b.BSON_DATA_OBJECT,Dn=b.BSON_DATA_STRING,Rn=b.BSON_DATA_NUMBER,Un=b.JS_INT_MIN,Mn=b.JS_INT_MAX,Pn=b.BSON_INT64_MIN,jn=b.BSON_INT64_MAX,Fn=b.BSON_INT32_MIN,Yn=b.BSON_INT32_MAX,Be=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateObjectSize=void 0;function h(l,f,u){let m=5;if(Array.isArray(l))for(let o=0;o<l.length;o++)m+=d(o.toString(),l[o],f,!0,u);else{l.toBSON&&(l=l.toBSON());for(let o in l)m+=d(o,l[o],f,!1,u)}return m}t.calculateObjectSize=h;function d(l,f,u=!1,m=!1,o=!1){switch(f&&f.toBSON&&(f=f.toBSON()),typeof f){case"string":return 1+C.Buffer.byteLength(l,"utf8")+1+4+C.Buffer.byteLength(f,"utf8")+1;case"number":return Math.floor(f)===f&&f>=b.JS_INT_MIN&&f<=b.JS_INT_MAX&&f>=b.BSON_INT32_MIN&&f<=b.BSON_INT32_MAX?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(4+1):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);case"undefined":return m||!o?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1:0;case"boolean":return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+1);case"object":if(f==null||f._bsontype==="MinKey"||f._bsontype==="MaxKey")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1;if(f._bsontype==="ObjectId"||f._bsontype==="ObjectID")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(12+1);if(f instanceof Date||rt.isDate(f))return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(f)||f instanceof ArrayBuffer)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+4+1)+f.byteLength;if(f._bsontype==="Long"||f._bsontype==="Double"||f._bsontype==="Timestamp")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(f._bsontype==="Decimal128")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(16+1);if(f._bsontype==="Code")return f.scope!=null&&Object.keys(f.scope).length>0?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1+h(f.scope,u,o):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1;if(f._bsontype==="Binary")return f.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1+4):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1);if(f._bsontype==="Symbol")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+C.Buffer.byteLength(f.value,"utf8")+4+1+1;if(f._bsontype==="DBRef"){let c=Object.assign({$ref:f.collection,$id:f.oid},f.fields);return f.db!=null&&(c.$db=f.db),(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+h(c,u,o)}else return f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1:f._bsontype==="BSONRegExp"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.pattern,"utf8")+1+C.Buffer.byteLength(f.options,"utf8")+1:(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+h(f,u,o)+1;case"function":if(f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"||String.call(f)==="[object RegExp]")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1;if(u&&f.scope!=null&&Object.keys(f.scope).length>0)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1+h(f.scope,u,o);if(u)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1}return 0}});st(Be);var Ln=Be.calculateObjectSize,Ot=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BSONRegExp=void 0;function h(l){return l.split("").sort().join("")}class d{constructor(f,u){this.pattern=f,this.options=u??"",h(this.options);for(let m=0;m<this.options.length;m++)if(!(this.options[m]==="i"||this.options[m]==="m"||this.options[m]==="x"||this.options[m]==="l"||this.options[m]==="s"||this.options[m]==="u"))throw new Error(`The regular expression option [${this.options[m]}] is not supported`)}static parseOptions(f){return f?f.split("").sort().join(""):""}toExtendedJSON(f){return f=f||{},f.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(f){if("$regex"in f)if(typeof f.$regex!="string"){if(f.$regex._bsontype==="BSONRegExp")return f}else return new d(f.$regex,d.parseOptions(f.$options));if("$regularExpression"in f)return new d(f.$regularExpression.pattern,d.parseOptions(f.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(f)}`)}}t.BSONRegExp=d,Object.defineProperty(d.prototype,"_bsontype",{value:"BSONRegExp"})});st(Ot);var vn=Ot.BSONRegExp,Mt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BSONSymbol=void 0;class h{constructor(l){this.value=l}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(l){return new h(l.$symbol)}}t.BSONSymbol=h,Object.defineProperty(h.prototype,"_bsontype",{value:"Symbol"})});st(Mt);var Cn=Mt.BSONSymbol,wt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Timestamp=t.LongWithoutOverridesClass=void 0,t.LongWithoutOverridesClass=K.Long;class h extends t.LongWithoutOverridesClass{constructor(l,f){K.Long.isLong(l)?super(l.low,l.high,!0):super(l,f,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(l){return new h(K.Long.fromInt(l,!0))}static fromNumber(l){return new h(K.Long.fromNumber(l,!0))}static fromBits(l,f){return new h(l,f)}static fromString(l,f){return new h(K.Long.fromString(l,!0,f))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(l){return new h(l.$timestamp.i,l.$timestamp.t)}}t.Timestamp=h,h.MAX_VALUE=K.Long.MAX_UNSIGNED_VALUE});st(wt);var zn=wt.Timestamp,Jn=wt.LongWithoutOverridesClass,Gt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateUtf8=void 0;let h=128,d=192,l=224,f=240,u=248,m=192,o=224,c=240,_=128;function g(n,w,U){let p=0;for(let F=w;F<U;F+=1){let J=n[F];if(p){if((J&d)!==_)return!1;p-=1}else if(J&h)if((J&l)===m)p=1;else if((J&f)===o)p=2;else if((J&u)===c)p=3;else return!1}return!p}t.validateUtf8=g});st(Gt);var Wn=Gt.validateUtf8,xt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=void 0;let h=K.Long.fromNumber(b.JS_INT_MAX),d=K.Long.fromNumber(b.JS_INT_MIN),l={};function f(o,c,_){c=c??{};let g=c&&c.index?c.index:0,n=o[g]|o[g+1]<<8|o[g+2]<<16|o[g+3]<<24;if(n<5)throw new Error(`bson size must be >= 5, is ${n}`);if(c.allowObjectSmallerThanBufferSize&&o.length<n)throw new Error(`buffer length ${o.length} must be >= bson size ${n}`);if(!c.allowObjectSmallerThanBufferSize&&o.length!==n)throw new Error(`buffer length ${o.length} must === bson size ${n}`);if(n+g>o.byteLength)throw new Error(`(bson size ${n} + options.index ${g} must be <= buffer length ${o.byteLength})`);if(o[g+n-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return u(o,g,c,_)}t.deserialize=f;function u(o,c,_,g=!1){let n=_.evalFunctions==null?!1:_.evalFunctions,w=_.cacheFunctions==null?!1:_.cacheFunctions,U=_.fieldsAsRaw==null?null:_.fieldsAsRaw,p=_.raw==null?!1:_.raw,F=typeof _.bsonRegExp=="boolean"?_.bsonRegExp:!1,J=_.promoteBuffers==null?!1:_.promoteBuffers,R=_.promoteLongs==null?!0:_.promoteLongs,W=_.promoteValues==null?!0:_.promoteValues,Q=c;if(o.length<5)throw new Error("corrupt bson message < 5 bytes long");let H=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(H<5||H>o.length)throw new Error("corrupt bson message");let M=g?[]:{},G=0,z=!1;for(;!z;){let O=o[c++];if(O===0)break;let A=c;for(;o[A]!==0&&A<o.length;)A++;if(A>=o.byteLength)throw new Error("Bad BSON Document: illegal CString");let i=g?G++:o.toString("utf8",c,A);if(c=A+1,O===b.BSON_DATA_STRING){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(E<=0||E>o.length-c||o[c+E-1]!==0)throw new Error("bad string length in bson");if(!Gt.validateUtf8(o,c,c+E-1))throw new Error("Invalid UTF-8 string in BSON document");let I=o.toString("utf8",c,c+E-1);M[i]=I,c=c+E}else if(O===b.BSON_DATA_OID){let E=C.Buffer.alloc(12);o.copy(E,0,c,c+12),M[i]=new St.ObjectId(E),c=c+12}else if(O===b.BSON_DATA_INT&&W===!1)M[i]=new dt.Int32(o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24);else if(O===b.BSON_DATA_INT)M[i]=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;else if(O===b.BSON_DATA_NUMBER&&W===!1)M[i]=new bt.Double(o.readDoubleLE(c)),c=c+8;else if(O===b.BSON_DATA_NUMBER)M[i]=o.readDoubleLE(c),c=c+8;else if(O===b.BSON_DATA_DATE){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,I=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new Date(new K.Long(E,I).toNumber())}else if(O===b.BSON_DATA_BOOLEAN){if(o[c]!==0&&o[c]!==1)throw new Error("illegal boolean type value");M[i]=o[c++]===1}else if(O===b.BSON_DATA_OBJECT){let E=c,I=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24;if(I<=0||I>o.length-c)throw new Error("bad embedded document length in bson");p?M[i]=o.slice(c,c+I):M[i]=u(o,E,_,!1),c=c+I}else if(O===b.BSON_DATA_ARRAY){let E=c,I=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,j=_,L=c+I;if(U&&U[i]){j={};for(let N in _)j[N]=_[N];j.raw=!0}if(M[i]=u(o,E,j,!0),c=c+I,o[c-1]!==0)throw new Error("invalid array terminator byte");if(c!==L)throw new Error("corrupted array bson")}else if(O===b.BSON_DATA_UNDEFINED)M[i]=void 0;else if(O===b.BSON_DATA_NULL)M[i]=null;else if(O===b.BSON_DATA_LONG){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,I=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,j=new K.Long(E,I);R&&W===!0?M[i]=j.lessThanOrEqual(h)&&j.greaterThanOrEqual(d)?j.toNumber():j:M[i]=j}else if(O===b.BSON_DATA_DECIMAL128){let E=C.Buffer.alloc(16);o.copy(E,0,c,c+16),c=c+16;let I=new Dt.Decimal128(E);"toObject"in I&&typeof I.toObject=="function"?M[i]=I.toObject():M[i]=I}else if(O===b.BSON_DATA_BINARY){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,I=E,j=o[c++];if(E<0)throw new Error("Negative binary type element size found");if(E>o.byteLength)throw new Error("Binary type size larger than document size");if(o.slice!=null){if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,E<0)throw new Error("Negative binary type element size found for subtype 0x02");if(E>I-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(E<I-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}J&&W?M[i]=o.slice(c,c+E):M[i]=new _t.Binary(o.slice(c,c+E),j)}else{let L=C.Buffer.alloc(E);if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,E<0)throw new Error("Negative binary type element size found for subtype 0x02");if(E>I-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(E<I-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(A=0;A<E;A++)L[A]=o[c+A];J&&W?M[i]=L:M[i]=new _t.Binary(L,j)}c=c+E}else if(O===b.BSON_DATA_REGEXP&&F===!1){for(A=c;o[A]!==0&&A<o.length;)A++;if(A>=o.length)throw new Error("Bad BSON Document: illegal CString");let E=o.toString("utf8",c,A);for(c=A+1,A=c;o[A]!==0&&A<o.length;)A++;if(A>=o.length)throw new Error("Bad BSON Document: illegal CString");let I=o.toString("utf8",c,A);c=A+1;let j=new Array(I.length);for(A=0;A<I.length;A++)switch(I[A]){case"m":j[A]="m";break;case"s":j[A]="g";break;case"i":j[A]="i";break}M[i]=new RegExp(E,j.join(""))}else if(O===b.BSON_DATA_REGEXP&&F===!0){for(A=c;o[A]!==0&&A<o.length;)A++;if(A>=o.length)throw new Error("Bad BSON Document: illegal CString");let E=o.toString("utf8",c,A);for(c=A+1,A=c;o[A]!==0&&A<o.length;)A++;if(A>=o.length)throw new Error("Bad BSON Document: illegal CString");let I=o.toString("utf8",c,A);c=A+1,M[i]=new Ot.BSONRegExp(E,I)}else if(O===b.BSON_DATA_SYMBOL){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(E<=0||E>o.length-c||o[c+E-1]!==0)throw new Error("bad string length in bson");let I=o.toString("utf8",c,c+E-1);M[i]=W?I:new Mt.BSONSymbol(I),c=c+E}else if(O===b.BSON_DATA_TIMESTAMP){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,I=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new wt.Timestamp(E,I)}else if(O===b.BSON_DATA_MIN_KEY)M[i]=new Ut.MinKey;else if(O===b.BSON_DATA_MAX_KEY)M[i]=new Rt.MaxKey;else if(O===b.BSON_DATA_CODE){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(E<=0||E>o.length-c||o[c+E-1]!==0)throw new Error("bad string length in bson");let I=o.toString("utf8",c,c+E-1);n?w?M[i]=m(I,l,M):M[i]=m(I):M[i]=new mt.Code(I),c=c+E}else if(O===b.BSON_DATA_CODE_W_SCOPE){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(E<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let I=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(I<=0||I>o.length-c||o[c+I-1]!==0)throw new Error("bad string length in bson");let j=o.toString("utf8",c,c+I-1);c=c+I;let L=c,N=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,$=u(o,L,_,!1);if(c=c+N,E<4+4+N+I)throw new Error("code_w_scope total size is too short, truncating scope");if(E>4+4+N+I)throw new Error("code_w_scope total size is too long, clips outer document");n?(w?M[i]=m(j,l,M):M[i]=m(j),M[i].scope=$):M[i]=new mt.Code(j,$)}else if(O===b.BSON_DATA_DBPOINTER){let E=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(E<=0||E>o.length-c||o[c+E-1]!==0)throw new Error("bad string length in bson");if(!Gt.validateUtf8(o,c,c+E-1))throw new Error("Invalid UTF-8 string in BSON document");let I=o.toString("utf8",c,c+E-1);c=c+E;let j=C.Buffer.alloc(12);o.copy(j,0,c,c+12);let L=new St.ObjectId(j);c=c+12,M[i]=new pt.DBRef(I,L)}else throw new Error("Detected unknown BSON type "+O.toString(16)+' for fieldname "'+i+'"')}if(H!==c-Q)throw g?new Error("corrupt array bson"):new Error("corrupt object bson");let x=Object.keys(M).filter(O=>O.startsWith("$")),s=!0;if(x.forEach(O=>{["$ref","$id","$db"].indexOf(O)===-1&&(s=!1)}),!s)return M;if(pt.isDBRefLike(M)){let O=Object.assign({},M);return delete O.$ref,delete O.$id,delete O.$db,new pt.DBRef(M.$ref,M.$id,M.$db,O)}return M}function m(o,c,_){return c?(c[o]==null&&(c[o]=new Function(o)),c[o].bind(_)):new Function(o)}});st(xt);var kn=xt.deserialize,Ft=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.EJSON=t.isBSONType=void 0;function h(p){return rt.isObjectLike(p)&&Reflect.has(p,"_bsontype")&&typeof p._bsontype=="string"}t.isBSONType=h;let d=2147483647,l=-2147483648,f=9223372036854776e3,u=-9223372036854776e3,m={$oid:St.ObjectId,$binary:_t.Binary,$uuid:_t.Binary,$symbol:Mt.BSONSymbol,$numberInt:dt.Int32,$numberDecimal:Dt.Decimal128,$numberDouble:bt.Double,$numberLong:K.Long,$minKey:Ut.MinKey,$maxKey:Rt.MaxKey,$regex:Ot.BSONRegExp,$regularExpression:Ot.BSONRegExp,$timestamp:wt.Timestamp};function o(p,F={}){if(typeof p=="number"){if(F.relaxed||F.legacy)return p;if(Math.floor(p)===p){if(p>=l&&p<=d)return new dt.Int32(p);if(p>=u&&p<=f)return K.Long.fromNumber(p)}return new bt.Double(p)}if(p==null||typeof p!="object")return p;if(p.$undefined)return null;let J=Object.keys(p).filter(R=>R.startsWith("$")&&p[R]!=null);for(let R=0;R<J.length;R++){let W=m[J[R]];if(W)return W.fromExtendedJSON(p,F)}if(p.$date!=null){let R=p.$date,W=new Date;return F.legacy?typeof R=="number"?W.setTime(R):typeof R=="string"&&W.setTime(Date.parse(R)):typeof R=="string"?W.setTime(Date.parse(R)):K.Long.isLong(R)?W.setTime(R.toNumber()):typeof R=="number"&&F.relaxed&&W.setTime(R),W}if(p.$code!=null){let R=Object.assign({},p);return p.$scope&&(R.$scope=o(p.$scope)),mt.Code.fromExtendedJSON(p)}if(p.$ref!=null||p.$dbPointer!=null){let R=p.$ref?p:p.$dbPointer;if(R instanceof pt.DBRef)return R;let W=Object.keys(R).filter(H=>H.startsWith("$")),Q=!0;if(W.forEach(H=>{["$ref","$id","$db"].indexOf(H)===-1&&(Q=!1)}),Q)return pt.DBRef.fromExtendedJSON(R)}return p}function c(p,F){return p.map(J=>g(J,F))}function _(p){let F=p.toISOString();return p.getUTCMilliseconds()!==0?F:F.slice(0,-5)+"Z"}function g(p,F){if(Array.isArray(p))return c(p,F);if(p===void 0)return null;if(p instanceof Date){let J=p.getTime(),R=J>-1&&J<2534023188e5;return F.legacy?F.relaxed&&R?{$date:p.getTime()}:{$date:_(p)}:F.relaxed&&R?{$date:_(p)}:{$date:{$numberLong:p.getTime().toString()}}}if(typeof p=="number"&&!F.relaxed){if(Math.floor(p)===p){let J=p>=l&&p<=d,R=p>=u&&p<=f;if(J)return{$numberInt:p.toString()};if(R)return{$numberLong:p.toString()}}return{$numberDouble:p.toString()}}if(p instanceof RegExp){let J=p.flags;if(J===void 0){let W=p.toString().match(/[gimuy]*$/);W&&(J=W[0])}return new Ot.BSONRegExp(p.source,J).toExtendedJSON(F)}return p!=null&&typeof p=="object"?w(p,F):p}let n={Binary:p=>new _t.Binary(p.value(),p.sub_type),Code:p=>new mt.Code(p.code,p.scope),DBRef:p=>new pt.DBRef(p.collection||p.namespace,p.oid,p.db,p.fields),Decimal128:p=>new Dt.Decimal128(p.bytes),Double:p=>new bt.Double(p.value),Int32:p=>new dt.Int32(p.value),Long:p=>K.Long.fromBits(p.low!=null?p.low:p.low_,p.low!=null?p.high:p.high_,p.low!=null?p.unsigned:p.unsigned_),MaxKey:()=>new Rt.MaxKey,MinKey:()=>new Ut.MinKey,ObjectID:p=>new St.ObjectId(p),ObjectId:p=>new St.ObjectId(p),BSONRegExp:p=>new Ot.BSONRegExp(p.pattern,p.options),Symbol:p=>new Mt.BSONSymbol(p.value),Timestamp:p=>wt.Timestamp.fromBits(p.low,p.high)};function w(p,F){if(p==null||typeof p!="object")throw new Error("not an object instance");let J=p._bsontype;if(typeof J>"u"){let R={};for(let W in p)R[W]=g(p[W],F);return R}else if(h(p)){let R=p;if(typeof R.toExtendedJSON!="function"){let W=n[p._bsontype];if(!W)throw new TypeError("Unrecognized or invalid _bsontype: "+p._bsontype);R=W(R)}return J==="Code"&&R.scope?R=new mt.Code(R.code,g(R.scope,F)):J==="DBRef"&&R.oid&&(R=new pt.DBRef(R.collection,g(R.oid,F),R.db,R.fields)),R.toExtendedJSON(F)}else throw new Error("_bsontype must be a string, but was: "+typeof J)}var U;(function(p){function F(Q,H){let M=Object.assign({},{relaxed:!0,legacy:!1},H);return typeof M.relaxed=="boolean"&&(M.strict=!M.relaxed),typeof M.strict=="boolean"&&(M.relaxed=!M.strict),JSON.parse(Q,(G,z)=>o(z,M))}p.parse=F;function J(Q,H,M,G){M!=null&&typeof M=="object"&&(G=M,M=0),H!=null&&typeof H=="object"&&!Array.isArray(H)&&(G=H,H=void 0,M=0),G=Object.assign({},{relaxed:!0,legacy:!1},G);let z=g(Q,G);return JSON.stringify(z,H,M)}p.stringify=J;function R(Q,H){return H=H||{},JSON.parse(J(Q,H))}p.serialize=R;function W(Q,H){return H=H||{},F(JSON.stringify(Q),H)}p.deserialize=W})(U=t.EJSON||(t.EJSON={}))});st(Ft);var Xn=Ft.EJSON,Kn=Ft.isBSONType,jt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.writeIEEE754=t.readIEEE754=void 0;function h(l,f,u,m,o){let c,_,g=u==="big",n=o*8-m-1,w=(1<<n)-1,U=w>>1,p=-7,F=g?0:o-1,J=g?1:-1,R=l[f+F];for(F+=J,c=R&(1<<-p)-1,R>>=-p,p+=n;p>0;c=c*256+l[f+F],F+=J,p-=8);for(_=c&(1<<-p)-1,c>>=-p,p+=m;p>0;_=_*256+l[f+F],F+=J,p-=8);if(c===0)c=1-U;else{if(c===w)return _?NaN:(R?-1:1)*(1/0);_=_+Math.pow(2,m),c=c-U}return(R?-1:1)*_*Math.pow(2,c-m)}t.readIEEE754=h;function d(l,f,u,m,o,c){let _,g,n,w=m==="big",U=c*8-o-1,p=(1<<U)-1,F=p>>1,J=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=w?c-1:0,W=w?-1:1,Q=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(g=isNaN(f)?1:0,_=p):(_=Math.floor(Math.log(f)/Math.LN2),f*(n=Math.pow(2,-_))<1&&(_--,n*=2),_+F>=1?f+=J/n:f+=J*Math.pow(2,1-F),f*n>=2&&(_++,n/=2),_+F>=p?(g=0,_=p):_+F>=1?(g=(f*n-1)*Math.pow(2,o),_=_+F):(g=f*Math.pow(2,F-1)*Math.pow(2,o),_=0)),isNaN(f)&&(g=0);o>=8;)l[u+R]=g&255,R+=W,g/=256,o-=8;for(_=_<<o|g,isNaN(f)&&(_+=8),U+=o;U>0;)l[u+R]=_&255,R+=W,_/=256,U-=8;l[u+R-W]|=Q*128}t.writeIEEE754=d});st(jt);var Vn=jt.writeIEEE754,Hn=jt.readIEEE754,Zt=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeInto=void 0;let h=/\x00/,d=new Set(["$db","$ref","$id","$clusterTime"]);function l(s){return Object.prototype.toString.call(s)==="[object RegExp]"}function f(s,O,A,i,E){s[i++]=b.BSON_DATA_STRING;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I+1,s[i-1]=0;let j=s.write(A,i+4,void 0,"utf8");return s[i+3]=j+1>>24&255,s[i+2]=j+1>>16&255,s[i+1]=j+1>>8&255,s[i]=j+1&255,i=i+4+j,s[i++]=0,i}function u(s,O,A,i,E){if(Number.isInteger(A)&&A>=b.BSON_INT32_MIN&&A<=b.BSON_INT32_MAX){s[i++]=b.BSON_DATA_INT;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0,s[i++]=A&255,s[i++]=A>>8&255,s[i++]=A>>16&255,s[i++]=A>>24&255}else{s[i++]=b.BSON_DATA_NUMBER;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0,jt.writeIEEE754(s,A,i,"little",52,8),i=i+8}return i}function m(s,O,A,i,E){s[i++]=b.BSON_DATA_NULL;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,i}function o(s,O,A,i,E){s[i++]=b.BSON_DATA_BOOLEAN;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,s[i++]=A?1:0,i}function c(s,O,A,i,E){s[i++]=b.BSON_DATA_DATE;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0;let j=K.Long.fromNumber(A.getTime()),L=j.getLowBits(),N=j.getHighBits();return s[i++]=L&255,s[i++]=L>>8&255,s[i++]=L>>16&255,s[i++]=L>>24&255,s[i++]=N&255,s[i++]=N>>8&255,s[i++]=N>>16&255,s[i++]=N>>24&255,i}function _(s,O,A,i,E){s[i++]=b.BSON_DATA_REGEXP;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");if(i=i+I,s[i++]=0,A.source&&A.source.match(h)!=null)throw Error("value "+A.source+" must not contain null bytes");return i=i+s.write(A.source,i,void 0,"utf8"),s[i++]=0,A.ignoreCase&&(s[i++]=105),A.global&&(s[i++]=115),A.multiline&&(s[i++]=109),s[i++]=0,i}function g(s,O,A,i,E){s[i++]=b.BSON_DATA_REGEXP;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");if(i=i+I,s[i++]=0,A.pattern.match(h)!=null)throw Error("pattern "+A.pattern+" must not contain null bytes");return i=i+s.write(A.pattern,i,void 0,"utf8"),s[i++]=0,i=i+s.write(A.options.split("").sort().join(""),i,void 0,"utf8"),s[i++]=0,i}function n(s,O,A,i,E){A===null?s[i++]=b.BSON_DATA_NULL:A._bsontype==="MinKey"?s[i++]=b.BSON_DATA_MIN_KEY:s[i++]=b.BSON_DATA_MAX_KEY;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,i}function w(s,O,A,i,E){s[i++]=b.BSON_DATA_OID;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");if(i=i+I,s[i++]=0,typeof A.id=="string")s.write(A.id,i,void 0,"binary");else if(A.id&&A.id.copy)A.id.copy(s,i,0,12);else throw new TypeError("object ["+JSON.stringify(A)+"] is not a valid ObjectId");return i+12}function U(s,O,A,i,E){s[i++]=b.BSON_DATA_BINARY;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0;let j=A.length;return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=b.BSON_BINARY_SUBTYPE_DEFAULT,s.set(Et.ensureBuffer(A),i),i=i+j,i}function p(s,O,A,i,E=!1,I=0,j=!1,L=!0,N=!1,$=[]){for(let D=0;D<$.length;D++)if($[D]===A)throw new Error("cyclic dependency detected");$.push(A),s[i++]=Array.isArray(A)?b.BSON_DATA_ARRAY:b.BSON_DATA_OBJECT;let v=N?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+v,s[i++]=0;let T=x(s,A,E,i,I+1,j,L,$);return $.pop(),T}function F(s,O,A,i,E){s[i++]=b.BSON_DATA_DECIMAL128;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,A.bytes.copy(s,i,0,16),i+16}function J(s,O,A,i,E){s[i++]=A._bsontype==="Long"?b.BSON_DATA_LONG:b.BSON_DATA_TIMESTAMP;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0;let j=A.getLowBits(),L=A.getHighBits();return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=L&255,s[i++]=L>>8&255,s[i++]=L>>16&255,s[i++]=L>>24&255,i}function R(s,O,A,i,E){A=A.valueOf(),s[i++]=b.BSON_DATA_INT;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,s[i++]=A&255,s[i++]=A>>8&255,s[i++]=A>>16&255,s[i++]=A>>24&255,i}function W(s,O,A,i,E){s[i++]=b.BSON_DATA_NUMBER;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");return i=i+I,s[i++]=0,jt.writeIEEE754(s,A.value,i,"little",52,8),i=i+8,i}function Q(s,O,A,i,E=!1,I=0,j){s[i++]=b.BSON_DATA_CODE;let L=j?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+L,s[i++]=0;let N=rt.normalizedFunctionString(A),$=s.write(N,i+4,void 0,"utf8")+1;return s[i]=$&255,s[i+1]=$>>8&255,s[i+2]=$>>16&255,s[i+3]=$>>24&255,i=i+4+$-1,s[i++]=0,i}function H(s,O,A,i,E=!1,I=0,j=!1,L=!0,N=!1){if(A.scope&&typeof A.scope=="object"){s[i++]=b.BSON_DATA_CODE_W_SCOPE;let $=N?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+$,s[i++]=0;let v=i,T=typeof A.code=="string"?A.code:A.code.toString();i=i+4;let D=s.write(T,i+4,void 0,"utf8")+1;s[i]=D&255,s[i+1]=D>>8&255,s[i+2]=D>>16&255,s[i+3]=D>>24&255,s[i+4+D-1]=0,i=i+D+4;let Z=x(s,A.scope,E,i,I+1,j,L);i=Z-1;let k=Z-v;s[v++]=k&255,s[v++]=k>>8&255,s[v++]=k>>16&255,s[v++]=k>>24&255,s[i++]=0}else{s[i++]=b.BSON_DATA_CODE;let $=N?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+$,s[i++]=0;let v=A.code.toString(),T=s.write(v,i+4,void 0,"utf8")+1;s[i]=T&255,s[i+1]=T>>8&255,s[i+2]=T>>16&255,s[i+3]=T>>24&255,i=i+4+T-1,s[i++]=0}return i}function M(s,O,A,i,E){s[i++]=b.BSON_DATA_BINARY;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0;let j=A.value(!0),L=A.position;return A.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(L=L+4),s[i++]=L&255,s[i++]=L>>8&255,s[i++]=L>>16&255,s[i++]=L>>24&255,s[i++]=A.sub_type,A.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(L=L-4,s[i++]=L&255,s[i++]=L>>8&255,s[i++]=L>>16&255,s[i++]=L>>24&255),s.set(j,i),i=i+A.position,i}function G(s,O,A,i,E){s[i++]=b.BSON_DATA_SYMBOL;let I=E?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+I,s[i++]=0;let j=s.write(A.value,i+4,void 0,"utf8")+1;return s[i]=j&255,s[i+1]=j>>8&255,s[i+2]=j>>16&255,s[i+3]=j>>24&255,i=i+4+j-1,s[i++]=0,i}function z(s,O,A,i,E,I,j){s[i++]=b.BSON_DATA_OBJECT;let L=j?s.write(O,i,void 0,"ascii"):s.write(O,i,void 0,"utf8");i=i+L,s[i++]=0;let N=i,$={$ref:A.collection||A.namespace,$id:A.oid};A.db!=null&&($.$db=A.db),$=Object.assign($,A.fields);let v=x(s,$,!1,i,E+1,I),T=v-N;return s[N++]=T&255,s[N++]=T>>8&255,s[N++]=T>>16&255,s[N++]=T>>24&255,v}function x(s,O,A=!1,i=0,E=0,I=!1,j=!0,L=[]){i=i||0,L=L||[],L.push(O);let N=i+4;if(Array.isArray(O))for(let v=0;v<O.length;v++){let T=""+v,D=O[v];if(D&&D.toBSON){if(typeof D.toBSON!="function")throw new TypeError("toBSON is not a function");D=D.toBSON()}if(typeof D=="string")N=f(s,T,D,N,!0);else if(typeof D=="number")N=u(s,T,D,N,!0);else{if(typeof D=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof D=="boolean")N=o(s,T,D,N,!0);else if(D instanceof Date||rt.isDate(D))N=c(s,T,D,N,!0);else if(D===void 0)N=m(s,T,D,N,!0);else if(D===null)N=m(s,T,D,N,!0);else if(D._bsontype==="ObjectId"||D._bsontype==="ObjectID")N=w(s,T,D,N,!0);else if(C.Buffer.isBuffer(D)||rt.isUint8Array(D))N=U(s,T,D,N,!0);else if(D instanceof RegExp||l(D))N=_(s,T,D,N,!0);else if(typeof D=="object"&&D._bsontype==null)N=p(s,T,D,N,A,E,I,j,!0,L);else if(typeof D=="object"&&Ft.isBSONType(D)&&D._bsontype==="Decimal128")N=F(s,T,D,N,!0);else if(D._bsontype==="Long"||D._bsontype==="Timestamp")N=J(s,T,D,N,!0);else if(D._bsontype==="Double")N=W(s,T,D,N,!0);else if(typeof D=="function"&&I)N=Q(s,T,D,N,A,E,!0);else if(D._bsontype==="Code")N=H(s,T,D,N,A,E,I,j,!0);else if(D._bsontype==="Binary")N=M(s,T,D,N,!0);else if(D._bsontype==="Symbol")N=G(s,T,D,N,!0);else if(D._bsontype==="DBRef")N=z(s,T,D,N,E,I,!0);else if(D._bsontype==="BSONRegExp")N=g(s,T,D,N,!0);else if(D._bsontype==="Int32")N=R(s,T,D,N,!0);else if(D._bsontype==="MinKey"||D._bsontype==="MaxKey")N=n(s,T,D,N,!0);else if(typeof D._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+D._bsontype)}}else if(O instanceof $t.Map){let v=O.entries(),T=!1;for(;!T;){let D=v.next();if(T=!!D.done,T)continue;let Z=D.value[0],k=D.value[1],et=typeof k;if(typeof Z=="string"&&!d.has(Z)){if(Z.match(h)!=null)throw Error("key "+Z+" must not contain null bytes");if(A){if(Z[0]==="$")throw Error("key "+Z+" must not start with '$'");if(~Z.indexOf("."))throw Error("key "+Z+" must not contain '.'")}}if(et==="string")N=f(s,Z,k,N);else if(et==="number")N=u(s,Z,k,N);else{if(et==="bigint"||rt.isBigInt64Array(k)||rt.isBigUInt64Array(k))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(et==="boolean")N=o(s,Z,k,N);else if(k instanceof Date||rt.isDate(k))N=c(s,Z,k,N);else if(k===null||k===void 0&&j===!1)N=m(s,Z,k,N);else if(k._bsontype==="ObjectId"||k._bsontype==="ObjectID")N=w(s,Z,k,N);else if(C.Buffer.isBuffer(k)||rt.isUint8Array(k))N=U(s,Z,k,N);else if(k instanceof RegExp||l(k))N=_(s,Z,k,N);else if(et==="object"&&k._bsontype==null)N=p(s,Z,k,N,A,E,I,j,!1,L);else if(et==="object"&&k._bsontype==="Decimal128")N=F(s,Z,k,N);else if(k._bsontype==="Long"||k._bsontype==="Timestamp")N=J(s,Z,k,N);else if(k._bsontype==="Double")N=W(s,Z,k,N);else if(k._bsontype==="Code")N=H(s,Z,k,N,A,E,I,j);else if(typeof k=="function"&&I)N=Q(s,Z,k,N,A,E,I);else if(k._bsontype==="Binary")N=M(s,Z,k,N);else if(k._bsontype==="Symbol")N=G(s,Z,k,N);else if(k._bsontype==="DBRef")N=z(s,Z,k,N,E,I);else if(k._bsontype==="BSONRegExp")N=g(s,Z,k,N);else if(k._bsontype==="Int32")N=R(s,Z,k,N);else if(k._bsontype==="MinKey"||k._bsontype==="MaxKey")N=n(s,Z,k,N);else if(typeof k._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+k._bsontype)}}}else{if(O.toBSON){if(typeof O.toBSON!="function")throw new TypeError("toBSON is not a function");if(O=O.toBSON(),O!=null&&typeof O!="object")throw new TypeError("toBSON function did not return an object")}for(let v in O){let T=O[v];if(T&&T.toBSON){if(typeof T.toBSON!="function")throw new TypeError("toBSON is not a function");T=T.toBSON()}let D=typeof T;if(typeof v=="string"&&!d.has(v)){if(v.match(h)!=null)throw Error("key "+v+" must not contain null bytes");if(A){if(v[0]==="$")throw Error("key "+v+" must not start with '$'");if(~v.indexOf("."))throw Error("key "+v+" must not contain '.'")}}if(D==="string")N=f(s,v,T,N);else if(D==="number")N=u(s,v,T,N);else{if(D==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(D==="boolean")N=o(s,v,T,N);else if(T instanceof Date||rt.isDate(T))N=c(s,v,T,N);else if(T===void 0)j===!1&&(N=m(s,v,T,N));else if(T===null)N=m(s,v,T,N);else if(T._bsontype==="ObjectId"||T._bsontype==="ObjectID")N=w(s,v,T,N);else if(C.Buffer.isBuffer(T)||rt.isUint8Array(T))N=U(s,v,T,N);else if(T instanceof RegExp||l(T))N=_(s,v,T,N);else if(D==="object"&&T._bsontype==null)N=p(s,v,T,N,A,E,I,j,!1,L);else if(D==="object"&&T._bsontype==="Decimal128")N=F(s,v,T,N);else if(T._bsontype==="Long"||T._bsontype==="Timestamp")N=J(s,v,T,N);else if(T._bsontype==="Double")N=W(s,v,T,N);else if(T._bsontype==="Code")N=H(s,v,T,N,A,E,I,j);else if(typeof T=="function"&&I)N=Q(s,v,T,N,A,E,I);else if(T._bsontype==="Binary")N=M(s,v,T,N);else if(T._bsontype==="Symbol")N=G(s,v,T,N);else if(T._bsontype==="DBRef")N=z(s,v,T,N,E,I);else if(T._bsontype==="BSONRegExp")N=g(s,v,T,N);else if(T._bsontype==="Int32")N=R(s,v,T,N);else if(T._bsontype==="MinKey"||T._bsontype==="MaxKey")N=n(s,v,T,N);else if(typeof T._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype)}}}L.pop(),s[N++]=0;let $=N-i;return s[i++]=$&255,s[i++]=$>>8&255,s[i++]=$>>16&255,s[i++]=$>>24&255,N}t.serializeInto=x});st(Zt);var Gn=Zt.serializeInto,V=ot(function(B,t){Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeStream=t.calculateObjectSize=t.deserialize=t.serializeWithBufferAndIndex=t.serialize=t.setInternalBufferSize=t.ObjectID=t.Decimal128=t.BSONRegExp=t.MaxKey=t.MinKey=t.Int32=t.Double=t.Timestamp=t.Long=t.ObjectId=t.Binary=t.DBRef=t.BSONSymbol=t.Map=t.Code=t.LongWithoutOverridesClass=t.EJSON=t.JS_INT_MIN=t.JS_INT_MAX=t.BSON_INT64_MIN=t.BSON_INT64_MAX=t.BSON_INT32_MIN=t.BSON_INT32_MAX=t.BSON_DATA_UNDEFINED=t.BSON_DATA_TIMESTAMP=t.BSON_DATA_SYMBOL=t.BSON_DATA_STRING=t.BSON_DATA_REGEXP=t.BSON_DATA_OID=t.BSON_DATA_OBJECT=t.BSON_DATA_NUMBER=t.BSON_DATA_NULL=t.BSON_DATA_MIN_KEY=t.BSON_DATA_MAX_KEY=t.BSON_DATA_LONG=t.BSON_DATA_INT=t.BSON_DATA_DECIMAL128=t.BSON_DATA_DBPOINTER=t.BSON_DATA_DATE=t.BSON_DATA_CODE_W_SCOPE=t.BSON_DATA_CODE=t.BSON_DATA_BOOLEAN=t.BSON_DATA_BINARY=t.BSON_DATA_ARRAY=t.BSON_BINARY_SUBTYPE_UUID_NEW=t.BSON_BINARY_SUBTYPE_UUID=t.BSON_BINARY_SUBTYPE_USER_DEFINED=t.BSON_BINARY_SUBTYPE_MD5=t.BSON_BINARY_SUBTYPE_FUNCTION=t.BSON_BINARY_SUBTYPE_DEFAULT=t.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return _t.Binary}}),Object.defineProperty(t,"Code",{enumerable:!0,get:function(){return mt.Code}}),Object.defineProperty(t,"DBRef",{enumerable:!0,get:function(){return pt.DBRef}}),Object.defineProperty(t,"Decimal128",{enumerable:!0,get:function(){return Dt.Decimal128}}),Object.defineProperty(t,"Double",{enumerable:!0,get:function(){return bt.Double}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return dt.Int32}}),Object.defineProperty(t,"Long",{enumerable:!0,get:function(){return K.Long}}),Object.defineProperty(t,"Map",{enumerable:!0,get:function(){return $t.Map}}),Object.defineProperty(t,"MaxKey",{enumerable:!0,get:function(){return Rt.MaxKey}}),Object.defineProperty(t,"MinKey",{enumerable:!0,get:function(){return Ut.MinKey}}),Object.defineProperty(t,"ObjectId",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(t,"ObjectID",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(t,"BSONRegExp",{enumerable:!0,get:function(){return Ot.BSONRegExp}}),Object.defineProperty(t,"BSONSymbol",{enumerable:!0,get:function(){return Mt.BSONSymbol}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(t,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return b.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(t,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return b.BSON_DATA_ARRAY}}),Object.defineProperty(t,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return b.BSON_DATA_BINARY}}),Object.defineProperty(t,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return b.BSON_DATA_BOOLEAN}}),Object.defineProperty(t,"BSON_DATA_CODE",{enumerable:!0,get:function(){return b.BSON_DATA_CODE}}),Object.defineProperty(t,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return b.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(t,"BSON_DATA_DATE",{enumerable:!0,get:function(){return b.BSON_DATA_DATE}}),Object.defineProperty(t,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return b.BSON_DATA_DBPOINTER}}),Object.defineProperty(t,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return b.BSON_DATA_DECIMAL128}}),Object.defineProperty(t,"BSON_DATA_INT",{enumerable:!0,get:function(){return b.BSON_DATA_INT}}),Object.defineProperty(t,"BSON_DATA_LONG",{enumerable:!0,get:function(){return b.BSON_DATA_LONG}}),Object.defineProperty(t,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return b.BSON_DATA_MAX_KEY}}),Object.defineProperty(t,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return b.BSON_DATA_MIN_KEY}}),Object.defineProperty(t,"BSON_DATA_NULL",{enumerable:!0,get:function(){return b.BSON_DATA_NULL}}),Object.defineProperty(t,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return b.BSON_DATA_NUMBER}}),Object.defineProperty(t,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return b.BSON_DATA_OBJECT}}),Object.defineProperty(t,"BSON_DATA_OID",{enumerable:!0,get:function(){return b.BSON_DATA_OID}}),Object.defineProperty(t,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return b.BSON_DATA_REGEXP}}),Object.defineProperty(t,"BSON_DATA_STRING",{enumerable:!0,get:function(){return b.BSON_DATA_STRING}}),Object.defineProperty(t,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return b.BSON_DATA_SYMBOL}}),Object.defineProperty(t,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return b.BSON_DATA_TIMESTAMP}}),Object.defineProperty(t,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return b.BSON_DATA_UNDEFINED}}),Object.defineProperty(t,"BSON_INT32_MAX",{enumerable:!0,get:function(){return b.BSON_INT32_MAX}}),Object.defineProperty(t,"BSON_INT32_MIN",{enumerable:!0,get:function(){return b.BSON_INT32_MIN}}),Object.defineProperty(t,"BSON_INT64_MAX",{enumerable:!0,get:function(){return b.BSON_INT64_MAX}}),Object.defineProperty(t,"BSON_INT64_MIN",{enumerable:!0,get:function(){return b.BSON_INT64_MIN}}),Object.defineProperty(t,"JS_INT_MAX",{enumerable:!0,get:function(){return b.JS_INT_MAX}}),Object.defineProperty(t,"JS_INT_MIN",{enumerable:!0,get:function(){return b.JS_INT_MIN}}),Object.defineProperty(t,"EJSON",{enumerable:!0,get:function(){return Ft.EJSON}});var h=wt;Object.defineProperty(t,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return h.LongWithoutOverridesClass}});let d=1024*1024*17,l=C.Buffer.alloc(d);function f(g){l.length<g&&(l=C.Buffer.alloc(g))}t.setInternalBufferSize=f;function u(g,n={}){let w=typeof n.checkKeys=="boolean"?n.checkKeys:!1,U=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,p=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0,F=typeof n.minInternalBufferSize=="number"?n.minInternalBufferSize:d;l.length<F&&(l=C.Buffer.alloc(F));let J=Zt.serializeInto(l,g,w,0,0,U,p,[]),R=C.Buffer.alloc(J);return l.copy(R,0,0,R.length),R}t.serialize=u;function m(g,n,w={}){let U=typeof w.checkKeys=="boolean"?w.checkKeys:!1,p=typeof w.serializeFunctions=="boolean"?w.serializeFunctions:!1,F=typeof w.ignoreUndefined=="boolean"?w.ignoreUndefined:!0,J=typeof w.index=="number"?w.index:0,R=Zt.serializeInto(l,g,U,0,0,p,F);return l.copy(n,J,0,R),J+R-1}t.serializeWithBufferAndIndex=m;function o(g,n={}){return xt.deserialize(Et.ensureBuffer(g),n)}t.deserialize=o;function c(g,n={}){n=n||{};let w=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,U=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0;return Be.calculateObjectSize(g,w,U)}t.calculateObjectSize=c;function _(g,n,w,U,p,F){let J=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},F),R=Et.ensureBuffer(g),W=n;for(let Q=0;Q<w;Q++){let H=R[W]|R[W+1]<<8|R[W+2]<<16|R[W+3]<<24;J.index=W,U[p+Q]=xt.deserialize(R,J),W=W+H}return W}t.deserializeStream=_}),xn=st(V),Zn=V.deserializeStream,qn=V.calculateObjectSize,Ue=V.deserialize,Qn=V.serializeWithBufferAndIndex,Me=V.serialize,$n=V.setInternalBufferSize,ti=V.ObjectID,ei=V.Decimal128,ri=V.BSONRegExp,ni=V.MaxKey,ii=V.MinKey,oi=V.Int32,si=V.Double,fi=V.Timestamp,ai=V.Long,ui=V.ObjectId,li=V.Binary,ci=V.DBRef,hi=V.BSONSymbol,_i=V.Map,yi=V.Code,Bi=V.LongWithoutOverridesClass,pi=V.EJSON,Ni=V.JS_INT_MIN,gi=V.JS_INT_MAX,Ai=V.BSON_INT64_MIN,Si=V.BSON_INT64_MAX,Oi=V.BSON_INT32_MIN,mi=V.BSON_INT32_MAX,Ei=V.BSON_DATA_UNDEFINED,wi=V.BSON_DATA_TIMESTAMP,Ti=V.BSON_DATA_SYMBOL,bi=V.BSON_DATA_STRING,di=V.BSON_DATA_REGEXP,Ii=V.BSON_DATA_OID,Di=V.BSON_DATA_OBJECT,Ri=V.BSON_DATA_NUMBER,Ui=V.BSON_DATA_NULL,Mi=V.BSON_DATA_MIN_KEY,Pi=V.BSON_DATA_MAX_KEY,ji=V.BSON_DATA_LONG,Fi=V.BSON_DATA_INT,Yi=V.BSON_DATA_DECIMAL128,Li=V.BSON_DATA_DBPOINTER,vi=V.BSON_DATA_DATE,Ci=V.BSON_DATA_CODE_W_SCOPE,zi=V.BSON_DATA_CODE,Ji=V.BSON_DATA_BOOLEAN,Wi=V.BSON_DATA_BINARY,ki=V.BSON_DATA_ARRAY,Xi=V.BSON_BINARY_SUBTYPE_UUID_NEW,Ki=V.BSON_BINARY_SUBTYPE_UUID,Vi=V.BSON_BINARY_SUBTYPE_USER_DEFINED,Hi=V.BSON_BINARY_SUBTYPE_MD5,Gi=V.BSON_BINARY_SUBTYPE_FUNCTION,xi=V.BSON_BINARY_SUBTYPE_DEFAULT,Zi=V.BSON_BINARY_SUBTYPE_BYTE_ARRAY;function pe(B,t){return Ue(new Uint8Array(B),t)}var te={name:"BSON",id:"bson",module:"bson",extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0};var Or="4.4.0-alpha.9",ee={...te,dataType:null,batchType:null,name:"BSON",id:"bson",module:"bson",version:Or,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:mr,parseSync:Er,options:{bson:{}}};async function mr(B,t){let h={...ee.options.bson,...t?.bson};return pe(B,h)}function Er(B,t){let h={...ee.options.bson,...t?.bson};return pe(B,h)}var je=B=>typeof SharedArrayBuffer<"u"&&B instanceof SharedArrayBuffer;function ge(B){if(B instanceof ArrayBuffer)return B;if(je(B))return Ne(B);let{buffer:t,byteOffset:h,byteLength:d}=B;return t instanceof ArrayBuffer&&h===0&&d===t.byteLength?t:Ne(t,h,d)}function Ne(B,t=0,h=B.byteLength-t){let d=new Uint8Array(B,t,h),l=new Uint8Array(d.length);return l.set(d),l.buffer}function Ae(B,t){let h=Me(B);return ge(h)}var wr="4.4.0-alpha.9",Fe={...te,name:"BSON",id:"bson",module:"bson",version:wr,extensions:["bson"],options:{bson:{}},async encode(B,t){return Ae(B,{})},encodeSync(B,t){return Ae(B,{})}};return Xe(Yt);})();
|
|
17
17
|
return __exports__;
|
|
18
18
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ var BSONFormat = {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// dist/bson-loader.js
|
|
57
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
57
|
+
var VERSION = true ? "4.4.0-alpha.9" : "latest";
|
|
58
58
|
var BSONLoader = {
|
|
59
59
|
...BSONFormat,
|
|
60
60
|
dataType: null,
|
|
@@ -84,13 +84,14 @@ function parseSync(arrayBuffer, options) {
|
|
|
84
84
|
|
|
85
85
|
// dist/lib/encoders/encode-bson.js
|
|
86
86
|
var BSON2 = __toESM(require("bson"), 1);
|
|
87
|
+
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
87
88
|
function encodeBSONSync(value, options) {
|
|
88
89
|
const uint8Array = BSON2.serialize(value);
|
|
89
|
-
return uint8Array
|
|
90
|
+
return (0, import_loader_utils.ensureArrayBuffer)(uint8Array);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
// dist/bson-writer.js
|
|
93
|
-
var VERSION2 = true ? "4.4.0-alpha.
|
|
94
|
+
var VERSION2 = true ? "4.4.0-alpha.9" : "latest";
|
|
94
95
|
var BSONWriter = {
|
|
95
96
|
...BSONFormat,
|
|
96
97
|
name: "BSON",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["index.
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { BSONLoader
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
3
|
+
"sources": ["../src/index.ts", "../src/lib/parsers/parse-bson.ts", "../src/bson-format.ts", "../src/bson-loader.ts", "../src/lib/encoders/encode-bson.ts", "../src/bson-writer.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type {BSONLoaderOptions} from './bson-loader';\nexport {BSONLoader} from './bson-loader';\nexport {BSONWriter} from './bson-writer';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {DeserializeOptions} from 'bson';\nimport * as BSON from 'bson';\n\nexport type ParseBSONOptions = DeserializeOptions;\n\nexport function parseBSONSync(\n value: ArrayBuffer,\n options?: ParseBSONOptions\n): Record<string, unknown> {\n const parsedData = BSON.deserialize(new Uint8Array(value), options);\n return parsedData;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/loader-utils';\n\nexport const BSONFormat = {\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n extensions: ['bson'],\n mimeTypes: ['application/bson'],\n category: 'json',\n binary: true\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ParseBSONOptions} from './lib/parsers/parse-bson';\nimport {parseBSONSync} from './lib/parsers/parse-bson';\nimport {BSONFormat} from './bson-format';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * @param table -\n * @param bsonpaths -\n */\nexport type BSONLoaderOptions = LoaderOptions & {\n bson?: ParseBSONOptions;\n};\n\nexport const BSONLoader = {\n ...BSONFormat,\n dataType: null as unknown as Record<string, unknown>,\n batchType: null as never,\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n version: VERSION,\n extensions: ['bson'],\n mimeTypes: ['application/bson'],\n category: 'json',\n binary: true,\n parse,\n parseSync,\n options: {\n bson: {}\n }\n} as const satisfies LoaderWithParser<Record<string, unknown>, never, BSONLoaderOptions>;\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: BSONLoaderOptions) {\n const bsonOptions = {...BSONLoader.options.bson, ...options?.bson};\n return parseBSONSync(arrayBuffer, bsonOptions);\n}\n\nfunction parseSync(arrayBuffer: ArrayBuffer, options?: BSONLoaderOptions) {\n const bsonOptions = {...BSONLoader.options.bson, ...options?.bson};\n return parseBSONSync(arrayBuffer, bsonOptions);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {SerializeOptions} from 'bson';\nimport * as BSON from 'bson';\nimport {ensureArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport type EncodeBSONOptions = SerializeOptions;\n\nexport function encodeBSONSync(\n value: Record<string, unknown>,\n options?: EncodeBSONOptions\n): ArrayBuffer {\n const uint8Array = BSON.serialize(value);\n // TODO - make sure the uint8array occupies the entire buffer.\n return ensureArrayBuffer(uint8Array);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterWithEncoder, WriterOptions} from '@loaders.gl/loader-utils';\nimport type {EncodeBSONOptions} from './lib/encoders/encode-bson';\nimport {encodeBSONSync} from './lib/encoders/encode-bson';\nimport {BSONFormat} from './bson-format';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type BSONWriterOptions = WriterOptions & {\n bson?: EncodeBSONOptions\n}\n\nexport const BSONWriter = {\n ...BSONFormat,\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n version: VERSION,\n extensions: ['bson'],\n options: {\n bson: {}\n },\n async encode(data: Record<string, unknown>, options?: WriterOptions): Promise<ArrayBuffer> {\n return encodeBSONSync(data, {}); // options\n },\n encodeSync(data: Record<string, unknown>, options?: WriterOptions): ArrayBuffer {\n return encodeBSONSync(data, {}); // options\n }\n} as const satisfies WriterWithEncoder<Record<string, unknown>, never, BSONWriterOptions>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACKA,WAAsB;AAIhB,SAAU,cACd,OACA,SAA0B;AAE1B,QAAM,aAAkB,iBAAY,IAAI,WAAW,KAAK,GAAG,OAAO;AAClE,SAAO;AACT;;;ACTO,IAAM,aAAa;EACxB,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,WAAW,CAAC,kBAAkB;EAC9B,UAAU;EACV,QAAQ;;;;ACFV,IAAM,UAAU,OAAoC,kBAAe;AAU5D,IAAM,aAAa;EACxB,GAAG;EACH,UAAU;EACV,WAAW;EACX,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAAS;EACT,YAAY,CAAC,MAAM;EACnB,WAAW,CAAC,kBAAkB;EAC9B,UAAU;EACV,QAAQ;EACR;EACA;EACA,SAAS;IACP,MAAM,CAAA;;;AAIV,eAAe,MAAM,aAA0B,SAA2B;AACxE,QAAM,cAAc,EAAC,GAAG,WAAW,QAAQ,MAAM,GAAG,mCAAS,KAAI;AACjE,SAAO,cAAc,aAAa,WAAW;AAC/C;AAEA,SAAS,UAAU,aAA0B,SAA2B;AACtE,QAAM,cAAc,EAAC,GAAG,WAAW,QAAQ,MAAM,GAAG,mCAAS,KAAI;AACjE,SAAO,cAAc,aAAa,WAAW;AAC/C;;;AC3CA,IAAAA,QAAsB;AACtB,0BAAgC;AAI1B,SAAU,eACd,OACA,SAA2B;AAE3B,QAAM,aAAkB,gBAAU,KAAK;AAEvC,aAAO,uCAAkB,UAAU;AACrC;;;ACNA,IAAMC,WAAU,OAAoC,kBAAe;AAM5D,IAAM,aAAa;EACxB,GAAG;EACH,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAASA;EACT,YAAY,CAAC,MAAM;EACnB,SAAS;IACP,MAAM,CAAA;;EAER,MAAM,OAAO,MAA+B,SAAuB;AACjE,WAAO,eAAe,MAAM,CAAA,CAAE;EAChC;EACA,WAAW,MAA+B,SAAuB;AAC/D,WAAO,eAAe,MAAM,CAAA,CAAE;EAChC;;",
|
|
6
6
|
"names": ["BSON", "VERSION"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,UAAU,EAAC,yBAAsB;AACzC,OAAO,EAAC,UAAU,EAAC,yBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode-bson.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-bson.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"encode-bson.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-bson.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,MAAM,CAAC;AAI3C,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAEjD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,WAAW,CAIb"}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import * as BSON from 'bson';
|
|
5
|
+
import { ensureArrayBuffer } from '@loaders.gl/loader-utils';
|
|
5
6
|
export function encodeBSONSync(value, options) {
|
|
6
7
|
const uint8Array = BSON.serialize(value);
|
|
7
8
|
// TODO - make sure the uint8array occupies the entire buffer.
|
|
8
|
-
return uint8Array
|
|
9
|
+
return ensureArrayBuffer(uint8Array);
|
|
9
10
|
}
|
|
11
|
+
//# sourceMappingURL=encode-bson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-bson.js","sourceRoot":"","sources":["../../../src/lib/encoders/encode-bson.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAI3D,MAAM,UAAU,cAAc,CAC5B,KAA8B,EAC9B,OAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,8DAA8D;IAC9D,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-bson.js","sourceRoot":"","sources":["../../../src/lib/parsers/parse-bson.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,MAAM,UAAU,aAAa,CAC3B,KAAkB,EAClB,OAA0B;IAE1B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IACpE,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/bson",
|
|
3
|
-
"version": "4.4.0-alpha.
|
|
3
|
+
"version": "4.4.0-alpha.9",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@loaders.gl/gis": "4.4.0-alpha.
|
|
44
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
45
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
43
|
+
"@loaders.gl/gis": "4.4.0-alpha.9",
|
|
44
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.9",
|
|
45
|
+
"@loaders.gl/schema": "4.4.0-alpha.9",
|
|
46
46
|
"@types/bson": "4.2.0",
|
|
47
47
|
"bson": "4.2.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e9e6710379718c7663e97eba868c76e15de4cb84"
|
|
53
53
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type {SerializeOptions} from 'bson';
|
|
6
6
|
import * as BSON from 'bson';
|
|
7
|
+
import {ensureArrayBuffer} from '@loaders.gl/loader-utils';
|
|
7
8
|
|
|
8
9
|
export type EncodeBSONOptions = SerializeOptions;
|
|
9
10
|
|
|
@@ -13,5 +14,5 @@ export function encodeBSONSync(
|
|
|
13
14
|
): ArrayBuffer {
|
|
14
15
|
const uint8Array = BSON.serialize(value);
|
|
15
16
|
// TODO - make sure the uint8array occupies the entire buffer.
|
|
16
|
-
return uint8Array
|
|
17
|
+
return ensureArrayBuffer(uint8Array);
|
|
17
18
|
}
|