noxium 1.0.6 → 1.0.10

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.
Files changed (45) hide show
  1. package/README.md +167 -14
  2. package/build.ts +65 -0
  3. package/dist/drivers/mongo.cjs +1080 -0
  4. package/dist/drivers/mongo.cjs.map +456 -0
  5. package/dist/drivers/mongo.d.ts +4 -0
  6. package/dist/drivers/mongo.d.ts.map +1 -0
  7. package/dist/drivers/mongo.mjs +1081 -0
  8. package/dist/drivers/mongo.mjs.map +456 -0
  9. package/dist/drivers/sqlite.cjs +18 -0
  10. package/dist/drivers/sqlite.cjs.map +11 -0
  11. package/dist/drivers/sqlite.d.ts +4 -0
  12. package/dist/drivers/sqlite.d.ts.map +1 -0
  13. package/dist/drivers/sqlite.mjs +19 -0
  14. package/dist/drivers/sqlite.mjs.map +11 -0
  15. package/dist/error.cjs +18 -0
  16. package/dist/error.cjs.map +10 -0
  17. package/dist/error.d.ts +20 -0
  18. package/dist/error.d.ts.map +1 -0
  19. package/dist/error.mjs +19 -0
  20. package/dist/error.mjs.map +10 -0
  21. package/dist/noxium.cjs +1080 -0
  22. package/dist/noxium.cjs.map +473 -0
  23. package/dist/noxium.d.ts +21 -0
  24. package/dist/noxium.d.ts.map +1 -0
  25. package/dist/noxium.mjs +1081 -0
  26. package/dist/noxium.mjs.map +473 -0
  27. package/dist/schema.cjs +4 -0
  28. package/dist/schema.cjs.map +9 -0
  29. package/dist/schema.d.ts +84 -0
  30. package/dist/schema.d.ts.map +1 -0
  31. package/dist/schema.mjs +4 -0
  32. package/dist/schema.mjs.map +9 -0
  33. package/package.json +24 -26
  34. package/dist/cjs/createClient.cjs +0 -54
  35. package/dist/cjs/drivers/mongo.cjs +0 -61
  36. package/dist/cjs/drivers/sqlite.cjs +0 -74
  37. package/dist/cjs/error.cjs +0 -46
  38. package/dist/cjs/noxium.cjs +0 -39
  39. package/dist/cjs/schema.cjs +0 -2
  40. package/dist/esm/createClient.js +0 -52
  41. package/dist/esm/drivers/mongo.js +0 -59
  42. package/dist/esm/drivers/sqlite.js +0 -72
  43. package/dist/esm/error.js +0 -41
  44. package/dist/esm/noxium.js +0 -37
  45. package/dist/esm/schema.js +0 -1
@@ -0,0 +1,1080 @@
1
+ var nG=Object.create;var{getPrototypeOf:sG,defineProperty:rf,getOwnPropertyNames:MC,getOwnPropertyDescriptor:iG}=Object,_E=Object.prototype.hasOwnProperty;function PC(e){return this[e]}var oG,uG,aG=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?oG??=new WeakMap:uG??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?nG(sG(e)):{};let o=t||!e||!e.__esModule||!_E.call(e,"default")?rf(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let u of MC(e))if(!_E.call(o,u))rf(o,u,{get:PC.bind(e,u),enumerable:!0})}if(n)s.set(e,o);return o},BC=(e)=>{var t=(TC??=new WeakMap).get(e),r;if(t)return t;if(t=rf({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of MC(e))if(!_E.call(t,n))rf(t,n,{get:PC.bind(e,n),enumerable:!(r=iG(e,n))||r.enumerable})}return TC.set(e,t),t},TC,g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var cG=(e)=>e;function lG(e,t){this[e]=cG.bind(null,t)}var FC=(e,t)=>{for(var r in t)rf(e,r,{get:t[r],enumerable:!0,configurable:!0,set:lG.bind(t,r)})};var IE=g(function(Et){var hG=(()=>{let e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get;return(t)=>e.call(t)})();function ll(e){return hG(e)==="Uint8Array"}function bE(e){return typeof e==="object"&&e!=null&&Symbol.toStringTag in e&&(e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer")}function lp(e){return e instanceof RegExp||Object.prototype.toString.call(e)==="[object RegExp]"}function dp(e){return typeof e==="object"&&e!=null&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Map"}function hp(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Js(e,t){return JSON.stringify(e,(r,n)=>{if(typeof n==="bigint")return{$numberLong:`${n}`};else if(dp(n))return Object.fromEntries(n);return n})}function fG(e){if(e!=null&&typeof e==="object"&&"stylize"in e&&typeof e.stylize==="function")return e.stylize}var lf=7,pp=Symbol.for("@@mdb.bson.version"),hf=2147483647,ff=-2147483648,JC=Math.pow(2,63)-1,QC=-Math.pow(2,63),XC=Math.pow(2,53),ZC=-Math.pow(2,53),DE=1,e9=2,uf=3,of=4,TE=5,dG=6,t9=7,r9=8,n9=9,ME=10,fp=11,pG=12,PE=13,s9=14,cp=15,af=16,i9=17,BE=18,o9=19,u9=255,a9=127,mG=0,FE=4,c9=Object.freeze({double:1,string:2,object:3,array:4,binData:5,undefined:6,objectId:7,bool:8,date:9,null:10,regex:11,dbPointer:12,javascript:13,symbol:14,javascriptWithScope:15,int:16,timestamp:17,long:18,decimal:19,minKey:-1,maxKey:127});class x extends Error{get bsonError(){return!0}get name(){return"BSONError"}constructor(e,t){super(e,t)}static isBSONError(e){return e!=null&&typeof e==="object"&&"bsonError"in e&&e.bsonError===!0&&"name"in e&&"message"in e&&"stack"in e}}class hl extends x{get name(){return"BSONVersionError"}constructor(){super(`Unsupported BSON version, bson types must be from bson ${lf}.x.x`)}}class cf extends x{get name(){return"BSONRuntimeError"}constructor(e){super(e)}}class uo extends x{get name(){return"BSONOffsetError"}offset;constructor(e,t,r){super(`${e}. offset: ${t}`,r);this.offset=t}}var NC,IC;function l9(e,t,r,n){if(n){NC??=new TextDecoder("utf8",{fatal:!0});try{return NC.decode(e.subarray(t,r))}catch(s){throw new x("Invalid UTF-8 string in BSON document",{cause:s})}}return IC??=new TextDecoder("utf8",{fatal:!1}),IC.decode(e.subarray(t,r))}function h9(e,t,r){if(e.length===0)return"";let n=r-t;if(n===0)return"";if(n>20)return null;if(n===1&&e[t]<128)return String.fromCharCode(e[t]);if(n===2&&e[t]<128&&e[t+1]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1]);if(n===3&&e[t]<128&&e[t+1]<128&&e[t+2]<128)return String.fromCharCode(e[t])+String.fromCharCode(e[t+1])+String.fromCharCode(e[t+2]);let s=[];for(let i=t;i<r;i++){let o=e[i];if(o>127)return null;s.push(o)}return String.fromCharCode(...s)}function yG(e,t,r){if(t.length===0)return 0;if(t.length>25)return null;if(e.length-r<t.length)return null;for(let n=0,s=r;n<t.length;n++,s++){let i=t.charCodeAt(n);if(i>127)return null;e[s]=i}return t.length}function gG(e){return li.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}function _G(e){return crypto.getRandomValues(li.allocate(e))}var EG=(()=>{let{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues==="function")return _G;else return gG})(),li={isUint8Array:ll,toLocalBufferType(e){if(Buffer.isBuffer(e))return e;if(ArrayBuffer.isView(e))return Buffer.from(e.buffer,e.byteOffset,e.byteLength);let t=e?.[Symbol.toStringTag]??Object.prototype.toString.call(e);if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return Buffer.from(e);throw new x("Cannot create Buffer from the passed potentialBuffer.")},allocate(e){return Buffer.alloc(e)},allocateUnsafe(e){return Buffer.allocUnsafe(e)},compare(e,t){return li.toLocalBufferType(e).compare(t)},concat(e){return Buffer.concat(e)},copy(e,t,r,n,s){return li.toLocalBufferType(e).copy(t,r??0,n??0,s??e.length)},equals(e,t){return li.toLocalBufferType(e).equals(t)},fromNumberArray(e){return Buffer.from(e)},fromBase64(e){return Buffer.from(e,"base64")},fromUTF8(e){return Buffer.from(e,"utf8")},toBase64(e){return li.toLocalBufferType(e).toString("base64")},fromISO88591(e){return Buffer.from(e,"binary")},toISO88591(e){return li.toLocalBufferType(e).toString("binary")},fromHex(e){return Buffer.from(e,"hex")},toHex(e){return li.toLocalBufferType(e).toString("hex")},toUTF8(e,t,r,n){let s=r-t<=20?h9(e,t,r):null;if(s!=null)return s;let i=li.toLocalBufferType(e).toString("utf8",t,r);if(n){for(let o=0;o<i.length;o++)if(i.charCodeAt(o)===65533){l9(e,t,r,!0);break}}return i},utf8ByteLength(e){return Buffer.byteLength(e,"utf8")},encodeUTF8Into(e,t,r){let n=yG(e,t,r);if(n!=null)return n;return li.toLocalBufferType(e).write(t,r,void 0,"utf8")},randomBytes:EG,swap32(e){return li.toLocalBufferType(e).swap32()}};function AG(){let{navigator:e}=globalThis;return typeof e==="object"&&e.product==="ReactNative"}function OG(e){if(e<0)throw RangeError(`The argument 'byteLength' is invalid. Received ${e}`);return dc.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}var SG=(()=>{let{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues==="function")return(t)=>e.getRandomValues(dc.allocate(t));else{if(AG()){let{console:t}=globalThis;t?.warn?.("BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.")}return OG}})(),RC=/(\d|[a-f])/i,dc={isUint8Array:ll,toLocalBufferType(e){let t=e?.[Symbol.toStringTag]??Object.prototype.toString.call(e);if(t==="Uint8Array")return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(t==="ArrayBuffer"||t==="SharedArrayBuffer"||t==="[object ArrayBuffer]"||t==="[object SharedArrayBuffer]")return new Uint8Array(e);throw new x("Cannot make a Uint8Array from passed potentialBuffer.")},allocate(e){if(typeof e!=="number")throw TypeError(`The "size" argument must be of type number. Received ${String(e)}`);return new Uint8Array(e)},allocateUnsafe(e){return dc.allocate(e)},compare(e,t){if(e===t)return 0;let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}if(e.length<t.length)return-1;if(e.length>t.length)return 1;return 0},concat(e){if(e.length===0)return dc.allocate(0);let t=0;for(let s of e)t+=s.length;let r=dc.allocate(t),n=0;for(let s of e)r.set(s,n),n+=s.length;return r},copy(e,t,r,n,s){if(s!==void 0&&s<0)throw RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${s}`);if(s=s??e.length,n!==void 0&&(n<0||n>s))throw RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${s}. Received ${n}`);if(n=n??0,r!==void 0&&r<0)throw RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${r}`);r=r??0;let i=e.subarray(n,s),o=Math.min(i.length,t.length-r);if(o<=0)return 0;return t.set(i.subarray(0,o),r),o},equals(e,t){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},fromNumberArray(e){return Uint8Array.from(e)},fromBase64(e){return Uint8Array.from(atob(e),(t)=>t.charCodeAt(0))},fromUTF8(e){return new TextEncoder().encode(e)},toBase64(e){return btoa(dc.toISO88591(e))},fromISO88591(e){return Uint8Array.from(e,(t)=>t.charCodeAt(0)&255)},toISO88591(e){return Array.from(Uint16Array.from(e),(t)=>String.fromCharCode(t)).join("")},fromHex(e){let t=e.length%2===0?e:e.slice(0,e.length-1),r=[];for(let n=0;n<t.length;n+=2){let s=t[n],i=t[n+1];if(!RC.test(s))break;if(!RC.test(i))break;let o=Number.parseInt(`${s}${i}`,16);r.push(o)}return Uint8Array.from(r)},toHex(e){return Array.from(e,(t)=>t.toString(16).padStart(2,"0")).join("")},toUTF8(e,t,r,n){let s=r-t<=20?h9(e,t,r):null;if(s!=null)return s;return l9(e,t,r,n)},utf8ByteLength(e){return new TextEncoder().encode(e).byteLength},encodeUTF8Into(e,t,r){let n=new TextEncoder().encode(t);return e.set(n,r),n.byteLength},randomBytes:SG,swap32(e){if(e.length%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e.length;t+=4){let r=e[t],n=e[t+1],s=e[t+2],i=e[t+3];e[t]=i,e[t+1]=s,e[t+2]=n,e[t+3]=r}return e}},wG=typeof Buffer==="function"&&Buffer.prototype?._isBuffer!==!0,v=wG?li:dc,pc=Symbol.for("@@mdb.bson.type");class cs{get[pc](){return this._bsontype}get[pp](){return lf}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return this.inspect(e,t,r)}}var al=new Float64Array(1),_t=new Uint8Array(al.buffer,0,8);al[0]=-1;var EE=_t[7]===0,Se={isBigEndian:EE,getNonnegativeInt32LE(e,t){if(e[t+3]>127)throw RangeError(`Size cannot be negative at offset: ${t}`);return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getInt32LE(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},getUint32LE(e,t){return e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216},getUint32BE(e,t){return e[t+3]+e[t+2]*256+e[t+1]*65536+e[t]*16777216},getBigInt64LE(e,t){let r=BigInt(e[t+4]+e[t+5]*256+e[t+6]*65536+(e[t+7]<<24)),n=BigInt(e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216);return(r<<32n)+n},getFloat64LE:EE?(e,t)=>(_t[7]=e[t],_t[6]=e[t+1],_t[5]=e[t+2],_t[4]=e[t+3],_t[3]=e[t+4],_t[2]=e[t+5],_t[1]=e[t+6],_t[0]=e[t+7],al[0]):(e,t)=>(_t[0]=e[t],_t[1]=e[t+1],_t[2]=e[t+2],_t[3]=e[t+3],_t[4]=e[t+4],_t[5]=e[t+5],_t[6]=e[t+6],_t[7]=e[t+7],al[0]),setInt32BE(e,t,r){return e[t+3]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t]=r,4},setInt32LE(e,t,r){return e[t]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+3]=r,4},setBigInt64LE(e,t,r){let n=0xffffffffn,s=Number(r&n);e[t]=s,s>>=8,e[t+1]=s,s>>=8,e[t+2]=s,s>>=8,e[t+3]=s;let i=Number(r>>32n&n);return e[t+4]=i,i>>=8,e[t+5]=i,i>>=8,e[t+6]=i,i>>=8,e[t+7]=i,8},setFloat64LE:EE?(e,t,r)=>(al[0]=r,e[t]=_t[7],e[t+1]=_t[6],e[t+2]=_t[5],e[t+3]=_t[4],e[t+4]=_t[3],e[t+5]=_t[2],e[t+6]=_t[1],e[t+7]=_t[0],8):(e,t,r)=>(al[0]=r,e[t]=_t[0],e[t+1]=_t[1],e[t+2]=_t[2],e[t+3]=_t[3],e[t+4]=_t[4],e[t+5]=_t[5],e[t+6]=_t[6],e[t+7]=_t[7],8)};class je extends cs{get _bsontype(){return"Binary"}static BSON_BINARY_SUBTYPE_DEFAULT=0;static BUFFER_SIZE=256;static SUBTYPE_DEFAULT=0;static SUBTYPE_FUNCTION=1;static SUBTYPE_BYTE_ARRAY=2;static SUBTYPE_UUID_OLD=3;static SUBTYPE_UUID=4;static SUBTYPE_MD5=5;static SUBTYPE_ENCRYPTED=6;static SUBTYPE_COLUMN=7;static SUBTYPE_SENSITIVE=8;static SUBTYPE_VECTOR=9;static SUBTYPE_USER_DEFINED=128;static VECTOR_TYPE=Object.freeze({Int8:3,Float32:39,PackedBit:16});buffer;sub_type;position;constructor(e,t){super();if(e!=null&&typeof e==="string"&&!ArrayBuffer.isView(e)&&!bE(e)&&!Array.isArray(e))throw new x("Binary can only be constructed from Uint8Array or number[]");if(this.sub_type=(t??je.BSON_BINARY_SUBTYPE_DEFAULT)&255,e==null)this.buffer=v.allocate(je.BUFFER_SIZE),this.position=0;else this.buffer=Array.isArray(e)?v.fromNumberArray(e):v.toLocalBufferType(e),this.position=this.buffer.byteLength}put(e){if(typeof e==="string"&&e.length!==1)throw new x("only accepts single character String");else if(typeof e!=="number"&&e.length!==1)throw new x("only accepts single character Uint8Array or Array");let t;if(typeof e==="string")t=e.charCodeAt(0);else if(typeof e==="number")t=e;else t=e[0];if(t<0||t>255)throw new x("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.byteLength>this.position)this.buffer[this.position++]=t;else{let r=v.allocate(je.BUFFER_SIZE+this.buffer.length);r.set(this.buffer,0),this.buffer=r,this.buffer[this.position++]=t}}write(e,t){if(t=typeof t==="number"?t:this.position,this.buffer.byteLength<t+e.length){let r=v.allocate(this.buffer.byteLength+e.length);r.set(this.buffer,0),this.buffer=r}if(ArrayBuffer.isView(e))this.buffer.set(v.toLocalBufferType(e),t),this.position=t+e.byteLength>this.position?t+e.length:this.position;else if(typeof e==="string")throw new x("input cannot be string")}read(e,t){t=t&&t>0?t:this.position;let r=e+t;return this.buffer.subarray(e,r>this.position?this.position:r)}value(){return this.buffer.length===this.position?this.buffer:this.buffer.subarray(0,this.position)}length(){return this.position}toJSON(){return v.toBase64(this.buffer.subarray(0,this.position))}toString(e){if(e==="hex")return v.toHex(this.buffer.subarray(0,this.position));if(e==="base64")return v.toBase64(this.buffer.subarray(0,this.position));if(e==="utf8"||e==="utf-8")return v.toUTF8(this.buffer,0,this.position,!1);return v.toUTF8(this.buffer,0,this.position,!1)}toExtendedJSON(e){if(e=e||{},this.sub_type===je.SUBTYPE_VECTOR)Eu(this);let t=v.toBase64(this.buffer),r=Number(this.sub_type).toString(16);if(e.legacy)return{$binary:t,$type:r.length===1?"0"+r:r};return{$binary:{base64:t,subType:r.length===1?"0"+r:r}}}toUUID(){if(this.sub_type===je.SUBTYPE_UUID)return new bn(this.buffer.subarray(0,this.position));throw new x(`Binary sub_type "${this.sub_type}" (${typeof this.sub_type}) is not supported for converting to UUID. Only 0x${je.SUBTYPE_UUID.toString(16).padStart(2,"0")} is currently supported.`)}static createFromHexString(e,t){return new je(v.fromHex(e),t)}static createFromBase64(e,t){return new je(v.fromBase64(e),t)}static fromExtendedJSON(e,t){t=t||{};let r,n;if("$binary"in e){if(t.legacy&&typeof e.$binary==="string"&&"$type"in e)n=e.$type?parseInt(e.$type,16):0,r=v.fromBase64(e.$binary);else if(typeof e.$binary!=="string")n=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=v.fromBase64(e.$binary.base64)}else if("$uuid"in e)n=4,r=bn.bytesFromString(e.$uuid);if(!r)throw new x(`Unexpected Binary Extended JSON format ${JSON.stringify(e)}`);return n===FE?new bn(r):new je(r,n)}inspect(e,t,r){r??=Js;let n=v.toBase64(this.buffer.subarray(0,this.position)),s=r(n,t),i=r(this.sub_type,t);return`Binary.createFromBase64(${s}, ${i})`}toInt8Array(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new x("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.Int8)throw new x("Binary datatype field is not Int8");return Eu(this),new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toFloat32Array(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new x("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.Float32)throw new x("Binary datatype field is not Float32");Eu(this);let e=new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position));if(Se.isBigEndian)v.swap32(e);return new Float32Array(e.buffer)}toPackedBits(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new x("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.PackedBit)throw new x("Binary datatype field is not packed bit");return Eu(this),new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position))}toBits(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new x("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.PackedBit)throw new x("Binary datatype field is not packed bit");Eu(this);let t=(this.length()-2)*8-this.buffer[1],r=new Int8Array(t);for(let n=0;n<r.length;n++){let s=n/8|0,i=this.buffer[s+2],o=7-n%8,u=i>>o&1;r[n]=u}return r}static fromInt8Array(e){let t=v.allocate(e.byteLength+2);t[0]=je.VECTOR_TYPE.Int8,t[1]=0;let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);t.set(r,2);let n=new this(t,this.SUBTYPE_VECTOR);return Eu(n),n}static fromFloat32Array(e){let t=v.allocate(e.byteLength+2);t[0]=je.VECTOR_TYPE.Float32,t[1]=0;let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.set(r,2),Se.isBigEndian)v.swap32(new Uint8Array(t.buffer,2));let n=new this(t,this.SUBTYPE_VECTOR);return Eu(n),n}static fromPackedBits(e,t=0){let r=v.allocate(e.byteLength+2);r[0]=je.VECTOR_TYPE.PackedBit,r[1]=t,r.set(e,2);let n=new this(r,this.SUBTYPE_VECTOR);return Eu(n),n}static fromBits(e){let t=e.length+7>>>3,r=new Uint8Array(t+2);r[0]=je.VECTOR_TYPE.PackedBit;let n=e.length%8;r[1]=n===0?0:8-n;for(let s=0;s<e.length;s++){let i=s>>>3,o=e[s];if(o!==0&&o!==1)throw new x(`Invalid bit value at ${s}: must be 0 or 1, found ${e[s]}`);if(o===0)continue;let u=7-s%8;r[i+2]|=o<<u}return new this(r,je.SUBTYPE_VECTOR)}}function Eu(e){if(e.sub_type!==je.SUBTYPE_VECTOR)return;let t=e.position,r=e.buffer[0],n=e.buffer[1];if((r===je.VECTOR_TYPE.Float32||r===je.VECTOR_TYPE.Int8)&&n!==0)throw new x("Invalid Vector: padding must be zero for int8 and float32 vectors");if(r===je.VECTOR_TYPE.Float32){if(t!==0&&t-2!==0&&(t-2)%4!==0)throw new x("Invalid Vector: Float32 vector must contain a multiple of 4 bytes")}if(r===je.VECTOR_TYPE.PackedBit&&n!==0&&t===2)throw new x("Invalid Vector: padding must be zero for packed bit vectors that are empty");if(r===je.VECTOR_TYPE.PackedBit&&n>7)throw new x(`Invalid Vector: padding must be a value between 0 and 7. found: ${n}`)}var AE=16,CG=/^[0-9A-F]{32}$/i,bG=/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;class bn extends je{constructor(e){let t;if(e==null)t=bn.generate();else if(e instanceof bn)t=v.toLocalBufferType(new Uint8Array(e.buffer));else if(ArrayBuffer.isView(e)&&e.byteLength===AE)t=v.toLocalBufferType(e);else if(typeof e==="string")t=bn.bytesFromString(e);else throw new x("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");super(t,FE)}get id(){return this.buffer}set id(e){this.buffer=e}toHexString(e=!0){if(e)return[v.toHex(this.buffer.subarray(0,4)),v.toHex(this.buffer.subarray(4,6)),v.toHex(this.buffer.subarray(6,8)),v.toHex(this.buffer.subarray(8,10)),v.toHex(this.buffer.subarray(10,16))].join("-");return v.toHex(this.buffer)}toString(e){if(e==="hex")return v.toHex(this.id);if(e==="base64")return v.toBase64(this.id);return this.toHexString()}toJSON(){return this.toHexString()}equals(e){if(!e)return!1;if(e instanceof bn)return v.equals(e.id,this.id);try{return v.equals(new bn(e).id,this.id)}catch{return!1}}toBinary(){return new je(this.id,je.SUBTYPE_UUID)}static generate(){let e=v.randomBytes(AE);return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}static isValid(e){if(!e)return!1;if(typeof e==="string")return bn.isValidUUIDString(e);if(ll(e))return e.byteLength===AE;return e._bsontype==="Binary"&&e.sub_type===this.SUBTYPE_UUID&&e.buffer.byteLength===16}static createFromHexString(e){let t=bn.bytesFromString(e);return new bn(t)}static createFromBase64(e){return new bn(v.fromBase64(e))}static bytesFromString(e){if(!bn.isValidUUIDString(e))throw new x("UUID string representation must be 32 hex digits or canonical hyphenated representation");return v.fromHex(e.replace(/-/g,""))}static isValidUUIDString(e){return CG.test(e)||bG.test(e)}inspect(e,t,r){return r??=Js,`new UUID(${r(this.toHexString(),t)})`}}class Ou extends cs{get _bsontype(){return"Code"}code;scope;constructor(e,t){super();this.code=e.toString(),this.scope=t??null}toJSON(){if(this.scope!=null)return{code:this.code,scope:this.scope};return{code:this.code}}toExtendedJSON(){if(this.scope)return{$code:this.code,$scope:this.scope};return{$code:this.code}}static fromExtendedJSON(e){return new Ou(e.$code,e.$scope)}inspect(e,t,r){r??=Js;let n=r(this.code,t),s=n.includes(`
2
+ `);if(this.scope!=null)n+=`,${s?`
3
+ `:" "}${r(this.scope,t)}`;let i=s&&this.scope===null;return`new Code(${s?`
4
+ `:""}${n}${i?`
5
+ `:""})`}}function f9(e){return e!=null&&typeof e==="object"&&"$id"in e&&e.$id!=null&&"$ref"in e&&typeof e.$ref==="string"&&(!("$db"in e)||("$db"in e)&&typeof e.$db==="string")}class Mo extends cs{get _bsontype(){return"DBRef"}collection;oid;db;fields;constructor(e,t,r,n){super();let s=e.split(".");if(s.length===2)r=s.shift(),e=s.shift();this.collection=e,this.oid=t,this.db=r,this.fields=n||{}}get namespace(){return this.collection}set namespace(e){this.collection=e}toJSON(){let e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);if(this.db!=null)e.$db=this.db;return e}toExtendedJSON(e){e=e||{};let t={$ref:this.collection,$id:this.oid};if(e.legacy)return t;if(this.db)t.$db=this.db;return t=Object.assign(t,this.fields),t}static fromExtendedJSON(e){let t=Object.assign({},e);return delete t.$ref,delete t.$id,delete t.$db,new Mo(e.$ref,e.$id,e.$db,t)}inspect(e,t,r){r??=Js;let n=[r(this.namespace,t),r(this.oid,t),...this.db?[r(this.db,t)]:[],...Object.keys(this.fields).length>0?[r(this.fields,t)]:[]];return n[1]=r===Js?`new ObjectId(${n[1]})`:n[1],`new DBRef(${n.join(", ")})`}}function d9(e){if(e==="")return e;let t=0,r=e[t]==="-",n=e[t]==="+";if(n||r)t+=1;let s=!1;for(;t<e.length&&e[t]==="0";++t)s=!0;if(!s)return n?e.slice(1):e;return`${r?"-":""}${e.length===t?"0":e.slice(t)}`}function DG(e,t){t=t??10;let r="0123456789abcdefghijklmnopqrstuvwxyz".slice(0,t);return new RegExp(`[^-+${r}]`,"i").test(e)?!1:e}var ci=void 0;try{ci=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{}var $C=65536,TG=16777216,cl=$C*$C,p9=cl*cl,vC=p9/2,xC={},kC={},MG=20,PG=/^(\+?0|(\+|-)?[1-9][0-9]*)$/;class M extends cs{get _bsontype(){return"Long"}get __isLong__(){return!0}high;low;unsigned;constructor(e=0,t,r){super();let n=typeof t==="boolean"?t:Boolean(r),s=typeof t==="number"?t:0,i=typeof e==="string"?M.fromString(e,n):typeof e==="bigint"?M.fromBigInt(e,n):{low:e|0,high:s|0,unsigned:n};this.low=i.low,this.high=i.high,this.unsigned=i.unsigned}static TWO_PWR_24=M.fromInt(TG);static MAX_UNSIGNED_VALUE=M.fromBits(-1,-1,!0);static ZERO=M.fromInt(0);static UZERO=M.fromInt(0,!0);static ONE=M.fromInt(1);static UONE=M.fromInt(1,!0);static NEG_ONE=M.fromInt(-1);static MAX_VALUE=M.fromBits(-1,2147483647,!1);static MIN_VALUE=M.fromBits(0,-2147483648,!1);static fromBits(e,t,r){return new M(e,t,r)}static fromInt(e,t){let r,n,s;if(t){if(e>>>=0,s=0<=e&&e<256){if(n=kC[e],n)return n}if(r=M.fromBits(e,(e|0)<0?-1:0,!0),s)kC[e]=r;return r}else{if(e|=0,s=-128<=e&&e<128){if(n=xC[e],n)return n}if(r=M.fromBits(e,e<0?-1:0,!1),s)xC[e]=r;return r}}static fromNumber(e,t){if(isNaN(e))return t?M.UZERO:M.ZERO;if(t){if(e<0)return M.UZERO;if(e>=p9)return M.MAX_UNSIGNED_VALUE}else{if(e<=-vC)return M.MIN_VALUE;if(e+1>=vC)return M.MAX_VALUE}if(e<0)return M.fromNumber(-e,t).neg();return M.fromBits(e%cl|0,e/cl|0,t)}static fromBigInt(e,t){let r=0xffffffffn,n=32n;return new M(Number(e&r),Number(e>>n&r),t)}static _fromString(e,t,r){if(e.length===0)throw new x("empty string");if(r<2||36<r)throw new x("radix");let n;if((n=e.indexOf("-"))>0)throw new x("interior hyphen");else if(n===0)return M._fromString(e.substring(1),t,r).neg();let s=M.fromNumber(Math.pow(r,8)),i=M.ZERO;for(let o=0;o<e.length;o+=8){let u=Math.min(8,e.length-o),a=parseInt(e.substring(o,o+u),r);if(u<8){let c=M.fromNumber(Math.pow(r,u));i=i.mul(c).add(M.fromNumber(a))}else i=i.mul(s),i=i.add(M.fromNumber(a))}return i.unsigned=t,i}static fromStringStrict(e,t,r){let n=!1;if(typeof t==="number")r=t,t=!1;else n=!!t;if(r??=10,e.trim()!==e)throw new x(`Input: '${e}' contains leading and/or trailing whitespace`);if(!DG(e,r))throw new x(`Input: '${e}' contains invalid characters for radix: ${r}`);let s=d9(e),i=M._fromString(s,n,r);if(i.toString(r).toLowerCase()!==s.toLowerCase())throw new x(`Input: ${e} is not representable as ${i.unsigned?"an unsigned":"a signed"} 64-bit Long ${r!=null?`with radix: ${r}`:""}`);return i}static fromString(e,t,r){let n=!1;if(typeof t==="number")r=t,t=!1;else n=!!t;if(r??=10,e==="NaN"&&r<24)return M.ZERO;else if((e==="Infinity"||e==="+Infinity"||e==="-Infinity")&&r<35)return M.ZERO;return M._fromString(e,n,r)}static fromBytes(e,t,r){return r?M.fromBytesLE(e,t):M.fromBytesBE(e,t)}static fromBytesLE(e,t){return new M(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)}static fromBytesBE(e,t){return new M(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}static isLong(e){return e!=null&&typeof e==="object"&&"__isLong__"in e&&e.__isLong__===!0}static fromValue(e,t){if(typeof e==="number")return M.fromNumber(e,t);if(typeof e==="string")return M.fromString(e,t);return M.fromBits(e.low,e.high,typeof t==="boolean"?t:e.unsigned)}add(e){if(!M.isLong(e))e=M.fromValue(e);let t=this.high>>>16,r=this.high&65535,n=this.low>>>16,s=this.low&65535,i=e.high>>>16,o=e.high&65535,u=e.low>>>16,a=e.low&65535,c=0,l=0,f=0,h=0;return h+=s+a,f+=h>>>16,h&=65535,f+=n+u,l+=f>>>16,f&=65535,l+=r+o,c+=l>>>16,l&=65535,c+=t+i,c&=65535,M.fromBits(f<<16|h,c<<16|l,this.unsigned)}and(e){if(!M.isLong(e))e=M.fromValue(e);return M.fromBits(this.low&e.low,this.high&e.high,this.unsigned)}compare(e){if(!M.isLong(e))e=M.fromValue(e);if(this.eq(e))return 0;let t=this.isNegative(),r=e.isNegative();if(t&&!r)return-1;if(!t&&r)return 1;if(!this.unsigned)return this.sub(e).isNegative()?-1:1;return e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1}comp(e){return this.compare(e)}divide(e){if(!M.isLong(e))e=M.fromValue(e);if(e.isZero())throw new x("division by zero");if(ci){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;let s=(this.unsigned?ci.div_u:ci.div_s)(this.low,this.high,e.low,e.high);return M.fromBits(s,ci.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?M.UZERO:M.ZERO;let t,r,n;if(!this.unsigned){if(this.eq(M.MIN_VALUE))if(e.eq(M.ONE)||e.eq(M.NEG_ONE))return M.MIN_VALUE;else if(e.eq(M.MIN_VALUE))return M.ONE;else if(t=this.shr(1).div(e).shl(1),t.eq(M.ZERO))return e.isNegative()?M.ONE:M.NEG_ONE;else return r=this.sub(e.mul(t)),n=t.add(r.div(e)),n;else if(e.eq(M.MIN_VALUE))return this.unsigned?M.UZERO:M.ZERO;if(this.isNegative()){if(e.isNegative())return this.neg().div(e.neg());return this.neg().div(e).neg()}else if(e.isNegative())return this.div(e.neg()).neg();n=M.ZERO}else{if(!e.unsigned)e=e.toUnsigned();if(e.gt(this))return M.UZERO;if(e.gt(this.shru(1)))return M.UONE;n=M.UZERO}r=this;while(r.gte(e)){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));let s=Math.ceil(Math.log(t)/Math.LN2),i=s<=48?1:Math.pow(2,s-48),o=M.fromNumber(t),u=o.mul(e);while(u.isNegative()||u.gt(r))t-=i,o=M.fromNumber(t,this.unsigned),u=o.mul(e);if(o.isZero())o=M.ONE;n=n.add(o),r=r.sub(u)}return n}div(e){return this.divide(e)}equals(e){if(!M.isLong(e))e=M.fromValue(e);if(this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1)return!1;return this.high===e.high&&this.low===e.low}eq(e){return this.equals(e)}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(M.MIN_VALUE)?64:this.neg().getNumBitsAbs();let e=this.high!==0?this.high:this.low,t;for(t=31;t>0;t--)if((e&1<<t)!==0)break;return this.high!==0?t+33:t+1}greaterThan(e){return this.comp(e)>0}gt(e){return this.greaterThan(e)}greaterThanOrEqual(e){return this.comp(e)>=0}gte(e){return this.greaterThanOrEqual(e)}ge(e){return this.greaterThanOrEqual(e)}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(e){return this.comp(e)<0}lt(e){return this.lessThan(e)}lessThanOrEqual(e){return this.comp(e)<=0}lte(e){return this.lessThanOrEqual(e)}modulo(e){if(!M.isLong(e))e=M.fromValue(e);if(ci){let t=(this.unsigned?ci.rem_u:ci.rem_s)(this.low,this.high,e.low,e.high);return M.fromBits(t,ci.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))}mod(e){return this.modulo(e)}rem(e){return this.modulo(e)}multiply(e){if(this.isZero())return M.ZERO;if(!M.isLong(e))e=M.fromValue(e);if(ci){let d=ci.mul(this.low,this.high,e.low,e.high);return M.fromBits(d,ci.get_high(),this.unsigned)}if(e.isZero())return M.ZERO;if(this.eq(M.MIN_VALUE))return e.isOdd()?M.MIN_VALUE:M.ZERO;if(e.eq(M.MIN_VALUE))return this.isOdd()?M.MIN_VALUE:M.ZERO;if(this.isNegative())if(e.isNegative())return this.neg().mul(e.neg());else return this.neg().mul(e).neg();else if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(M.TWO_PWR_24)&&e.lt(M.TWO_PWR_24))return M.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);let t=this.high>>>16,r=this.high&65535,n=this.low>>>16,s=this.low&65535,i=e.high>>>16,o=e.high&65535,u=e.low>>>16,a=e.low&65535,c=0,l=0,f=0,h=0;return h+=s*a,f+=h>>>16,h&=65535,f+=n*a,l+=f>>>16,f&=65535,f+=s*u,l+=f>>>16,f&=65535,l+=r*a,c+=l>>>16,l&=65535,l+=n*u,c+=l>>>16,l&=65535,l+=s*o,c+=l>>>16,l&=65535,c+=t*a+r*u+n*o+s*i,c&=65535,M.fromBits(f<<16|h,c<<16|l,this.unsigned)}mul(e){return this.multiply(e)}negate(){if(!this.unsigned&&this.eq(M.MIN_VALUE))return M.MIN_VALUE;return this.not().add(M.ONE)}neg(){return this.negate()}not(){return M.fromBits(~this.low,~this.high,this.unsigned)}notEquals(e){return!this.equals(e)}neq(e){return this.notEquals(e)}ne(e){return this.notEquals(e)}or(e){if(!M.isLong(e))e=M.fromValue(e);return M.fromBits(this.low|e.low,this.high|e.high,this.unsigned)}shiftLeft(e){if(M.isLong(e))e=e.toInt();if((e&=63)===0)return this;else if(e<32)return M.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned);else return M.fromBits(0,this.low<<e-32,this.unsigned)}shl(e){return this.shiftLeft(e)}shiftRight(e){if(M.isLong(e))e=e.toInt();if((e&=63)===0)return this;else if(e<32)return M.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned);else return M.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)}shr(e){return this.shiftRight(e)}shiftRightUnsigned(e){if(M.isLong(e))e=e.toInt();if(e&=63,e===0)return this;else{let t=this.high;if(e<32){let r=this.low;return M.fromBits(r>>>e|t<<32-e,t>>>e,this.unsigned)}else if(e===32)return M.fromBits(t,0,this.unsigned);else return M.fromBits(t>>>e-32,0,this.unsigned)}}shr_u(e){return this.shiftRightUnsigned(e)}shru(e){return this.shiftRightUnsigned(e)}subtract(e){if(!M.isLong(e))e=M.fromValue(e);return this.add(e.neg())}sub(e){return this.subtract(e)}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){if(this.unsigned)return(this.high>>>0)*cl+(this.low>>>0);return this.high*cl+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(e){return e?this.toBytesLE():this.toBytesBE()}toBytesLE(){let e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}toBytesBE(){let e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,t>>>24,t>>>16&255,t>>>8&255,t&255]}toSigned(){if(!this.unsigned)return this;return M.fromBits(this.low,this.high,!1)}toString(e){if(e=e||10,e<2||36<e)throw new x("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(M.MIN_VALUE)){let s=M.fromNumber(e),i=this.div(s),o=i.mul(s).sub(this);return i.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);let t=M.fromNumber(Math.pow(e,6),this.unsigned),r=this,n="";while(!0){let s=r.div(t),o=(r.sub(s.mul(t)).toInt()>>>0).toString(e);if(r=s,r.isZero())return o+n;else{while(o.length<6)o="0"+o;n=""+o+n}}}toUnsigned(){if(this.unsigned)return this;return M.fromBits(this.low,this.high,!0)}xor(e){if(!M.isLong(e))e=M.fromValue(e);return M.fromBits(this.low^e.low,this.high^e.high,this.unsigned)}eqz(){return this.isZero()}le(e){return this.lessThanOrEqual(e)}toExtendedJSON(e){if(e&&e.relaxed)return this.toNumber();return{$numberLong:this.toString()}}static fromExtendedJSON(e,t){let{useBigInt64:r=!1,relaxed:n=!0}={...t};if(e.$numberLong.length>MG)throw new x("$numberLong string is too long");if(!PG.test(e.$numberLong))throw new x(`$numberLong string "${e.$numberLong}" is in an invalid format`);if(r){let i=BigInt(e.$numberLong);return BigInt.asIntN(64,i)}let s=M.fromString(e.$numberLong);if(n)return s.toNumber();return s}inspect(e,t,r){r??=Js;let n=r(this.toString(),t),s=this.unsigned?`, ${r(this.unsigned,t)}`:"";return`new Long(${n}${s})`}}var BG=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,FG=/^(\+|-)?(Infinity|inf)$/i,NG=/^(\+|-)?NaN$/i,ul=6111,nf=-6176,qC=6176,jC=34,OE=v.fromNumberArray([124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),LC=v.fromNumberArray([248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),UC=v.fromNumberArray([120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),IG=/^([-+])?(\d+)?$/,RG=31,VC=16383,$G=30,vG=31;function zC(e){return!isNaN(parseInt(e,10))}function xG(e){let t=M.fromNumber(1e9),r=M.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:r};for(let n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new M(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function kG(e,t){if(!e&&!t)return{high:M.fromNumber(0),low:M.fromNumber(0)};let r=e.shiftRightUnsigned(32),n=new M(e.getLowBits(),0),s=t.shiftRightUnsigned(32),i=new M(t.getLowBits(),0),o=r.multiply(s),u=r.multiply(i),a=n.multiply(s),c=n.multiply(i);return o=o.add(u.shiftRightUnsigned(32)),u=new M(u.getLowBits(),0).add(a).add(c.shiftRightUnsigned(32)),o=o.add(u.shiftRightUnsigned(32)),c=u.shiftLeft(32).add(new M(c.getLowBits(),0)),{high:o,low:c}}function qG(e,t){let r=e.high>>>0,n=t.high>>>0;if(r<n)return!0;else if(r===n){let s=e.low>>>0,i=t.low>>>0;if(s<i)return!0}return!1}function oo(e,t){throw new x(`"${e}" is not a valid Decimal128 string - ${t}`)}class xn extends cs{get _bsontype(){return"Decimal128"}bytes;constructor(e){super();if(typeof e==="string")this.bytes=xn.fromString(e).bytes;else if(e instanceof Uint8Array||ll(e)){if(e.byteLength!==16)throw new x("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new x("Decimal128 must take a Buffer or string")}static fromString(e){return xn._fromString(e,{allowRounding:!1})}static fromStringWithRounding(e){return xn._fromString(e,{allowRounding:!0})}static _fromString(e,t){let r=!1,n=!1,s=!1,i=!1,o=0,u=0,a=0,c=0,l=0,f=[0],h=0,d=0,p=0,m=0,_=new M(0,0),y=new M(0,0),E=0,C=0;if(e.length>=7000)throw new x(""+e+" not a valid Decimal128 string");let D=e.match(BG),A=e.match(FG),P=e.match(NG);if(!D&&!A&&!P||e.length===0)throw new x(""+e+" not a valid Decimal128 string");if(D){let I=D[2],Oe=D[4],Ne=D[5],ae=D[6];if(Oe&&ae===void 0)oo(e,"missing exponent power");if(Oe&&I===void 0)oo(e,"missing exponent base");if(Oe===void 0&&(Ne||ae))oo(e,"missing e before exponent")}if(e[C]==="+"||e[C]==="-")n=!0,r=e[C++]==="-";if(!zC(e[C])&&e[C]!=="."){if(e[C]==="i"||e[C]==="I")return new xn(r?LC:UC);else if(e[C]==="N")return new xn(OE)}while(zC(e[C])||e[C]==="."){if(e[C]==="."){if(s)oo(e,"contains multiple periods");s=!0,C=C+1;continue}if(h<jC){if(e[C]!=="0"||i){if(!i)l=u;i=!0,f[d++]=parseInt(e[C],10),h=h+1}}if(i)a=a+1;if(s)c=c+1;u=u+1,C=C+1}if(s&&!u)throw new x(""+e+" not a valid Decimal128 string");if(e[C]==="e"||e[C]==="E"){let I=e.substr(++C).match(IG);if(!I||!I[2])return new xn(OE);m=parseInt(I[0],10),C=C+I[0].length}if(e[C])return new xn(OE);if(!h)f[0]=0,a=1,h=1,o=0;else if(p=h-1,o=a,o!==1)while(e[l+o-1+Number(n)+Number(s)]==="0")o=o-1;if(m<=c&&c>m+16384)m=nf;else m=m-c;while(m>ul){if(p=p+1,p>=jC){if(o===0){m=ul;break}oo(e,"overflow")}m=m-1}if(t.allowRounding){while(m<nf||h<a){if(p===0&&o<h){m=nf,o=0;break}if(h<a)a=a-1;else p=p-1;if(m<ul)m=m+1;else{if(f.join("").match(/^0+$/)){m=ul;break}oo(e,"overflow")}}if(p+1<o){let I=u;if(s)l=l+1,I=I+1;if(n)l=l+1,I=I+1;let Oe=parseInt(e[l+p+1],10),Ne=0;if(Oe>=5){if(Ne=1,Oe===5){Ne=f[p]%2===1?1:0;for(let ae=l+p+2;ae<I;ae++)if(parseInt(e[ae],10)){Ne=1;break}}}if(Ne){let ae=p;for(;ae>=0;ae--)if(++f[ae]>9){if(f[ae]=0,ae===0)if(m<ul)m=m+1,f[ae]=1;else return new xn(r?LC:UC)}else break}}}else{while(m<nf||h<a){if(p===0){if(o===0){m=nf;break}oo(e,"exponent underflow")}if(h<a){if(e[a-1+Number(n)+Number(s)]!=="0"&&o!==0)oo(e,"inexact rounding");a=a-1}else{if(f[p]!==0)oo(e,"inexact rounding");p=p-1}if(m<ul)m=m+1;else oo(e,"overflow")}if(p+1<o){if(s)l=l+1;if(n)l=l+1;if(parseInt(e[l+p+1],10)!==0)oo(e,"inexact rounding")}}if(_=M.fromNumber(0),y=M.fromNumber(0),o===0)_=M.fromNumber(0),y=M.fromNumber(0);else if(p<17){let I=0;y=M.fromNumber(f[I++]),_=new M(0,0);for(;I<=p;I++)y=y.multiply(M.fromNumber(10)),y=y.add(M.fromNumber(f[I]))}else{let I=0;_=M.fromNumber(f[I++]);for(;I<=p-17;I++)_=_.multiply(M.fromNumber(10)),_=_.add(M.fromNumber(f[I]));y=M.fromNumber(f[I++]);for(;I<=p;I++)y=y.multiply(M.fromNumber(10)),y=y.add(M.fromNumber(f[I]))}let S=kG(_,M.fromString("100000000000000000"));if(S.low=S.low.add(y),qG(S.low,y))S.high=S.high.add(M.fromNumber(1));E=m+qC;let B={low:M.fromNumber(0),high:M.fromNumber(0)};if(S.high.shiftRightUnsigned(49).and(M.fromNumber(1)).equals(M.fromNumber(1)))B.high=B.high.or(M.fromNumber(3).shiftLeft(61)),B.high=B.high.or(M.fromNumber(E).and(M.fromNumber(16383).shiftLeft(47))),B.high=B.high.or(S.high.and(M.fromNumber(140737488355327)));else B.high=B.high.or(M.fromNumber(E&16383).shiftLeft(49)),B.high=B.high.or(S.high.and(M.fromNumber(562949953421311)));if(B.low=S.low,r)B.high=B.high.or(M.fromString("9223372036854775808"));let q=v.allocateUnsafe(16);return C=0,q[C++]=B.low.low&255,q[C++]=B.low.low>>8&255,q[C++]=B.low.low>>16&255,q[C++]=B.low.low>>24&255,q[C++]=B.low.high&255,q[C++]=B.low.high>>8&255,q[C++]=B.low.high>>16&255,q[C++]=B.low.high>>24&255,q[C++]=B.high.low&255,q[C++]=B.high.low>>8&255,q[C++]=B.high.low>>16&255,q[C++]=B.high.low>>24&255,q[C++]=B.high.high&255,q[C++]=B.high.high>>8&255,q[C++]=B.high.high>>16&255,q[C++]=B.high.high>>24&255,new xn(q)}toString(){let e,t=0,r=Array(36);for(let C=0;C<r.length;C++)r[C]=0;let n=0,s=!1,i,o={parts:[0,0,0,0]},u,a,c=[];n=0;let l=this.bytes,f=l[n++]|l[n++]<<8|l[n++]<<16|l[n++]<<24,h=l[n++]|l[n++]<<8|l[n++]<<16|l[n++]<<24,d=l[n++]|l[n++]<<8|l[n++]<<16|l[n++]<<24,p=l[n++]|l[n++]<<8|l[n++]<<16|l[n++]<<24;if(n=0,{low:new M(f,h),high:new M(d,p)}.high.lessThan(M.ZERO))c.push("-");let _=p>>26&RG;if(_>>3===3)if(_===$G)return c.join("")+"Infinity";else if(_===vG)return"NaN";else e=p>>15&VC,i=8+(p>>14&1);else i=p>>14&7,e=p>>17&VC;let y=e-qC;if(o.parts[0]=(p&16383)+((i&15)<<14),o.parts[1]=d,o.parts[2]=h,o.parts[3]=f,o.parts[0]===0&&o.parts[1]===0&&o.parts[2]===0&&o.parts[3]===0)s=!0;else for(a=3;a>=0;a--){let C=0,D=xG(o);if(o=D.quotient,C=D.rem.low,!C)continue;for(u=8;u>=0;u--)r[a*9+u]=C%10,C=Math.floor(C/10)}if(s)t=1,r[n]=0;else{t=36;while(!r[n])t=t-1,n=n+1}let E=t-1+y;if(E>=34||E<=-7||y>0){if(t>34){if(c.push("0"),y>0)c.push(`E+${y}`);else if(y<0)c.push(`E${y}`);return c.join("")}if(c.push(`${r[n++]}`),t=t-1,t)c.push(".");for(let C=0;C<t;C++)c.push(`${r[n++]}`);if(c.push("E"),E>0)c.push(`+${E}`);else c.push(`${E}`)}else if(y>=0)for(let C=0;C<t;C++)c.push(`${r[n++]}`);else{let C=t+y;if(C>0)for(let D=0;D<C;D++)c.push(`${r[n++]}`);else c.push("0");c.push(".");while(C++<0)c.push("0");for(let D=0;D<t-Math.max(C-1,0);D++)c.push(`${r[n++]}`)}return c.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(e){return xn.fromString(e.$numberDecimal)}inspect(e,t,r){return r??=Js,`new Decimal128(${r(this.toString(),t)})`}}class hi extends cs{get _bsontype(){return"Double"}value;constructor(e){super();if(e instanceof Number)e=e.valueOf();this.value=+e}static fromString(e){let t=Number(e);if(e==="NaN")return new hi(NaN);if(e==="Infinity")return new hi(1/0);if(e==="-Infinity")return new hi(-1/0);if(!Number.isFinite(t))throw new x(`Input: ${e} is not representable as a Double`);if(e.trim()!==e)throw new x(`Input: '${e}' contains whitespace`);if(e==="")throw new x("Input is an empty string");if(/[^-0-9.+eE]/.test(e))throw new x(`Input: '${e}' is not in decimal or exponential notation`);return new hi(t)}valueOf(){return this.value}toJSON(){return this.value}toString(e){return this.value.toString(e)}toExtendedJSON(e){if(e&&(e.legacy||e.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:"-0.0"};return{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}}static fromExtendedJSON(e,t){let r=parseFloat(e.$numberDouble);return t&&t.relaxed?r:new hi(r)}inspect(e,t,r){return r??=Js,`new Double(${r(this.value,t)})`}}class Su extends cs{get _bsontype(){return"Int32"}value;constructor(e){super();if(e instanceof Number)e=e.valueOf();this.value=+e|0}static fromString(e){let t=d9(e),r=Number(e);if(hf<r)throw new x(`Input: '${e}' is larger than the maximum value for Int32`);else if(ff>r)throw new x(`Input: '${e}' is smaller than the minimum value for Int32`);else if(!Number.isSafeInteger(r))throw new x(`Input: '${e}' is not a safe integer`);else if(r.toString()!==t)throw new x(`Input: '${e}' is not a valid Int32 string`);return new Su(r)}valueOf(){return this.value}toString(e){return this.value.toString(e)}toJSON(){return this.value}toExtendedJSON(e){if(e&&(e.relaxed||e.legacy))return this.value;return{$numberInt:this.value.toString()}}static fromExtendedJSON(e,t){return t&&t.relaxed?parseInt(e.$numberInt,10):new Su(e.$numberInt)}inspect(e,t,r){return r??=Js,`new Int32(${r(this.value,t)})`}}class mc extends cs{get _bsontype(){return"MaxKey"}toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new mc}inspect(){return"new MaxKey()"}}class yc extends cs{get _bsontype(){return"MinKey"}toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new yc}inspect(){return"new MinKey()"}}var sf=new WeakMap,Ys=[];for(let e=0;e<256;e++)Ys.push(e.toString(16).padStart(2,"0"));var mp=new Int8Array(103);for(let e=48;e<=57;e++)mp[e]=e-48;for(let e=65;e<=70;e++)mp[e]=e-55;for(let e=97;e<=102;e++)mp[e]=e-87;class Wt extends cs{get _bsontype(){return"ObjectId"}static index=0;static PROCESS_UNIQUE=null;static resetState=()=>{this.index=Math.floor(Math.random()*16777216),this.PROCESS_UNIQUE=null};static{this.resetState();let e,t=!1;try{e=globalThis?.process?.getBuiltinModule?.("v8")??{}}catch{}let r=e?.startupSnapshot;try{t=r?.isBuildingSnapshot?.()}catch{}if(t)r?.addDeserializeCallback?.(this.resetState)}static cacheHexString;i0;i1;i2;i3;setFromBytes(e,t=0){this.i0=e[t]<<16|e[t+1]<<8|e[t+2],this.i1=e[t+3]<<16|e[t+4]<<8|e[t+5],this.i2=e[t+6]<<16|e[t+7]<<8|e[t+8],this.i3=e[t+9]<<16|e[t+10]<<8|e[t+11]}setFromHex(e){let t=mp;this.i0=t[e.charCodeAt(0)]<<20|t[e.charCodeAt(1)]<<16|t[e.charCodeAt(2)]<<12|t[e.charCodeAt(3)]<<8|t[e.charCodeAt(4)]<<4|t[e.charCodeAt(5)],this.i1=t[e.charCodeAt(6)]<<20|t[e.charCodeAt(7)]<<16|t[e.charCodeAt(8)]<<12|t[e.charCodeAt(9)]<<8|t[e.charCodeAt(10)]<<4|t[e.charCodeAt(11)],this.i2=t[e.charCodeAt(12)]<<20|t[e.charCodeAt(13)]<<16|t[e.charCodeAt(14)]<<12|t[e.charCodeAt(15)]<<8|t[e.charCodeAt(16)]<<4|t[e.charCodeAt(17)],this.i3=t[e.charCodeAt(18)]<<20|t[e.charCodeAt(19)]<<16|t[e.charCodeAt(20)]<<12|t[e.charCodeAt(21)]<<8|t[e.charCodeAt(22)]<<4|t[e.charCodeAt(23)]}constructor(e,t){super();if(typeof t==="number"){this.setFromBytes(e,t);return}let r;if(typeof e==="object"&&e&&"id"in e){if(Wt.is(e)&&typeof e.i0==="number"&&typeof e.i1==="number"&&typeof e.i2==="number"&&typeof e.i3==="number"){this.i0=e.i0,this.i1=e.i1,this.i2=e.i2,this.i3=e.i3;return}if(typeof e.id!=="string"&&!ArrayBuffer.isView(e.id))throw new x("Argument passed in must have an id that is of type string or Buffer");if("toHexString"in e&&typeof e.toHexString==="function")r=v.fromHex(e.toHexString());else r=e.id}else r=e;if(r==null){let n=Math.floor(Date.now()/1000),s=Wt.getInc(),i=Wt.PROCESS_UNIQUE??=v.randomBytes(5);this.i0=n>>>8&16777215,this.i1=(n&255)<<16|i[0]<<8|i[1],this.i2=i[2]<<16|i[3]<<8|i[4],this.i3=s&16777215}else if(ArrayBuffer.isView(r)&&r.byteLength===12)this.setFromBytes(r instanceof Uint8Array?r:v.toLocalBufferType(r));else if(typeof r==="string")if(Wt.validateHexString(r)){if(this.setFromHex(r),Wt.cacheHexString)sf.set(this,r)}else throw new x("input must be a 24 character hex string, 12 byte Uint8Array, or an integer");else throw new x("Argument passed in does not match the accepted types")}get id(){let e=v.allocateUnsafe(12);return e[0]=this.i0>>>16&255,e[1]=this.i0>>>8&255,e[2]=this.i0&255,e[3]=this.i1>>>16&255,e[4]=this.i1>>>8&255,e[5]=this.i1&255,e[6]=this.i2>>>16&255,e[7]=this.i2>>>8&255,e[8]=this.i2&255,e[9]=this.i3>>>16&255,e[10]=this.i3>>>8&255,e[11]=this.i3&255,e}set id(e){let t=e instanceof Uint8Array?e:v.toLocalBufferType(e);if(this.setFromBytes(t),Wt.cacheHexString)sf.set(this,v.toHex(t))}static validateHexString(e){if(e?.length!==24)return!1;for(let t=0;t<24;t++){let r=e.charCodeAt(t);if(r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70)continue;return!1}return!0}toHexString(){if(Wt.cacheHexString){let i=sf.get(this);if(i)return i}let e=this.i0,t=this.i1,r=this.i2,n=this.i3,s=Ys[e>>>16&255]+Ys[e>>>8&255]+Ys[e&255]+Ys[t>>>16&255]+Ys[t>>>8&255]+Ys[t&255]+Ys[r>>>16&255]+Ys[r>>>8&255]+Ys[r&255]+Ys[n>>>16&255]+Ys[n>>>8&255]+Ys[n&255];if(Wt.cacheHexString)sf.set(this,s);return s}static getInc(){return Wt.index=(Wt.index+1)%16777216}static generate(e){if(typeof e!=="number")e=Math.floor(Date.now()/1000);let t=Wt.getInc(),r=v.allocateUnsafe(12);Se.setInt32BE(r,0,e);let n=this.PROCESS_UNIQUE??=v.randomBytes(5);return r[4]=n[0],r[5]=n[1],r[6]=n[2],r[7]=n[3],r[8]=n[4],r[11]=t&255,r[10]=t>>>8&255,r[9]=t>>>16&255,r}toString(e){if(e==="base64")return v.toBase64(this.id);if(e==="hex")return this.toHexString();return this.toHexString()}toJSON(){return this.toHexString()}static is(e){return e!=null&&typeof e==="object"&&"_bsontype"in e&&e._bsontype==="ObjectId"}equals(e){if(e===void 0||e===null)return!1;if(Wt.is(e)&&typeof e.i0==="number"&&typeof e.i1==="number"&&typeof e.i2==="number"&&typeof e.i3==="number")return this.i3===e.i3&&this.i0===e.i0&&this.i1===e.i1&&this.i2===e.i2;if(typeof e==="string")return e.toLowerCase()===this.toHexString();if(typeof e==="object"&&typeof e.toHexString==="function"){let t=e.toHexString(),r=this.toHexString();return typeof t==="string"&&t.toLowerCase()===r}return!1}getTimestamp(){let e=new Date,t=this.i0*256+(this.i1>>>16);return e.setTime(t*1000),e}static createPk(){return new Wt}serializeInto(e,t){return e[t]=this.i0>>>16&255,e[t+1]=this.i0>>>8&255,e[t+2]=this.i0&255,e[t+3]=this.i1>>>16&255,e[t+4]=this.i1>>>8&255,e[t+5]=this.i1&255,e[t+6]=this.i2>>>16&255,e[t+7]=this.i2>>>8&255,e[t+8]=this.i2&255,e[t+9]=this.i3>>>16&255,e[t+10]=this.i3>>>8&255,e[t+11]=this.i3&255,12}static createFromTime(e){let t=v.allocate(12);for(let r=11;r>=4;r--)t[r]=0;return Se.setInt32BE(t,0,e),new Wt(t)}static createFromHexString(e){if(e?.length!==24)throw new x("hex string must be 24 characters");return new Wt(v.fromHex(e))}static createFromBase64(e){if(e?.length!==16)throw new x("base64 string must be 16 characters");return new Wt(v.fromBase64(e))}static isValid(e){if(e==null)return!1;if(typeof e==="string")return Wt.validateHexString(e);try{return new Wt(e),!0}catch{return!1}}toExtendedJSON(){if(this.toHexString)return{$oid:this.toHexString()};return{$oid:this.toString("hex")}}static fromExtendedJSON(e){return new Wt(e.$oid)}isCached(){return Wt.cacheHexString&&sf.has(this)}inspect(e,t,r){return r??=Js,`new ObjectId(${r(this.toHexString(),t)})`}}function jG(e,t,r){let n=[{object:e,ignoreUndefined:r??!1,exit:!1}],s=new Set,i=0;while(n.length>0){let o=n.pop();if(o.exit){s.delete(o.object);continue}let{object:u,ignoreUndefined:a}=o;s.add(u),o.exit=!0,n.push(o),i+=5;let c=Array.isArray(u),l=!c&&(u instanceof Map||dp(u)),f=u;if(!c&&!l&&typeof u?.toBSON==="function")f=u.toBSON();if(c){let h=f;for(let d=0;d<h.length;d++)i+=SE(d.toString(),h[d],t,!0,a,n,s)}else if(l)for(let[h,d]of f)i+=SE(h,d,t,!1,a,n,s);else for(let h of Object.keys(f))i+=SE(h,f[h],t,!1,a,n,s)}return i}function SE(e,t,r=!1,n=!1,s=!1,i,o){if(typeof t?.toBSON==="function")t=t.toBSON();switch(typeof t){case"string":return 1+v.utf8ByteLength(e)+1+4+v.utf8ByteLength(t)+1;case"number":if(Math.floor(t)===t&&t>=ZC&&t<=XC)if(!Object.is(t,-0)&&t>=ff&&t<=hf)return v.utf8ByteLength(e)+1+5;else return v.utf8ByteLength(e)+1+9;else return v.utf8ByteLength(e)+1+9;case"undefined":if(n||!s)return v.utf8ByteLength(e)+1+1;return 0;case"boolean":return v.utf8ByteLength(e)+1+2;case"object":if(t!=null&&typeof t._bsontype==="string"&&t[pp]!==lf)throw new hl;else if(t==null||t._bsontype==="MinKey"||t._bsontype==="MaxKey")return v.utf8ByteLength(e)+1+1;else if(t._bsontype==="ObjectId")return v.utf8ByteLength(e)+1+13;else if(t instanceof Date||hp(t))return v.utf8ByteLength(e)+1+9;else if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||bE(t))return v.utf8ByteLength(e)+1+6+t.byteLength;else if(t._bsontype==="Long"||t._bsontype==="Double"||t._bsontype==="Timestamp")return v.utf8ByteLength(e)+1+9;else if(t._bsontype==="Decimal128")return v.utf8ByteLength(e)+1+17;else if(t._bsontype==="Int32")return v.utf8ByteLength(e)+1+5;else if(t._bsontype==="Code")if(t.scope!=null&&typeof t.scope==="object"){if(o.has(t.scope))throw new x("Cannot convert circular structure to BSON");return i.push({object:t.scope,ignoreUndefined:s,exit:!1}),v.utf8ByteLength(e)+1+1+4+4+v.utf8ByteLength(t.code.toString())+1}else return v.utf8ByteLength(e)+1+1+4+v.utf8ByteLength(t.code.toString())+1;else if(t._bsontype==="Binary"){let u=t;if(u.sub_type===je.SUBTYPE_BYTE_ARRAY)return v.utf8ByteLength(e)+1+(u.position+1+4+1+4);else return v.utf8ByteLength(e)+1+(u.position+1+4+1)}else if(t._bsontype==="BSONSymbol")return v.utf8ByteLength(e)+1+v.utf8ByteLength(t.value)+4+1+1;else if(t._bsontype==="DBRef"){let u=Object.assign({$ref:t.collection,$id:t.oid},t.fields);if(t.db!=null)u.$db=t.db;return i.push({object:u,ignoreUndefined:!0,exit:!1}),v.utf8ByteLength(e)+1+1}else if(t instanceof RegExp||lp(t))return v.utf8ByteLength(e)+1+1+v.utf8ByteLength(t.source)+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;else if(t._bsontype==="BSONRegExp")return v.utf8ByteLength(e)+1+1+v.utf8ByteLength(t.pattern)+1+v.utf8ByteLength(t.options)+1;else{if(o.has(t))throw new x("Cannot convert circular structure to BSON");return i.push({object:t,ignoreUndefined:s,exit:!1}),v.utf8ByteLength(e)+1+1}case"function":if(r)return v.utf8ByteLength(e)+1+1+4+v.utf8ByteLength(t.toString())+1;return 0;case"bigint":return v.utf8ByteLength(e)+1+9;case"symbol":return 0;default:throw new x(`Unrecognized JS type: ${typeof t}`)}}function LG(e){return e.split("").sort().join("")}class fi extends cs{get _bsontype(){return"BSONRegExp"}pattern;options;constructor(e,t){super();if(this.pattern=e,this.options=LG(t??""),this.pattern.indexOf("\x00")!==-1)throw new x(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);if(this.options.indexOf("\x00")!==-1)throw new x(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);for(let r=0;r<this.options.length;r++)if(!(this.options[r]==="i"||this.options[r]==="m"||this.options[r]==="x"||this.options[r]==="l"||this.options[r]==="s"||this.options[r]==="u"))throw new x(`The regular expression option [${this.options[r]}] is not supported`)}static parseOptions(e){return e?e.split("").sort().join(""):""}toExtendedJSON(e){if(e=e||{},e.legacy)return{$regex:this.pattern,$options:this.options};return{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(e){if("$regex"in e)if(typeof e.$regex!=="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new fi(e.$regex,fi.parseOptions(e.$options));if("$regularExpression"in e)return new fi(e.$regularExpression.pattern,fi.parseOptions(e.$regularExpression.options));throw new x(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(e)}`)}inspect(e,t,r){let n=fG(t)??((o)=>o);r??=Js;let s=n(r(this.pattern),"regexp"),i=n(r(this.options),"regexp");return`new BSONRegExp(${s}, ${i})`}}class gc extends cs{get _bsontype(){return"BSONSymbol"}value;constructor(e){super();this.value=e}valueOf(){return this.value}toString(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(e){return new gc(e.$symbol)}inspect(e,t,r){return r??=Js,`new BSONSymbol(${r(this.value,t)})`}}var UG=M;class ao extends UG{get _bsontype(){return"Timestamp"}get[pc](){return"Timestamp"}static MAX_VALUE=M.MAX_UNSIGNED_VALUE;get i(){return this.low>>>0}get t(){return this.high>>>0}constructor(e){if(e==null)super(0,0,!0);else if(typeof e==="bigint")super(e,!0);else if(M.isLong(e))super(e.low,e.high,!0);else if(typeof e==="object"&&"t"in e&&"i"in e){if(typeof e.t!=="number"&&(typeof e.t!=="object"||e.t._bsontype!=="Int32"))throw new x("Timestamp constructed from { t, i } must provide t as a number");if(typeof e.i!=="number"&&(typeof e.i!=="object"||e.i._bsontype!=="Int32"))throw new x("Timestamp constructed from { t, i } must provide i as a number");let t=Number(e.t),r=Number(e.i);if(t<0||Number.isNaN(t))throw new x("Timestamp constructed from { t, i } must provide a positive t");if(r<0||Number.isNaN(r))throw new x("Timestamp constructed from { t, i } must provide a positive i");if(t>4294967295)throw new x("Timestamp constructed from { t, i } must provide t equal or less than uint32 max");if(r>4294967295)throw new x("Timestamp constructed from { t, i } must provide i equal or less than uint32 max");super(r,t,!0)}else throw new x("A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }")}toJSON(){return{$timestamp:this.toString()}}static fromInt(e){return new ao(M.fromInt(e,!0))}static fromNumber(e){return new ao(M.fromNumber(e,!0))}static fromBits(e,t){return new ao({i:e,t})}static fromString(e,t){return new ao(M.fromString(e,!0,t))}toExtendedJSON(){return{$timestamp:{t:this.t,i:this.i}}}static fromExtendedJSON(e){let t=M.isLong(e.$timestamp.i)?e.$timestamp.i.getLowBitsUnsigned():e.$timestamp.i,r=M.isLong(e.$timestamp.t)?e.$timestamp.t.getLowBitsUnsigned():e.$timestamp.t;return new ao({t:r,i:t})}inspect(e,t,r){r??=Js;let n=r(this.t,t),s=r(this.i,t);return`new Timestamp({ t: ${n}, i: ${s} })`}}var VG=M.fromNumber(XC),zG=M.fromNumber(ZC);function m9(e,t,r){t=t==null?{}:t;let n=t&&t.index?t.index:0,s=Se.getInt32LE(e,n);if(s<5)throw new x(`bson size must be >= 5, is ${s}`);if(t.allowObjectSmallerThanBufferSize&&e.length<s)throw new x(`buffer length ${e.length} must be >= bson size ${s}`);if(!t.allowObjectSmallerThanBufferSize&&e.length!==s)throw new x(`buffer length ${e.length} must === bson size ${s}`);if(s+n>e.byteLength)throw new x(`(bson size ${s} + options.index ${n} must be <= buffer length ${e.byteLength})`);if(e[n+s-1]!==0)throw new x("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return WG(e,n,t,r)}var WC=/^\$ref$|^\$id$|^\$db$/;function HC(e,t,r){if(t==="__proto__")Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0});else e[t]=r}function KC(e){if(f9(e)){let{$ref:t,$id:r,$db:n,...s}=e;return new Mo(t,r,n,s)}return e}function WG(e,t,r,n=!1){r={...r};let s=r.fieldsAsRaw==null?null:r.fieldsAsRaw,i=r.raw==null?!1:r.raw,o=typeof r.bsonRegExp==="boolean"?r.bsonRegExp:!1,u=r.promoteBuffers??!1,a=r.promoteLongs??!0,c=r.promoteValues??!0,l=r.useBigInt64??!1;if(l&&!c)throw new x("Must either request bigint or Long for int64 deserialization");if(l&&!a)throw new x("Must either request bigint or Long for int64 deserialization");let f=r.validation==null?{utf8:!0}:r.validation,h=!0,d,p,m=f.utf8;if(typeof m==="boolean")d=m;else{h=!1;let q=Object.keys(m).map(function(I){return m[I]});if(q.length===0)throw new x("UTF-8 validation setting cannot be empty");if(typeof q[0]!=="boolean")throw new x("Invalid UTF-8 validation option, must specify boolean values");if(d=q[0],!q.every((I)=>I===d))throw new x("Invalid UTF-8 validation option - keys must be all true or all false")}if(!h){p=new Set;for(let q of Object.keys(m))p.add(q)}let _=t;if(e.length<5)throw new x("corrupt bson message < 5 bytes long");let y=Se.getInt32LE(e,t);if(t+=4,y<5||y>e.length)throw new x("corrupt bson message");let E=n?[]:{},C=0,D=n?!1:null,A=null,P=E,S=n;while(!0){let q=e[t++];if(q===0)if(A)if(t===A.lastIndex){let G=A;if(A=G.prev,A===null)P=E,S=n;else P=A.holdingDocument,S=A.isArray;let De=G.holdingDocument;switch(G.elementType){case uf:if(G.isPossibleDBRef)De=KC(De);break;case of:break;case cp:De=new Ou(G.functionString,G.holdingDocument);break;default:throw new x("Unexpected element type in frame stack")}HC(P,G.propertyName,De);continue}else{if(A.elementType===of)throw new x("corrupted array bson");throw new x("Bad BSON Document: object not properly terminated")}else break;let I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.byteLength)throw new x("Bad BSON Document: illegal CString");let Oe=S?A!==null?A.arrayIndex++:C++:v.toUTF8(e,t,I,!1),Ne;if(A!==null)Ne=A.validationSetting;else if(h||p?.has(Oe))Ne=d;else Ne=!d;if(A!==null){if(A.isPossibleDBRef!==!1&&typeof Oe==="string"&&Oe[0]==="$")A.isPossibleDBRef=WC.test(Oe)}else if(D!==!1&&Oe[0]==="$")D=WC.test(Oe);let ae,sr=!1;if(t=I+1,q===e9){let G=Se.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new x("bad string length in bson");ae=v.toUTF8(e,t,t+G-1,Ne),t=t+G}else if(q===t9)ae=new Wt(e,t),t=t+12;else if(q===af&&c===!1)ae=new Su(Se.getInt32LE(e,t)),t+=4;else if(q===af)ae=Se.getInt32LE(e,t),t+=4;else if(q===DE){if(ae=Se.getFloat64LE(e,t),t+=8,c===!1)ae=new hi(ae)}else if(q===n9){let G=Se.getInt32LE(e,t),De=Se.getInt32LE(e,t+4);t+=8,ae=new Date(new M(G,De).toNumber())}else if(q===r9){if(e[t]!==0&&e[t]!==1)throw new x("illegal boolean type value");ae=e[t++]===1}else if(q===uf){let G=Se.getInt32LE(e,t);if(G<5||G>e.length-t)throw new x("bad embedded document length in bson");if(i||(A?.raw??!1))ae=e.subarray(t,t+G),t=t+G;else{sr=!0;let De={holdingDocument:{},elementType:uf,propertyName:Oe,functionString:null,lastIndex:t+G,isArray:!1,arrayIndex:0,raw:!1,isPossibleDBRef:null,validationSetting:Ne,prev:A};A=De,P=De.holdingDocument,S=!1,t=t+4}}else if(q===of){let G=Se.getInt32LE(e,t);if(G<5||G>e.length-t)throw new x("bad embedded array length in bson");let De=t+G,gt=!!(s&&s[Oe])||(A?.raw??!1);sr=!0;let Ss={holdingDocument:[],elementType:of,propertyName:Oe,functionString:null,lastIndex:De,isArray:!0,arrayIndex:0,raw:gt,isPossibleDBRef:!1,validationSetting:Ne,prev:A};A=Ss,P=Ss.holdingDocument,S=!0,t=t+4}else if(q===dG)ae=void 0;else if(q===ME)ae=null;else if(q===BE)if(l)ae=Se.getBigInt64LE(e,t),t+=8;else{let G=Se.getInt32LE(e,t),De=Se.getInt32LE(e,t+4);t+=8;let gt=new M(G,De);if(a&&c===!0)ae=gt.lessThanOrEqual(VG)&&gt.greaterThanOrEqual(zG)?gt.toNumber():gt;else ae=gt}else if(q===o9){let G=v.allocateUnsafe(16);for(let De=0;De<16;De++)G[De]=e[t+De];t=t+16,ae=new xn(G)}else if(q===TE){let G=Se.getInt32LE(e,t);t+=4;let De=G,gt=e[t++];if(G<0)throw new x("Negative binary type element size found");if(G>e.byteLength)throw new x("Binary type size larger than document size");if(gt===je.SUBTYPE_BYTE_ARRAY){if(G=Se.getInt32LE(e,t),t+=4,G<0)throw new x("Negative binary type element size found for subtype 0x02");if(G>De-4)throw new x("Binary type with subtype 0x02 contains too long binary size");if(G<De-4)throw new x("Binary type with subtype 0x02 contains too short binary size")}if(u&&c)ae=v.toLocalBufferType(e.subarray(t,t+G));else if(ae=new je(e.subarray(t,t+G),gt),gt===FE&&bn.isValid(ae))ae=ae.toUUID();t=t+G}else if(q===fp&&o===!1){I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new x("Bad BSON Document: illegal CString");let G=v.toUTF8(e,t,I,!1);t=I+1,I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new x("Bad BSON Document: illegal CString");let De=v.toUTF8(e,t,I,!1);t=I+1;let gt=Array(De.length);for(I=0;I<De.length;I++)switch(De[I]){case"m":gt[I]="m";break;case"s":gt[I]="g";break;case"i":gt[I]="i";break}ae=new RegExp(G,gt.join(""))}else if(q===fp&&o===!0){I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new x("Bad BSON Document: illegal CString");let G=v.toUTF8(e,t,I,!1);t=I+1,I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new x("Bad BSON Document: illegal CString");let De=v.toUTF8(e,t,I,!1);t=I+1,ae=new fi(G,De)}else if(q===s9){let G=Se.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new x("bad string length in bson");let De=v.toUTF8(e,t,t+G-1,Ne);ae=c?De:new gc(De),t=t+G}else if(q===i9)ae=new ao({i:Se.getUint32LE(e,t),t:Se.getUint32LE(e,t+4)}),t+=8;else if(q===u9)ae=new yc;else if(q===a9)ae=new mc;else if(q===PE){let G=Se.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new x("bad string length in bson");let De=v.toUTF8(e,t,t+G-1,Ne);ae=new Ou(De),t=t+G}else if(q===cp){let G=Se.getInt32LE(e,t);if(t+=4,G<13)throw new x("code_w_scope total size shorter minimum expected length");let De=Se.getInt32LE(e,t);if(t+=4,De<=0||De>e.length-t||e[t+De-1]!==0)throw new x("bad string length in bson");let gt=v.toUTF8(e,t,t+De-1,Ne);t=t+De;let Ss=t,Je=Se.getInt32LE(e,t);if(Je<5||Je>e.length-t)throw new x("bad scope document size in code_w_scope");if(G<8+Je+De)throw new x("code_w_scope total size is too short, truncating scope");if(G>8+Je+De)throw new x("code_w_scope total size is too long, clips outer document");sr=!0;let vn={holdingDocument:{},elementType:cp,propertyName:Oe,functionString:gt,lastIndex:Ss+Je,isArray:!1,arrayIndex:0,raw:!1,isPossibleDBRef:null,validationSetting:Ne,prev:A};A=vn,P=vn.holdingDocument,S=!1,t=t+4}else if(q===pG){let G=Se.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new x("bad string length in bson");let De=v.toUTF8(e,t,t+G-1,Ne);t=t+G;let gt=v.allocateUnsafe(12);for(let Je=0;Je<12;Je++)gt[Je]=e[t+Je];let Ss=new Wt(gt);t=t+12,ae=new Mo(De,Ss)}else throw new x(`Detected unknown BSON type ${q.toString(16)} for fieldname "${Oe}"`);if(!sr)HC(P,Oe,ae)}if(A!==null)throw new x("corrupted bson, more objects expected based on the current document size");let B=E;if(y!==t-_){if(n)throw new x("corrupt array bson");throw new x("corrupt object bson")}if(!D)return B;return KC(B)}var NE=/\x00/,HG=new Set(["$db","$ref","$id","$clusterTime"]);function KG(e,t,r,n){e[n++]=e9;let s=v.encodeUTF8Into(e,t,n);n=n+s+1,e[n-1]=0;let i=v.encodeUTF8Into(e,r,n+4);return Se.setInt32LE(e,n,i+1),n=n+4+i,e[n++]=0,n}function GG(e,t,r,n){let i=!Object.is(r,-0)&&Number.isSafeInteger(r)&&r<=hf&&r>=ff?af:DE;e[n++]=i;let o=v.encodeUTF8Into(e,t,n);if(n=n+o,e[n++]=0,i===af)n+=Se.setInt32LE(e,n,r);else n+=Se.setFloat64LE(e,n,r);return n}function YG(e,t,r,n){e[n++]=BE;let s=v.encodeUTF8Into(e,t,n);return n+=s,e[n++]=0,n+=Se.setBigInt64LE(e,n,r),n}function GC(e,t,r,n){e[n++]=ME;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,n}function JG(e,t,r,n){e[n++]=r9;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,e[n++]=r?1:0,n}function QG(e,t,r,n){e[n++]=n9;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let i=M.fromNumber(r.getTime()),o=i.getLowBits(),u=i.getHighBits();return n+=Se.setInt32LE(e,n,o),n+=Se.setInt32LE(e,n,u),n}function XG(e,t,r,n){e[n++]=fp;let s=v.encodeUTF8Into(e,t,n);if(n=n+s,e[n++]=0,r.source&&r.source.match(NE)!=null)throw new x("value "+r.source+" must not contain null bytes");if(n=n+v.encodeUTF8Into(e,r.source,n),e[n++]=0,r.ignoreCase)e[n++]=105;if(r.global)e[n++]=115;if(r.multiline)e[n++]=109;return e[n++]=0,n}function ZG(e,t,r,n){e[n++]=fp;let s=v.encodeUTF8Into(e,t,n);if(n=n+s,e[n++]=0,r.pattern.match(NE)!=null)throw new x("pattern "+r.pattern+" must not contain null bytes");n=n+v.encodeUTF8Into(e,r.pattern,n),e[n++]=0;let i=r.options.split("").sort().join("");return n=n+v.encodeUTF8Into(e,i,n),e[n++]=0,n}function eY(e,t,r,n){if(r===null)e[n++]=ME;else if(r[pc]==="MinKey")e[n++]=u9;else e[n++]=a9;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,n}function tY(e,t,r,n){e[n++]=t9;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,n+=r.serializeInto(e,n),n}function rY(e,t,r,n){e[n++]=TE;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let i=r.length;if(n+=Se.setInt32LE(e,n,i),e[n++]=mG,i<=16)for(let o=0;o<i;o++)e[n+o]=r[o];else e.set(r,n);return n=n+i,n}function nY(e,t,r,n){e[n++]=o9;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;for(let i=0;i<16;i++)e[n+i]=r.bytes[i];return n+16}function sY(e,t,r,n){e[n++]=r[pc]==="Long"?BE:i9;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let i=r.getLowBits(),o=r.getHighBits();return n+=Se.setInt32LE(e,n,i),n+=Se.setInt32LE(e,n,o),n}function iY(e,t,r,n){r=r.valueOf(),e[n++]=af;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,n+=Se.setInt32LE(e,n,r),n}function oY(e,t,r,n){e[n++]=DE;let s=v.encodeUTF8Into(e,t,n);return n=n+s,e[n++]=0,n+=Se.setFloat64LE(e,n,r.value),n}function uY(e,t,r,n){e[n++]=PE;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let i=r.toString(),o=v.encodeUTF8Into(e,i,n+4)+1;return Se.setInt32LE(e,n,o),n=n+4+o-1,e[n++]=0,n}function aY(e,t,r,n){e[n++]=TE;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let{buffer:i,position:o}=r;if(r.sub_type===je.SUBTYPE_BYTE_ARRAY)o=o+4;if(n+=Se.setInt32LE(e,n,o),e[n++]=r.sub_type,r.sub_type===je.SUBTYPE_BYTE_ARRAY)o=o-4,n+=Se.setInt32LE(e,n,o);if(r.sub_type===je.SUBTYPE_VECTOR)Eu(r);if(o<=16)for(let u=0;u<o;u++)e[n+u]=i[u];else e.set(i,n);return n=n+r.position,n}function cY(e,t,r,n){e[n++]=s9;let s=v.encodeUTF8Into(e,t,n);n=n+s,e[n++]=0;let i=v.encodeUTF8Into(e,r.value,n+4)+1;return Se.setInt32LE(e,n,i),n=n+4+i-1,e[n++]=0,n}function ap(e,t,r,n,s,i){if(Array.isArray(e))return{sourceObject:e,isArray:!0,objectSizeIndex:t,codeSizeIndex:r,iterTarget:e,keys:null,keyIndex:0,mapIterator:null,prev:n,checkKeys:s,ignoreUndefined:i};if(e instanceof Map||dp(e))return{sourceObject:e,isArray:!1,objectSizeIndex:t,codeSizeIndex:r,iterTarget:e,keys:null,keyIndex:0,mapIterator:e.entries(),prev:n,checkKeys:s,ignoreUndefined:i};let o=e;if(typeof o?.toBSON==="function"){if(o=o.toBSON(),o!=null&&typeof o!=="object")throw new x("toBSON function did not return an object")}return{sourceObject:e,isArray:!1,objectSizeIndex:t,codeSizeIndex:r,iterTarget:o,keys:Object.keys(o),keyIndex:0,mapIterator:null,prev:n,checkKeys:s,ignoreUndefined:i}}function y9(e,t,r,n,s,i,o){if(o==null){if(t==null)return e[0]=5,e[1]=0,e[2]=0,e[3]=0,e[4]=0,5;if(Array.isArray(t))throw new x("serialize does not support an array as the root input");if(typeof t!=="object")throw new x("serialize does not support non-object as the root input");else if("_bsontype"in t&&typeof t._bsontype==="string")throw new x("BSON types cannot be serialized as a document");else if(hp(t)||lp(t)||ll(t)||bE(t))throw new x("date, regexp, typedarray, and arraybuffer cannot be BSON documents");o=new Set}o.add(t);let u=ap(t,n,null,null,r,i),a=n+4;while(u!==null){let c=u,l,f;if(c.mapIterator!==null){let d=c.mapIterator.next();if(d.done){if(e[a++]=0,Se.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Se.setInt32LE(e,c.codeSizeIndex,a-c.codeSizeIndex);o.delete(c.sourceObject),u=c.prev;continue}l=d.value[0],f=d.value[1]}else if(c.keys!==null){if(c.keyIndex>=c.keys.length){if(e[a++]=0,Se.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Se.setInt32LE(e,c.codeSizeIndex,a-c.codeSizeIndex);o.delete(c.sourceObject),u=c.prev;continue}l=c.keys[c.keyIndex++],f=c.iterTarget[l]}else{let d=c.iterTarget;if(c.keyIndex>=d.length){if(e[a++]=0,Se.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Se.setInt32LE(e,c.codeSizeIndex,a-c.codeSizeIndex);o.delete(c.sourceObject),u=c.prev;continue}let p=c.keyIndex++;l=String(p),f=d[p]}if(typeof f?.toBSON==="function")f=f.toBSON();if(!c.isArray&&typeof l==="string"&&!(l[0]==="$"&&HG.has(l))){if(NE.test(l))throw new x("key "+l+" must not contain null bytes");if(c.checkKeys){if(l[0]==="$")throw new x("key "+l+" must not start with '$'");else if(l.includes("."))throw new x("key "+l+" must not contain '.'")}}let h=typeof f;if(f===void 0){if(c.isArray||c.ignoreUndefined===!1)a=GC(e,l,f,a)}else if(f===null)a=GC(e,l,f,a);else if(h==="string")a=KG(e,l,f,a);else if(h==="number")a=GG(e,l,f,a);else if(h==="bigint")a=YG(e,l,f,a);else if(h==="boolean")a=JG(e,l,f,a);else if(h==="object"&&f._bsontype==null)if(f instanceof Date||hp(f))a=QG(e,l,f,a);else if(f instanceof Uint8Array||ll(f))a=rY(e,l,f,a);else if(f instanceof RegExp||lp(f))a=XG(e,l,f,a);else{if(o.has(f))throw new x("Cannot convert circular structure to BSON");let d=Array.isArray(f);e[a++]=d?of:uf,a+=v.encodeUTF8Into(e,l,a),e[a++]=0;let p=a;o.add(f),u=ap(f,p,null,c,c.checkKeys,c.ignoreUndefined),a+=4}else if(h==="object"){if(f[pp]!==lf)throw new hl;let d=f[pc];if(d==="ObjectId")a=tY(e,l,f,a);else if(d==="Decimal128")a=nY(e,l,f,a);else if(d==="Long"||d==="Timestamp")a=sY(e,l,f,a);else if(d==="Double")a=oY(e,l,f,a);else if(d==="Code"){let p=f;if(p.scope&&typeof p.scope==="object"){e[a++]=cp,a+=v.encodeUTF8Into(e,l,a),e[a++]=0;let m=a;a+=4;let _=p.code,y=v.encodeUTF8Into(e,_,a+4)+1;Se.setInt32LE(e,a,y),e[a+4+y-1]=0,a=a+y+4;let E=p.scope;if(o.has(E))throw new x("Cannot convert circular structure to BSON");o.add(E),u=ap(E,a,m,c,c.checkKeys,c.ignoreUndefined),a+=4}else{e[a++]=PE,a+=v.encodeUTF8Into(e,l,a),e[a++]=0;let m=p.code.toString(),_=v.encodeUTF8Into(e,m,a+4)+1;Se.setInt32LE(e,a,_),a=a+4+_-1,e[a++]=0}}else if(d==="Binary")a=aY(e,l,f,a);else if(d==="BSONSymbol")a=cY(e,l,f,a);else if(d==="DBRef"){let p=f,m=Object.assign({$ref:p.collection,$id:p.oid},p.db!=null?{$db:p.db}:null,p.fields);e[a++]=uf,a+=v.encodeUTF8Into(e,l,a),e[a++]=0,o.add(m),u=ap(m,a,null,c,!1,!0),a+=4}else if(d==="BSONRegExp")a=ZG(e,l,f,a);else if(d==="Int32")a=iY(e,l,f,a);else if(d==="MinKey"||d==="MaxKey")a=eY(e,l,f,a);else if(typeof f._bsontype<"u")throw new x(`Unrecognized or invalid _bsontype: ${String(f._bsontype)}`)}else if(h==="function"&&s)a=uY(e,l,f,a)}return a}function lY(e){return e!=null&&typeof e==="object"&&"_bsontype"in e&&typeof e._bsontype==="string"}var hY={$oid:Wt,$binary:je,$uuid:je,$symbol:gc,$numberInt:Su,$numberDecimal:xn,$numberDouble:hi,$numberLong:M,$minKey:yc,$maxKey:mc,$regex:fi,$regularExpression:fi,$timestamp:ao};function g9(e,t={}){if(typeof e==="number"){let n=e<=hf&&e>=ff,s=e<=JC&&e>=QC;if(t.relaxed||t.legacy)return e;if(Number.isInteger(e)&&!Object.is(e,-0)){if(n)return new Su(e);if(s){if(t.useBigInt64)return BigInt(e);return M.fromNumber(e)}}return new hi(e)}if(e==null||typeof e!=="object")return e;if(e.$undefined)return null;let r=Object.keys(e).filter((n)=>n.startsWith("$")&&e[n]!=null);for(let n=0;n<r.length;n++){let s=hY[r[n]];if(s)return s.fromExtendedJSON(e,t)}if(e.$date!=null){let n=e.$date,s=new Date;if(t.legacy)if(typeof n==="number")s.setTime(n);else if(typeof n==="string")s.setTime(Date.parse(n));else if(typeof n==="bigint")s.setTime(Number(n));else throw new cf(`Unrecognized type for EJSON date: ${typeof n}`);else if(typeof n==="string")s.setTime(Date.parse(n));else if(M.isLong(n))s.setTime(n.toNumber());else if(typeof n==="number"&&t.relaxed)s.setTime(n);else if(typeof n==="bigint")s.setTime(Number(n));else throw new cf(`Unrecognized type for EJSON date: ${typeof n}`);return s}if(e.$code!=null){let n=Object.assign({},e);if(e.$scope)n.$scope=g9(e.$scope);return Ou.fromExtendedJSON(e)}if(f9(e)||e.$dbPointer){let n=e.$ref?e:e.$dbPointer;if(n instanceof Mo)return n;let s=Object.keys(n).filter((o)=>o.startsWith("$")),i=!0;if(s.forEach((o)=>{if(["$ref","$id","$db"].indexOf(o)===-1)i=!1}),i)return Mo.fromExtendedJSON(n)}return e}function fY(e,t){return e.map((r,n)=>{t.seenObjects.push({propertyName:`index ${n}`,obj:null});try{return Au(r,t)}finally{t.seenObjects.pop()}})}function YC(e){let t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function Au(e,t){if(e instanceof Map||dp(e)){let r=Object.create(null);for(let[n,s]of e){if(typeof n!=="string")throw new x("Can only serialize maps with string keys");r[n]=s}return Au(r,t)}if((typeof e==="object"||typeof e==="function")&&e!==null){let r=t.seenObjects.findIndex((n)=>n.obj===e);if(r!==-1){let n=t.seenObjects.map((l)=>l.propertyName),s=n.slice(0,r).map((l)=>`${l} -> `).join(""),i=n[r],o=" -> "+n.slice(r+1,n.length-1).map((l)=>`${l} -> `).join(""),u=n[n.length-1],a=" ".repeat(s.length+i.length/2),c="-".repeat(o.length+(i.length+u.length)/2-1);throw new x(`Converting circular structure to EJSON:
6
+ ${s}${i}${o}${u}
7
+ ${a}\\${c}/`)}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return fY(e,t);if(e===void 0)return t.ignoreUndefined?void 0:null;if(e instanceof Date||hp(e)){let r=e.getTime(),n=r>-1&&r<253402300800000;if(t.legacy)return t.relaxed&&n?{$date:e.getTime()}:{$date:YC(e)};return t.relaxed&&n?{$date:YC(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e==="number"&&(!t.relaxed||!isFinite(e))){if(Number.isInteger(e)&&!Object.is(e,-0)){if(e>=ff&&e<=hf)return{$numberInt:e.toString()};if(e>=QC&&e<=JC)return{$numberLong:e.toString()}}return{$numberDouble:Object.is(e,-0)?"-0.0":e.toString()}}if(typeof e==="bigint"){if(!t.relaxed)return{$numberLong:BigInt.asIntN(64,e).toString()};return Number(BigInt.asIntN(64,e))}if(e instanceof RegExp||lp(e)){let r=e.flags;if(r===void 0){let s=e.toString().match(/[gimuy]*$/);if(s)r=s[0]}return new fi(e.source,r).toExtendedJSON(t)}if(e!=null&&typeof e==="object")return pY(e,t);return e}var dY={Binary:(e)=>new je(e.value(),e.sub_type),Code:(e)=>new Ou(e.code,e.scope),DBRef:(e)=>new Mo(e.collection||e.namespace,e.oid,e.db,e.fields),Decimal128:(e)=>new xn(e.bytes),Double:(e)=>new hi(e.value),Int32:(e)=>new Su(e.value),Long:(e)=>M.fromBits(e.low!=null?e.low:e.low_,e.low!=null?e.high:e.high_,e.low!=null?e.unsigned:e.unsigned_),MaxKey:()=>new mc,MinKey:()=>new yc,ObjectId:(e)=>new Wt(e),BSONRegExp:(e)=>new fi(e.pattern,e.options),BSONSymbol:(e)=>new gc(e.value),Timestamp:(e)=>ao.fromBits(e.low,e.high)};function pY(e,t){if(e==null||typeof e!=="object")throw new x("not an object instance");let r=e._bsontype;if(typeof r>"u"){let n={};for(let s of Object.keys(e)){t.seenObjects.push({propertyName:s,obj:null});try{let i=Au(e[s],t);if(s==="__proto__")Object.defineProperty(n,s,{value:i,writable:!0,enumerable:!0,configurable:!0});else n[s]=i}finally{t.seenObjects.pop()}}return n}else if(e!=null&&typeof e==="object"&&typeof e._bsontype==="string"&&e[pp]!==lf)throw new hl;else if(lY(e)){let n=e;if(typeof n.toExtendedJSON!=="function"){let s=dY[e._bsontype];if(!s)throw new x("Unrecognized or invalid _bsontype: "+e._bsontype);n=s(n)}if(r==="Code"&&n.scope)n=new Ou(n.code,Au(n.scope,t));else if(r==="DBRef"&&n.oid)n=new Mo(Au(n.collection,t),Au(n.oid,t),Au(n.db,t),Au(n.fields,t));return n.toExtendedJSON(t)}else throw new x("_bsontype must be a string, but was: "+typeof r)}function _9(e,t){let r={useBigInt64:t?.useBigInt64??!1,relaxed:t?.relaxed??!0,legacy:t?.legacy??!1};return JSON.parse(e,(n,s)=>{if(n.indexOf("\x00")!==-1)throw new x(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(n)}`);return g9(s,r)})}function E9(e,t,r,n){if(r!=null&&typeof r==="object")n=r,r=void 0;if(t!=null&&typeof t==="object"&&!Array.isArray(t))n=t,t=void 0;let s=Object.assign({relaxed:!0,legacy:!1},n,{seenObjects:[{propertyName:"(root)",obj:null}]}),i=Au(e,s);return JSON.stringify(i,t,r)}function mY(e,t){return t=t||{},JSON.parse(E9(e,t))}function yY(e,t){return t=t||{},_9(JSON.stringify(e),t)}var _c=Object.create(null);_c.parse=_9;_c.stringify=E9;_c.serialize=mY;_c.deserialize=yY;Object.freeze(_c);var lr={double:1,string:2,object:3,array:4,binData:5,undefined:6,objectId:7,bool:8,date:9,null:10,regex:11,dbPointer:12,javascript:13,symbol:14,javascriptWithScope:15,int:16,timestamp:17,long:18,decimal:19,minKey:255,maxKey:127};function wE(e,t){try{return Se.getNonnegativeInt32LE(e,t)}catch(r){throw new uo("BSON size cannot be negative",t,{cause:r})}}function CE(e,t){let r=t;for(;e[r];r++);if(r>=e.length-1)throw new uo("Null terminator not found",t);return r}function gY(e,t=0){if(t??=0,e.length<5)throw new uo(`Input must be at least 5 bytes, got ${e.length} bytes`,t);let r=wE(e,t);if(r>e.length-t)throw new uo(`Parsed documentSize (${r} bytes) does not match input length (${e.length} bytes)`,t);if(e[t+r-1]!==0)throw new uo("BSON documents must end in 0x00",t+r);let n=[],s=t+4;while(s<=r+t){let i=e[s];if(s+=1,i===0){if(s-t!==r)throw new uo("Invalid 0x00 type byte",s);break}let o=s,u=CE(e,s)-o;s+=u+1;let a;if(i===lr.double||i===lr.long||i===lr.date||i===lr.timestamp)a=8;else if(i===lr.int)a=4;else if(i===lr.objectId)a=12;else if(i===lr.decimal)a=16;else if(i===lr.bool)a=1;else if(i===lr.null||i===lr.undefined||i===lr.maxKey||i===lr.minKey)a=0;else if(i===lr.regex)a=CE(e,CE(e,s)+1)+1-s;else if(i===lr.object||i===lr.array||i===lr.javascriptWithScope)a=wE(e,s);else if(i===lr.string||i===lr.binData||i===lr.dbPointer||i===lr.javascript||i===lr.symbol){if(a=wE(e,s)+4,i===lr.binData)a+=1;if(i===lr.dbPointer)a+=12}else throw new uo(`Invalid 0x${i.toString(16).padStart(2,"0")} type byte`,s);if(s+a>t+r-1)throw new uo("value reports length larger than document",s);n.push([i,o,u,s,a]),s+=a}return n}var fl=Object.create(null);fl.parseToElements=gY;fl.ByteUtils=v;fl.NumberUtils=Se;Object.freeze(fl);var A9=17825792,Zu=v.allocate(A9);function O9(e){if(Zu.length<e)Zu=v.allocate(e)}function S9(e,t={}){let r=typeof t.checkKeys==="boolean"?t.checkKeys:!1,n=typeof t.serializeFunctions==="boolean"?t.serializeFunctions:!1,s=typeof t.ignoreUndefined==="boolean"?t.ignoreUndefined:!0,i=typeof t.minInternalBufferSize==="number"?t.minInternalBufferSize:A9;if(Zu.length<i)Zu=v.allocate(i);let o=y9(Zu,e,r,0,n,s,null),u=v.allocateUnsafe(o);return u.set(Zu.subarray(0,o),0),u}function w9(e,t,r={}){let n=typeof r.checkKeys==="boolean"?r.checkKeys:!1,s=typeof r.serializeFunctions==="boolean"?r.serializeFunctions:!1,i=typeof r.ignoreUndefined==="boolean"?r.ignoreUndefined:!0,o=typeof r.index==="number"?r.index:0,u=y9(Zu,e,n,0,s,i,null);return t.set(Zu.subarray(0,u),o),o+u-1}function C9(e,t={}){return m9(v.toLocalBufferType(e),t)}function b9(e,t={}){t=t||{};let r=typeof t.serializeFunctions==="boolean"?t.serializeFunctions:!1,n=typeof t.ignoreUndefined==="boolean"?t.ignoreUndefined:!0;return jG(e,r,n)}function D9(e,t,r,n,s,i){let o=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),u=v.toLocalBufferType(e),a=t;for(let c=0;c<r;c++){let l=Se.getInt32LE(u,a);o.index=a,n[s+c]=m9(u,o),a=a+l}return a}var _Y=Object.freeze({__proto__:null,BSONError:x,BSONOffsetError:uo,BSONRegExp:fi,BSONRuntimeError:cf,BSONSymbol:gc,BSONType:c9,BSONValue:cs,BSONVersionError:hl,Binary:je,ByteUtils:v,Code:Ou,DBRef:Mo,Decimal128:xn,Double:hi,EJSON:_c,Int32:Su,Long:M,MaxKey:mc,MinKey:yc,NumberUtils:Se,ObjectId:Wt,Timestamp:ao,UUID:bn,bsonType:pc,calculateObjectSize:b9,deserialize:C9,deserializeStream:D9,onDemand:fl,serialize:S9,serializeWithBufferAndIndex:w9,setInternalBufferSize:O9});Et.BSON=_Y;Et.BSONError=x;Et.BSONOffsetError=uo;Et.BSONRegExp=fi;Et.BSONRuntimeError=cf;Et.BSONSymbol=gc;Et.BSONType=c9;Et.BSONValue=cs;Et.BSONVersionError=hl;Et.Binary=je;Et.ByteUtils=v;Et.Code=Ou;Et.DBRef=Mo;Et.Decimal128=xn;Et.Double=hi;Et.EJSON=_c;Et.Int32=Su;Et.Long=M;Et.MaxKey=mc;Et.MinKey=yc;Et.NumberUtils=Se;Et.ObjectId=Wt;Et.Timestamp=ao;Et.UUID=bn;Et.bsonType=pc;Et.calculateObjectSize=b9;Et.deserialize=C9;Et.deserializeStream=D9;Et.onDemand=fl;Et.serialize=S9;Et.serializeWithBufferAndIndex=w9;Et.setInternalBufferSize=O9});var Te=g(function(ye){Object.defineProperty(ye,"__esModule",{value:!0});ye.setUint32LE=ye.readUint8=ye.readInt32LE=ye.UUID=ye.Timestamp=ye.serialize=ye.ObjectId=ye.NumberUtils=ye.MinKey=ye.MaxKey=ye.Long=ye.Int32=ye.EJSON=ye.Double=ye.deserialize=ye.Decimal128=ye.DBRef=ye.Code=ye.calculateObjectSize=ye.ByteUtils=ye.BSONType=ye.BSONSymbol=ye.BSONRegExp=ye.BSONError=ye.BSON=ye.Binary=void 0;ye.parseToElementsToArray=EY;ye.pluckBSONSerializeOptions=wY;ye.resolveBSONOptions=CY;ye.parseUtf8ValidationOption=bY;var yp=IE(),hr=IE();Object.defineProperty(ye,"Binary",{enumerable:!0,get:function(){return hr.Binary}});Object.defineProperty(ye,"BSON",{enumerable:!0,get:function(){return hr.BSON}});Object.defineProperty(ye,"BSONError",{enumerable:!0,get:function(){return hr.BSONError}});Object.defineProperty(ye,"BSONRegExp",{enumerable:!0,get:function(){return hr.BSONRegExp}});Object.defineProperty(ye,"BSONSymbol",{enumerable:!0,get:function(){return hr.BSONSymbol}});Object.defineProperty(ye,"BSONType",{enumerable:!0,get:function(){return hr.BSONType}});Object.defineProperty(ye,"ByteUtils",{enumerable:!0,get:function(){return hr.ByteUtils}});Object.defineProperty(ye,"calculateObjectSize",{enumerable:!0,get:function(){return hr.calculateObjectSize}});Object.defineProperty(ye,"Code",{enumerable:!0,get:function(){return hr.Code}});Object.defineProperty(ye,"DBRef",{enumerable:!0,get:function(){return hr.DBRef}});Object.defineProperty(ye,"Decimal128",{enumerable:!0,get:function(){return hr.Decimal128}});Object.defineProperty(ye,"deserialize",{enumerable:!0,get:function(){return hr.deserialize}});Object.defineProperty(ye,"Double",{enumerable:!0,get:function(){return hr.Double}});Object.defineProperty(ye,"EJSON",{enumerable:!0,get:function(){return hr.EJSON}});Object.defineProperty(ye,"Int32",{enumerable:!0,get:function(){return hr.Int32}});Object.defineProperty(ye,"Long",{enumerable:!0,get:function(){return hr.Long}});Object.defineProperty(ye,"MaxKey",{enumerable:!0,get:function(){return hr.MaxKey}});Object.defineProperty(ye,"MinKey",{enumerable:!0,get:function(){return hr.MinKey}});Object.defineProperty(ye,"NumberUtils",{enumerable:!0,get:function(){return hr.NumberUtils}});Object.defineProperty(ye,"ObjectId",{enumerable:!0,get:function(){return hr.ObjectId}});Object.defineProperty(ye,"serialize",{enumerable:!0,get:function(){return hr.serialize}});Object.defineProperty(ye,"Timestamp",{enumerable:!0,get:function(){return hr.Timestamp}});Object.defineProperty(ye,"UUID",{enumerable:!0,get:function(){return hr.UUID}});function EY(e,t){let r=yp.BSON.onDemand.parseToElements(e,t);return Array.isArray(r)?r:[...r]}var T9=(e,t,r)=>{if(t<0||t+r>e.length)throw RangeError(`Attempt to access memory outside buffer bounds: buffer length: ${e.length}, offset: ${t}, length: ${r}`)},AY=(e,t)=>(T9(e,t,4),yp.NumberUtils.getInt32LE(e,t));ye.readInt32LE=AY;var OY=(e,t)=>(T9(e,t,1),e[t]);ye.readUint8=OY;var SY=(e,t,r)=>(e[t]=r,r>>>=8,e[t+1]=r,r>>>=8,e[t+2]=r,r>>>=8,e[t+3]=r,4);ye.setUint32LE=SY;function wY(e){let{fieldsAsRaw:t,useBigInt64:r,promoteValues:n,promoteBuffers:s,promoteLongs:i,serializeFunctions:o,ignoreUndefined:u,bsonRegExp:a,raw:c,enableUtf8Validation:l}=e;return{fieldsAsRaw:t,useBigInt64:r,promoteValues:n,promoteBuffers:s,promoteLongs:i,serializeFunctions:o,ignoreUndefined:u,bsonRegExp:a,raw:c,enableUtf8Validation:l}}function CY(e,t){let r=t?.bsonOptions;return{raw:e?.raw??r?.raw??!1,useBigInt64:e?.useBigInt64??r?.useBigInt64??!1,promoteLongs:e?.promoteLongs??r?.promoteLongs??!0,promoteValues:e?.promoteValues??r?.promoteValues??!0,promoteBuffers:e?.promoteBuffers??r?.promoteBuffers??!1,ignoreUndefined:e?.ignoreUndefined??r?.ignoreUndefined??!1,bsonRegExp:e?.bsonRegExp??r?.bsonRegExp??!1,serializeFunctions:e?.serializeFunctions??r?.serializeFunctions??!1,fieldsAsRaw:e?.fieldsAsRaw??r?.fieldsAsRaw??{},enableUtf8Validation:e?.enableUtf8Validation??r?.enableUtf8Validation??!0}}function bY(e){if(e?.enableUtf8Validation===!1)return{utf8:!1};return{utf8:{writeErrors:!1}}}});var X=g(function(N){Object.defineProperty(N,"__esModule",{value:!0});N.MongoWriteConcernError=N.MongoServerSelectionError=N.MongoSystemError=N.MongoMissingDependencyError=N.MongoMissingCredentialsError=N.MongoCompatibilityError=N.MongoInvalidArgumentError=N.MongoParseError=N.MongoNetworkTimeoutError=N.MongoNetworkError=N.MongoClientClosedError=N.MongoTopologyClosedError=N.MongoCursorExhaustedError=N.MongoServerClosedError=N.MongoCursorInUseError=N.MongoOperationTimeoutError=N.MongoUnexpectedServerResponseError=N.MongoGridFSChunkError=N.MongoGridFSStreamError=N.MongoTailableCursorError=N.MongoChangeStreamError=N.MongoClientBulkWriteExecutionError=N.MongoClientBulkWriteCursorError=N.MongoClientBulkWriteError=N.MongoGCPError=N.MongoAzureError=N.MongoOIDCError=N.MongoAWSError=N.MongoKerberosError=N.MongoExpiredSessionError=N.MongoTransactionError=N.MongoNotConnectedError=N.MongoDecompressionError=N.MongoBatchReExecutionError=N.MongoStalePrimaryError=N.MongoRuntimeError=N.MongoAPIError=N.MongoDriverError=N.MongoServerError=N.MongoError=N.MongoErrorLabel=N.GET_MORE_RESUMABLE_CODES=N.MONGODB_ERROR_CODES=N.NODE_IS_RECOVERING_ERROR_MESSAGE=N.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=void 0;N.isNamespaceNotFoundError=DY;N.needsRetryableWriteLabel=MY;N.isRetryableWriteError=PY;N.isRetryableReadError=BY;N.isNodeShuttingDownError=$Y;N.isStateChangeError=vY;N.isNetworkTimeoutError=xY;N.isResumableError=kY;N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=new RegExp("not master","i");N.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=new RegExp("not master or secondary","i");N.NODE_IS_RECOVERING_ERROR_MESSAGE=new RegExp("node is recovering","i");N.MONGODB_ERROR_CODES=Object.freeze({HostUnreachable:6,HostNotFound:7,AuthenticationFailed:18,NetworkTimeout:89,ShutdownInProgress:91,PrimarySteppedDown:189,ExceededTimeLimit:262,SocketException:9001,NotWritablePrimary:10107,InterruptedAtShutdown:11600,InterruptedDueToReplStateChange:11602,NotPrimaryNoSecondaryOk:13435,NotPrimaryOrSecondary:13436,StaleShardVersion:63,StaleEpoch:150,StaleConfig:13388,RetryChangeStream:234,FailedToSatisfyReadPreference:133,CursorNotFound:43,LegacyNotPrimary:10058,WriteConcernTimeout:64,NamespaceNotFound:26,IllegalOperation:20,MaxTimeMSExpired:50,UnknownReplWriteConcern:79,UnsatisfiableWriteConcern:100,Reauthenticate:391,ReadConcernMajorityNotAvailableYet:134});function DY(e){return Number(e?.code)===N.MONGODB_ERROR_CODES.NamespaceNotFound}N.GET_MORE_RESUMABLE_CODES=new Set([N.MONGODB_ERROR_CODES.HostUnreachable,N.MONGODB_ERROR_CODES.HostNotFound,N.MONGODB_ERROR_CODES.NetworkTimeout,N.MONGODB_ERROR_CODES.ShutdownInProgress,N.MONGODB_ERROR_CODES.PrimarySteppedDown,N.MONGODB_ERROR_CODES.ExceededTimeLimit,N.MONGODB_ERROR_CODES.SocketException,N.MONGODB_ERROR_CODES.NotWritablePrimary,N.MONGODB_ERROR_CODES.InterruptedAtShutdown,N.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,N.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,N.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,N.MONGODB_ERROR_CODES.StaleShardVersion,N.MONGODB_ERROR_CODES.StaleEpoch,N.MONGODB_ERROR_CODES.StaleConfig,N.MONGODB_ERROR_CODES.RetryChangeStream,N.MONGODB_ERROR_CODES.FailedToSatisfyReadPreference,N.MONGODB_ERROR_CODES.CursorNotFound]);N.MongoErrorLabel=Object.freeze({RetryableWriteError:"RetryableWriteError",TransientTransactionError:"TransientTransactionError",UnknownTransactionCommitResult:"UnknownTransactionCommitResult",ResumableChangeStreamError:"ResumableChangeStreamError",HandshakeError:"HandshakeError",ResetPool:"ResetPool",PoolRequestedRetry:"PoolRequestedRetry",InterruptInUseConnections:"InterruptInUseConnections",NoWritesPerformed:"NoWritesPerformed",RetryableError:"RetryableError",SystemOverloadedError:"SystemOverloadedError"});function TY(e){return e!=null&&typeof e==="object"&&"errors"in e&&Array.isArray(e.errors)}class Po extends Error{get errorLabels(){return Array.from(this.errorLabelSet)}constructor(e,t){super(e,t);this.errorLabelSet=new Set}static buildErrorMessage(e){if(typeof e==="string")return e;if(TY(e)&&e.message.length===0)return e.errors.length===0?"AggregateError has an empty errors array. Please check the `cause` property for more information.":e.errors.map(({message:t})=>t).join(", ");return e!=null&&typeof e==="object"&&"message"in e&&typeof e.message==="string"?e.message:"empty error message"}get name(){return"MongoError"}get errmsg(){return this.message}hasErrorLabel(e){return this.errorLabelSet.has(e)}addErrorLabel(e){this.errorLabelSet.add(e)}}N.MongoError=Po;class gp extends Po{constructor(e){super(e.message||e.errmsg||e.$err||"n/a");if(e.errorLabels)for(let t of e.errorLabels)this.addErrorLabel(t);this.errorResponse=e;for(let t in e)if(t!=="errorLabels"&&t!=="errmsg"&&t!=="message"&&t!=="errorResponse")this[t]=e[t]}get name(){return"MongoServerError"}}N.MongoServerError=gp;class dl extends Po{constructor(e,t){super(e,t)}get name(){return"MongoDriverError"}}N.MongoDriverError=dl;class kn extends dl{constructor(e,t){super(e,t)}get name(){return"MongoAPIError"}}N.MongoAPIError=kn;class Qs extends dl{constructor(e,t){super(e,t)}get name(){return"MongoRuntimeError"}}N.MongoRuntimeError=Qs;class P9 extends Qs{constructor(e,t){super(e,t)}get name(){return"MongoStalePrimaryError"}}N.MongoStalePrimaryError=P9;class B9 extends kn{constructor(e="This batch has already been executed, create new batch to execute"){super(e)}get name(){return"MongoBatchReExecutionError"}}N.MongoBatchReExecutionError=B9;class F9 extends Qs{constructor(e){super(e)}get name(){return"MongoDecompressionError"}}N.MongoDecompressionError=F9;class N9 extends kn{constructor(e){super(e)}get name(){return"MongoNotConnectedError"}}N.MongoNotConnectedError=N9;class I9 extends kn{constructor(e){super(e)}get name(){return"MongoTransactionError"}}N.MongoTransactionError=I9;class R9 extends kn{constructor(e="Cannot use a session that has ended"){super(e)}get name(){return"MongoExpiredSessionError"}}N.MongoExpiredSessionError=R9;class $9 extends Qs{constructor(e){super(e)}get name(){return"MongoKerberosError"}}N.MongoKerberosError=$9;class v9 extends Qs{constructor(e,t){super(e,t)}get name(){return"MongoAWSError"}}N.MongoAWSError=v9;class _p extends Qs{constructor(e){super(e)}get name(){return"MongoOIDCError"}}N.MongoOIDCError=_p;class x9 extends _p{constructor(e){super(e)}get name(){return"MongoAzureError"}}N.MongoAzureError=x9;class k9 extends _p{constructor(e){super(e)}get name(){return"MongoGCPError"}}N.MongoGCPError=k9;class q9 extends gp{constructor(e){super(e);this.writeConcernErrors=[],this.writeErrors=new Map}get name(){return"MongoClientBulkWriteError"}}N.MongoClientBulkWriteError=q9;class j9 extends Qs{constructor(e){super(e)}get name(){return"MongoClientBulkWriteCursorError"}}N.MongoClientBulkWriteCursorError=j9;class L9 extends Qs{constructor(e){super(e)}get name(){return"MongoClientBulkWriteExecutionError"}}N.MongoClientBulkWriteExecutionError=L9;class U9 extends Qs{constructor(e){super(e)}get name(){return"MongoChangeStreamError"}}N.MongoChangeStreamError=U9;class V9 extends kn{constructor(e="Tailable cursor does not support this operation"){super(e)}get name(){return"MongoTailableCursorError"}}N.MongoTailableCursorError=V9;class z9 extends Qs{constructor(e){super(e)}get name(){return"MongoGridFSStreamError"}}N.MongoGridFSStreamError=z9;class W9 extends Qs{constructor(e){super(e)}get name(){return"MongoGridFSChunkError"}}N.MongoGridFSChunkError=W9;class H9 extends Qs{constructor(e,t){super(e,t)}get name(){return"MongoUnexpectedServerResponseError"}}N.MongoUnexpectedServerResponseError=H9;class K9 extends dl{get name(){return"MongoOperationTimeoutError"}}N.MongoOperationTimeoutError=K9;class G9 extends kn{constructor(e="Cursor is already initialized"){super(e)}get name(){return"MongoCursorInUseError"}}N.MongoCursorInUseError=G9;class Y9 extends kn{constructor(e="Server is closed"){super(e)}get name(){return"MongoServerClosedError"}}N.MongoServerClosedError=Y9;class J9 extends kn{constructor(e){super(e||"Cursor is exhausted")}get name(){return"MongoCursorExhaustedError"}}N.MongoCursorExhaustedError=J9;class Q9 extends kn{constructor(e="Topology is closed"){super(e)}get name(){return"MongoTopologyClosedError"}}N.MongoTopologyClosedError=Q9;class X9 extends kn{constructor(){super("Operation interrupted because client was closed")}get name(){return"MongoClientClosedError"}}N.MongoClientClosedError=X9;class Ec extends Po{constructor(e,t){super(e,{cause:t?.cause});this.beforeHandshake=!!t?.beforeHandshake}get name(){return"MongoNetworkError"}}N.MongoNetworkError=Ec;class Z9 extends Ec{constructor(e,t){super(e,t)}get name(){return"MongoNetworkTimeoutError"}}N.MongoNetworkTimeoutError=Z9;class eb extends dl{constructor(e){super(e)}get name(){return"MongoParseError"}}N.MongoParseError=eb;class tb extends kn{constructor(e,t){super(e,t)}get name(){return"MongoInvalidArgumentError"}}N.MongoInvalidArgumentError=tb;class rb extends kn{constructor(e){super(e)}get name(){return"MongoCompatibilityError"}}N.MongoCompatibilityError=rb;class nb extends kn{constructor(e){super(e)}get name(){return"MongoMissingCredentialsError"}}N.MongoMissingCredentialsError=nb;class sb extends kn{constructor(e,t){super(e,t);this.dependencyName=t.dependencyName}get name(){return"MongoMissingDependencyError"}}N.MongoMissingDependencyError=sb;class RE extends Po{constructor(e,t){if(t&&t.error)super(Po.buildErrorMessage(t.error.message||t.error),{cause:t.error});else super(e);if(t)this.reason=t;this.code=t.error?.code}get name(){return"MongoSystemError"}}N.MongoSystemError=RE;class $E extends RE{constructor(e,t){super(e,t)}get name(){return"MongoServerSelectionError"}}N.MongoServerSelectionError=$E;class vE extends gp{constructor(e){super({...e.writeConcernError,...e});this.errInfo=e.writeConcernError.errInfo,this.result=e}get name(){return"MongoWriteConcernError"}}N.MongoWriteConcernError=vE;var ib=new Set([N.MONGODB_ERROR_CODES.HostUnreachable,N.MONGODB_ERROR_CODES.HostNotFound,N.MONGODB_ERROR_CODES.NetworkTimeout,N.MONGODB_ERROR_CODES.ShutdownInProgress,N.MONGODB_ERROR_CODES.PrimarySteppedDown,N.MONGODB_ERROR_CODES.SocketException,N.MONGODB_ERROR_CODES.NotWritablePrimary,N.MONGODB_ERROR_CODES.InterruptedAtShutdown,N.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,N.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,N.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,N.MONGODB_ERROR_CODES.ExceededTimeLimit,N.MONGODB_ERROR_CODES.ReadConcernMajorityNotAvailableYet]),M9=ib;function MY(e){if(e instanceof Ec)return!0;if(e instanceof Po){if(!e.hasErrorLabel(N.MongoErrorLabel.HandshakeError))return!1}if(e instanceof vE){let n=e.result.writeConcernError.code??Number(e.code);return M9.has(Number.isNaN(n)?0:n)}if(e instanceof Po)return M9.has(Number(e.code));if(N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message))return!0;if(N.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message))return!0;return!1}function PY(e){return e.hasErrorLabel(N.MongoErrorLabel.RetryableWriteError)||e.hasErrorLabel(N.MongoErrorLabel.PoolRequestedRetry)}function BY(e){if(typeof e.code==="number"?ib.has(e.code):!1)return!0;if(e instanceof Ec)return!0;if(N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message))return!0;if(N.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message))return!0;return!1}var FY=new Set([N.MONGODB_ERROR_CODES.ShutdownInProgress,N.MONGODB_ERROR_CODES.PrimarySteppedDown,N.MONGODB_ERROR_CODES.InterruptedAtShutdown,N.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,N.MONGODB_ERROR_CODES.NotPrimaryOrSecondary]),NY=new Set([N.MONGODB_ERROR_CODES.NotWritablePrimary,N.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,N.MONGODB_ERROR_CODES.LegacyNotPrimary]),IY=new Set([N.MONGODB_ERROR_CODES.InterruptedAtShutdown,N.MONGODB_ERROR_CODES.ShutdownInProgress]);function ob(e){if(typeof e.code==="number")return FY.has(e.code);return N.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE.test(e.message)||N.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)}function RY(e){if(typeof e.code==="number")return NY.has(e.code);if(ob(e))return!1;return N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)}function $Y(e){return!!(typeof e.code==="number"&&IY.has(e.code))}function vY(e){return ob(e)||RY(e)}function xY(e){return!!(e instanceof Ec&&e.message.match(/timed out/))}function kY(e,t){if(e==null||!(e instanceof Po))return!1;if(e instanceof Ec)return!0;if(e instanceof $E)return!0;if(t!=null&&t>=9){if(e.code===N.MONGODB_ERROR_CODES.CursorNotFound)return!0;return e.hasErrorLabel(N.MongoErrorLabel.ResumableChangeStreamError)}if(typeof e.code==="number")return N.GET_MORE_RESUMABLE_CODES.has(e.code);return!1}});var Br=g(function(F){Object.defineProperty(F,"__esModule",{value:!0});F.END=F.CHANGE=F.INIT=F.MORE=F.RESPONSE=F.SERVER_HEARTBEAT_FAILED=F.SERVER_HEARTBEAT_SUCCEEDED=F.SERVER_HEARTBEAT_STARTED=F.COMMAND_FAILED=F.COMMAND_SUCCEEDED=F.COMMAND_STARTED=F.CLUSTER_TIME_RECEIVED=F.CONNECTION_CHECKED_IN=F.CONNECTION_CHECKED_OUT=F.CONNECTION_CHECK_OUT_FAILED=F.CONNECTION_CHECK_OUT_STARTED=F.CONNECTION_CLOSED=F.CONNECTION_READY=F.CONNECTION_CREATED=F.CONNECTION_POOL_READY=F.CONNECTION_POOL_CLEARED=F.CONNECTION_POOL_CLOSED=F.CONNECTION_POOL_CREATED=F.WAITING_FOR_SUITABLE_SERVER=F.SERVER_SELECTION_SUCCEEDED=F.SERVER_SELECTION_FAILED=F.SERVER_SELECTION_STARTED=F.TOPOLOGY_DESCRIPTION_CHANGED=F.TOPOLOGY_CLOSED=F.TOPOLOGY_OPENING=F.SERVER_DESCRIPTION_CHANGED=F.SERVER_CLOSED=F.SERVER_OPENING=F.DESCRIPTION_RECEIVED=F.UNPINNED=F.PINNED=F.MESSAGE=F.ENDED=F.CLOSED=F.CONNECT=F.OPEN=F.CLOSE=F.TIMEOUT=F.ERROR=F.SYSTEM_JS_COLLECTION=F.SYSTEM_COMMAND_COLLECTION=F.SYSTEM_USER_COLLECTION=F.SYSTEM_PROFILE_COLLECTION=F.SYSTEM_INDEX_COLLECTION=F.SYSTEM_NAMESPACE_COLLECTION=void 0;F.kDecoratedKeys=F.kDecorateResult=F.LEGACY_HELLO_COMMAND_CAMEL_CASE=F.LEGACY_HELLO_COMMAND=F.MONGO_CLIENT_EVENTS=F.LOCAL_SERVER_EVENTS=F.SERVER_RELAY_EVENTS=F.APM_EVENTS=F.TOPOLOGY_EVENTS=F.CMAP_EVENTS=F.HEARTBEAT_EVENTS=F.RESUME_TOKEN_CHANGED=void 0;F.SYSTEM_NAMESPACE_COLLECTION="system.namespaces";F.SYSTEM_INDEX_COLLECTION="system.indexes";F.SYSTEM_PROFILE_COLLECTION="system.profile";F.SYSTEM_USER_COLLECTION="system.users";F.SYSTEM_COMMAND_COLLECTION="$cmd";F.SYSTEM_JS_COLLECTION="system.js";F.ERROR="error";F.TIMEOUT="timeout";F.CLOSE="close";F.OPEN="open";F.CONNECT="connect";F.CLOSED="closed";F.ENDED="ended";F.MESSAGE="message";F.PINNED="pinned";F.UNPINNED="unpinned";F.DESCRIPTION_RECEIVED="descriptionReceived";F.SERVER_OPENING="serverOpening";F.SERVER_CLOSED="serverClosed";F.SERVER_DESCRIPTION_CHANGED="serverDescriptionChanged";F.TOPOLOGY_OPENING="topologyOpening";F.TOPOLOGY_CLOSED="topologyClosed";F.TOPOLOGY_DESCRIPTION_CHANGED="topologyDescriptionChanged";F.SERVER_SELECTION_STARTED="serverSelectionStarted";F.SERVER_SELECTION_FAILED="serverSelectionFailed";F.SERVER_SELECTION_SUCCEEDED="serverSelectionSucceeded";F.WAITING_FOR_SUITABLE_SERVER="waitingForSuitableServer";F.CONNECTION_POOL_CREATED="connectionPoolCreated";F.CONNECTION_POOL_CLOSED="connectionPoolClosed";F.CONNECTION_POOL_CLEARED="connectionPoolCleared";F.CONNECTION_POOL_READY="connectionPoolReady";F.CONNECTION_CREATED="connectionCreated";F.CONNECTION_READY="connectionReady";F.CONNECTION_CLOSED="connectionClosed";F.CONNECTION_CHECK_OUT_STARTED="connectionCheckOutStarted";F.CONNECTION_CHECK_OUT_FAILED="connectionCheckOutFailed";F.CONNECTION_CHECKED_OUT="connectionCheckedOut";F.CONNECTION_CHECKED_IN="connectionCheckedIn";F.CLUSTER_TIME_RECEIVED="clusterTimeReceived";F.COMMAND_STARTED="commandStarted";F.COMMAND_SUCCEEDED="commandSucceeded";F.COMMAND_FAILED="commandFailed";F.SERVER_HEARTBEAT_STARTED="serverHeartbeatStarted";F.SERVER_HEARTBEAT_SUCCEEDED="serverHeartbeatSucceeded";F.SERVER_HEARTBEAT_FAILED="serverHeartbeatFailed";F.RESPONSE="response";F.MORE="more";F.INIT="init";F.CHANGE="change";F.END="end";F.RESUME_TOKEN_CHANGED="resumeTokenChanged";F.HEARTBEAT_EVENTS=Object.freeze([F.SERVER_HEARTBEAT_STARTED,F.SERVER_HEARTBEAT_SUCCEEDED,F.SERVER_HEARTBEAT_FAILED]);F.CMAP_EVENTS=Object.freeze([F.CONNECTION_POOL_CREATED,F.CONNECTION_POOL_READY,F.CONNECTION_POOL_CLEARED,F.CONNECTION_POOL_CLOSED,F.CONNECTION_CREATED,F.CONNECTION_READY,F.CONNECTION_CLOSED,F.CONNECTION_CHECK_OUT_STARTED,F.CONNECTION_CHECK_OUT_FAILED,F.CONNECTION_CHECKED_OUT,F.CONNECTION_CHECKED_IN]);F.TOPOLOGY_EVENTS=Object.freeze([F.SERVER_OPENING,F.SERVER_CLOSED,F.SERVER_DESCRIPTION_CHANGED,F.TOPOLOGY_OPENING,F.TOPOLOGY_CLOSED,F.TOPOLOGY_DESCRIPTION_CHANGED,F.ERROR,F.TIMEOUT,F.CLOSE]);F.APM_EVENTS=Object.freeze([F.COMMAND_STARTED,F.COMMAND_SUCCEEDED,F.COMMAND_FAILED]);F.SERVER_RELAY_EVENTS=Object.freeze([F.SERVER_HEARTBEAT_STARTED,F.SERVER_HEARTBEAT_SUCCEEDED,F.SERVER_HEARTBEAT_FAILED,F.COMMAND_STARTED,F.COMMAND_SUCCEEDED,F.COMMAND_FAILED,...F.CMAP_EVENTS]);F.LOCAL_SERVER_EVENTS=Object.freeze([F.CONNECT,F.DESCRIPTION_RECEIVED,F.CLOSED,F.ENDED]);F.MONGO_CLIENT_EVENTS=Object.freeze([...F.CMAP_EVENTS,...F.APM_EVENTS,...F.TOPOLOGY_EVENTS,...F.HEARTBEAT_EVENTS]);F.LEGACY_HELLO_COMMAND="ismaster";F.LEGACY_HELLO_COMMAND_CAMEL_CASE="isMaster";F.kDecorateResult=Symbol.for("@@mdb.decorateDecryptionResult");F.kDecoratedKeys=Symbol.for("@@mdb.decryptedKeys")});var Fo=g(function(wu){Object.defineProperty(wu,"__esModule",{value:!0});wu.getKerberos=qY;wu.getZstdLibrary=LY;wu.getAwsCredentialProvider=UY;wu.getGcpMetadata=VY;wu.getSnappy=zY;wu.getSocks=WY;wu.getMongoDBClientEncryption=HY;var Bo=require("zlib"),ws=X();function Ep(e){return new Proxy(e?{kModuleError:e}:{},{get:(r,n)=>{if(n==="kModuleError")return e;throw e},set:()=>{throw e}})}function qY(){let e;try{e=(()=>{throw new Error("Cannot require module "+"kerberos");})()}catch(t){e=Ep(new ws.MongoMissingDependencyError("Optional module `kerberos` not found. Please install it to enable kerberos authentication",{cause:t,dependencyName:"kerberos"}))}return e}function jY(){if(typeof Bo.zstdCompress!=="function"||typeof Bo.zstdDecompress!=="function")return null;return{compress(e,t){let r=t==null?{}:{params:{[Bo.constants.ZSTD_c_compressionLevel]:t}};return new Promise((n,s)=>{Bo.zstdCompress(e,r,(i,o)=>{if(i)return s(i);n(o)})})},decompress(e){return new Promise((t,r)=>{Bo.zstdDecompress(e,(n,s)=>{if(n)return r(n);t(s)})})}}}function LY(){let e=jY();if(e!=null)return e;let t;try{t=(()=>{throw new Error("Cannot require module "+"@mongodb-js/zstd");})()}catch(r){t=Ep(new ws.MongoMissingDependencyError("Built-in zstd is unavailable (requires Node.js 22.15.0 or later) and optional module `@mongodb-js/zstd` not found. Please upgrade Node.js or install `@mongodb-js/zstd` to enable zstd compression",{cause:r,dependencyName:"zstd"}))}return t}function UY(){try{return (()=>{throw new Error("Cannot require module "+"@aws-sdk/credential-providers");})()}catch(e){return Ep(new ws.MongoMissingDependencyError("Optional module `@aws-sdk/credential-providers` not found. Please install it to enable getting aws credentials via the official sdk.",{cause:e,dependencyName:"@aws-sdk/credential-providers"}))}}function VY(){try{return (()=>{throw new Error("Cannot require module "+"gcp-metadata");})()}catch(e){return Ep(new ws.MongoMissingDependencyError("Optional module `gcp-metadata` not found. Please install it to enable getting gcp credentials via the official sdk.",{cause:e,dependencyName:"gcp-metadata"}))}}function zY(){try{return (()=>{throw new Error("Cannot require module "+"snappy");})()}catch(e){return{kModuleError:new ws.MongoMissingDependencyError("Optional module `snappy` not found. Please install it to enable snappy compression",{cause:e,dependencyName:"snappy"})}}}function WY(){try{return (()=>{throw new Error("Cannot require module "+"socks");})()}catch(e){return{kModuleError:new ws.MongoMissingDependencyError("Optional module `socks` not found. Please install it to connections over a SOCKS5 proxy",{cause:e,dependencyName:"socks"})}}}function HY(){let e=null;try{e=(()=>{throw new Error("Cannot require module "+"mongodb-client-encryption");})()}catch(t){return{kModuleError:new ws.MongoMissingDependencyError("Optional module `mongodb-client-encryption` not found. Please install it to use auto encryption or ClientEncryption.",{cause:t,dependencyName:"mongodb-client-encryption"})}}return e}});var Cu=g(function(tt){Object.defineProperty(tt,"__esModule",{value:!0});tt.OP_MSG=tt.OP_COMPRESSED=tt.OP_DELETE=tt.OP_QUERY=tt.OP_INSERT=tt.OP_UPDATE=tt.OP_REPLY=tt.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION=tt.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION=tt.MIN_SUPPORTED_QE_SERVER_VERSION=tt.MIN_SUPPORTED_QE_WIRE_VERSION=tt.MAX_SUPPORTED_WIRE_VERSION=tt.MIN_SUPPORTED_WIRE_VERSION=tt.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION=tt.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION=tt.MAX_SUPPORTED_SERVER_VERSION=tt.MIN_SUPPORTED_SERVER_VERSION=void 0;tt.MIN_SUPPORTED_SERVER_VERSION="4.4";tt.MAX_SUPPORTED_SERVER_VERSION="9.0";tt.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION=13;tt.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION="5.0";tt.MIN_SUPPORTED_WIRE_VERSION=9;tt.MAX_SUPPORTED_WIRE_VERSION=29;tt.MIN_SUPPORTED_QE_WIRE_VERSION=21;tt.MIN_SUPPORTED_QE_SERVER_VERSION="7.0";tt.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION=27;tt.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION="8.2";tt.OP_REPLY=1;tt.OP_UPDATE=2001;tt.OP_INSERT=2002;tt.OP_QUERY=2004;tt.OP_DELETE=2006;tt.OP_COMPRESSED=2012;tt.OP_MSG=2013});var pf=g(function(Dn){Object.defineProperty(Dn,"__esModule",{value:!0});Dn.uncompressibleCommands=Dn.Compressor=void 0;Dn.compress=JY;Dn.decompress=ab;Dn.compressCommand=QY;Dn.decompressResponse=XY;var Op=require("zlib"),Cs=Te(),Ap=Br(),Sp=Fo(),ml=X(),di=ta(),pl=Cu();Dn.Compressor=Object.freeze({none:0,snappy:1,zlib:2,zstd:3});Dn.uncompressibleCommands=new Set(["hello",Ap.LEGACY_HELLO_COMMAND,Ap.LEGACY_HELLO_COMMAND_CAMEL_CASE,"saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);var KY=3,GY=(e)=>new Promise((t,r)=>{Op.inflate(e,(n,s)=>{if(n)return r(n);t(s)})}),YY=(e,t)=>new Promise((r,n)=>{Op.deflate(e,t,(s,i)=>{if(s)return n(s);r(i)})}),ea,Ac=null;function ub(){if(Ac==null){let e=Sp.getSnappy();if("kModuleError"in e)throw e.kModuleError;Ac=e}return Ac}async function JY(e,t){let r={};switch(e.agreedCompressor){case"snappy":return Ac??=ub(),await Ac.compress(t);case"zstd":{if(cb(),"kModuleError"in ea)throw ea.kModuleError;return await ea.compress(t,KY)}case"zlib":{if(e.zlibCompressionLevel)r.level=e.zlibCompressionLevel;return await YY(t,r)}default:throw new ml.MongoInvalidArgumentError(`Unknown compressor ${e.agreedCompressor} failed to compress`)}}async function ab(e,t){if(e!==Dn.Compressor.snappy&&e!==Dn.Compressor.zstd&&e!==Dn.Compressor.zlib&&e!==Dn.Compressor.none)throw new ml.MongoDecompressionError(`Server sent message compressed using an unsupported compressor. (Received compressor ID ${e})`);switch(e){case Dn.Compressor.snappy:return Ac??=ub(),await Ac.uncompress(t,{asBuffer:!0});case Dn.Compressor.zstd:{if(cb(),"kModuleError"in ea)throw ea.kModuleError;return await ea.decompress(t)}case Dn.Compressor.zlib:return await GY(t);default:return t}}function cb(){if(!ea)ea=Sp.getZstdLibrary()}var df=16;async function QY(e,t){let n=await(t.agreedCompressor==="none"||!di.OpCompressedRequest.canCompress(e)?e:new di.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0})).toBin();return Cs.ByteUtils.concat(n)}async function XY(e){let t={length:Cs.readInt32LE(e,0),requestId:Cs.readInt32LE(e,4),responseTo:Cs.readInt32LE(e,8),opCode:Cs.readInt32LE(e,12)};if(t.opCode!==pl.OP_COMPRESSED){let u=t.opCode===pl.OP_MSG?di.OpMsgResponse:di.OpReply,a=e.subarray(df);return new u(e,t,a)}let r={...t,fromCompressed:!0,opCode:Cs.readInt32LE(e,df),length:Cs.readInt32LE(e,df+4)},n=e[df+8],s=e.slice(df+9),i=r.opCode===pl.OP_MSG?di.OpMsgResponse:di.OpReply,o=await ab(n,s);if(o.length!==r.length)throw new ml.MongoDecompressionError("Message body and message header must be the same length");return new i(e,r,o)}});var ta=g(function(ls){Object.defineProperty(ls,"__esModule",{value:!0});ls.OpCompressedRequest=ls.OpMsgResponse=ls.OpMsgRequest=ls.DocumentSequence=ls.OpReply=ls.OpQueryRequest=void 0;ls.makeDocumentSequence=lJ;var ie=Te(),No=X(),yl=pf(),pi=Cu(),gl=0,ZY=2,eJ=4,tJ=8,rJ=16,nJ=32,sJ=64,iJ=128,oJ=1,uJ=2,aJ=4,cJ=8,hb=ie.ByteUtils.encodeUTF8Into;class kE{constructor(e,t,r){this.moreToCome=!1;let n=`${e}.$cmd`;if(typeof e!=="string")throw new No.MongoRuntimeError("Database name must be a string for a query");if(t==null)throw new No.MongoRuntimeError("A query document must be specified for query");if(n.indexOf("\x00")!==-1)throw new No.MongoRuntimeError("Namespace cannot contain a null character");this.databaseName=e,this.query=t,this.ns=n,this.numberToSkip=r.numberToSkip||0,this.numberToReturn=r.numberToReturn||0,this.returnFieldSelector=r.returnFieldSelector||void 0,this.requestId=r.requestId??kE.getRequestId(),this.pre32Limit=r.pre32Limit,this.serializeFunctions=typeof r.serializeFunctions==="boolean"?r.serializeFunctions:!1,this.ignoreUndefined=typeof r.ignoreUndefined==="boolean"?r.ignoreUndefined:!1,this.maxBsonSize=r.maxBsonSize||16777216,this.checkKeys=typeof r.checkKeys==="boolean"?r.checkKeys:!1,this.batchSize=this.numberToReturn,this.tailable=!1,this.secondaryOk=typeof r.secondaryOk==="boolean"?r.secondaryOk:!1,this.oplogReplay=!1,this.noCursorTimeout=!1,this.awaitData=!1,this.exhaust=!1,this.partial=!1}incRequestId(){this.requestId=gl++}nextRequestId(){return gl+1}static getRequestId(){return++gl}toBin(){let e=[],t=null,r=0;if(this.tailable)r|=ZY;if(this.secondaryOk)r|=eJ;if(this.oplogReplay)r|=tJ;if(this.noCursorTimeout)r|=rJ;if(this.awaitData)r|=nJ;if(this.exhaust)r|=sJ;if(this.partial)r|=iJ;if(this.batchSize!==this.numberToReturn)this.numberToReturn=this.batchSize;let n=ie.ByteUtils.allocate(20+ie.ByteUtils.utf8ByteLength(this.ns)+1+4+4);e.push(n);let s=ie.BSON.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});if(e.push(s),this.returnFieldSelector&&Object.keys(this.returnFieldSelector).length>0)t=ie.BSON.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined}),e.push(t);let i=n.length+s.length+(t?t.length:0),o=4;return n[3]=i>>24&255,n[2]=i>>16&255,n[1]=i>>8&255,n[0]=i&255,n[o+3]=this.requestId>>24&255,n[o+2]=this.requestId>>16&255,n[o+1]=this.requestId>>8&255,n[o]=this.requestId&255,o=o+4,n[o+3]=0,n[o+2]=0,n[o+1]=0,n[o]=0,o=o+4,n[o+3]=pi.OP_QUERY>>24&255,n[o+2]=pi.OP_QUERY>>16&255,n[o+1]=pi.OP_QUERY>>8&255,n[o]=pi.OP_QUERY&255,o=o+4,n[o+3]=r>>24&255,n[o+2]=r>>16&255,n[o+1]=r>>8&255,n[o]=r&255,o=o+4,o=o+hb(n,this.ns,o)+1,n[o-1]=0,n[o+3]=this.numberToSkip>>24&255,n[o+2]=this.numberToSkip>>16&255,n[o+1]=this.numberToSkip>>8&255,n[o]=this.numberToSkip&255,o=o+4,n[o+3]=this.numberToReturn>>24&255,n[o+2]=this.numberToReturn>>16&255,n[o+1]=this.numberToReturn>>8&255,n[o]=this.numberToReturn&255,o=o+4,e}}ls.OpQueryRequest=kE;class fb{constructor(e,t,r,n){this.index=0,this.sections=[],this.moreToCome=!1,this.parsed=!1,this.raw=e,this.data=r,this.opts=n??{useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.useBigInt64=typeof this.opts.useBigInt64==="boolean"?this.opts.useBigInt64:!1,this.promoteLongs=typeof this.opts.promoteLongs==="boolean"?this.opts.promoteLongs:!0,this.promoteValues=typeof this.opts.promoteValues==="boolean"?this.opts.promoteValues:!0,this.promoteBuffers=typeof this.opts.promoteBuffers==="boolean"?this.opts.promoteBuffers:!1,this.bsonRegExp=typeof this.opts.bsonRegExp==="boolean"?this.opts.bsonRegExp:!1}isParsed(){return this.parsed}parse(){if(this.parsed)return this.sections[0];if(this.index=20,this.responseFlags=ie.readInt32LE(this.data,0),this.cursorId=new ie.BSON.Long(ie.readInt32LE(this.data,4),ie.readInt32LE(this.data,8)),this.startingFrom=ie.readInt32LE(this.data,12),this.numberReturned=ie.readInt32LE(this.data,16),this.numberReturned<0||this.numberReturned>4294967295)throw RangeError(`OP_REPLY numberReturned is an invalid array length ${this.numberReturned}`);this.cursorNotFound=(this.responseFlags&oJ)!==0,this.queryFailure=(this.responseFlags&uJ)!==0,this.shardConfigStale=(this.responseFlags&aJ)!==0,this.awaitCapable=(this.responseFlags&cJ)!==0;for(let e=0;e<this.numberReturned;e++){let t=this.data[this.index]|this.data[this.index+1]<<8|this.data[this.index+2]<<16|this.data[this.index+3]<<24,r=this.data.subarray(this.index,this.index+t);this.sections.push(r),this.index=this.index+t}return this.parsed=!0,this.sections[0]}}ls.OpReply=fb;var db=1,pb=2,mb=65536;class wp{constructor(e,t){this.field=e,this.documents=[],this.chunks=[],this.serializedDocumentsLength=0;let r=ie.ByteUtils.allocateUnsafe(5+this.field.length+1);if(r[0]=1,hb(r,`${this.field}\x00`,5),this.chunks.push(r),this.header=r,t)for(let n of t)this.push(n,ie.BSON.serialize(n))}push(e,t){if(this.serializedDocumentsLength+=t.length,this.documents.push(e),this.chunks.push(t),this.header)ie.NumberUtils.setInt32LE(this.header,1,4+this.field.length+1+this.serializedDocumentsLength);return this.serializedDocumentsLength+this.header.length}toBin(){return ie.ByteUtils.concat(this.chunks)}}ls.DocumentSequence=wp;function lJ(e,t,r){let n=new wp(e);for(let s=0;s<t.length;s++)n.push(t[s],r[s]);return n}class Cp{constructor(e,t,r){if(t==null)throw new No.MongoInvalidArgumentError("Query document must be specified for query");this.databaseName=e,this.command=t,this.command.$db=e,this.options=r??{},this.requestId=r.requestId?r.requestId:Cp.getRequestId(),this.serializeFunctions=typeof r.serializeFunctions==="boolean"?r.serializeFunctions:!1,this.ignoreUndefined=typeof r.ignoreUndefined==="boolean"?r.ignoreUndefined:!1,this.checkKeys=typeof r.checkKeys==="boolean"?r.checkKeys:!1,this.maxBsonSize=r.maxBsonSize||16777216,this.checksumPresent=!1,this.moreToCome=r.moreToCome??t.writeConcern?.w===0,this.exhaustAllowed=typeof r.exhaustAllowed==="boolean"?r.exhaustAllowed:!1}toBin(){let e=[],t=0;if(this.checksumPresent)t|=db;if(this.moreToCome)t|=pb;if(this.exhaustAllowed)t|=mb;let r=ie.ByteUtils.allocate(20);e.push(r);let n=r.length,s=this.command;return n+=this.makeSections(e,s),ie.NumberUtils.setInt32LE(r,0,n),ie.NumberUtils.setInt32LE(r,4,this.requestId),ie.NumberUtils.setInt32LE(r,8,0),ie.NumberUtils.setInt32LE(r,12,pi.OP_MSG),ie.setUint32LE(r,16,t),e}makeSections(e,t){let r=this.extractDocumentSequences(t),n=ie.ByteUtils.allocateUnsafe(1);n[0]=0;let s=this.serializeBson(t);return e.push(n),e.push(s),e.push(r),n.length+s.length+r.length}extractDocumentSequences(e){let t=[];for(let[r,n]of Object.entries(e))if(n instanceof wp)t.push(n.toBin()),delete e[r];if(t.length>0)return ie.ByteUtils.concat(t);return ie.ByteUtils.allocate(0)}serializeBson(e){return ie.BSON.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}static getRequestId(){return gl=gl+1&2147483647,gl}}ls.OpMsgRequest=Cp;class yb{constructor(e,t,r,n){this.index=0,this.sections=[],this.parsed=!1,this.raw=e,this.data=r,this.opts=n??{useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.responseFlags=ie.readInt32LE(r,0),this.checksumPresent=(this.responseFlags&db)!==0,this.moreToCome=(this.responseFlags&pb)!==0,this.exhaustAllowed=(this.responseFlags&mb)!==0,this.useBigInt64=typeof this.opts.useBigInt64==="boolean"?this.opts.useBigInt64:!1,this.promoteLongs=typeof this.opts.promoteLongs==="boolean"?this.opts.promoteLongs:!0,this.promoteValues=typeof this.opts.promoteValues==="boolean"?this.opts.promoteValues:!0,this.promoteBuffers=typeof this.opts.promoteBuffers==="boolean"?this.opts.promoteBuffers:!1,this.bsonRegExp=typeof this.opts.bsonRegExp==="boolean"?this.opts.bsonRegExp:!1}isParsed(){return this.parsed}parse(){if(this.parsed)return this.sections[0];this.index=4;while(this.index<this.data.length){let e=this.data[this.index++];if(e===0){let t=ie.readInt32LE(this.data,this.index),r=this.data.subarray(this.index,this.index+t);this.sections.push(r),this.index+=t}else if(e===1)throw new No.MongoRuntimeError("OP_MSG Payload Type 1 detected unsupported protocol")}return this.parsed=!0,this.sections[0]}}ls.OpMsgResponse=yb;var xE=16,lb=9;class gb{constructor(e,t){this.command=e,this.options={zlibCompressionLevel:t.zlibCompressionLevel,agreedCompressor:t.agreedCompressor}}static canCompress(e){let t=e instanceof Cp?e.command:e.query,r=Object.keys(t)[0];return!yl.uncompressibleCommands.has(r)}async toBin(){let e=ie.ByteUtils.concat(this.command.toBin()),t=e.slice(xE),r=ie.readInt32LE(e,12),n=await yl.compress(this.options,t),s=ie.ByteUtils.allocate(xE);ie.NumberUtils.setInt32LE(s,0,xE+lb+n.length),ie.NumberUtils.setInt32LE(s,4,this.command.requestId),ie.NumberUtils.setInt32LE(s,8,0),ie.NumberUtils.setInt32LE(s,12,pi.OP_COMPRESSED);let i=ie.ByteUtils.allocate(lb);return ie.NumberUtils.setInt32LE(i,0,r),ie.NumberUtils.setInt32LE(i,4,t.length),i[8]=yl.Compressor[this.options.agreedCompressor],[s,i,n]}}ls.OpCompressedRequest=gb});var lo=g(function(co){Object.defineProperty(co,"__esModule",{value:!0});co.ReadConcern=co.ReadConcernLevel=void 0;co.ReadConcernLevel=Object.freeze({local:"local",majority:"majority",linearizable:"linearizable",available:"available",snapshot:"snapshot"});class _l{constructor(e){this.level=co.ReadConcernLevel[e]??e}static fromOptions(e){if(e==null)return;if(e.readConcern){let{readConcern:t}=e;if(t instanceof _l)return t;else if(typeof t==="string")return new _l(t);else if("level"in t&&t.level)return new _l(t.level)}if(e.level)return new _l(e.level);return}static get MAJORITY(){return co.ReadConcernLevel.majority}static get AVAILABLE(){return co.ReadConcernLevel.available}static get LINEARIZABLE(){return co.ReadConcernLevel.linearizable}static get SNAPSHOT(){return co.ReadConcernLevel.snapshot}toJSON(){return{level:this.level}}}co.ReadConcern=_l});var Xr=g(function(qn){Object.defineProperty(qn,"__esModule",{value:!0});qn.ReadPreference=qn.ReadPreferenceMode=void 0;var bs=X();qn.ReadPreferenceMode=Object.freeze({primary:"primary",primaryPreferred:"primaryPreferred",secondary:"secondary",secondaryPreferred:"secondaryPreferred",nearest:"nearest"});class Ht{static{this.PRIMARY=qn.ReadPreferenceMode.primary}static{this.PRIMARY_PREFERRED=qn.ReadPreferenceMode.primaryPreferred}static{this.SECONDARY=qn.ReadPreferenceMode.secondary}static{this.SECONDARY_PREFERRED=qn.ReadPreferenceMode.secondaryPreferred}static{this.NEAREST=qn.ReadPreferenceMode.nearest}static{this.primary=new Ht(qn.ReadPreferenceMode.primary)}static{this.primaryPreferred=new Ht(qn.ReadPreferenceMode.primaryPreferred)}static{this.secondary=new Ht(qn.ReadPreferenceMode.secondary)}static{this.secondaryPreferred=new Ht(qn.ReadPreferenceMode.secondaryPreferred)}static{this.nearest=new Ht(qn.ReadPreferenceMode.nearest)}constructor(e,t,r){if(!Ht.isValid(e))throw new bs.MongoInvalidArgumentError(`Invalid read preference mode ${JSON.stringify(e)}`);if(r==null&&typeof t==="object"&&!Array.isArray(t))r=t,t=void 0;else if(t&&!Array.isArray(t))throw new bs.MongoInvalidArgumentError("ReadPreference tags must be an array");if(this.mode=e,this.tags=t,this.hedge=r?.hedge,this.maxStalenessSeconds=void 0,r=r??{},r.maxStalenessSeconds!=null){if(r.maxStalenessSeconds<=0)throw new bs.MongoInvalidArgumentError("maxStalenessSeconds must be a positive integer");this.maxStalenessSeconds=r.maxStalenessSeconds}if(this.mode===Ht.PRIMARY){if(this.tags&&Array.isArray(this.tags)&&this.tags.length>0)throw new bs.MongoInvalidArgumentError("Primary read preference cannot be combined with tags");if(this.maxStalenessSeconds)throw new bs.MongoInvalidArgumentError("Primary read preference cannot be combined with maxStalenessSeconds");if(this.hedge)throw new bs.MongoInvalidArgumentError("Primary read preference cannot be combined with hedge")}}get preference(){return this.mode}static fromString(e){return new Ht(e)}static fromOptions(e){if(!e)return;let t=e.readPreference??e.session?.transaction.options.readPreference,r=e.readPreferenceTags;if(t==null)return;if(typeof t==="string")return new Ht(t,r,{maxStalenessSeconds:e.maxStalenessSeconds,hedge:e.hedge});else if(!(t instanceof Ht)&&typeof t==="object"){let n=t.mode||t.preference;if(n&&typeof n==="string")return new Ht(n,t.tags??r,{maxStalenessSeconds:t.maxStalenessSeconds,hedge:e.hedge})}if(r)t.tags=r;return t}static translate(e){if(e.readPreference==null)return e;let t=e.readPreference;if(typeof t==="string")e.readPreference=new Ht(t);else if(t&&!(t instanceof Ht)&&typeof t==="object"){let r=t.mode||t.preference;if(r&&typeof r==="string")e.readPreference=new Ht(r,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds})}else if(!(t instanceof Ht))throw new bs.MongoInvalidArgumentError(`Invalid read preference: ${t}`);return e}static isValid(e){return new Set([Ht.PRIMARY,Ht.PRIMARY_PREFERRED,Ht.SECONDARY,Ht.SECONDARY_PREFERRED,Ht.NEAREST,null]).has(e)}isValid(e){return Ht.isValid(typeof e==="string"?e:this.mode)}secondaryOk(){return new Set([Ht.PRIMARY_PREFERRED,Ht.SECONDARY,Ht.SECONDARY_PREFERRED,Ht.NEAREST]).has(this.mode)}equals(e){return e.mode===this.mode}toJSON(){let e={mode:this.mode};if(Array.isArray(this.tags))e.tags=this.tags;if(this.maxStalenessSeconds)e.maxStalenessSeconds=this.maxStalenessSeconds;if(this.hedge)e.hedge=this.hedge;return e}}qn.ReadPreference=Ht});var Ds=g(function(hs){Object.defineProperty(hs,"__esModule",{value:!0});hs.ServerType=hs.TopologyType=hs.STATE_CONNECTED=hs.STATE_CONNECTING=hs.STATE_CLOSED=hs.STATE_CLOSING=void 0;hs._advanceClusterTime=hJ;hs.STATE_CLOSING="closing";hs.STATE_CLOSED="closed";hs.STATE_CONNECTING="connecting";hs.STATE_CONNECTED="connected";hs.TopologyType=Object.freeze({Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown",LoadBalanced:"LoadBalanced"});hs.ServerType=Object.freeze({Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown",LoadBalancer:"LoadBalancer"});function hJ(e,t){if(e.clusterTime==null)e.clusterTime=t;else if(t.clusterTime.greaterThan(e.clusterTime.clusterTime))e.clusterTime=t}});var fs=g(function(Oc){Object.defineProperty(Oc,"__esModule",{value:!0});Oc.WriteConcern=Oc.WRITE_CONCERN_KEYS=void 0;Oc.throwIfWriteConcernError=fJ;var bp=wt(),_b=X();Oc.WRITE_CONCERN_KEYS=["w","wtimeout","j","journal","fsync"];class mf{constructor(e,t,r,n){if(e!=null)if(!Number.isNaN(Number(e)))this.w=Number(e);else this.w=e;if(t!=null)this.wtimeoutMS=this.wtimeout=t;if(r!=null)this.journal=this.j=r;if(n!=null)this.journal=this.j=n?!0:!1}static apply(e,t){let r={};if(t.w!=null)r.w=t.w;if(t.wtimeoutMS!=null)r.wtimeout=t.wtimeoutMS;if(t.journal!=null)r.j=t.j;return e.writeConcern=r,e}static fromOptions(e,t){if(e==null)return;t=t??{};let r;if(typeof e==="string"||typeof e==="number")r={w:e};else if(e instanceof mf)r=e;else r=e.writeConcern;let s={...t instanceof mf?t:t.writeConcern,...r},{w:i=void 0,wtimeout:o=void 0,j:u=void 0,fsync:a=void 0,journal:c=void 0,wtimeoutMS:l=void 0}=s;if(i!=null||o!=null||l!=null||u!=null||c!=null||a!=null)return new mf(i,o??l,u??c,a);return}}Oc.WriteConcern=mf;function fJ(e){if(typeof e==="object"&&e!=null){let t=bp.MongoDBResponse.is(e)&&e.has("writeConcernError")?e.toObject():!bp.MongoDBResponse.is(e)&&("writeConcernError"in e)?e:null;if(t!=null)throw new _b.MongoWriteConcernError(t)}}});var he=g(function(Z){Object.defineProperty(Z,"__esModule",{value:!0});Z.kDispose=Z.randomBytes=Z.COSMOS_DB_MSG=Z.DOCUMENT_DB_MSG=Z.COSMOS_DB_CHECK=Z.DOCUMENT_DB_CHECK=Z.MONGODB_WARNING_CODE=Z.DEFAULT_PK_FACTORY=Z.HostAddress=Z.BufferPool=Z.List=Z.MongoDBCollectionNamespace=Z.MongoDBNamespace=void 0;Z.isUint8Array=dJ;Z.hostMatchesWildcards=pJ;Z.normalizeHintField=mJ;Z.isObject=qE;Z.mergeOptions=gJ;Z.filterOptions=_J;Z.isPromiseLike=EJ;Z.decorateWithCollation=AJ;Z.decorateWithReadConcern=OJ;Z.getTopology=SJ;Z.ns=wJ;Z.makeCounter=CJ;Z.uuidV4=bJ;Z.maxWireVersion=DJ;Z.arrayStrictEqual=TJ;Z.errorStrictEqual=MJ;Z.makeStateMachine=PJ;Z.processTimeMS=Mb;Z.calculateDurationInMs=BJ;Z.hasAtomicOperators=Pb;Z.resolveTimeoutOptions=FJ;Z.resolveOptions=NJ;Z.isSuperset=Bb;Z.isHello=IJ;Z.setDifference=RJ;Z.isRecord=vJ;Z.emitWarning=Nb;Z.emitWarningOnce=xJ;Z.enumToString=kJ;Z.supportsRetryableWrites=qJ;Z.shuffle=jJ;Z.commandSupportsReadConcern=LJ;Z.commandSupportsAfterClusterTime=UJ;Z.compareObjectId=VJ;Z.parseInteger=Ib;Z.parseUnsignedInteger=zJ;Z.checkParentDomainMatch=Rb;Z.dnsNameToASCII=$b;Z.normalizeDnsName=vb;Z.verifySrvHost=HJ;Z.get=KJ;Z.isHostMatch=GJ;Z.promiseWithResolvers=UE;Z.squashError=YJ;Z.once=QJ;Z.maybeAddIdToDocuments=XJ;Z.fileIsAccessible=ZJ;Z.csotMin=eQ;Z.noop=tQ;Z.decorateDecryptionResult=xb;Z.addAbortListener=VE;Z.abortable=rQ;var Ab=require("fs"),Ob=require("http"),Sb=require("process"),El=require("timers"),wb=require("url"),qr=Te(),Dp=Cu(),ra=Br(),Ft=X(),Cb=lo(),bb=Xr(),Db=Ds(),Tb=fs();function dJ(e){return e!=null&&typeof e==="object"&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Uint8Array"}function pJ(e,t){for(let r of t){if(e===r)return!0;if(r.startsWith("*.")){let n=r.substring(2);if(e===n||e.endsWith(`.${n}`))return!0}if(r.startsWith("*/")){let n=r.substring(2);if(e===n||e.endsWith(`/${n}`))return!0}}return!1}function mJ(e){let t=void 0;if(typeof e==="string")t=e;else if(Array.isArray(e))t={},e.forEach((r)=>{t[r]=1});else if(e!=null&&typeof e==="object"){t={};for(let r in e)t[r]=e[r]}return t}var yJ=(e)=>Object.prototype.toString.call(e);function qE(e){return yJ(e)==="[object Object]"}function gJ(e,t){return{...e,...t}}function _J(e,t){let r={};for(let n in e)if(t.includes(n))r[n]=e[n];return r}function EJ(e){return e!=null&&typeof e==="object"&&"then"in e&&typeof e.then==="function"}function AJ(e,t){if(t.collation&&typeof t.collation==="object")e.collation=t.collation}function OJ(e,t,r){if(r&&r.session&&r.session.inTransaction())return;let n=Object.assign({},e.readConcern||{});if(t.s.readConcern)Object.assign(n,t.s.readConcern);if(Object.keys(n).length>0)Object.assign(e,{readConcern:n})}function SJ(e){if("topology"in e&&e.topology)return e.topology;else if("client"in e&&e.client.topology)return e.client.topology;throw new Ft.MongoNotConnectedError("MongoClient must be connected to perform this operation")}function wJ(e){return gf.fromString(e)}class gf{constructor(e,t){this.db=e,this.collection=t===""?void 0:t}toString(){return this.collection?`${this.db}.${this.collection}`:this.db}withCollection(e){return new jE(this.db,e)}static fromString(e){if(typeof e!=="string"||e==="")throw new Ft.MongoRuntimeError(`Cannot parse namespace from "${e}"`);let[t,...r]=e.split("."),n=r.join(".");return new gf(t,n===""?void 0:n)}}Z.MongoDBNamespace=gf;class jE extends gf{constructor(e,t){super(e,t);this.collection=t}static fromString(e){return super.fromString(e)}}Z.MongoDBCollectionNamespace=jE;function*CJ(e=0){let t=e;while(!0){let r=t;t+=1,yield r}}function bJ(){let e=crypto.getRandomValues(new Uint8Array(16));return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function DJ(e){if(e){if(e.hello)return e.hello.maxWireVersion;if(e.serverApi?.version)return Dp.MAX_SUPPORTED_WIRE_VERSION;if(e.loadBalanced)return Dp.MAX_SUPPORTED_WIRE_VERSION;if("lastHello"in e&&typeof e.lastHello==="function"){let t=e.lastHello();if(t)return t.maxWireVersion}if(e.description&&"maxWireVersion"in e.description&&e.description.maxWireVersion!=null)return e.description.maxWireVersion}return 0}function TJ(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;return e.length===t.length&&e.every((r,n)=>r===t[n])}function MJ(e,t){if(e===t)return!0;if(!e||!t)return e===t;if(e==null&&t!=null||e!=null&&t==null)return!1;if(e.constructor.name!==t.constructor.name)return!1;if(e.message!==t.message)return!1;return!0}function PJ(e){return function(r,n){let s=e[r.s.state];if(s&&s.indexOf(n)<0)throw new Ft.MongoRuntimeError(`illegal state transition from [${r.s.state}] => [${n}], allowed: [${s}]`);r.emit("stateChanged",r.s.state,n),r.s.state=n}}function Mb(){return Math.floor(performance.now())}function BJ(e){if(typeof e!=="number")return-1;let t=Mb()-e;return t<0?0:t}function Pb(e,t){if(Array.isArray(e)){for(let n of e)if(Pb(n))return!0;return!1}let r=Object.keys(e);if(t?.ignoreUndefined){let n=!0;for(let s of r)if(e[s]!==void 0){n=!1;break}if(n)throw new Ft.MongoInvalidArgumentError("Update operations require that all atomic operators have defined values, but none were provided.")}return r.length>0&&r[0][0]==="$"}function FJ(e,t){let{socketTimeoutMS:r,serverSelectionTimeoutMS:n,waitQueueTimeoutMS:s}=e.s.options;return{socketTimeoutMS:r,serverSelectionTimeoutMS:n,waitQueueTimeoutMS:s,...t,timeoutMS:void 0}}function NJ(e,t){let r=Object.assign({},t,qr.resolveBSONOptions(t,e));if(!t?.session?.inTransaction()){let i=Cb.ReadConcern.fromOptions(t)??e?.readConcern;if(i)r.readConcern=i;let o=Tb.WriteConcern.fromOptions(t)??e?.writeConcern;if(o)r.writeConcern=o}r.timeoutMS=void 0;let s=bb.ReadPreference.fromOptions(t)??e?.readPreference;if(s)r.readPreference=s;return r}function Bb(e,t){e=Array.isArray(e)?new Set(e):e,t=Array.isArray(t)?new Set(t):t;for(let r of t)if(!e.has(r))return!1;return!0}function IJ(e){return e[ra.LEGACY_HELLO_COMMAND]||e.hello?!0:!1}function RJ(e,t){let r=new Set(e);for(let n of t)r.delete(n);return r}var $J=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function vJ(e,t=void 0){if(!qE(e))return!1;let r=e.constructor;if(r&&r.prototype){if(!qE(r.prototype))return!1;if(!$J(r.prototype,"isPrototypeOf"))return!1}if(t){let n=Object.keys(e);return Bb(n,t)}return!0}class LE{get length(){return this.count}get[Symbol.toStringTag](){return"List"}constructor(){this.count=0,this.head={next:null,prev:null,value:null},this.head.next=this.head,this.head.prev=this.head}toArray(){return Array.from(this)}toString(){return`head <=> ${this.toArray().join(" <=> ")} <=> head`}*[Symbol.iterator](){for(let e of this.nodes())yield e.value}*nodes(){let e=this.head.next;while(e!==this.head){let{next:t}=e;yield e,e=t}}push(e){this.count+=1;let t={next:this.head,prev:this.head.prev,value:e};this.head.prev.next=t,this.head.prev=t}pushMany(e){for(let t of e)this.push(t)}unshift(e){this.count+=1;let t={next:this.head.next,prev:this.head,value:e};this.head.next.prev=t,this.head.next=t}remove(e){if(e===this.head||this.length===0)return null;this.count-=1;let{prev:t,next:r}=e;return t.next=r,r.prev=t,e.value}shift(){return this.remove(this.head.next)}pop(){return this.remove(this.head.prev)}prune(e){for(let t of this.nodes())if(e(t.value))this.remove(t)}clear(){this.count=0,this.head.next=this.head,this.head.prev=this.head}first(){return this.head.next.value}last(){return this.head.prev.value}}Z.List=LE;class Fb{constructor(){this.buffers=new LE,this.totalByteLength=0}get length(){return this.totalByteLength}append(e){this.buffers.push(e),this.totalByteLength+=e.length}getInt32(){if(this.totalByteLength<4)return null;let e=this.buffers.first();if(e!=null&&e.byteLength>=4)return qr.NumberUtils.getInt32LE(e,0);let t=this.read(4),r=qr.NumberUtils.getInt32LE(t,0);return this.totalByteLength+=4,this.buffers.unshift(t),r}read(e){if(typeof e!=="number"||e<0)throw new Ft.MongoInvalidArgumentError('Argument "size" must be a non-negative number');if(e>this.totalByteLength)return qr.ByteUtils.allocate(0);let t=qr.ByteUtils.allocateUnsafe(e);for(let r=0;r<e;){let n=this.buffers.shift();if(n==null)break;let s=e-r,i=Math.min(s,n.byteLength),o=n.subarray(0,i);if(t.set(o,r),r+=i,this.totalByteLength-=i,i<n.byteLength)this.buffers.unshift(n.subarray(i))}return t}}Z.BufferPool=Fb;class yf{constructor(e){this.host=void 0,this.port=void 0,this.socketPath=void 0,this.isIPv6=!1;let t=e.split(" ").join("%20");if(t.endsWith(".sock")){this.socketPath=decodeURIComponent(t);return}let r=`iLoveJS://${t}`,n;try{n=new URL(r)}catch(u){delete u.input;let a=new Ft.MongoRuntimeError("Unable to parse host with URL");throw a.cause=u,a}let s=n.hostname,i=n.port,o=decodeURIComponent(s).toLowerCase();if(o.startsWith("[")&&o.endsWith("]"))this.isIPv6=!0,o=o.substring(1,s.length-1);if(this.host=o.toLowerCase(),typeof i==="number")this.port=i;else if(typeof i==="string"&&i!=="")this.port=Number.parseInt(i,10);else this.port=27017;if(this.port===0)throw new Ft.MongoParseError("Invalid port (zero) with hostname");Object.freeze(this)}[Symbol.for("nodejs.util.inspect.custom")](){return this.inspect()}inspect(){return`new HostAddress('${this.toString()}')`}toString(){if(typeof this.host==="string"){if(this.isIPv6)return`[${this.host}]:${this.port}`;return`${this.host}:${this.port}`}return`${this.socketPath}`}static fromString(e){return new yf(e)}static fromHostPort(e,t){if(e.includes(":"))e=`[${e}]`;return yf.fromString(`${e}:${t}`)}static fromSrvRecord({name:e,port:t}){return yf.fromHostPort(e,t)}toHostPort(){if(this.socketPath)return{host:this.socketPath,port:0};let e=this.host??"",t=this.port??0;return{host:e,port:t}}}Z.HostAddress=yf;Z.DEFAULT_PK_FACTORY={createPk(){return new qr.ObjectId}};Z.MONGODB_WARNING_CODE="MONGODB DRIVER";function Nb(e){return Sb.emitWarning(e,{code:Z.MONGODB_WARNING_CODE})}var Eb=new Set;function xJ(e){if(!Eb.has(e))return Eb.add(e),Nb(e)}function kJ(e){return Object.values(e).join(", ")}function qJ(e){if(!e)return!1;if(e.loadBalanced)return!0;if(e.description.logicalSessionTimeoutMinutes!=null){if(e.description.type!==Db.ServerType.Standalone)return!0}return!1}function jJ(e,t=0){let r=Array.from(e);if(t>r.length)throw new Ft.MongoRuntimeError("Limit must be less than the number of items");let n=r.length,s=t%r.length===0?1:r.length-t;while(n>s){let i=Math.floor(Math.random()*n);n-=1;let o=r[n];r[n]=r[i],r[i]=o}return t%r.length===0?r:r.slice(s)}function LJ(e){if(e.aggregate||e.count||e.distinct||e.find||e.geoNear)return!0;return!1}function UJ(e){if(e.aggregate||e.count||e.distinct||e.find||e.geoNear)return!0;if(e.bulkWrite||e.create||e.createIndexes||e.delete||e.drop||e.dropDatabase||e.dropIndexes||e.findAndModify||e.insert||e.update)return!0;return!1}function VJ(e,t){if(e==null&&t==null)return 0;if(e==null)return-1;if(t==null)return 1;return qr.ByteUtils.compare(e.id,t.id)}function Ib(e){if(typeof e==="number")return Math.trunc(e);let t=Number.parseInt(String(e),10);return Number.isNaN(t)?null:t}function zJ(e){let t=Ib(e);return t!=null&&t>=0?t:null}function Rb(e,t){let r=vb(t),n=/^.*?\./,s=r.split(".").length<3,i=`.${e.replace(n,"")}`,o=s?r:`.${r.replace(n,"")}`;if(!o.startsWith("."))o="."+o;if(s&&e.split(".").length<=r.split(".").length)throw new Ft.MongoAPIError("Server record does not have at least one more domain level than parent URI");if(!i.endsWith(o))throw new Ft.MongoAPIError("Server record does not share hostname with parent URI")}var WJ=/[\u0000-\u0020\u007F#%/:<>?@[\\\]^|]/;function $b(e){if(WJ.test(e))return null;let t=/^\p{ASCII}*$/u.test(e)?e.toLowerCase():wb.domainToASCII(e);return t===""?null:t}function vb(e){let t=e.endsWith(".")?e.slice(0,-1):e,r=$b(t);if(r==null)throw new Ft.MongoAPIError("Invalid DNS host name");return r}function HJ(e,t,r){let{srvAllowedHostsSuffix:n,srvHostValidator:s}=r;if(s!=null){if(!s(e))throw new Ft.MongoAPIError("Server record was rejected by srvHostValidator");return}if(n!=null){if(!e.endsWith(n))throw new Ft.MongoAPIError("Server record does not end with srvAllowedHostsSuffix");return}Rb(e,t)}function KJ(e,t={}){return new Promise((r,n)=>{let s,i=Ob.get(e,t,(o)=>{o.setEncoding("utf8");let u="";o.on("data",(a)=>u+=a),o.on("end",()=>{El.clearTimeout(s),r({status:o.statusCode,body:u})})}).on("error",(o)=>{El.clearTimeout(s),n(o)}).end();s=El.setTimeout(()=>{i.destroy(new Ft.MongoNetworkTimeoutError("request timed out after 10 seconds"))},1e4)})}Z.DOCUMENT_DB_CHECK=/(\.docdb\.amazonaws\.com$)|(\.docdb-elastic\.amazonaws\.com$)/;Z.COSMOS_DB_CHECK=/\.cosmos\.azure\.com$/;Z.DOCUMENT_DB_MSG="You appear to be connected to a DocumentDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/documentdb";Z.COSMOS_DB_MSG="You appear to be connected to a CosmosDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb";function GJ(e,t){return t&&e.test(t.toLowerCase())?!0:!1}function UE(){let e,t;return{promise:new Promise(function(s,i){e=s,t=i}),resolve:e,reject:t}}function YJ(e){return}var JJ=(e)=>Promise.resolve(crypto.getRandomValues(new Uint8Array(e)));Z.randomBytes=JJ;async function QJ(e,t,r){r?.signal?.throwIfAborted();let{promise:n,resolve:s,reject:i}=UE(),o=(c)=>s(c),u=(c)=>i(c),a=VE(r?.signal,function(){i(this.reason)});e.once(t,o).once("error",u);try{return await n}finally{e.off(t,o),e.off("error",u),a?.[Z.kDispose]()}}function XJ(e,t,r){if(r.forceServerObjectId??e.db.options?.forceServerObjectId??!1)return t;if(t._id==null)t._id=e.s.pkFactory.createPk();return t}async function ZJ(e,t){try{return await Ab.promises.access(e,t),!0}catch{return!1}}function eQ(e,t){if(e===0)return t;if(t===0)return e;return Math.min(e,t)}function tQ(){return}function xb(e,t,r=!0){if(r){if(qr.ByteUtils.isUint8Array(t))t=qr.deserialize(t);if(qr.ByteUtils.isUint8Array(e))throw new Ft.MongoRuntimeError("Expected result of decryption to be deserialized BSON object")}if(!e||typeof e!=="object")return;for(let n of Object.keys(e)){let s=t[n];if(s&&s._bsontype==="Binary"&&s.sub_type===6){if(!e[ra.kDecoratedKeys])Object.defineProperty(e,ra.kDecoratedKeys,{value:[],configurable:!0,enumerable:!1,writable:!1});e[ra.kDecoratedKeys].push(n);continue}xb(e[n],s,!1)}}Z.kDispose=Symbol.dispose??Symbol("dispose");function VE(e,t){if(e==null)return;return e.addEventListener("abort",t,{once:!0}),{[Z.kDispose]:()=>e.removeEventListener("abort",t)}}async function rQ(e,{signal:t}){if(t==null)return await e;let{promise:r,reject:n}=UE(),s=t.aborted?n(t.reason):VE(t,function(){n(this.reason)});try{return await Promise.race([e,r])}finally{s?.[Z.kDispose]()}}});var kb=g(function(Mp){Object.defineProperty(Mp,"__esModule",{value:!0});Mp.OnDemandDocument=void 0;var re=Te(),_f={type:0,nameOffset:1,nameLength:2,offset:3,length:4};class Tp{constructor(e,t=0,r=!1,n){this.cache=Object.create(null),this.indexFound=Object.create(null),this.bson=e,this.offset=t,this.isArray=r,this.elements=n??re.parseToElementsToArray(this.bson,t)}isElementName(e,t){let r=t[_f.nameLength],n=t[_f.nameOffset];if(e.length!==r)return!1;let s=n+r;for(let i=n,o=0;o<e.length&&i<s;o++,i++)if(this.bson[i]!==e.charCodeAt(o))return!1;return!0}getElement(e){let t=this.cache[e];if(t===!1)return null;if(t!=null)return t;if(typeof e==="number")if(this.isArray)if(e<this.elements.length){let n={element:this.elements[e],value:void 0};return this.cache[e]=n,this.indexFound[e]=!0,n}else return null;else return null;for(let r=0;r<this.elements.length;r++){let n=this.elements[r];if(!(r in this.indexFound)&&this.isElementName(e,n)){let s={element:n,value:void 0};return this.cache[e]=s,this.indexFound[r]=!0,s}}return this.cache[e]=!1,null}toJSValue(e,t){let r=e[_f.type],n=e[_f.offset],s=e[_f.length];if(t!==r)return null;switch(t){case re.BSONType.null:case re.BSONType.undefined:return null;case re.BSONType.double:return re.NumberUtils.getFloat64LE(this.bson,n);case re.BSONType.int:return re.NumberUtils.getInt32LE(this.bson,n);case re.BSONType.long:return re.NumberUtils.getBigInt64LE(this.bson,n);case re.BSONType.bool:return Boolean(this.bson[n]);case re.BSONType.objectId:return new re.ObjectId(this.bson.subarray(n,n+12));case re.BSONType.timestamp:return new re.Timestamp(re.NumberUtils.getBigInt64LE(this.bson,n));case re.BSONType.string:return re.ByteUtils.toUTF8(this.bson,n+4,n+s-1,!1);case re.BSONType.binData:{let i=re.NumberUtils.getInt32LE(this.bson,n),o=this.bson[n+4];if(o===2){let u=re.NumberUtils.getInt32LE(this.bson,n+1+4);if(u<0)throw new re.BSONError("Negative binary type element size found for subtype 0x02");if(u>i-4)throw new re.BSONError("Binary type with subtype 0x02 contains too long binary size");if(u<i-4)throw new re.BSONError("Binary type with subtype 0x02 contains too short binary size");return new re.Binary(this.bson.subarray(n+1+4+4,n+1+4+4+u),2)}return new re.Binary(this.bson.subarray(n+1+4,n+1+4+i),o)}case re.BSONType.date:return new Date(Number(re.NumberUtils.getBigInt64LE(this.bson,n)));case re.BSONType.object:return new Tp(this.bson,n);case re.BSONType.array:return new Tp(this.bson,n,!0);default:throw new re.BSONError(`Unsupported BSON type: ${t}`)}}size(){return this.elements.length}has(e){let t=this.cache[e];if(t===!1)return!1;if(t!=null)return!0;return this.getElement(e)!=null}get(e,t,r){let n=this.getElement(e);if(n==null)if(r===!0)throw new re.BSONError(`BSON element "${e}" is missing`);else return null;if(n.value==null){let s=this.toJSValue(n.element,t);if(s==null)if(r===!0)throw new re.BSONError(`BSON element "${e}" is missing`);else return null;n.value=s}return n.value}getNumber(e,t){let r=this.get(e,re.BSONType.bool),n=r==null?null:r?1:0,s=this.get(e,re.BSONType.long),i=s==null?null:Number(s),o=n??i??this.get(e,re.BSONType.int)??this.get(e,re.BSONType.double);if(t===!0&&o==null)throw new re.BSONError(`BSON element "${e}" is missing`);return o}toObject(e){return re.deserialize(this.bson,{...e,index:this.offset,allowObjectSmallerThanBufferSize:!0})}toBytes(){let e=re.NumberUtils.getInt32LE(this.bson,this.offset);return this.bson.subarray(this.offset,this.offset+e)}}Mp.OnDemandDocument=Tp});var wt=g(function(ho){Object.defineProperty(ho,"__esModule",{value:!0});ho.ClientBulkWriteCursorResponse=ho.ExplainedCursorResponse=ho.CursorResponse=ho.MongoDBResponse=void 0;ho.isErrorResponse=jb;var oe=Te(),Ts=X(),Bp=he(),qb=kb(),Pp={type:0,nameOffset:1,nameLength:2,offset:3,length:4};function jb(e,t){for(let r=0;r<t.length;r++){let n=t[r];if(n[Pp.nameLength]===2){let s=n[Pp.nameOffset];if(e[s]===111&&e[s+1]===107){let i=n[Pp.offset],o=n[Pp.length];for(let u=i;u<i+o;u++)if(e[u]!==0)return!1;return!0}}}return!0}class Al extends qb.OnDemandDocument{get(e,t,r){try{return super.get(e,t,r)}catch(n){throw new Ts.MongoUnexpectedServerResponseError(n.message,{cause:n})}}static is(e){return e instanceof Al}static make(e){let t=oe.parseToElementsToArray(e,0);return jb(e,t)?new Al(e,0,!1,t):new this(e,0,!1,t)}static{this.empty=new Al(new Uint8Array([13,0,0,0,16,111,107,0,1,0,0,0,0]))}get isMaxTimeExpiredError(){if(this.ok===0&&this.code===Ts.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;if(this.ok===0)return!1;if(this.get("writeConcernError",oe.BSONType.object)?.getNumber("code")===Ts.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;let r=this.get("writeErrors",oe.BSONType.array);if(r?.size()){for(let n=0;n<r.size();n++)if(r.get(n,oe.BSONType.object)?.getNumber("code")===Ts.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0}return!1}get recoveryToken(){return this.get("recoveryToken",oe.BSONType.object)?.toObject({promoteValues:!1,promoteLongs:!1,promoteBuffers:!1,validation:{utf8:!0}})??null}get atClusterTime(){return this.get("cursor",oe.BSONType.object)?.get("atClusterTime",oe.BSONType.timestamp)??this.get("atClusterTime",oe.BSONType.timestamp)}get operationTime(){return this.get("operationTime",oe.BSONType.timestamp)}get ok(){return this.getNumber("ok")?1:0}get $err(){return this.get("$err",oe.BSONType.string)}get errmsg(){return this.get("errmsg",oe.BSONType.string)}get code(){return this.getNumber("code")}get $clusterTime(){if(!("clusterTime"in this)){let e=this.get("$clusterTime",oe.BSONType.object);if(e==null)return this.clusterTime=null,null;let t=e.get("clusterTime",oe.BSONType.timestamp,!0),r=e.get("signature",oe.BSONType.object)?.toObject();this.clusterTime={clusterTime:t,signature:r}}return this.clusterTime??null}toObject(e){let t={...oe.pluckBSONSerializeOptions(e??{}),validation:oe.parseUtf8ValidationOption(e)};return super.toObject(t)}}ho.MongoDBResponse=Al;class Sc extends Al{constructor(){super(...arguments);this._batch=null,this.iterated=0,this._encryptedBatch=null}static get emptyGetMore(){return new Sc(oe.serialize({ok:1,cursor:{id:0n,nextBatch:[]}}))}static is(e){return e instanceof Sc||e===Sc.emptyGetMore}get cursor(){return this.get("cursor",oe.BSONType.object,!0)}get id(){try{return oe.Long.fromBigInt(this.cursor.get("id",oe.BSONType.long,!0))}catch(e){throw new Ts.MongoUnexpectedServerResponseError(e.message,{cause:e})}}get ns(){let e=this.cursor.get("ns",oe.BSONType.string);if(e!=null)return Bp.ns(e);return null}get length(){return Math.max(this.batchSize-this.iterated,0)}get encryptedBatch(){if(this.encryptedResponse==null)return null;if(this._encryptedBatch!=null)return this._encryptedBatch;let e=this.encryptedResponse?.get("cursor",oe.BSONType.object);if(e?.has("firstBatch"))this._encryptedBatch=e.get("firstBatch",oe.BSONType.array,!0);else if(e?.has("nextBatch"))this._encryptedBatch=e.get("nextBatch",oe.BSONType.array,!0);else throw new Ts.MongoUnexpectedServerResponseError("Cursor document did not contain a batch");return this._encryptedBatch}get batch(){if(this._batch!=null)return this._batch;let e=this.cursor;if(e.has("firstBatch"))this._batch=e.get("firstBatch",oe.BSONType.array,!0);else if(e.has("nextBatch"))this._batch=e.get("nextBatch",oe.BSONType.array,!0);else throw new Ts.MongoUnexpectedServerResponseError("Cursor document did not contain a batch");return this._batch}get batchSize(){return this.batch?.size()}get postBatchResumeToken(){return this.cursor.get("postBatchResumeToken",oe.BSONType.object)?.toObject({promoteValues:!1,promoteLongs:!1,promoteBuffers:!1,validation:{utf8:!0}})??null}shift(e){if(this.iterated>=this.batchSize)return null;let t=this.batch.get(this.iterated,oe.BSONType.object,!0)??null,r=this.encryptedBatch?.get(this.iterated,oe.BSONType.object,!0)??null;if(this.iterated+=1,e?.raw)return t.toBytes();else{let n=t.toObject(e);if(r)Bp.decorateDecryptionResult(n,r.toObject(e),!0);return n}}clear(){this.iterated=this.batchSize}}ho.CursorResponse=Sc;class Lb extends Sc{constructor(){super(...arguments);this.isExplain=!0,this._length=1}get id(){return oe.Long.fromBigInt(0n)}get batchSize(){return 0}get ns(){return null}get length(){return this._length}shift(e){if(this._length===0)return null;return this._length-=1,this.toObject(e)}}ho.ExplainedCursorResponse=Lb;class Ub extends Sc{get insertedCount(){return this.get("nInserted",oe.BSONType.int,!0)}get upsertedCount(){return this.get("nUpserted",oe.BSONType.int,!0)}get matchedCount(){return this.get("nMatched",oe.BSONType.int,!0)}get modifiedCount(){return this.get("nModified",oe.BSONType.int,!0)}get deletedCount(){return this.get("nDeleted",oe.BSONType.int,!0)}get writeConcernError(){return this.get("writeConcernError",oe.BSONType.object,!1)}}ho.ClientBulkWriteCursorResponse=Ub});var zE=g(function(bu){Object.defineProperty(bu,"__esModule",{value:!0});bu.Explain=bu.ExplainVerbosity=void 0;bu.decorateWithExplain=nQ;bu.ExplainVerbosity=Object.freeze({queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"});class Fp{constructor(e,t){if(typeof e==="boolean")this.verbosity=e?bu.ExplainVerbosity.allPlansExecution:bu.ExplainVerbosity.queryPlanner;else this.verbosity=e;this.maxTimeMS=t}static fromOptions({explain:e}={}){if(e==null)return;if(typeof e==="boolean"||typeof e==="string")return new Fp(e);let{verbosity:t,maxTimeMS:r}=e;return new Fp(t,r)}}bu.Explain=Fp;function nQ(e,t){let{verbosity:r,maxTimeMS:n}=t,s={explain:e,verbosity:r};if(typeof n==="number")s.maxTimeMS=n;return s}});var xt=g(function(mi){Object.defineProperty(mi,"__esModule",{value:!0});mi.AbstractOperation=mi.Aspect=void 0;mi.defineAspects=sQ;var Vb=Te(),Ol=Xr();mi.Aspect={READ_OPERATION:Symbol("READ_OPERATION"),WRITE_OPERATION:Symbol("WRITE_OPERATION"),RETRYABLE:Symbol("RETRYABLE"),EXPLAINABLE:Symbol("EXPLAINABLE"),SKIP_COLLATION:Symbol("SKIP_COLLATION"),CURSOR_CREATING:Symbol("CURSOR_CREATING"),MUST_SELECT_SAME_SERVER:Symbol("MUST_SELECT_SAME_SERVER"),COMMAND_BATCHING:Symbol("COMMAND_BATCHING"),SUPPORTS_RAW_DATA:Symbol("SUPPORTS_RAW_DATA")};class zb{constructor(e={}){this.readPreference=this.hasAspect(mi.Aspect.WRITE_OPERATION)?Ol.ReadPreference.primary:Ol.ReadPreference.fromOptions(e)??Ol.ReadPreference.primary,this.bsonOptions=Vb.resolveBSONOptions(e),this._session=e.session!=null?e.session:void 0,this.options=e,this.bypassPinningCheck=!!e.bypassPinningCheck,this.attemptsMade=0}hasAspect(e){let t=this.constructor;if(t.aspects==null)return!1;return t.aspects.has(e)}get session(){return this._session}set session(e){this._session=e}clearSession(){this._session=void 0}resetBatch(){return!0}get canRetryRead(){return this.hasAspect(mi.Aspect.RETRYABLE)&&this.hasAspect(mi.Aspect.READ_OPERATION)}get canRetryWrite(){return this.hasAspect(mi.Aspect.RETRYABLE)&&this.hasAspect(mi.Aspect.WRITE_OPERATION)}handleOk(e){return e.toObject(this.bsonOptions)}handleError(e){throw e}}mi.AbstractOperation=zb;function sQ(e,t){if(!Array.isArray(t)&&!(t instanceof Set))t=[t];return t=new Set(t),Object.defineProperty(e,"aspects",{value:t,writable:!1}),t}});var fr=g(function(Rp){Object.defineProperty(Rp,"__esModule",{value:!0});Rp.CommandOperation=void 0;var Wb=Cu(),Hb=X(),Np=zE(),Kb=lo(),na=he(),Ip=fs(),Ms=xt();class Gb extends Ms.AbstractOperation{constructor(e,t){super(t);this.options=t??{};let r=t?.dbName||t?.authdb;if(r)this.ns=new na.MongoDBNamespace(r,"$cmd");else this.ns=e?e.s.namespace.withCollection("$cmd"):new na.MongoDBNamespace("admin","$cmd");if(this.readConcern=Kb.ReadConcern.fromOptions(t),this.writeConcern=Ip.WriteConcern.fromOptions(t),this.hasAspect(Ms.Aspect.EXPLAINABLE))this.explain=Np.Explain.fromOptions(t);else if(t?.explain!=null)throw new Hb.MongoInvalidArgumentError('Option "explain" is not supported on this command')}get canRetryWrite(){if(this.hasAspect(Ms.Aspect.EXPLAINABLE))return this.explain==null;return super.canRetryWrite}buildOptions(e){return{...this.options,...this.bsonOptions,timeoutContext:e,readPreference:this.readPreference,session:this.session}}buildCommand(e,t){let r=this.buildCommandDocument(e,t),n=this.session&&this.session.inTransaction();if(this.readConcern&&na.commandSupportsReadConcern(r)&&!n)Object.assign(r,{readConcern:this.readConcern});if(this.writeConcern&&this.hasAspect(Ms.Aspect.WRITE_OPERATION)&&!n)Ip.WriteConcern.apply(r,this.writeConcern);if(this.options.collation&&typeof this.options.collation==="object"&&!this.hasAspect(Ms.Aspect.SKIP_COLLATION))Object.assign(r,{collation:this.options.collation});if(typeof this.options.maxTimeMS==="number")r.maxTimeMS=this.options.maxTimeMS;if(this.options.rawData!=null&&this.hasAspect(Ms.Aspect.SUPPORTS_RAW_DATA)&&na.maxWireVersion(e)>=Wb.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION)r.rawData=this.options.rawData;if(this.hasAspect(Ms.Aspect.EXPLAINABLE)&&this.explain)return Np.decorateWithExplain(r,this.explain);return r}}Rp.CommandOperation=Gb});var GE=g(function(Du){Object.defineProperty(Du,"__esModule",{value:!0});Du.DeleteManyOperation=Du.DeleteOneOperation=Du.DeleteOperation=void 0;Du.makeDeleteStatement=KE;var Yb=ta(),Jb=wt(),sa=X(),Qb=fr(),Nt=xt();class Ef extends Qb.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=Jb.MongoDBResponse,this.options=r,this.ns=e,this.statements=t,this.serializedOperations=n}get commandName(){return"delete"}get canRetryWrite(){if(super.canRetryWrite===!1)return!1;return this.statements.every((e)=>e.limit!=null?e.limit>0:!0)}buildCommandDocument(e,t){let r=this.options,n=typeof r.ordered==="boolean"?r.ordered:!0,s={delete:this.ns.collection,deletes:this.serializedOperations?Yb.makeDocumentSequence("deletes",this.statements,this.serializedOperations):this.statements,ordered:n};if(r.let)s.let=r.let;if(r.comment!==void 0)s.comment=r.comment;return s}}Du.DeleteOperation=Ef;class WE extends Ef{constructor(e,t,r){super(e,[KE(t,{...r,limit:1})],r)}handleOk(e){let t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new sa.MongoServerError(t);if(t.writeErrors)throw new sa.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,deletedCount:t.n}}}Du.DeleteOneOperation=WE;class HE extends Ef{constructor(e,t,r){super(e,[KE(t,r)],r)}handleOk(e){let t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new sa.MongoServerError(t);if(t.writeErrors)throw new sa.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,deletedCount:t.n}}}Du.DeleteManyOperation=HE;function KE(e,t){let r={q:e,limit:typeof t.limit==="number"?t.limit:0};if(t.collation)r.collation=t.collation;if(t.hint)r.hint=t.hint;return r}Nt.defineAspects(Ef,[Nt.Aspect.RETRYABLE,Nt.Aspect.WRITE_OPERATION,Nt.Aspect.SUPPORTS_RAW_DATA]);Nt.defineAspects(WE,[Nt.Aspect.RETRYABLE,Nt.Aspect.WRITE_OPERATION,Nt.Aspect.EXPLAINABLE,Nt.Aspect.SKIP_COLLATION,Nt.Aspect.SUPPORTS_RAW_DATA]);Nt.defineAspects(HE,[Nt.Aspect.WRITE_OPERATION,Nt.Aspect.EXPLAINABLE,Nt.Aspect.SKIP_COLLATION,Nt.Aspect.SUPPORTS_RAW_DATA])});var Sl=g(function(fo){Object.defineProperty(fo,"__esModule",{value:!0});fo.DeprioritizedServers=fo.MIN_SECONDARY_WRITE_WIRE_VERSION=void 0;fo.writableServerSelector=oQ;fo.sameServerSelector=uQ;fo.secondaryWritableServerSelector=aQ;fo.readPreferenceServerSelector=QE;var Io=X(),xp=Xr(),nn=Ds(),iQ=1e4,Xb=90;fo.MIN_SECONDARY_WRITE_WIRE_VERSION=13;class t7{constructor(e){this.deprioritized=new Set;for(let t of e??[])this.add(t)}add({address:e}){this.deprioritized.add(e)}has({address:e}){return this.deprioritized.has(e)}}fo.DeprioritizedServers=t7;function XE(e,t){let r=e.filter((n)=>!t.has(n));return r.length?r:e}function oQ(){return function(t,r,n){let s=XE(r.filter(({isWritable:i})=>i),n);return Tu(t,s)}}function uQ(e){return function(r,n,s){if(!e)return[];return n.filter((i)=>i.address===e.address&&i.type!==nn.ServerType.Unknown)}}function aQ(e,t){if(!t||!e||e&&e<fo.MIN_SECONDARY_WRITE_WIRE_VERSION)return QE(xp.ReadPreference.primary);return QE(t)}function YE(e,t,r){if(e.maxStalenessSeconds==null||e.maxStalenessSeconds<0)return r;let n=e.maxStalenessSeconds,s=(t.heartbeatFrequencyMS+iQ)/1000;if(n<s)throw new Io.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${s} seconds`);if(n<Xb)throw new Io.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${Xb} seconds`);if(t.type===nn.TopologyType.ReplicaSetWithPrimary){let i=Array.from(t.servers.values()).filter(vp)[0];return r.filter((o)=>{let a=(o.lastUpdateTime-o.lastWriteDate-(i.lastUpdateTime-i.lastWriteDate)+t.heartbeatFrequencyMS)/1000,c=e.maxStalenessSeconds??0;return a<=c})}if(t.type===nn.TopologyType.ReplicaSetNoPrimary){if(r.length===0)return r;let i=r.reduce((o,u)=>u.lastWriteDate>o.lastWriteDate?u:o);return r.filter((o)=>{let a=(i.lastWriteDate-o.lastWriteDate+t.heartbeatFrequencyMS)/1000,c=e.maxStalenessSeconds??0;return a<=c})}return r}function cQ(e,t){return Object.entries(e).every(([r,n])=>t[r]!=null&&t[r]===n)}function JE({tags:e},t){if(e==null||e.length===0)return t;for(let r of e){let n=t.filter((s)=>cQ(r,s.tags));if(n.length)return n}return[]}function Tu(e,t){let r=t.reduce((s,i)=>Math.min(i.roundTripTime,s),1/0),n=r+e.localThresholdMS;return t.filter((s)=>s.roundTripTime<=n&&s.roundTripTime>=r)}function vp(e){return e.type===nn.ServerType.RSPrimary}function Zb(e){return e.type===nn.ServerType.RSSecondary}function lQ(e){return e.type===nn.ServerType.RSSecondary||e.type===nn.ServerType.RSPrimary}function e7(e){return e.type!==nn.ServerType.Unknown}function hQ(e){return e.type===nn.ServerType.LoadBalancer}function $p(e){return(t)=>!e.has(t)}function fQ(e,t,r,n){let s=e.mode;switch(s){case"primary":return r.filter(vp);case"primaryPreferred":{let i=r.filter(vp),o=i.filter($p(n));if(o.length)return o;let u=JE(e,YE(e,t,r.filter(Zb))),a=u.filter($p(n));if(a.length)return Tu(t,a);return i.length?i:Tu(t,u)}case"nearest":{let i=XE(JE(e,YE(e,t,r.filter(lQ))),n);return Tu(t,i)}case"secondary":case"secondaryPreferred":{let i=JE(e,YE(e,t,r.filter(Zb))),o=i.filter($p(n));if(o.length)return Tu(t,o);if(s===xp.ReadPreference.SECONDARY_PREFERRED){let u=r.filter(vp),a=u.filter($p(n));if(a.length)return a;return i.length?Tu(t,i):u}return Tu(t,i)}default:{let i=s;throw new Io.MongoRuntimeError(`unexpected readPreference=${s} (should never happen). Please report a bug in the Node driver Jira project.`)}}}function QE(e){if(!e.isValid())throw new Io.MongoInvalidArgumentError("Invalid read preference specified");return function(r,n,s){switch(r.type){case"Single":return Tu(r,n.filter(e7));case"ReplicaSetNoPrimary":case"ReplicaSetWithPrimary":return fQ(e,r,n,s);case"Sharded":{let i=XE(n,s);return Tu(r,i.filter(e7))}case"Unknown":return[];case"LoadBalanced":return n.filter(hQ);default:{let i=r.type;throw new Io.MongoRuntimeError(`unexpected topology type: ${r.type} (this should never happen). Please file a bug in the Node driver Jira project.`)}}}}});var ds=g(function(yi){Object.defineProperty(yi,"__esModule",{value:!0});yi.LegacyTimeoutContext=yi.CSOTTimeoutContext=yi.TimeoutContext=yi.Timeout=yi.TimeoutError=void 0;var kp=require("timers"),Ps=X(),wl=he();class qp extends Error{get name(){return"TimeoutError"}constructor(e,t){super(e,t);this.duration=t.duration}static is(e){return e!=null&&typeof e==="object"&&"name"in e&&e.name==="TimeoutError"}}yi.TimeoutError=qp;class Xs extends Promise{get remainingTime(){if(this.timedOut)return 0;if(this.duration===0)return 1/0;return this.start+this.duration-Math.trunc(performance.now())}get timeElapsed(){return Math.trunc(performance.now())-this.start}constructor(e=()=>null,t){let r=t?.duration??0,n=!!t?.unref,s=t?.rejection;if(r<0)throw new Ps.MongoInvalidArgumentError("Cannot create a Timeout with a negative duration");let i;super((o,u)=>{i=u,e(wl.noop,u)});if(this.ended=null,this.timedOut=!1,this.cleared=!1,this.duration=r,this.start=Math.trunc(performance.now()),s==null&&this.duration>0){if(this.id=kp.setTimeout(()=>{this.ended=Math.trunc(performance.now()),this.timedOut=!0,i(new qp(`Expired after ${r}ms`,{duration:r}))},this.duration),typeof this.id.unref==="function"&&n)this.id.unref()}else if(s!=null)this.ended=Math.trunc(performance.now()),this.timedOut=!0,i(s)}clear(){kp.clearTimeout(this.id),this.id=void 0,this.timedOut=!1,this.cleared=!0}throwIfExpired(){if(this.timedOut)throw this.then(void 0,wl.squashError),new qp("Timed out",{duration:this.duration})}static expires(e,t){return new Xs(void 0,{duration:e,unref:t})}static reject(e){return new Xs(void 0,{duration:0,unref:!0,rejection:e})}}yi.Timeout=Xs;function dQ(e){return e!=null&&typeof e==="object"&&"serverSelectionTimeoutMS"in e&&typeof e.serverSelectionTimeoutMS==="number"&&"waitQueueTimeoutMS"in e&&typeof e.waitQueueTimeoutMS==="number"}class Lp{static create(e){if(e.session?.timeoutContext!=null)return e.session?.timeoutContext;if(dQ(e))return new Up(e);else throw new Ps.MongoRuntimeError("Unrecognized options")}}yi.TimeoutContext=Lp;class jp extends Lp{constructor(e){super();this.minRoundTripTime=0,this.start=Math.trunc(performance.now()),this.timeoutMS=e.timeoutMS,this.serverSelectionTimeoutMS=e.serverSelectionTimeoutMS,this.socketTimeoutMS=e.socketTimeoutMS,this.clearServerSelectionTimeout=!1}get maxTimeMS(){return this.remainingTimeMS-this.minRoundTripTime}get remainingTimeMS(){let e=Math.trunc(performance.now())-this.start;return this.timeoutMS<=0?1/0:this.timeoutMS-e}csotEnabled(){return!0}get serverSelectionTimeout(){if(typeof this._serverSelectionTimeout!=="object"||this._serverSelectionTimeout?.cleared){let{remainingTimeMS:e,serverSelectionTimeoutMS:t}=this;if(e<=0)return Xs.reject(new Ps.MongoOperationTimeoutError(`Timed out in server selection after ${this.timeoutMS}ms`));if(t!==0&&wl.csotMin(e,t)===t)this._serverSelectionTimeout=Xs.expires(t);else if(e>0&&Number.isFinite(e))this._serverSelectionTimeout=Xs.expires(e);else this._serverSelectionTimeout=null}return this._serverSelectionTimeout}get connectionCheckoutTimeout(){if(typeof this._connectionCheckoutTimeout!=="object"||this._connectionCheckoutTimeout?.cleared)if(typeof this._serverSelectionTimeout==="object")this._connectionCheckoutTimeout=this._serverSelectionTimeout;else throw new Ps.MongoRuntimeError("Unreachable. If you are seeing this error, please file a ticket on the NODE driver project on Jira");return this._connectionCheckoutTimeout}get timeoutForSocketWrite(){let{remainingTimeMS:e}=this;if(!Number.isFinite(e))return null;if(e>0)return Xs.expires(e);return Xs.reject(new Ps.MongoOperationTimeoutError("Timed out before socket write"))}get timeoutForSocketRead(){let{remainingTimeMS:e}=this;if(!Number.isFinite(e))return null;if(e>0)return Xs.expires(e);return Xs.reject(new Ps.MongoOperationTimeoutError("Timed out before socket read"))}refresh(){this.start=Math.trunc(performance.now()),this.minRoundTripTime=0,this._serverSelectionTimeout?.clear(),this._connectionCheckoutTimeout?.clear()}clear(){this._serverSelectionTimeout?.clear(),this._connectionCheckoutTimeout?.clear()}getRemainingTimeMSOrThrow(e){let{remainingTimeMS:t}=this;if(t<=0)throw new Ps.MongoOperationTimeoutError(e??`Expired after ${this.timeoutMS}ms`);return t}clone(){let e=new jp({timeoutMS:this.timeoutMS,serverSelectionTimeoutMS:this.serverSelectionTimeoutMS});return e.start=this.start,e}refreshed(){return new jp(this)}addMaxTimeMSToCommand(e,t){if(t.omitMaxTimeMS)return;let r=this.remainingTimeMS-this.minRoundTripTime;if(r>0&&Number.isFinite(r))e.maxTimeMS=r}getSocketTimeoutMS(){return 0}}yi.CSOTTimeoutContext=jp;class Up extends Lp{constructor(e){super();this.options=e,this.clearServerSelectionTimeout=!0}csotEnabled(){return!1}get serverSelectionTimeout(){if(this.options.serverSelectionTimeoutMS!=null&&this.options.serverSelectionTimeoutMS>0)return Xs.expires(this.options.serverSelectionTimeoutMS);return null}get connectionCheckoutTimeout(){if(this.options.waitQueueTimeoutMS!=null&&this.options.waitQueueTimeoutMS>0)return Xs.expires(this.options.waitQueueTimeoutMS);return null}get timeoutForSocketWrite(){return null}get timeoutForSocketRead(){return null}refresh(){return}clear(){return}get maxTimeMS(){return null}refreshed(){return new Up(this.options)}addMaxTimeMSToCommand(e,t){}getSocketTimeoutMS(){return this.options.socketTimeoutMS}}yi.LegacyTimeoutContext=Up});var Af=g(function(wc){Object.defineProperty(wc,"__esModule",{value:!0});wc.AggregateOperation=wc.DB_AGGREGATE_COLLECTION=void 0;var Cl=wt(),r7=X(),n7=fs(),s7=fr(),gi=xt();wc.DB_AGGREGATE_COLLECTION=1;class ZE extends s7.CommandOperation{constructor(e,t,r){super(void 0,{...r,dbName:e.db});if(this.SERVER_COMMAND_RESPONSE_TYPE=Cl.CursorResponse,this.options={...r},this.target=e.collection||wc.DB_AGGREGATE_COLLECTION,this.pipeline=t,this.hasWriteStage=!1,typeof r?.out==="string")this.pipeline=this.pipeline.concat({$out:r.out}),this.hasWriteStage=!0;else if(t.length>0){let n=t[t.length-1];if(n.$out||n.$merge)this.hasWriteStage=!0}if(!this.hasWriteStage)delete this.options.writeConcern;if(r?.cursor!=null&&typeof r.cursor!=="object")throw new r7.MongoInvalidArgumentError("Cursor options must be an object");this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?Cl.ExplainedCursorResponse:Cl.CursorResponse}get commandName(){return"aggregate"}get canRetryRead(){return!this.hasWriteStage}addToPipeline(e){this.pipeline.push(e)}buildCommandDocument(){let e=this.options,t={aggregate:this.target,pipeline:this.pipeline};if(this.hasWriteStage&&this.writeConcern)n7.WriteConcern.apply(t,this.writeConcern);if(e.bypassDocumentValidation===!0)t.bypassDocumentValidation=e.bypassDocumentValidation;if(typeof e.allowDiskUse==="boolean")t.allowDiskUse=e.allowDiskUse;if(e.hint)t.hint=e.hint;if(e.let)t.let=e.let;if(e.comment!==void 0)t.comment=e.comment;if(t.cursor=e.cursor||{},e.batchSize&&!this.hasWriteStage)t.cursor.batchSize=e.batchSize;return t}handleOk(e){return e}}wc.AggregateOperation=ZE;gi.defineAspects(ZE,[gi.Aspect.READ_OPERATION,gi.Aspect.RETRYABLE,gi.Aspect.EXPLAINABLE,gi.Aspect.CURSOR_CREATING,gi.Aspect.SUPPORTS_RAW_DATA])});var Dl=g(function(bl){Object.defineProperty(bl,"__esModule",{value:!0});bl.RunCursorCommandOperation=bl.RunCommandOperation=void 0;var Vp=wt(),i7=xt();class e6 extends i7.AbstractOperation{constructor(e,t,r){super(r);this.SERVER_COMMAND_RESPONSE_TYPE=Vp.MongoDBResponse,this.command=t,this.options=r,this.ns=e.withCollection("$cmd")}get commandName(){return"runCommand"}buildCommand(e,t){return this.command}buildOptions(e){return{...this.options,session:this.session,timeoutContext:e,signal:this.options.signal,readPreference:this.options.readPreference}}}bl.RunCommandOperation=e6;class o7 extends e6{constructor(){super(...arguments);this.SERVER_COMMAND_RESPONSE_TYPE=Vp.CursorResponse}handleOk(e){return e}}bl.RunCursorCommandOperation=o7});var sn=g(function(Mu){Object.defineProperty(Mu,"__esModule",{value:!0});Mu.BASE_BACKOFF_MS=void 0;Mu.executeOperation=mQ;Mu.autoConnect=f7;Mu.calculateBaseBackoffMS=d7;var a7=require("timers/promises"),c7=Cu(),Ie=X(),zp=Xr(),l7=Ds(),ia=Sl(),h7=ds(),oa=he(),Wp=Af(),jr=xt(),Hp=Dl(),pQ=Ie.MONGODB_ERROR_CODES.IllegalOperation,u7="This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.";async function mQ(e,t,r){if(!(t instanceof jr.AbstractOperation))throw new Ie.MongoRuntimeError("This method requires a valid operation instance");let n=e.topology==null?await oa.abortable(f7(e),t.options):e.topology,s=t.session,i;if(s==null)i=Symbol(),s=e.startSession({owner:i,explicit:!1});else if(s.hasEnded)throw new Ie.MongoExpiredSessionError("Use of expired sessions is not permitted");else if(s.snapshotEnabled&&oa.maxWireVersion(n)<c7.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION)throw new Ie.MongoCompatibilityError("Snapshot reads require MongoDB 5.0 or later");else if(s.client!==e)throw new Ie.MongoInvalidArgumentError("ClientSession must be from the same MongoClient");t.session??=s;let o=t.readPreference??zp.ReadPreference.primary,u=!!s?.inTransaction(),a=t.hasAspect(jr.Aspect.READ_OPERATION);if(u&&!o.equals(zp.ReadPreference.primary)&&(a||t.commandName==="runCommand"))throw new Ie.MongoTransactionError(`Read preference in a transaction must be primary, not: ${o.mode}`);if(s?.isPinned&&s.transaction.isCommitted&&!t.bypassPinningCheck)s.unpin();r??=h7.TimeoutContext.create({session:s,serverSelectionTimeoutMS:e.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.s.options.waitQueueTimeoutMS,timeoutMS:t.options.timeoutMS});try{return await gQ(t,{topology:n,timeoutContext:r,session:s,readPreference:o})}finally{if(s?.owner!=null&&s.owner===i)await s.endSession()}}async function f7(e){if(e.topology==null){if(e.s.hasBeenClosed)throw new Ie.MongoNotConnectedError("Client must be connected before running operations");e.s.options.__skipPingOnConnect=!0;try{if(await e.connect(),e.topology==null)throw new Ie.MongoRuntimeError("client.connect did not create a topology but also did not throw");return e.topology}finally{delete e.s.options.__skipPingOnConnect}}return e.topology}Mu.BASE_BACKOFF_MS=100;var yQ=1e4;function d7(e){if(!(e instanceof Ie.MongoServerError))return Mu.BASE_BACKOFF_MS;let t=e.errorResponse.baseBackoffMS,n=typeof t==="number"||typeof t==="bigint"||typeof t==="object"?Number(t):NaN;return Number.isFinite(n)&&n>0?n:Mu.BASE_BACKOFF_MS}async function gQ(e,{topology:t,timeoutContext:r,session:n,readPreference:s}){let i;if(e.hasAspect(jr.Aspect.MUST_SELECT_SAME_SERVER))i=ia.sameServerSelector(e.server?.description);else if(e instanceof Wp.AggregateOperation&&e.hasWriteStage)i=ia.secondaryWritableServerSelector(t.commonWireVersion,s);else i=s;let o=await t.selectServer(i,{session:n,operationName:e.commandName,timeoutContext:r,signal:e.options.signal,deprioritizedServers:new ia.DeprioritizedServers}),u=e.hasAspect(jr.Aspect.READ_OPERATION),a=e.hasAspect(jr.Aspect.WRITE_OPERATION),c=n?.inTransaction()??!1,l=t.s.options.retryReads&&!c&&e.canRetryRead,f=t.s.options.retryWrites&&!c&&oa.supportsRetryableWrites(o)&&e.canRetryWrite,h=e.hasAspect(jr.Aspect.RETRYABLE)&&n!=null&&(u&&l||a&&f);if(a&&f&&n!=null)e.options.willRetryWrite=!0,n.incrementTransactionNumber();let d=new ia.DeprioritizedServers,p=typeof e.maxAttempts==="number"?e.maxAttempts:h?r.csotEnabled()?1/0:2:1,m=null;for(let y=0;y<p;y++){e.attemptsMade=y+1,e.server=o;try{try{let E=await o.command(e,r);return e.handleOk(E)}catch(E){return e.handleError(E)}}catch(E){if(!(E instanceof Ie.MongoError))throw E;if(m==null)m=E;else if(!E.hasErrorLabel(Ie.MongoErrorLabel.NoWritesPerformed))m=E;if(r.clear(),a&&E.code===pQ)throw new Ie.MongoServerError({message:u7,errmsg:u7,originalError:E});if(!_(e,E))throw m;if(E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)){let C=t.s.options.maxAdaptiveRetries+1;p=Math.min(C,e.maxAttempts??C)}if(y+1>=p)throw m;if(E instanceof Ie.MongoNetworkError&&e.hasAspect(jr.Aspect.CURSOR_CREATING)&&n!=null&&n.isPinned&&!n.inTransaction())n.unpin({force:!0,forceClear:!0});if(E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&e.hasAspect(jr.Aspect.CURSOR_CREATING)&&n!=null&&n.isPinned&&!n.inTransaction())n.unpin({force:!0});if(E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)){let C=d7(E),D=Math.random()*Math.min(yQ,C*2**(y+1));if(r.csotEnabled()&&D>r.remainingTimeMS)throw m;await a7.setTimeout(D)}if(t.description.type===l7.TopologyType.Sharded||E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&t.s.options.enableOverloadRetargeting)d.add(o.description);if(o=await t.selectServer(i,{session:n,operationName:e.commandName,deprioritizedServers:d,signal:e.options.signal}),a&&!oa.supportsRetryableWrites(o)&&!E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError))throw new Ie.MongoUnexpectedServerResponseError("Selected server does not support retryable writes");if(e.hasAspect(jr.Aspect.COMMAND_BATCHING))e.resetBatch()}}throw m??new Ie.MongoRuntimeError("Should never happen: operation execution loop terminated but no error was recorded.");function _(y,E){if(E.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&E.hasErrorLabel(Ie.MongoErrorLabel.RetryableError)){if(y instanceof Hp.RunCommandOperation)return t.s.options.retryReads&&t.s.options.retryWrites;if(y instanceof Wp.AggregateOperation&&y.hasWriteStage)return t.s.options.retryWrites;let C=u&&t.s.options.retryReads,D=a&&t.s.options.retryWrites;return C||D}if(y instanceof Hp.RunCommandOperation)return!1;if(y.hasAspect(jr.Aspect.COMMAND_BATCHING))return y.canRetryWrite&&Ie.isRetryableWriteError(E);return a&&f&&Ie.isRetryableWriteError(E)||u&&l&&Ie.isRetryableReadError(E)}}});var r6=g(function(Tl){Object.defineProperty(Tl,"__esModule",{value:!0});Tl.InsertOneOperation=Tl.InsertOperation=void 0;var p7=ta(),m7=wt(),Kp=X(),y7=he(),g7=fr(),jn=xt();class Gp extends g7.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=m7.MongoDBResponse,this.options={...r,checkKeys:r.checkKeys??!1},this.ns=e,this.documents=t,this.serializedOperations=n}get commandName(){return"insert"}buildCommandDocument(e,t){let r=this.options??{},n=typeof r.ordered==="boolean"?r.ordered:!0,s={insert:this.ns.collection,documents:this.serializedOperations?p7.makeDocumentSequence("documents",this.documents,this.serializedOperations):this.documents,ordered:n};if(typeof r.bypassDocumentValidation==="boolean")s.bypassDocumentValidation=r.bypassDocumentValidation;if(r.comment!==void 0)s.comment=r.comment;return s}}Tl.InsertOperation=Gp;class t6 extends Gp{constructor(e,t,r){super(e.s.namespace,[y7.maybeAddIdToDocuments(e,t,r)],r)}handleOk(e){let t=super.handleOk(e);if(t.code)throw new Kp.MongoServerError(t);if(t.writeErrors)throw new Kp.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,insertedId:this.documents[0]._id}}}Tl.InsertOneOperation=t6;jn.defineAspects(Gp,[jn.Aspect.RETRYABLE,jn.Aspect.WRITE_OPERATION,jn.Aspect.SUPPORTS_RAW_DATA]);jn.defineAspects(t6,[jn.Aspect.RETRYABLE,jn.Aspect.WRITE_OPERATION,jn.Aspect.SUPPORTS_RAW_DATA])});var Pl=g(function(n6){Object.defineProperty(n6,"__esModule",{value:!0});n6.formatSort=MQ;var Yp=X();function Ml(e=1){let t=`${e}`.toLowerCase();if(_Q(e))return e;switch(t){case"ascending":case"asc":case"1":return 1;case"descending":case"desc":case"-1":return-1;default:throw new Yp.MongoInvalidArgumentError(`Invalid sort direction: ${JSON.stringify(e)}`)}}function _Q(e){return typeof e==="object"&&e!=null&&"$meta"in e&&typeof e.$meta==="string"}function EQ(e){if(Array.isArray(e)&&e.length===2)try{return Ml(e[1]),!0}catch{return!1}return!1}function AQ(e){return Array.isArray(e)&&Array.isArray(e[0])}function OQ(e){return e instanceof Map&&e.size>0}function SQ(e){return Array.isArray(e)}function wQ(e){return new Map([[`${e[0]}`,Ml(e[1])]])}function CQ(e){let t=e.map(([r,n])=>[`${r}`,Ml(n)]);return new Map(t)}function bQ(e){let t=e.map((r)=>[`${r}`,1]);return new Map(t)}function DQ(e){let t=Object.entries(e).map(([r,n])=>[`${r}`,Ml(n)]);return new Map(t)}function TQ(e){let t=Array.from(e).map(([r,n])=>[`${r}`,Ml(n)]);return new Map(t)}function MQ(e,t){if(e==null)return;if(typeof e==="string")return new Map([[e,Ml(t)]]);if(typeof e!=="object")throw new Yp.MongoInvalidArgumentError(`Invalid sort format: ${JSON.stringify(e)} Sort must be a valid object`);if(!SQ(e)){if(OQ(e))return TQ(e);if(Object.keys(e).length)return DQ(e);return}if(!e.length)return;if(AQ(e))return CQ(e);if(EQ(e))return wQ(e);return bQ(e)}});var u6=g(function(po){Object.defineProperty(po,"__esModule",{value:!0});po.ReplaceOneOperation=po.UpdateManyOperation=po.UpdateOneOperation=po.UpdateOperation=void 0;po.makeUpdateStatement=Jp;var _7=ta(),E7=wt(),gr=X(),A7=Pl(),Bl=he(),O7=fr(),Ue=xt();class Fl extends O7.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=E7.MongoDBResponse,this.options=r,this.ns=e,this.statements=t,this.serializedOperations=n}get commandName(){return"update"}get canRetryWrite(){if(super.canRetryWrite===!1)return!1;return this.statements.every((e)=>e.multi==null||e.multi===!1)}buildCommandDocument(e,t){let r=this.options,n={update:this.ns.collection,updates:this.serializedOperations?_7.makeDocumentSequence("updates",this.statements,this.serializedOperations):this.statements,ordered:r.ordered??!0};if(typeof r.bypassDocumentValidation==="boolean")n.bypassDocumentValidation=r.bypassDocumentValidation;if(r.let)n.let=r.let;if(r.comment!==void 0)n.comment=r.comment;return n}}po.UpdateOperation=Fl;class s6 extends Fl{constructor(e,t,r,n){super(e,[Jp(t,r,{...n,multi:!1})],n);if(!Bl.hasAtomicOperators(r,n))throw new gr.MongoInvalidArgumentError("Update document requires atomic operators")}handleOk(e){let t=super.handleOk(e);if(this.explain!=null)return t;if(t.code)throw new gr.MongoServerError(t);if(t.writeErrors)throw new gr.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}po.UpdateOneOperation=s6;class i6 extends Fl{constructor(e,t,r,n){super(e,[Jp(t,r,{...n,multi:!0})],n);if(!Bl.hasAtomicOperators(r,n))throw new gr.MongoInvalidArgumentError("Update document requires atomic operators")}handleOk(e){let t=super.handleOk(e);if(this.explain!=null)return t;if(t.code)throw new gr.MongoServerError(t);if(t.writeErrors)throw new gr.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}po.UpdateManyOperation=i6;class o6 extends Fl{constructor(e,t,r,n){super(e,[Jp(t,r,{...n,multi:!1})],n);if(Bl.hasAtomicOperators(r))throw new gr.MongoInvalidArgumentError("Replacement document must not contain atomic operators")}handleOk(e){let t=super.handleOk(e);if(this.explain!=null)return t;if(t.code)throw new gr.MongoServerError(t);if(t.writeErrors)throw new gr.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}po.ReplaceOneOperation=o6;function Jp(e,t,r){if(e==null||typeof e!=="object")throw new gr.MongoInvalidArgumentError("Selector must be a valid JavaScript object");if(t==null||typeof t!=="object")throw new gr.MongoInvalidArgumentError("Document must be a valid JavaScript object");let n={q:e,u:t};if(typeof r.upsert==="boolean")n.upsert=r.upsert;if(r.multi)n.multi=r.multi;if(r.hint)n.hint=r.hint;if(r.arrayFilters)n.arrayFilters=r.arrayFilters;if(r.collation)n.collation=r.collation;if(!r.multi&&r.sort!=null)n.sort=A7.formatSort(r.sort);return n}Ue.defineAspects(Fl,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(s6,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.EXPLAINABLE,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(i6,[Ue.Aspect.WRITE_OPERATION,Ue.Aspect.EXPLAINABLE,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(o6,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA])});var Il=g(function(ht){Object.defineProperty(ht,"__esModule",{value:!0});ht.BulkOperationBase=ht.FindOperators=ht.MongoBulkWriteError=ht.WriteError=ht.WriteConcernError=ht.BulkWriteResult=ht.Batch=ht.BatchType=void 0;ht.mergeBatchResults=a6;var Zp=Te(),Qe=X(),Ro=GE(),w7=sn(),C7=r6(),Bs=u6(),b7=ds(),Lr=he(),Qp=fs();ht.BatchType=Object.freeze({INSERT:1,UPDATE:2,DELETE:3});class D7{constructor(e,t){this.originalZeroIndex=t,this.currentIndex=0,this.originalIndexes=[],this.batchType=e,this.operations=[],this.serializedOperations=[],this.size=0,this.sizeBytes=0}}ht.Batch=D7;class Pu{static generateIdMap(e){let t={};for(let r of e)t[r.index]=r._id;return t}constructor(e,t){this.result=e,this.insertedCount=this.result.nInserted??0,this.matchedCount=this.result.nMatched??0,this.modifiedCount=this.result.nModified??0,this.deletedCount=this.result.nRemoved??0,this.upsertedCount=this.result.upserted.length??0,this.upsertedIds=Pu.generateIdMap(this.result.upserted),this.insertedIds=Pu.generateIdMap(this.getSuccessfullyInsertedIds(e,t)),Object.defineProperty(this,"result",{value:this.result,enumerable:!1})}get ok(){return this.result.ok}getSuccessfullyInsertedIds(e,t){if(e.writeErrors.length===0)return e.insertedIds;if(t)return e.insertedIds.slice(0,e.writeErrors[0].index);return e.insertedIds.filter(({index:r})=>!e.writeErrors.some((n)=>r===n.index))}getUpsertedIdAt(e){return this.result.upserted[e]}getRawResponse(){return this.result}hasWriteErrors(){return this.result.writeErrors.length>0}getWriteErrorCount(){return this.result.writeErrors.length}getWriteErrorAt(e){return e<this.result.writeErrors.length?this.result.writeErrors[e]:void 0}getWriteErrors(){return this.result.writeErrors}getWriteConcernError(){if(this.result.writeConcernErrors.length===0)return;else if(this.result.writeConcernErrors.length===1)return this.result.writeConcernErrors[0];else{let e="";for(let t=0;t<this.result.writeConcernErrors.length;t++){let r=this.result.writeConcernErrors[t];if(e=e+r.errmsg,t===0)e=e+" and "}return new Sf({errmsg:e,code:Qe.MONGODB_ERROR_CODES.WriteConcernTimeout})}}toString(){return`BulkWriteResult(${Zp.EJSON.stringify(this.result)})`}isOk(){return this.result.ok===1}}ht.BulkWriteResult=Pu;class Sf{constructor(e){this.serverError=e}get code(){return this.serverError.code}get errmsg(){return this.serverError.errmsg}get errInfo(){return this.serverError.errInfo}toJSON(){return this.serverError}toString(){return`WriteConcernError(${this.errmsg})`}}ht.WriteConcernError=Sf;class Xp{constructor(e){this.err=e}get code(){return this.err.code}get index(){return this.err.index}get errmsg(){return this.err.errmsg}get errInfo(){return this.err.errInfo}getOperation(){return this.err.op}toJSON(){return{code:this.err.code,index:this.err.index,errmsg:this.err.errmsg,op:this.err.op}}toString(){return`WriteError(${JSON.stringify(this.toJSON())})`}}ht.WriteError=Xp;function a6(e,t,r,n){if(r)n=r;else if(n&&n.result)n=n.result;if(n==null)return;if(n.ok===0&&t.ok===1){t.ok=0;let i={index:0,code:n.code||0,errmsg:n.message,errInfo:n.errInfo,op:e.operations[0]};t.writeErrors.push(new Xp(i));return}else if(n.ok===0&&t.ok===0)return;if(M7(e)&&n.n)t.nInserted=t.nInserted+n.n;if(l6(e)&&n.n)t.nRemoved=t.nRemoved+n.n;let s=0;if(Array.isArray(n.upserted)){s=n.upserted.length;for(let i=0;i<n.upserted.length;i++)t.upserted.push({index:n.upserted[i].index+e.originalZeroIndex,_id:n.upserted[i]._id})}else if(n.upserted)s=1,t.upserted.push({index:e.originalZeroIndex,_id:n.upserted});if(c6(e)&&n.n){let i=n.nModified;if(t.nUpserted=t.nUpserted+s,t.nMatched=t.nMatched+(n.n-s),typeof i==="number")t.nModified=t.nModified+i;else t.nModified=0}if(Array.isArray(n.writeErrors))for(let i=0;i<n.writeErrors.length;i++){let o={index:e.originalIndexes[n.writeErrors[i].index],code:n.writeErrors[i].code,errmsg:n.writeErrors[i].errmsg,errInfo:n.writeErrors[i].errInfo,op:e.operations[n.writeErrors[i].index]};t.writeErrors.push(new Xp(o))}if(n.writeConcernError)t.writeConcernErrors.push(new Sf(n.writeConcernError))}async function S7(e,t){if(e.s.batches.length===0)return new Pu(e.s.bulkResult,e.isOrdered);for(let n of e.s.batches){let s=Lr.resolveOptions(e,{...t,ordered:e.isOrdered});if(s.bypassDocumentValidation!==!0)delete s.bypassDocumentValidation;if(e.s.bypassDocumentValidation===!0)s.bypassDocumentValidation=!0;if(e.s.checkKeys===!1)s.checkKeys=!1;if(e.retryWrites){if(c6(n))e.retryWrites=e.retryWrites&&!n.operations.some((h)=>h.multi);if(l6(n))e.retryWrites=e.retryWrites&&!n.operations.some((h)=>h.limit===0)}let i=e.s.bsonOptions,u=!e.s.usingAutoEncryption&&s.ignoreUndefined===i.ignoreUndefined&&s.serializeFunctions===i.serializeFunctions&&(s.checkKeys??!1)===e.s.checkKeys?n.serializedOperations:void 0,a=M7(n)?new C7.InsertOperation(e.s.namespace,n.operations,s,u):c6(n)?new Bs.UpdateOperation(e.s.namespace,n.operations,s,u):l6(n)?new Ro.DeleteOperation(e.s.namespace,n.operations,s,u):null;if(a==null)throw new Qe.MongoRuntimeError(`Unknown batchType: ${n.batchType}`);let c=null,l;try{l=await w7.executeOperation(e.s.collection.client,a,s.timeoutContext)}catch(h){c=h}if(n.serializedOperations=[],c!=null)if(c instanceof Qe.MongoWriteConcernError){a6(n,e.s.bulkResult,c,l);let h=new Pu(e.s.bulkResult,e.isOrdered);throw new Nl({message:c.result.writeConcernError.errmsg,code:c.result.writeConcernError.code},h)}else throw new Nl(c,new Pu(e.s.bulkResult,e.isOrdered));a6(n,e.s.bulkResult,c,l);let f=new Pu(e.s.bulkResult,e.isOrdered);e.handleWriteError(f)}e.s.batches.length=0;let r=new Pu(e.s.bulkResult,e.isOrdered);return e.handleWriteError(r),r}class Nl extends Qe.MongoServerError{constructor(e,t){super(e);if(this.writeErrors=[],e instanceof Sf)this.err=e;else if(!(e instanceof Error))this.message=e.message,this.code=e.code,this.writeErrors=e.writeErrors??[];this.result=t,Object.assign(this,e)}get name(){return"MongoBulkWriteError"}get insertedCount(){return this.result.insertedCount}get matchedCount(){return this.result.matchedCount}get modifiedCount(){return this.result.modifiedCount}get deletedCount(){return this.result.deletedCount}get upsertedCount(){return this.result.upsertedCount}get insertedIds(){return this.result.insertedIds}get upsertedIds(){return this.result.upsertedIds}}ht.MongoBulkWriteError=Nl;class h6{constructor(e){this.bulkOperation=e}update(e){let t=Of(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Bs.makeUpdateStatement(t.selector,e,{...t,multi:!0}))}updateOne(e){if(!Lr.hasAtomicOperators(e,this.bulkOperation.bsonOptions))throw new Qe.MongoInvalidArgumentError("Update document requires atomic operators");let t=Of(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Bs.makeUpdateStatement(t.selector,e,{...t,multi:!1}))}replaceOne(e){if(Lr.hasAtomicOperators(e))throw new Qe.MongoInvalidArgumentError("Replacement document must not use atomic operators");let t=Of(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Bs.makeUpdateStatement(t.selector,e,{...t,multi:!1}))}deleteOne(){let e=Of(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.DELETE,Ro.makeDeleteStatement(e.selector,{...e,limit:1}))}delete(){let e=Of(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.DELETE,Ro.makeDeleteStatement(e.selector,{...e,limit:0}))}upsert(){if(!this.bulkOperation.s.currentOp)this.bulkOperation.s.currentOp={};return this.bulkOperation.s.currentOp.upsert=!0,this}collation(e){if(!this.bulkOperation.s.currentOp)this.bulkOperation.s.currentOp={};return this.bulkOperation.s.currentOp.collation=e,this}arrayFilters(e){if(!this.bulkOperation.s.currentOp)this.bulkOperation.s.currentOp={};return this.bulkOperation.s.currentOp.arrayFilters=e,this}hint(e){if(!this.bulkOperation.s.currentOp)this.bulkOperation.s.currentOp={};return this.bulkOperation.s.currentOp.hint=e,this}}ht.FindOperators=h6;class T7{constructor(e,t,r){this.collection=e,this.retryWrites=e.db.options?.retryWrites,this.isOrdered=r;let n=Lr.getTopology(e);t=t==null?{}:t;let s=e.s.namespace,i=!1,o=void 0,u=n.lastHello(),a=!!(n.s.options&&n.s.options.autoEncrypter),c=u&&u.maxBsonObjectSize?u.maxBsonObjectSize:16777216,l=a?2097152:c,f=u&&u.maxWriteBatchSize?u.maxWriteBatchSize:1000,h=(f-1).toString(10).length+2,d={ok:1,writeErrors:[],writeConcernErrors:[],insertedIds:[],nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[]};if(this.s={bulkResult:d,currentBatch:void 0,currentIndex:0,currentBatchSize:0,currentBatchSizeBytes:0,currentInsertBatch:void 0,currentUpdateBatch:void 0,currentRemoveBatch:void 0,batches:[],writeConcern:Qp.WriteConcern.fromOptions(t),maxBsonObjectSize:c,maxBatchSizeBytes:l,maxWriteBatchSize:f,maxKeySize:h,namespace:s,topology:n,options:t,bsonOptions:Zp.resolveBSONOptions(t),currentOp:o,executed:i,collection:e,err:void 0,checkKeys:typeof t.checkKeys==="boolean"?t.checkKeys:!1,usingAutoEncryption:a},t.bypassDocumentValidation===!0)this.s.bypassDocumentValidation=!0}insert(e){return Lr.maybeAddIdToDocuments(this.collection,e,{forceServerObjectId:this.shouldForceServerObjectId()}),this.addToOperationsList(ht.BatchType.INSERT,e)}find(e){if(!e)throw new Qe.MongoInvalidArgumentError("Bulk find operation must specify a selector");return this.s.currentOp={selector:e},new h6(this)}raw(e){if(e==null||typeof e!=="object")throw new Qe.MongoInvalidArgumentError("Operation must be an object with an operation key");if("insertOne"in e){let t=this.shouldForceServerObjectId(),r=e.insertOne&&e.insertOne.document==null?e.insertOne:e.insertOne.document;return Lr.maybeAddIdToDocuments(this.collection,r,{forceServerObjectId:t}),this.addToOperationsList(ht.BatchType.INSERT,r)}if("replaceOne"in e||"updateOne"in e||"updateMany"in e){if("replaceOne"in e){if("q"in e.replaceOne)throw new Qe.MongoInvalidArgumentError("Raw operations are not allowed");let t=Bs.makeUpdateStatement(e.replaceOne.filter,e.replaceOne.replacement,{...e.replaceOne,multi:!1});if(Lr.hasAtomicOperators(t.u))throw new Qe.MongoInvalidArgumentError("Replacement document must not use atomic operators");return this.addToOperationsList(ht.BatchType.UPDATE,t)}if("updateOne"in e){if("q"in e.updateOne)throw new Qe.MongoInvalidArgumentError("Raw operations are not allowed");let t=Bs.makeUpdateStatement(e.updateOne.filter,e.updateOne.update,{...e.updateOne,multi:!1});if(!Lr.hasAtomicOperators(t.u,this.bsonOptions))throw new Qe.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(ht.BatchType.UPDATE,t)}if("updateMany"in e){if("q"in e.updateMany)throw new Qe.MongoInvalidArgumentError("Raw operations are not allowed");let t=Bs.makeUpdateStatement(e.updateMany.filter,e.updateMany.update,{...e.updateMany,multi:!0});if(!Lr.hasAtomicOperators(t.u,this.bsonOptions))throw new Qe.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(ht.BatchType.UPDATE,t)}}if("deleteOne"in e){if("q"in e.deleteOne)throw new Qe.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(ht.BatchType.DELETE,Ro.makeDeleteStatement(e.deleteOne.filter,{...e.deleteOne,limit:1}))}if("deleteMany"in e){if("q"in e.deleteMany)throw new Qe.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(ht.BatchType.DELETE,Ro.makeDeleteStatement(e.deleteMany.filter,{...e.deleteMany,limit:0}))}throw new Qe.MongoInvalidArgumentError("bulkWrite only supports insertOne, updateOne, updateMany, deleteOne, deleteMany")}get length(){return this.s.currentIndex}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get batches(){let e=[...this.s.batches];if(this.isOrdered){if(this.s.currentBatch)e.push(this.s.currentBatch)}else{if(this.s.currentInsertBatch)e.push(this.s.currentInsertBatch);if(this.s.currentUpdateBatch)e.push(this.s.currentUpdateBatch);if(this.s.currentRemoveBatch)e.push(this.s.currentRemoveBatch)}return e}async execute(e={}){if(this.s.executed)throw new Qe.MongoBatchReExecutionError;let t=Qp.WriteConcern.fromOptions(e);if(t)this.s.writeConcern=t;if(this.isOrdered){if(this.s.currentBatch)this.s.batches.push(this.s.currentBatch)}else{if(this.s.currentInsertBatch)this.s.batches.push(this.s.currentInsertBatch);if(this.s.currentUpdateBatch)this.s.batches.push(this.s.currentUpdateBatch);if(this.s.currentRemoveBatch)this.s.batches.push(this.s.currentRemoveBatch)}if(this.s.batches.length===0)throw new Qe.MongoInvalidArgumentError("Invalid BulkOperation, Batch cannot be empty");this.s.executed=!0;let r=Lr.resolveOptions(this.collection,{...this.s.options,...e});if(r.timeoutContext??=b7.TimeoutContext.create({session:r.session,timeoutMS:r.timeoutMS,serverSelectionTimeoutMS:this.collection.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:this.collection.client.s.options.waitQueueTimeoutMS}),r.session==null)return await this.collection.client.withSession({explicit:!1},async(n)=>await S7(this,{...r,session:n}));return await S7(this,{...r})}handleWriteError(e){if(this.s.bulkResult.writeErrors.length>0){let r=this.s.bulkResult.writeErrors[0].errmsg?this.s.bulkResult.writeErrors[0].errmsg:"write operation failed";throw new Nl({message:r,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors},e)}let t=e.getWriteConcernError();if(t)throw new Nl(t,e)}shouldForceServerObjectId(){return this.s.options.forceServerObjectId===!0||this.s.collection.db.options?.forceServerObjectId===!0}}ht.BulkOperationBase=T7;function M7(e){return e.batchType===ht.BatchType.INSERT}function c6(e){return e.batchType===ht.BatchType.UPDATE}function l6(e){return e.batchType===ht.BatchType.DELETE}function Of(e){let{currentOp:t}=e.s;if(e.s.currentOp=void 0,!t)t={};return t}});var B7=g(function(f0e,P7){var PQ=Il().BulkWriteResult;P7.exports=PQ});var ua=g(function(d0e,F7){/*!
8
+ * Centralize this so we can more easily work around issues with people
9
+ * stubbing out `process.nextTick()` in tests using sinon:
10
+ * https://github.com/sinonjs/lolex#automatically-incrementing-mocked-time
11
+ * See gh-6074
12
+ */var BQ=typeof process<"u"&&typeof process.nextTick==="function"?process.nextTick.bind(process):(e)=>setTimeout(e,0);F7.exports=function(t){return BQ(t)}});var f6=g(function(p0e,I7){/*!
13
+ * Module dependencies.
14
+ */var FQ=require("events").EventEmitter,N7=ua();function vt(e,t,r){if(r===void 0)r={};if(this.opts=r,this.name=e,this.collectionName=e,this.conn=t,this.queue=[],this.buffer=!t?._hasOpened,this.emitter=new FQ,t?._hasOpened)this.onOpen()}vt.prototype.name;vt.prototype.collectionName;vt.prototype.conn;vt.prototype.onOpen=function(){this.buffer=!1,N7(()=>this.doQueue())};vt.prototype.onClose=function(){};vt.prototype.addQueue=function(e,t){return this.queue.push([e,t]),this};vt.prototype.removeQueue=function(e,t){let r=this.queue.findIndex((n)=>n[0]===e&&n[1]===t);if(r===-1)return!1;return this.queue.splice(r,1),!0};vt.prototype.doQueue=function(){for(let t of this.queue)if(typeof t[0]==="function")t[0].apply(this,t[1]);else this[t[0]].apply(this,t[1]);this.queue=[];let e=this;return N7(function(){e.emitter.emit("queue")}),this};vt.prototype.ensureIndex=function(){throw Error("Collection#ensureIndex unimplemented by driver")};vt.prototype.createIndex=function(){throw Error("Collection#createIndex unimplemented by driver")};vt.prototype.findAndModify=function(){throw Error("Collection#findAndModify unimplemented by driver")};vt.prototype.findOneAndUpdate=function(){throw Error("Collection#findOneAndUpdate unimplemented by driver")};vt.prototype.findOneAndDelete=function(){throw Error("Collection#findOneAndDelete unimplemented by driver")};vt.prototype.findOneAndReplace=function(){throw Error("Collection#findOneAndReplace unimplemented by driver")};vt.prototype.findOne=function(){throw Error("Collection#findOne unimplemented by driver")};vt.prototype.find=function(){throw Error("Collection#find unimplemented by driver")};vt.prototype.insert=function(){throw Error("Collection#insert unimplemented by driver")};vt.prototype.insertOne=function(){throw Error("Collection#insertOne unimplemented by driver")};vt.prototype.insertMany=function(){throw Error("Collection#insertMany unimplemented by driver")};vt.prototype.save=function(){throw Error("Collection#save unimplemented by driver")};vt.prototype.updateOne=function(){throw Error("Collection#updateOne unimplemented by driver")};vt.prototype.updateMany=function(){throw Error("Collection#updateMany unimplemented by driver")};vt.prototype.deleteOne=function(){throw Error("Collection#deleteOne unimplemented by driver")};vt.prototype.deleteMany=function(){throw Error("Collection#deleteMany unimplemented by driver")};vt.prototype.getIndexes=function(){throw Error("Collection#getIndexes unimplemented by driver")};vt.prototype.watch=function(){throw Error("Collection#watch unimplemented by driver")};/*!
15
+ * ignore
16
+ */vt.prototype._shouldBufferCommands=function(){let t=this.opts;if(t.bufferCommands!=null)return t.bufferCommands;if(t?.schemaUserProvidedOptions?.bufferCommands!=null)return t.schemaUserProvidedOptions.bufferCommands;return this.conn._shouldBufferCommands()};/*!
17
+ * ignore
18
+ */vt.prototype._getBufferTimeoutMS=function(){let t=this.conn,r=this.opts;if(r.bufferTimeoutMS!=null)return r.bufferTimeoutMS;if(r?.schemaUserProvidedOptions?.bufferTimeoutMS!=null)return r.schemaUserProvidedOptions.bufferTimeoutMS;return t._getBufferTimeoutMS()};/*!
19
+ * Module exports.
20
+ */I7.exports=vt});var ze=g(function(m0e,R7){/*!
21
+ * ignore
22
+ */class d6 extends Error{}Object.defineProperty(d6.prototype,"name",{value:"MongooseError"});R7.exports=d6});var k7=g(function(e0){Object.defineProperty(e0,"__esModule",{value:!0});e0.ListDatabasesOperation=void 0;var $7=wt(),v7=he(),x7=fr(),Rl=xt();class p6 extends x7.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=$7.MongoDBResponse,this.options=t??{},this.ns=new v7.MongoDBNamespace("admin","$cmd")}get commandName(){return"listDatabases"}buildCommandDocument(e,t){let r={listDatabases:1};if(typeof this.options.nameOnly==="boolean")r.nameOnly=this.options.nameOnly;if(this.options.filter)r.filter=this.options.filter;if(typeof this.options.authorizedDatabases==="boolean")r.authorizedDatabases=this.options.authorizedDatabases;if(this.options.comment!==void 0)r.comment=this.options.comment;return r}}e0.ListDatabasesOperation=p6;Rl.defineAspects(p6,[Rl.Aspect.READ_OPERATION,Rl.Aspect.RETRYABLE])});var y6=g(function(r0){Object.defineProperty(r0,"__esModule",{value:!0});r0.RemoveUserOperation=void 0;var q7=wt(),j7=fr(),t0=xt();class m6 extends j7.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=q7.MongoDBResponse,this.options=r,this.username=t}get commandName(){return"dropUser"}buildCommandDocument(e){return{dropUser:this.username}}handleOk(e){return!0}}r0.RemoveUserOperation=m6;t0.defineAspects(m6,[t0.Aspect.WRITE_OPERATION])});var z7=g(function(n0){Object.defineProperty(n0,"__esModule",{value:!0});n0.ValidateCollectionOperation=void 0;var L7=wt(),$l=X(),U7=fr();class V7 extends U7.CommandOperation{constructor(e,t,r){super(e.s.db,r);this.SERVER_COMMAND_RESPONSE_TYPE=L7.MongoDBResponse,this.options=r,this.collectionName=t}get commandName(){return"validate"}buildCommandDocument(e,t){return{validate:this.collectionName,...Object.fromEntries(Object.entries(this.options).filter((r)=>r[0]!=="session"))}}handleOk(e){let t=super.handleOk(e);if(t.result!=null&&typeof t.result!=="string")throw new $l.MongoUnexpectedServerResponseError("Error with validation data");if(t.result!=null&&t.result.match(/exception|corrupt/)!=null)throw new $l.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);if(t.valid!=null&&!t.valid)throw new $l.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);return e}}n0.ValidateCollectionOperation=V7});var g6=g(function(s0){Object.defineProperty(s0,"__esModule",{value:!0});s0.Admin=void 0;var W7=Te(),aa=sn(),H7=k7(),K7=y6(),G7=Dl(),Y7=z7(),J7=he();class Q7{constructor(e){this.s={db:e}}async command(e,t){return await aa.executeOperation(this.s.db.client,new G7.RunCommandOperation(new J7.MongoDBNamespace("admin"),e,{...W7.resolveBSONOptions(t),session:t?.session,readPreference:t?.readPreference,timeoutMS:t?.timeoutMS??this.s.db.timeoutMS}))}async buildInfo(e){return await this.command({buildinfo:1},e)}async serverInfo(e){return await this.command({buildinfo:1},e)}async serverStatus(e){return await this.command({serverStatus:1},e)}async ping(e){return await this.command({ping:1},e)}async removeUser(e,t){return await aa.executeOperation(this.s.db.client,new K7.RemoveUserOperation(this.s.db,e,{dbName:"admin",...t}))}async validateCollection(e,t={}){return await aa.executeOperation(this.s.db.client,new Y7.ValidateCollectionOperation(this,e,t))}async listDatabases(e){return await aa.executeOperation(this.s.db.client,new H7.ListDatabasesOperation(this.s.db,{timeoutMS:this.s.db.timeoutMS,...e}))}async replSetGetStatus(e){return await this.command({replSetGetStatus:1},e)}}s0.Admin=Q7});var _6=g(function(u0){Object.defineProperty(u0,"__esModule",{value:!0});u0.OrderedBulkOperation=void 0;var i0=Te(),o0=X(),ca=Il();class X7 extends ca.BulkOperationBase{constructor(e,t){super(e,t,!0)}addToOperationsList(e,t){let r,n;if(this.s.usingAutoEncryption)n=i0.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});else{let i=this.s.bsonOptions;r=i0.serialize(t,{checkKeys:this.s.checkKeys,ignoreUndefined:i.ignoreUndefined,serializeFunctions:i.serializeFunctions}),n=r.length}if(n>=this.s.maxBsonObjectSize)throw new o0.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);if(this.s.currentBatch==null)this.s.currentBatch=new ca.Batch(e,this.s.currentIndex);let s=this.s.maxKeySize;if(this.s.currentBatchSize+1>=this.s.maxWriteBatchSize||this.s.currentBatchSize>0&&this.s.currentBatchSizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new ca.Batch(e,this.s.currentIndex),this.s.currentBatchSize=0,this.s.currentBatchSizeBytes=0;if(e===ca.BatchType.INSERT)this.s.bulkResult.insertedIds.push({index:this.s.currentIndex,_id:t._id});if(Array.isArray(t))throw new o0.MongoInvalidArgumentError("Operation passed in cannot be an Array");if(this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentBatch.operations.push(t),r!=null)this.s.currentBatch.serializedOperations.push(r);return this.s.currentBatchSize+=1,this.s.currentBatchSizeBytes+=s+n,this.s.currentIndex+=1,this}}u0.OrderedBulkOperation=X7});var E6=g(function(l0){Object.defineProperty(l0,"__esModule",{value:!0});l0.UnorderedBulkOperation=void 0;var a0=Te(),c0=X(),on=Il();class Z7 extends on.BulkOperationBase{constructor(e,t){super(e,t,!1)}handleWriteError(e){if(this.s.batches.length)return;return super.handleWriteError(e)}addToOperationsList(e,t){let r,n;if(this.s.usingAutoEncryption)n=a0.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});else{let i=this.s.bsonOptions;r=a0.serialize(t,{checkKeys:this.s.checkKeys,ignoreUndefined:i.ignoreUndefined,serializeFunctions:i.serializeFunctions}),n=r.length}if(n>=this.s.maxBsonObjectSize)throw new c0.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);if(this.s.currentBatch=void 0,e===on.BatchType.INSERT)this.s.currentBatch=this.s.currentInsertBatch;else if(e===on.BatchType.UPDATE)this.s.currentBatch=this.s.currentUpdateBatch;else if(e===on.BatchType.DELETE)this.s.currentBatch=this.s.currentRemoveBatch;let s=this.s.maxKeySize;if(this.s.currentBatch==null)this.s.currentBatch=new on.Batch(e,this.s.currentIndex);if(this.s.currentBatch.size+1>=this.s.maxWriteBatchSize||this.s.currentBatch.size>0&&this.s.currentBatch.sizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new on.Batch(e,this.s.currentIndex);if(Array.isArray(t))throw new c0.MongoInvalidArgumentError("Operation passed in cannot be an Array");if(this.s.currentBatch.operations.push(t),r!=null)this.s.currentBatch.serializedOperations.push(r);if(this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentIndex=this.s.currentIndex+1,e===on.BatchType.INSERT)this.s.currentInsertBatch=this.s.currentBatch,this.s.bulkResult.insertedIds.push({index:this.s.currentIndex-1,_id:t._id});else if(e===on.BatchType.UPDATE)this.s.currentUpdateBatch=this.s.currentBatch;else if(e===on.BatchType.DELETE)this.s.currentRemoveBatch=this.s.currentBatch;return this.s.currentBatch.size+=1,this.s.currentBatch.sizeBytes+=s+n,this}}l0.UnorderedBulkOperation=Z7});var fa=g(function(Ye){Object.defineProperty(Ye,"__esModule",{value:!0});Ye.MongoLogger=Ye.MongoLoggableComponent=Ye.SEVERITY_LEVEL_MAP=Ye.DEFAULT_MAX_DOCUMENT_LENGTH=Ye.SeverityLevel=void 0;Ye.parseSeverityFromString=S6;Ye.createStdioLogger=Cc;Ye.stringifyWithMaxLen=ha;Ye.defaultLogTransform=r8;var _i=require("process"),e8=require("util"),f0=Te(),Me=Br(),Fs=he();Ye.SeverityLevel=Object.freeze({EMERGENCY:"emergency",ALERT:"alert",CRITICAL:"critical",ERROR:"error",WARNING:"warn",NOTICE:"notice",INFORMATIONAL:"info",DEBUG:"debug",TRACE:"trace",OFF:"off"});Ye.DEFAULT_MAX_DOCUMENT_LENGTH=1000;class t8 extends Map{constructor(e){let t=[];for(let[r,n]of e)t.push([n,r]);t.push(...e);super(t)}getNumericSeverityLevel(e){return this.get(e)}getSeverityLevelName(e){return this.get(e)}}Ye.SEVERITY_LEVEL_MAP=new t8([[Ye.SeverityLevel.OFF,-1/0],[Ye.SeverityLevel.EMERGENCY,0],[Ye.SeverityLevel.ALERT,1],[Ye.SeverityLevel.CRITICAL,2],[Ye.SeverityLevel.ERROR,3],[Ye.SeverityLevel.WARNING,4],[Ye.SeverityLevel.NOTICE,5],[Ye.SeverityLevel.INFORMATIONAL,6],[Ye.SeverityLevel.DEBUG,7],[Ye.SeverityLevel.TRACE,8]]);Ye.MongoLoggableComponent=Object.freeze({COMMAND:"command",TOPOLOGY:"topology",SERVER_SELECTION:"serverSelection",CONNECTION:"connection",CLIENT:"client"});function S6(e){let t=Object.values(Ye.SeverityLevel),r=e?.toLowerCase();if(r!=null&&t.includes(r))return r;return null}function Cc(e){return{write:(t)=>new Promise((r,n)=>{let s=e8.inspect(t,{compact:!0,breakLength:1/0});e.write(`${s}
23
+ `,"utf-8",(i)=>{if(i)return n(i);r(!0)})})}}function NQ({MONGODB_LOG_PATH:e},{mongodbLogPath:t}){if(typeof t==="string"&&/^stderr$/i.test(t))return{mongodbLogPath:Cc(_i.stderr),mongodbLogPathIsStdErr:!0};if(typeof t==="string"&&/^stdout$/i.test(t))return{mongodbLogPath:Cc(_i.stdout),mongodbLogPathIsStdErr:!1};if(typeof t==="object"&&typeof t?.write==="function")return{mongodbLogPath:t,mongodbLogPathIsStdErr:!1};if(e&&/^stderr$/i.test(e))return{mongodbLogPath:Cc(_i.stderr),mongodbLogPathIsStdErr:!0};if(e&&/^stdout$/i.test(e))return{mongodbLogPath:Cc(_i.stdout),mongodbLogPathIsStdErr:!1};return{mongodbLogPath:Cc(_i.stderr),mongodbLogPathIsStdErr:!0}}function vl(e,t,r){return S6(e)??S6(t)??r}function IQ(e,t){let r=Ye.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(e),n=Ye.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(t);return r<n?-1:r>n?1:0}function ha(e,t,r={}){let n="",s=0,i=function(u,a){if(s>=t)return;if(u==="")return s+=1,a;if(s+=u.length+4,a==null)return a;switch(typeof a){case"string":s+=a.length+2;break;case"number":case"bigint":s+=String(a).length;break;case"boolean":s+=a?4:5;break;case"object":if(Fs.isUint8Array(a))s+=22+a.byteLength+a.byteLength*0.33+18|0;else if("_bsontype"in a){let c=a;switch(c._bsontype){case"Int32":s+=String(c.value).length;break;case"Double":s+=(c.value|0)===c.value?String(c.value).length+2:String(c.value).length;break;case"Long":s+=c.toString().length;break;case"ObjectId":s+=35;break;case"MaxKey":case"MinKey":s+=13;break;case"Binary":s+=22+a.position+a.position*0.33+18|0;break;case"Timestamp":s+=19+String(c.t).length+5+String(c.i).length+2;break;case"Code":if(c.scope==null)s+=c.code.length+10+2;else s+=c.code.length+10+11;break;case"BSONRegExp":s+=34+c.pattern.length+13+c.options.length+3;break}}}return a};if(typeof e==="string")n=e;else if(typeof e==="function")n=e.name;else try{if(t!==0)n=f0.EJSON.stringify(e,i,0,r);else n=f0.EJSON.stringify(e,r)}catch(o){n=`Extended JSON serialization failed with: ${o.message}`}if(t!==0&&n.length>t&&n.charCodeAt(t-1)!==n.codePointAt(t-1)){if(t--,t===0)return""}return t!==0&&n.length>t?`${n.slice(0,t)}...`:n}function RQ(e){let t=e;return t.toLog!==void 0&&typeof t.toLog==="function"}function h0(e,t,r=Ye.DEFAULT_MAX_DOCUMENT_LENGTH){let{selector:n,operation:s,topologyDescription:i,message:o}=t;return e.selector=ha(n,r),e.operation=s,e.topologyDescription=ha(i,r),e.message=o,e}function A6(e,t){e.commandName=t.commandName,e.requestId=t.requestId,e.driverConnectionId=t.connectionId;let{host:r,port:n}=Fs.HostAddress.fromString(t.address).toHostPort();if(e.serverHost=r,e.serverPort=n,t?.serviceId)e.serviceId=t.serviceId.toHexString();return e.databaseName=t.databaseName,e.serverConnectionId=t.serverConnectionId,e}function Zs(e,t){let{host:r,port:n}=Fs.HostAddress.fromString(t.address).toHostPort();return e.serverHost=r,e.serverPort=n,e}function la(e,t){return e.topologyId=t.topologyId,e}function O6(e,t){let{awaited:r,connectionId:n}=t;e.awaited=r,e.driverConnectionId=t.connectionId;let{host:s,port:i}=Fs.HostAddress.fromString(n).toHostPort();return e.serverHost=s,e.serverPort=i,e}function r8(e,t=Ye.DEFAULT_MAX_DOCUMENT_LENGTH){let r=Object.create(null);switch(e.name){case Me.SERVER_SELECTION_STARTED:return r=h0(r,e,t),r;case Me.SERVER_SELECTION_FAILED:return r=h0(r,e,t),r.failure=e.failure?.message,r;case Me.SERVER_SELECTION_SUCCEEDED:return r=h0(r,e,t),r.serverHost=e.serverHost,r.serverPort=e.serverPort,r;case Me.WAITING_FOR_SUITABLE_SERVER:return r=h0(r,e,t),r.remainingTimeMS=e.remainingTimeMS,r;case Me.COMMAND_STARTED:return r=A6(r,e),r.message="Command started",r.command=ha(e.command,t,{relaxed:!0}),r.databaseName=e.databaseName,r;case Me.COMMAND_SUCCEEDED:return r=A6(r,e),r.message="Command succeeded",r.durationMS=e.duration,r.reply=ha(e.reply,t,{relaxed:!0}),r;case Me.COMMAND_FAILED:return r=A6(r,e),r.message="Command failed",r.durationMS=e.duration,r.failure=e.failure?.message??"(redacted)",r;case Me.CONNECTION_POOL_CREATED:if(r=Zs(r,e),r.message="Connection pool created",e.options){let{maxIdleTimeMS:n,minPoolSize:s,maxPoolSize:i,maxConnecting:o,waitQueueTimeoutMS:u}=e.options;r={...r,maxIdleTimeMS:n,minPoolSize:s,maxPoolSize:i,maxConnecting:o,waitQueueTimeoutMS:u}}return r;case Me.CONNECTION_POOL_READY:return r=Zs(r,e),r.message="Connection pool ready",r;case Me.CONNECTION_POOL_CLEARED:if(r=Zs(r,e),r.message="Connection pool cleared",e.serviceId?._bsontype==="ObjectId")r.serviceId=e.serviceId?.toHexString();return r;case Me.CONNECTION_POOL_CLOSED:return r=Zs(r,e),r.message="Connection pool closed",r;case Me.CONNECTION_CREATED:return r=Zs(r,e),r.message="Connection created",r.driverConnectionId=e.connectionId,r;case Me.CONNECTION_READY:return r=Zs(r,e),r.message="Connection ready",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case Me.CONNECTION_CLOSED:switch(r=Zs(r,e),r.message="Connection closed",r.driverConnectionId=e.connectionId,e.reason){case"stale":r.reason="Connection became stale because the pool was cleared";break;case"idle":r.reason="Connection has been available but unused for longer than the configured max idle time";break;case"error":if(r.reason="An error occurred while using the connection",e.error)r.error=e.error;break;case"poolClosed":r.reason="Connection pool was closed";break;default:r.reason=`Unknown close reason: ${e.reason}`}return r;case Me.CONNECTION_CHECK_OUT_STARTED:return r=Zs(r,e),r.message="Connection checkout started",r;case Me.CONNECTION_CHECK_OUT_FAILED:switch(r=Zs(r,e),r.message="Connection checkout failed",e.reason){case"poolClosed":r.reason="Connection pool was closed";break;case"timeout":r.reason="Wait queue timeout elapsed without a connection becoming available";break;case"connectionError":if(r.reason="An error occurred while trying to establish a new connection",e.error)r.error=e.error;break;default:r.reason=`Unknown close reason: ${e.reason}`}return r.durationMS=e.durationMS,r;case Me.CONNECTION_CHECKED_OUT:return r=Zs(r,e),r.message="Connection checked out",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case Me.CONNECTION_CHECKED_IN:return r=Zs(r,e),r.message="Connection checked in",r.driverConnectionId=e.connectionId,r;case Me.SERVER_OPENING:return r=la(r,e),r=Zs(r,e),r.message="Starting server monitoring",r;case Me.SERVER_CLOSED:return r=la(r,e),r=Zs(r,e),r.message="Stopped server monitoring",r;case Me.SERVER_HEARTBEAT_STARTED:return r=la(r,e),r=O6(r,e),r.message="Server heartbeat started",r;case Me.SERVER_HEARTBEAT_SUCCEEDED:return r=la(r,e),r=O6(r,e),r.message="Server heartbeat succeeded",r.durationMS=e.duration,r.serverConnectionId=e.serverConnectionId,r.reply=ha(e.reply,t,{relaxed:!0}),r;case Me.SERVER_HEARTBEAT_FAILED:return r=la(r,e),r=O6(r,e),r.message="Server heartbeat failed",r.durationMS=e.duration,r.failure=e.failure?.message,r;case Me.TOPOLOGY_OPENING:return r=la(r,e),r.message="Starting topology monitoring",r;case Me.TOPOLOGY_CLOSED:return r=la(r,e),r.message="Stopped topology monitoring",r;case Me.TOPOLOGY_DESCRIPTION_CHANGED:return r=la(r,e),r.message="Topology description changed",r.previousDescription=r.reply=ha(e.previousDescription,t),r.newDescription=r.reply=ha(e.newDescription,t),r;default:for(let[n,s]of Object.entries(e))if(s!=null)r[n]=s}return r}class n8{constructor(e){this.pendingLog=null,this.error=this.log.bind(this,"error"),this.warn=this.log.bind(this,"warn"),this.info=this.log.bind(this,"info"),this.debug=this.log.bind(this,"debug"),this.trace=this.log.bind(this,"trace"),this.componentSeverities=e.componentSeverities,this.maxDocumentLength=e.maxDocumentLength,this.logDestination=e.logDestination,this.logDestinationIsStdErr=e.logDestinationIsStdErr,this.severities=this.createLoggingSeverities()}createLoggingSeverities(){let e=Object();for(let t of Object.values(Ye.MongoLoggableComponent)){e[t]={};for(let r of Object.values(Ye.SeverityLevel))e[t][r]=IQ(r,this.componentSeverities[t])<=0}return e}turnOffSeverities(){for(let e of Object.values(Ye.MongoLoggableComponent)){this.componentSeverities[e]=Ye.SeverityLevel.OFF;for(let t of Object.values(Ye.SeverityLevel))this.severities[e][t]=!1}}logWriteFailureHandler(e){if(this.logDestinationIsStdErr){this.turnOffSeverities(),this.clearPendingLog();return}this.logDestination=Cc(_i.stderr),this.logDestinationIsStdErr=!0,this.clearPendingLog(),this.error(Ye.MongoLoggableComponent.CLIENT,{toLog:function(){return{message:"User input for mongodbLogPath is now invalid. Logging is halted.",error:e.message}}}),this.turnOffSeverities(),this.clearPendingLog()}clearPendingLog(){this.pendingLog=null}willLog(e,t){if(t===Ye.SeverityLevel.OFF)return!1;return this.severities[e][t]}log(e,t,r){if(!this.willLog(t,e))return;let n={t:new Date,c:t,s:e};if(typeof r==="string")n.message=r;else if(typeof r==="object")if(RQ(r))n={...n,...r.toLog()};else n={...n,...r8(r,this.maxDocumentLength)};if(Fs.isPromiseLike(this.pendingLog)){this.pendingLog=this.pendingLog.then(()=>this.logDestination.write(n)).then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this));return}try{let s=this.logDestination.write(n);if(Fs.isPromiseLike(s))this.pendingLog=s.then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this))}catch(s){this.logWriteFailureHandler(s)}}static resolveOptions(e,t){let r=NQ(e,t),n={...e,...t,mongodbLogPath:r.mongodbLogPath,mongodbLogPathIsStdErr:r.mongodbLogPathIsStdErr},s=vl(n.mongodbLogComponentSeverities?.default,n.MONGODB_LOG_ALL,Ye.SeverityLevel.OFF);return{componentSeverities:{command:vl(n.mongodbLogComponentSeverities?.command,n.MONGODB_LOG_COMMAND,s),topology:vl(n.mongodbLogComponentSeverities?.topology,n.MONGODB_LOG_TOPOLOGY,s),serverSelection:vl(n.mongodbLogComponentSeverities?.serverSelection,n.MONGODB_LOG_SERVER_SELECTION,s),connection:vl(n.mongodbLogComponentSeverities?.connection,n.MONGODB_LOG_CONNECTION,s),client:vl(n.mongodbLogComponentSeverities?.client,n.MONGODB_LOG_CLIENT,s),default:s},maxDocumentLength:n.mongodbLogMaxDocumentLength??Fs.parseUnsignedInteger(n.MONGODB_LOG_MAX_DOCUMENT_LENGTH)??1000,logDestination:n.mongodbLogPath,logDestinationIsStdErr:n.mongodbLogPathIsStdErr}}}Ye.MongoLogger=n8});var ei=g(function(xl){Object.defineProperty(xl,"__esModule",{value:!0});xl.CancellationToken=xl.TypedEventEmitter=void 0;var s8=require("events"),i8=fa(),o8=he();class w6 extends s8.EventEmitter{emitAndLog(e,...t){if(this.emit(e,...t),this.component)this.mongoLogger?.debug(this.component,t[0])}emitAndLogHeartbeat(e,t,r,...n){if(this.emit(e,...n),this.component){let s={topologyId:t,serverConnectionId:r??null,...n[0]};this.mongoLogger?.debug(this.component,s)}}emitAndLogCommand(e,t,r,n,...s){if(e)this.emit(t,...s);if(n){let i={databaseName:r,...s[0]};this.mongoLogger?.debug(i8.MongoLoggableComponent.COMMAND,i)}}}xl.TypedEventEmitter=w6;class u8 extends w6{constructor(...e){super(...e);this.on("error",o8.noop)}}xl.CancellationToken=u8});var b6=g(function(p0){Object.defineProperty(p0,"__esModule",{value:!0});p0.GetMoreOperation=void 0;var a8=wt(),d0=X(),da=xt();class C6 extends da.AbstractOperation{constructor(e,t,r,n){super(n);this.SERVER_COMMAND_RESPONSE_TYPE=a8.CursorResponse,this.options=n,this.ns=e,this.cursorId=t,this.server=r}get commandName(){return"getMore"}buildCommand(e){if(this.cursorId==null||this.cursorId.isZero())throw new d0.MongoRuntimeError("Unable to iterate cursor with no id");let t=this.ns.collection;if(t==null)throw new d0.MongoRuntimeError("A collection name must be determined before getMore");let r={getMore:this.cursorId,collection:t};if(typeof this.options.batchSize==="number")r.batchSize=Math.abs(this.options.batchSize);if(typeof this.options.maxAwaitTimeMS==="number")r.maxTimeMS=this.options.maxAwaitTimeMS;if(this.options.comment!==void 0)r.comment=this.options.comment;return r}buildOptions(e){return{returnFieldSelector:null,documentsReturnedIn:"nextBatch",timeoutContext:e,...this.options}}handleOk(e){return e}}p0.GetMoreOperation=C6;da.defineAspects(C6,[da.Aspect.READ_OPERATION,da.Aspect.MUST_SELECT_SAME_SERVER])});var h8=g(function(m0){Object.defineProperty(m0,"__esModule",{value:!0});m0.KillCursorsOperation=void 0;var c8=wt(),l8=X(),kl=xt();class D6 extends kl.AbstractOperation{constructor(e,t,r,n){super(n);this.SERVER_COMMAND_RESPONSE_TYPE=c8.MongoDBResponse,this.ns=t,this.cursorId=e,this.server=r}get commandName(){return"killCursors"}buildCommand(e,t){let r=this.ns.collection;if(r==null)throw new l8.MongoRuntimeError("A collection name must be determined before killCursors");return{killCursors:r,cursors:[this.cursorId]}}buildOptions(e){return{session:this.session,timeoutContext:e}}handleError(e){}}m0.KillCursorsOperation=D6;kl.defineAspects(D6,[kl.Aspect.MUST_SELECT_SAME_SERVER])});var T6=g(function(y0){Object.defineProperty(y0,"__esModule",{value:!0});y0.ConnectionPoolMetrics=void 0;class ql{constructor(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}static{this.TXN="txn"}static{this.CURSOR="cursor"}static{this.OTHER="other"}markPinned(e){if(e===ql.TXN)this.txnConnections+=1;else if(e===ql.CURSOR)this.cursorConnections+=1;else this.otherConnections+=1}markUnpinned(e){if(e===ql.TXN)this.txnConnections-=1;else if(e===ql.CURSOR)this.cursorConnections-=1;else this.otherConnections-=1}info(e){return`Timed out while checking out a connection from connection pool: maxPoolSize: ${e}, connections in use by cursors: ${this.cursorConnections}, connections in use by transactions: ${this.txnConnections}, connections in use by other operations: ${this.otherConnections}`}reset(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}}y0.ConnectionPoolMetrics=ql});var M6=g(function(We){Object.defineProperty(We,"__esModule",{value:!0});We.Transaction=We.TxnState=void 0;We.isTransactionCommand=kQ;var g0=X(),f8=lo(),d8=Xr(),p8=fs();We.TxnState=Object.freeze({NO_TRANSACTION:"NO_TRANSACTION",STARTING_TRANSACTION:"STARTING_TRANSACTION",TRANSACTION_IN_PROGRESS:"TRANSACTION_IN_PROGRESS",TRANSACTION_COMMITTED:"TRANSACTION_COMMITTED",TRANSACTION_COMMITTED_EMPTY:"TRANSACTION_COMMITTED_EMPTY",TRANSACTION_ABORTED:"TRANSACTION_ABORTED"});var $Q={[We.TxnState.NO_TRANSACTION]:[We.TxnState.NO_TRANSACTION,We.TxnState.STARTING_TRANSACTION],[We.TxnState.STARTING_TRANSACTION]:[We.TxnState.TRANSACTION_IN_PROGRESS,We.TxnState.TRANSACTION_COMMITTED,We.TxnState.TRANSACTION_COMMITTED_EMPTY,We.TxnState.TRANSACTION_ABORTED],[We.TxnState.TRANSACTION_IN_PROGRESS]:[We.TxnState.TRANSACTION_IN_PROGRESS,We.TxnState.TRANSACTION_COMMITTED,We.TxnState.TRANSACTION_ABORTED],[We.TxnState.TRANSACTION_COMMITTED]:[We.TxnState.TRANSACTION_COMMITTED,We.TxnState.TRANSACTION_COMMITTED_EMPTY,We.TxnState.STARTING_TRANSACTION,We.TxnState.NO_TRANSACTION],[We.TxnState.TRANSACTION_ABORTED]:[We.TxnState.STARTING_TRANSACTION,We.TxnState.NO_TRANSACTION],[We.TxnState.TRANSACTION_COMMITTED_EMPTY]:[We.TxnState.TRANSACTION_COMMITTED_EMPTY,We.TxnState.NO_TRANSACTION]},vQ=new Set([We.TxnState.STARTING_TRANSACTION,We.TxnState.TRANSACTION_IN_PROGRESS]),xQ=new Set([We.TxnState.TRANSACTION_COMMITTED,We.TxnState.TRANSACTION_COMMITTED_EMPTY,We.TxnState.TRANSACTION_ABORTED]);class m8{constructor(e){e=e??{},this.state=We.TxnState.NO_TRANSACTION,this.options={};let t=p8.WriteConcern.fromOptions(e);if(t){if(t.w===0)throw new g0.MongoTransactionError("Transactions do not support unacknowledged write concern");this.options.writeConcern=t}if(e.readConcern)this.options.readConcern=f8.ReadConcern.fromOptions(e);if(e.readPreference)this.options.readPreference=d8.ReadPreference.fromOptions(e);if(e.maxCommitTimeMS)this.options.maxTimeMS=e.maxCommitTimeMS;this._pinnedServer=void 0,this._recoveryToken=void 0}get server(){return this._pinnedServer}get recoveryToken(){return this._recoveryToken}get isPinned(){return!!this.server}get isStarting(){return this.state===We.TxnState.STARTING_TRANSACTION}get isActive(){return vQ.has(this.state)}get isCommitted(){return xQ.has(this.state)}transition(e){let t=$Q[this.state];if(t&&t.includes(e)){if(this.state=e,this.state===We.TxnState.NO_TRANSACTION||this.state===We.TxnState.STARTING_TRANSACTION||this.state===We.TxnState.TRANSACTION_ABORTED)this.unpinServer();return}throw new g0.MongoRuntimeError(`Attempted illegal state transition from [${this.state}] to [${e}]`)}pinServer(e){if(this.isActive)this._pinnedServer=e}unpinServer(){this._pinnedServer=void 0}}We.Transaction=m8;function kQ(e){return!!(e.commitTransaction||e.abortTransaction)}});var wf=g(function(mo){Object.defineProperty(mo,"__esModule",{value:!0});mo.ServerSessionPool=mo.ServerSession=mo.ClientSession=void 0;mo.maybeClearPinnedConnection=_0;mo.applySession=jQ;mo.updateSessionFromResponse=LQ;var _8=require("timers/promises"),Ai=Te(),ma=T6(),E0=Br(),V=X(),E8=ei(),pa=sn(),jl=Dl(),A8=lo(),Ll=Xr(),Ul=Ds(),pe=M6(),Ct=he(),Ei=fs();class B6 extends E8.TypedEventEmitter{constructor(e,t,r,n){super();if(this.timeoutContext=null,this.on("error",Ct.noop),e==null)throw new V.MongoRuntimeError("ClientSession requires a MongoClient");if(t==null||!(t instanceof F6))throw new V.MongoRuntimeError("ClientSession requires a ServerSessionPool");if(r=r??{},this.snapshotEnabled=r.snapshot===!0,r.causalConsistency===!0&&this.snapshotEnabled)throw new V.MongoInvalidArgumentError('Properties "causalConsistency" and "snapshot" are mutually exclusive');this.client=e,this.sessionPool=t,this.hasEnded=!1,this.clientOptions=n,this.explicit=!!r.explicit,this._serverSession=this.explicit?this.sessionPool.acquire():null,this.txnNumberIncrement=0;let s=this.explicit&&r.snapshot!==!0;this.supports={causalConsistency:r.causalConsistency??s},this.clusterTime=r.initialClusterTime,this.operationTime=void 0,this.owner=r.owner,this.defaultTransactionOptions={...r.defaultTransactionOptions},this.transaction=new pe.Transaction}get id(){return this.serverSession?.id}get serverSession(){let e=this._serverSession;if(e==null){if(this.explicit)throw new V.MongoRuntimeError("Unexpected null serverSession for an explicit session");if(this.hasEnded)throw new V.MongoRuntimeError("Unexpected null serverSession for an ended implicit session");e=this.sessionPool.acquire(),this._serverSession=e}return e}get loadBalanced(){return this.client.topology?.description.type===Ul.TopologyType.LoadBalanced}pin(e){if(this.pinnedConnection)throw TypeError("Cannot pin multiple connections to the same session");this.pinnedConnection=e,e.emit(E0.PINNED,this.inTransaction()?ma.ConnectionPoolMetrics.TXN:ma.ConnectionPoolMetrics.CURSOR)}unpin(e){if(this.loadBalanced)return _0(this,e);this.transaction.unpinServer()}get isPinned(){return this.loadBalanced?!!this.pinnedConnection:this.transaction.isPinned}async endSession(e){try{if(this.inTransaction())await this.abortTransaction({...e,throwTimeout:!0})}catch(t){if(t.name==="MongoOperationTimeoutError")throw t;Ct.squashError(t)}finally{if(!this.hasEnded){let t=this.serverSession;if(t!=null)this.sessionPool.release(t),this._serverSession=new O0(t);this.hasEnded=!0,this.emit("ended",this)}_0(this,{force:!0,...e})}}async[Symbol.asyncDispose](){await this.endSession({force:!0})}advanceOperationTime(e){if(this.operationTime==null){this.operationTime=e;return}if(e.greaterThan(this.operationTime))this.operationTime=e}advanceClusterTime(e){if(!e||typeof e!=="object")throw new V.MongoInvalidArgumentError("input cluster time must be an object");if(!e.clusterTime||e.clusterTime._bsontype!=="Timestamp")throw new V.MongoInvalidArgumentError('input cluster time "clusterTime" property must be a valid BSON Timestamp');if(!e.signature||e.signature.hash?._bsontype!=="Binary"||typeof e.signature.keyId!=="bigint"&&typeof e.signature.keyId!=="number"&&e.signature.keyId?._bsontype!=="Long")throw new V.MongoInvalidArgumentError('input cluster time must have a valid "signature" property with BSON Binary hash and BSON Long keyId');Ul._advanceClusterTime(this,e)}equals(e){if(!(e instanceof B6))return!1;if(this.id==null||e.id==null)return!1;return Ai.ByteUtils.equals(this.id.id.buffer,e.id.id.buffer)}incrementTransactionNumber(){this.txnNumberIncrement+=1}inTransaction(){return this.transaction.isActive}startTransaction(e){if(this.snapshotEnabled)throw new V.MongoCompatibilityError("Transactions are not supported in snapshot sessions");if(this.inTransaction())throw new V.MongoTransactionError("Transaction already in progress");if(this.isPinned&&this.transaction.isCommitted)this.unpin();this.commitAttempted=!1,this.incrementTransactionNumber(),this.transaction=new pe.Transaction({readConcern:e?.readConcern??this.defaultTransactionOptions.readConcern??this.clientOptions?.readConcern,writeConcern:e?.writeConcern??this.defaultTransactionOptions.writeConcern??this.clientOptions?.writeConcern,readPreference:e?.readPreference??this.defaultTransactionOptions.readPreference??this.clientOptions?.readPreference,maxCommitTimeMS:e?.maxCommitTimeMS??this.defaultTransactionOptions.maxCommitTimeMS}),this.transaction.transition(pe.TxnState.STARTING_TRANSACTION)}async commitTransaction(e){if(this.transaction.state===pe.TxnState.NO_TRANSACTION)throw new V.MongoTransactionError("No transaction started");if(this.transaction.state===pe.TxnState.STARTING_TRANSACTION||this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED_EMPTY){this.transaction.transition(pe.TxnState.TRANSACTION_COMMITTED_EMPTY);return}if(this.transaction.state===pe.TxnState.TRANSACTION_ABORTED)throw new V.MongoTransactionError("Cannot call commitTransaction after calling abortTransaction");let t={commitTransaction:1},r=this.transaction.options.writeConcern??this.clientOptions?.writeConcern;if(r!=null)if(this.timeoutContext==null)Ei.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...r});else{let s=Object.keys(r);if(s.length>2||!s.includes("wtimeoutMS")&&!s.includes("wTimeoutMS"))Ei.WriteConcern.apply(t,{...r,wtimeoutMS:void 0})}if(this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED||this.commitAttempted)if(this.timeoutContext==null)Ei.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"});else Ei.WriteConcern.apply(t,{w:"majority",...r,wtimeoutMS:void 0});if(typeof this.transaction.options.maxTimeMS==="number")t.maxTimeMS=this.transaction.options.maxTimeMS;if(this.transaction.recoveryToken)t.recoveryToken=this.transaction.recoveryToken;let n=new jl.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Ll.ReadPreference.primary,bypassPinningCheck:!0});n.maxAttempts=this.clientOptions.maxAdaptiveRetries+1;try{await pa.executeOperation(this.client,n),this.commitAttempted=void 0;return}catch(s){this.commitAttempted=!0;let i=this.clientOptions.maxAdaptiveRetries+1-n.attemptsMade;if(i<=0)throw s;if(s instanceof V.MongoError&&V.isRetryableWriteError(s)){Ei.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"}),this.unpin({force:!0});try{let o=new jl.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Ll.ReadPreference.primary,bypassPinningCheck:!0});o.maxAttempts=i,await pa.executeOperation(this.client,o);return}catch(o){if(g8(o))o.addErrorLabel(V.MongoErrorLabel.UnknownTransactionCommitResult);if(y8(o))this.unpin({error:o});throw o}}if(g8(s))s.addErrorLabel(V.MongoErrorLabel.UnknownTransactionCommitResult);if(y8(s))this.unpin({error:s});throw s}finally{this.transaction.transition(pe.TxnState.TRANSACTION_COMMITTED)}}async abortTransaction(e){if(this.transaction.state===pe.TxnState.NO_TRANSACTION)throw new V.MongoTransactionError("No transaction started");if(this.transaction.state===pe.TxnState.STARTING_TRANSACTION){this.transaction.transition(pe.TxnState.TRANSACTION_ABORTED);return}if(this.transaction.state===pe.TxnState.TRANSACTION_ABORTED)throw new V.MongoTransactionError("Cannot call abortTransaction twice");if(this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED||this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED_EMPTY)throw new V.MongoTransactionError("Cannot call abortTransaction after calling commitTransaction");let t={abortTransaction:1},r=this.transaction.options.writeConcern??this.clientOptions?.writeConcern;if(r!=null)Ei.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...r});if(this.transaction.recoveryToken)t.recoveryToken=this.transaction.recoveryToken;let n=new jl.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Ll.ReadPreference.primary,bypassPinningCheck:!0});try{await pa.executeOperation(this.client,n),this.unpin();return}catch(s){if(this.unpin(),s.name==="MongoRuntimeError")throw s;if(e?.throwTimeout&&s.name==="MongoOperationTimeoutError")throw s;if(s instanceof V.MongoError&&V.isRetryableWriteError(s))try{await pa.executeOperation(this.client,n);return}catch(i){if(i.name==="MongoRuntimeError")throw i;if(e?.throwTimeout&&i.name==="MongoOperationTimeoutError")throw i}}finally{if(this.transaction.transition(pe.TxnState.TRANSACTION_ABORTED),this.loadBalanced)_0(this,{force:!1})}}toBSON(){throw new V.MongoRuntimeError("ClientSession cannot be serialized to BSON.")}async withTransaction(e,t){let n=!!this.timeoutContext?.csotEnabled(),s=this.timeoutContext?.csotEnabled()?this.timeoutContext.remainingTimeMS:120000,i=Ct.processTimeMS()+s,o=!1,u,a=null;try{e:for(let c=0,l=!1;!o;++c,l=c>0){if(l){let m=Math.random()*Math.min(5*1.5**c,500);if(Ct.processTimeMS()+m>=i)throw P6(a??new V.MongoRuntimeError("Transaction retry did not record an error: should never occur. Please file a bug."),n);await _8.setTimeout(m)}this.startTransaction(t);try{let f=e(this);if(!Ct.isPromiseLike(f))throw new V.MongoInvalidArgumentError("Function provided to `withTransaction` must return a Promise");if(u=await f,this.transaction.state===pe.TxnState.NO_TRANSACTION||this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED||this.transaction.state===pe.TxnState.TRANSACTION_ABORTED)return u}catch(f){if(!(f instanceof V.MongoError)||f instanceof V.MongoInvalidArgumentError)throw await this.abortTransaction(),f;if(a=f,this.transaction.state===pe.TxnState.STARTING_TRANSACTION||this.transaction.state===pe.TxnState.TRANSACTION_IN_PROGRESS)await this.abortTransaction();if(f.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError)){if(Ct.processTimeMS()>=i)throw P6(a,n);continue e}throw f}t:while(!o)try{await this.commitTransaction(),o=!0}catch(f){if(a=f,f.hasErrorLabel(V.MongoErrorLabel.UnknownTransactionCommitResult)&&!A0(f)){if(Ct.processTimeMS()>=i)throw P6(f,n);continue t}if(f.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))continue e;throw f}}return u}finally{this.timeoutContext=null}}}mo.ClientSession=B6;function P6(e,t){if(e instanceof V.MongoOperationTimeoutError)return e;if(t){let r=new V.MongoOperationTimeoutError("Timed out during withTransaction",{cause:e});if(e instanceof V.MongoError)for(let n of e.errorLabels)r.addErrorLabel(n);return r}return e}var qQ=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function y8(e){if(e instanceof V.MongoError){if(V.isRetryableWriteError(e)||e instanceof V.MongoWriteConcernError||A0(e)){if(O8(e))return!0}else if(e.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))return!0}return!1}function g8(e){let t=V.isRetryableWriteError(e);return t||=e instanceof V.MongoWriteConcernError,t||=A0(e),t&&=O8(e),t}function O8(e){let t=e instanceof V.MongoServerError&&e.codeName&&qQ.has(e.codeName);return A0(e)||!t&&e.code!==V.MONGODB_ERROR_CODES.UnsatisfiableWriteConcern&&e.code!==V.MONGODB_ERROR_CODES.UnknownReplWriteConcern}function _0(e,t){let r=e.pinnedConnection,n=t?.error;if(e.inTransaction()&&n&&n instanceof V.MongoError&&n.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))return;let s=e.client.topology;if(r&&s!=null){let o=Array.from(s.s.servers.values())[0];if(t?.error==null||t?.force){if(o.pool.checkIn(r),e.pinnedConnection=void 0,r.emit(E0.UNPINNED,e.transaction.state!==pe.TxnState.NO_TRANSACTION?ma.ConnectionPoolMetrics.TXN:ma.ConnectionPoolMetrics.CURSOR),t?.forceClear)o.pool.clear({serviceId:r.serviceId})}}}function A0(e){if(e==null||!(e instanceof V.MongoServerError))return!1;return e.code===V.MONGODB_ERROR_CODES.MaxTimeMSExpired||e.writeConcernError?.code===V.MONGODB_ERROR_CODES.MaxTimeMSExpired}class O0{constructor(e){if(e!=null){let t=Ai.ByteUtils.allocateUnsafe(16);t.set(e.id.id.buffer),this.id={id:new Ai.Binary(t,e.id.id.sub_type)},this.lastUse=e.lastUse,this.txnNumber=e.txnNumber,this.isDirty=e.isDirty;return}this.id={id:new Ai.Binary(Ct.uuidV4(),Ai.Binary.SUBTYPE_UUID)},this.lastUse=Ct.processTimeMS(),this.txnNumber=0,this.isDirty=!1}hasTimedOut(e){return Math.round(Ct.calculateDurationInMs(this.lastUse)%86400000%3600000/60000)>e-1}}mo.ServerSession=O0;class F6{constructor(e){if(e==null)throw new V.MongoRuntimeError("ServerSessionPool requires a MongoClient");this.client=e,this.sessions=new Ct.List}acquire(){let e=this.client.topology?.logicalSessionTimeoutMinutes??10,t=null;while(this.sessions.length>0){let r=this.sessions.shift();if(r!=null&&(!!this.client.topology?.loadBalanced||!r.hasTimedOut(e))){t=r;break}}if(t==null)t=new O0;return t}release(e){let t=this.client.topology?.logicalSessionTimeoutMinutes??10;if(this.client.topology?.loadBalanced&&!t)this.sessions.unshift(e);if(!t)return;if(this.sessions.prune((r)=>r.hasTimedOut(t)),!e.hasTimedOut(t)){if(e.isDirty)return;this.sessions.unshift(e)}}}mo.ServerSessionPool=F6;function jQ(e,t,r){if(e.hasEnded)return new V.MongoExpiredSessionError;let n=e.serverSession;if(n==null)return new V.MongoRuntimeError("Unable to acquire server session");if(r.writeConcern?.w===0){if(e&&e.explicit)return new V.MongoAPIError("Cannot have explicit session with unacknowledged writes");return}n.lastUse=Ct.processTimeMS(),t.lsid=n.id;let s=e.inTransaction()||pe.isTransactionCommand(t);if(!!r.willRetryWrite||s)n.txnNumber+=e.txnNumberIncrement,e.txnNumberIncrement=0,t.txnNumber=Ai.Long.fromNumber(n.txnNumber);if(!s){if(e.transaction.state!==pe.TxnState.NO_TRANSACTION)e.transaction.transition(pe.TxnState.NO_TRANSACTION);if(e.supports.causalConsistency&&e.operationTime&&Ct.commandSupportsAfterClusterTime(t))t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime});else if(e.snapshotEnabled){if(t.readConcern=t.readConcern||{level:A8.ReadConcernLevel.snapshot},e.snapshotTime!=null)Object.assign(t.readConcern,{atClusterTime:e.snapshotTime})}return}if(t.autocommit=!1,e.transaction.state===pe.TxnState.STARTING_TRANSACTION){t.startTransaction=!0;let o=e.transaction.options.readConcern||e?.clientOptions?.readConcern;if(o)t.readConcern=o;if(e.supports.causalConsistency&&e.operationTime)t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime})}return}function LQ(e,t){if(t.$clusterTime)Ul._advanceClusterTime(e,t.$clusterTime);if(t.operationTime&&e&&e.supports.causalConsistency)e.advanceOperationTime(t.operationTime);if(t.recoveryToken&&e&&e.inTransaction())e.transaction._recoveryToken=t.recoveryToken;if(e?.snapshotEnabled&&e.snapshotTime==null){let r=t.atClusterTime;if(r)e.snapshotTime=r}if(e.transaction.state===pe.TxnState.STARTING_TRANSACTION){if(t.ok===1)e.transaction.transition(pe.TxnState.TRANSACTION_IN_PROGRESS);else if(!new V.MongoServerError(t.toObject()).hasErrorLabel(V.MongoErrorLabel.RetryableError))e.transaction.transition(pe.TxnState.TRANSACTION_IN_PROGRESS)}}});var Ns=g(function(un){Object.defineProperty(un,"__esModule",{value:!0});un.CursorTimeoutContext=un.AbstractCursor=un.CursorTimeoutMode=un.CURSOR_FLAGS=void 0;var w8=require("stream"),Oi=Te(),bt=X(),C8=ei(),S0=sn(),b8=b6(),D8=h8(),w0=lo(),ya=Xr(),T8=wf(),Vl=ds(),Kt=he();un.CURSOR_FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];function S8(){this.client.s.activeCursors.delete(this)}un.CursorTimeoutMode=Object.freeze({ITERATION:"iteration",LIFETIME:"cursorLifetime"});class M8 extends C8.TypedEventEmitter{static{this.CLOSE="close"}constructor(e,t,r={}){super();if(this.documents=null,this.hasEmittedClose=!1,this.on("error",Kt.noop),r.timeoutMS=void 0,r.timeoutMode=void 0,!e.s.isMongoClient)throw new bt.MongoRuntimeError("Cursor must be constructed with MongoClient");this.cursorClient=e,this.cursorNamespace=t,this.cursorId=null,this.initialized=!1,this.isClosed=!1,this.isKilled=!1,this.cursorOptions={readPreference:r.readPreference&&r.readPreference instanceof ya.ReadPreference?r.readPreference:ya.ReadPreference.primary,...Oi.pluckBSONSerializeOptions(r),tailable:r.tailable,awaitData:r.awaitData};let n=w0.ReadConcern.fromOptions(r);if(n)this.cursorOptions.readConcern=n;if(typeof r.batchSize==="number")this.cursorOptions.batchSize=r.batchSize;if(r.comment!==void 0)this.cursorOptions.comment=r.comment;if(typeof r.maxTimeMS==="number")this.cursorOptions.maxTimeMS=r.maxTimeMS;if(typeof r.maxAwaitTimeMS==="number")this.cursorOptions.maxAwaitTimeMS=r.maxAwaitTimeMS;this.cursorSession=r.session??null,this.deserializationOptions={...this.cursorOptions,validation:{utf8:r?.enableUtf8Validation===!1?!1:!0}},this.timeoutContext=r.timeoutContext,this.signal=r.signal,this.abortListener=Kt.addAbortListener(this.signal,()=>void this.close().then(void 0,Kt.squashError)),this.trackCursor()}get id(){return this.cursorId??void 0}get isDead(){return(this.cursorId?.isZero()??!1)||this.isClosed||this.isKilled}get client(){return this.cursorClient}get server(){return this.selectedServer}get namespace(){return this.cursorNamespace}get readPreference(){return this.cursorOptions.readPreference}get readConcern(){return this.cursorOptions.readConcern}get session(){return this.cursorSession}set session(e){this.cursorSession=e}get closed(){return this.isClosed&&(this.documents?.length??0)===0}get killed(){return this.isKilled}get loadBalanced(){return!!this.cursorClient.topology?.loadBalanced}async[Symbol.asyncDispose](){await this.close()}trackCursor(){if(this.cursorClient.s.activeCursors.add(this),!this.listeners("close").includes(S8))this.once("close",S8)}bufferedCount(){return this.documents?.length??0}readBufferedDocuments(e){let t=[],r=Math.min(e??this.documents?.length??0,this.documents?.length??0);for(let n=0;n<r;n++){let s=this.documents?.shift(this.deserializationOptions);if(s!=null)t.push(s)}return t}async*[Symbol.asyncIterator](){if(this.signal?.throwIfAborted(),this.closed)return;try{while(!0){if(this.isKilled)return;if(this.closed)return;if(this.cursorId!=null&&this.isDead&&(this.documents?.length??0)===0)return;let e=await this.next();if(e===null)return;yield e,this.signal?.throwIfAborted()}}finally{if(!this.isClosed)try{await this.close()}catch(e){Kt.squashError(e)}}}stream(){let e=new P8(this),t=Kt.addAbortListener(this.signal,function(){e.destroy(this.reason)});return e.once("end",()=>{t?.[Kt.kDispose]()}),e}async hasNext(){if(this.signal?.throwIfAborted(),this.cursorId===Oi.Long.ZERO)return!1;if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION&&this.cursorId!=null)this.timeoutContext?.refresh();try{do{if((this.documents?.length??0)!==0)return!0;await this.fetchBatch()}while(!this.isDead||(this.documents?.length??0)!==0)}finally{if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION)this.timeoutContext?.clear()}return!1}async next(){if(this.signal?.throwIfAborted(),this.cursorId===Oi.Long.ZERO)throw new bt.MongoCursorExhaustedError;if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION&&this.cursorId!=null)this.timeoutContext?.refresh();try{do{let e=this.documents?.shift(this.deserializationOptions);if(e!=null){if(this.transform!=null)return await this.transformDocument(e);return e}await this.fetchBatch()}while(!this.isDead||(this.documents?.length??0)!==0)}finally{if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION)this.timeoutContext?.clear()}return null}async tryNext(){if(this.signal?.throwIfAborted(),this.cursorId===Oi.Long.ZERO)throw new bt.MongoCursorExhaustedError;if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION&&this.cursorId!=null)this.timeoutContext?.refresh();try{let e=this.documents?.shift(this.deserializationOptions);if(e!=null){if(this.transform!=null)return await this.transformDocument(e);return e}if(await this.fetchBatch(),e=this.documents?.shift(this.deserializationOptions),e!=null){if(this.transform!=null)return await this.transformDocument(e);return e}}finally{if(this.cursorOptions.timeoutMode===un.CursorTimeoutMode.ITERATION)this.timeoutContext?.clear()}return null}async forEach(e){if(this.signal?.throwIfAborted(),typeof e!=="function")throw new bt.MongoInvalidArgumentError('Argument "iterator" must be a function');for await(let t of this)if(e(t)===!1)break}async close(e){await this.cleanup()}async toArray(){this.signal?.throwIfAborted();let e=[];for await(let t of this){e.push(t);let r=this.readBufferedDocuments();if(this.transform!=null)for(let n of r)e.push(await this.transformDocument(n));else for(let n of r)e.push(n)}return e}addCursorFlag(e,t){if(this.throwIfInitialized(),!un.CURSOR_FLAGS.includes(e))throw new bt.MongoInvalidArgumentError(`Flag ${e} is not one of ${un.CURSOR_FLAGS}`);if(typeof t!=="boolean")throw new bt.MongoInvalidArgumentError(`Flag ${e} must be a boolean value`);return this.cursorOptions[e]=t,this}map(e){this.throwIfInitialized();let t=this.transform;if(t)this.transform=(r)=>e(t(r));else this.transform=e;return this}withReadPreference(e){if(this.throwIfInitialized(),e instanceof ya.ReadPreference)this.cursorOptions.readPreference=e;else if(typeof e==="string")this.cursorOptions.readPreference=ya.ReadPreference.fromString(e);else throw new bt.MongoInvalidArgumentError(`Invalid read preference: ${e}`);return this}withReadConcern(e){this.throwIfInitialized();let t=w0.ReadConcern.fromOptions({readConcern:e});if(t)this.cursorOptions.readConcern=t;return this}maxTimeMS(e){if(this.throwIfInitialized(),typeof e!=="number")throw new bt.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this.cursorOptions.maxTimeMS=e,this}batchSize(e){if(this.throwIfInitialized(),this.cursorOptions.tailable)throw new bt.MongoTailableCursorError("Tailable cursor does not support batchSize");if(typeof e!=="number")throw new bt.MongoInvalidArgumentError('Operation "batchSize" requires an integer');return this.cursorOptions.batchSize=e,this}rewind(){if(this.timeoutContext&&this.timeoutContext.owner!==this)throw new bt.MongoAPIError("Cannot rewind cursor that does not own its timeout context.");if(!this.initialized)return;if(this.cursorId=null,this.documents?.clear(),this.timeoutContext?.clear(),this.timeoutContext=void 0,this.isClosed=!1,this.isKilled=!1,this.initialized=!1,this.hasEmittedClose=!1,this.trackCursor(),this.cursorSession?.explicit===!1){if(!this.cursorSession.hasEnded)this.cursorSession.endSession().then(void 0,Kt.squashError);this.cursorSession=null}}async getMore(){if(this.cursorId==null)throw new bt.MongoRuntimeError("Unexpected null cursor id. A cursor creating command should have set this");if(this.selectedServer==null)throw new bt.MongoRuntimeError("Unexpected null selectedServer. A cursor creating command should have set this");if(this.cursorSession==null)throw new bt.MongoRuntimeError("Unexpected null session. A cursor creating command should have set this");let e={...this.cursorOptions,session:this.cursorSession,batchSize:this.cursorOptions.batchSize},t=new b8.GetMoreOperation(this.cursorNamespace,this.cursorId,this.selectedServer,e);return await S0.executeOperation(this.cursorClient,t,this.timeoutContext)}async cursorInit(){if(this.cursorOptions.timeoutMS!=null)this.timeoutContext??=new Cf(Vl.TimeoutContext.create({serverSelectionTimeoutMS:this.client.s.options.serverSelectionTimeoutMS,timeoutMS:this.cursorOptions.timeoutMS}),this);try{this.cursorSession??=this.cursorClient.startSession({owner:this,explicit:!1});let e=await this._initialize(this.cursorSession);this.cursorOptions.omitMaxTimeMS=this.cursorOptions.timeoutMS!=null;let t=e.response;this.selectedServer=e.server,this.cursorId=t.id,this.cursorNamespace=t.ns??this.namespace,this.documents=t,this.initialized=!0}catch(e){throw this.initialized=!0,await this.cleanup(void 0,e),e}if(this.isDead)await this.cleanup();return}async fetchBatch(){if(this.isClosed)return;if(this.isDead){await this.cleanup();return}if(this.cursorId==null){if(await this.cursorInit(),(this.documents?.length??0)!==0||this.isDead)return}try{let e=await this.getMore();this.cursorId=e.id,this.documents=e}catch(e){try{await this.cleanup(void 0,e)}catch(t){Kt.squashError(t)}throw e}if(this.isDead)await this.cleanup()}async cleanup(e,t){this.abortListener?.[Kt.kDispose](),this.isClosed=!0;let r=()=>{if(e!=null)return this.timeoutContext?.clear(),new Cf(Vl.TimeoutContext.create({serverSelectionTimeoutMS:this.client.s.options.serverSelectionTimeoutMS,timeoutMS:e}),this);else return this.timeoutContext?.refreshed()};await(async(i)=>{try{await i()}finally{this.emitClose()}})(async()=>{let i=this.cursorSession;if(!i)return;try{if(!this.isKilled&&this.cursorId&&!this.cursorId.isZero()&&this.cursorNamespace&&this.selectedServer&&!i.hasEnded){this.isKilled=!0;let o=this.cursorId;this.cursorId=Oi.Long.ZERO,await S0.executeOperation(this.cursorClient,new D8.KillCursorsOperation(o,this.cursorNamespace,this.selectedServer,{session:i}),r())}}catch(o){Kt.squashError(o)}finally{if(i.owner===this)await i.endSession({error:t});if(!i.inTransaction())T8.maybeClearPinnedConnection(i,{error:t})}})}emitClose(){try{if(!this.hasEmittedClose&&((this.documents?.length??0)===0||this.isClosed))this.emit("close")}finally{this.hasEmittedClose=!0}}async transformDocument(e){if(this.transform==null)return e;try{let t=this.transform(e);if(t===null)throw new bt.MongoAPIError("Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.");return t}catch(t){try{await this.close()}catch(r){Kt.squashError(r)}throw t}}throwIfInitialized(){if(this.initialized)throw new bt.MongoCursorInUseError}}un.AbstractCursor=M8;class P8 extends w8.Readable{constructor(e){super({objectMode:!0,autoDestroy:!1,highWaterMark:1});this._readInProgress=!1,this._cursor=e}_read(e){if(!this._readInProgress)this._readInProgress=!0,this._readNext()}_destroy(e,t){this._cursor.close().then(()=>t(e),(r)=>t(r))}_readNext(){if(this._cursor.id===Oi.Long.ZERO){this.push(null);return}this._cursor.next().then((e)=>{if(e==null)this.push(null);else if(this.destroyed)this._cursor.close().then(void 0,Kt.squashError);else{if(this.push(e))return this._readNext();this._readInProgress=!1}},(e)=>{if(e.message.match(/server is closed/))return this._cursor.close().then(void 0,Kt.squashError),this.push(null);if(e.message.match(/operation was interrupted/))return this.push(null);return this.destroy(e)}).catch((e)=>{this._readInProgress=!1,this.destroy(e)})}}class Cf extends Vl.TimeoutContext{constructor(e,t){super();this.timeoutContext=e,this.owner=t}get serverSelectionTimeout(){return this.timeoutContext.serverSelectionTimeout}get connectionCheckoutTimeout(){return this.timeoutContext.connectionCheckoutTimeout}get clearServerSelectionTimeout(){return this.timeoutContext.clearServerSelectionTimeout}get timeoutForSocketWrite(){return this.timeoutContext.timeoutForSocketWrite}get timeoutForSocketRead(){return this.timeoutContext.timeoutForSocketRead}csotEnabled(){return this.timeoutContext.csotEnabled()}refresh(){if(typeof this.owner!=="symbol")return this.timeoutContext.refresh()}clear(){if(typeof this.owner!=="symbol")return this.timeoutContext.clear()}get maxTimeMS(){return this.timeoutContext.maxTimeMS}get timeoutMS(){return this.timeoutContext.csotEnabled()?this.timeoutContext.timeoutMS:null}refreshed(){return new Cf(this.timeoutContext.refreshed(),this.owner)}addMaxTimeMSToCommand(e,t){this.timeoutContext.addMaxTimeMSToCommand(e,t)}getSocketTimeoutMS(){return this.timeoutContext.getSocketTimeoutMS()}}un.CursorTimeoutContext=Cf});var b0=g(function(C0){Object.defineProperty(C0,"__esModule",{value:!0});C0.ExplainableCursor=void 0;var B8=Ns();class F8 extends B8.AbstractCursor{resolveExplainTimeoutOptions(e,t){let r,n;if(e==null&&t==null)r=void 0,n=void 0;else if(e!=null&&t==null)r=typeof e!=="object"?e:("verbosity"in e)?e:void 0,n=typeof e==="object"&&"timeoutMS"in e?e:void 0;else r=e,n=t;return{timeout:n,explain:r}}}C0.ExplainableCursor=F8});var bf=g(function(B0){Object.defineProperty(B0,"__esModule",{value:!0});B0.AggregationCursor=void 0;var D0=X(),T0=Af(),M0=sn(),N8=he(),P0=Ns(),I8=b0();class N6 extends I8.ExplainableCursor{constructor(e,t,r=[],n={}){super(e,t,n);this.pipeline=r,this.aggregateOptions=n;let s=this.pipeline[this.pipeline.length-1];if(this.cursorOptions.timeoutMS!=null&&this.cursorOptions.timeoutMode===P0.CursorTimeoutMode.ITERATION&&(s?.$merge!=null||s?.$out!=null))throw new D0.MongoAPIError("Cannot use $out or $merge stage with ITERATION timeoutMode")}clone(){let e=N8.mergeOptions({},this.aggregateOptions);return delete e.session,new N6(this.client,this.namespace,this.pipeline,{...e})}map(e){return super.map(e)}async _initialize(e){let t={...this.aggregateOptions,...this.cursorOptions,session:e,signal:this.signal},r=new T0.AggregateOperation(this.namespace,this.pipeline,t),n=await M0.executeOperation(this.client,r,this.timeoutContext);return{server:r.server,session:e,response:n}}async explain(e,t){let{explain:r,timeout:n}=this.resolveExplainTimeoutOptions(e,t);return(await M0.executeOperation(this.client,new T0.AggregateOperation(this.namespace,this.pipeline,{...this.aggregateOptions,...this.cursorOptions,...n,explain:r??!0}))).shift(this.deserializationOptions)}addStage(e){if(this.throwIfInitialized(),this.cursorOptions.timeoutMS!=null&&this.cursorOptions.timeoutMode===P0.CursorTimeoutMode.ITERATION&&(e.$out!=null||e.$merge!=null))throw new D0.MongoAPIError("Cannot use $out or $merge stage with ITERATION timeoutMode");return this.pipeline.push(e),this}group(e){return this.addStage({$group:e})}limit(e){return this.addStage({$limit:e})}match(e){return this.addStage({$match:e})}out(e){return this.addStage({$out:e})}project(e){return this.addStage({$project:e})}lookup(e){return this.addStage({$lookup:e})}redact(e){return this.addStage({$redact:e})}skip(e){return this.addStage({$skip:e})}sort(e){return this.addStage({$sort:e})}unwind(e){return this.addStage({$unwind:e})}geoNear(e){return this.addStage({$geoNear:e})}}B0.AggregationCursor=N6});var R6=g(function(F0){Object.defineProperty(F0,"__esModule",{value:!0});F0.CountOperation=void 0;var R8=wt(),$8=fr(),ga=xt();class I6 extends $8.CommandOperation{constructor(e,t,r){super({s:{namespace:e}},r);this.SERVER_COMMAND_RESPONSE_TYPE=R8.MongoDBResponse,this.options=r,this.collectionName=e.collection,this.query=t}get commandName(){return"count"}buildCommandDocument(e,t){let r=this.options,n={count:this.collectionName,query:this.query};if(typeof r.limit==="number")n.limit=r.limit;if(typeof r.skip==="number")n.skip=r.skip;if(r.hint!=null)n.hint=r.hint;if(typeof r.maxTimeMS==="number")n.maxTimeMS=r.maxTimeMS;return n}handleOk(e){return e.getNumber("n")??0}}F0.CountOperation=I6;ga.defineAspects(I6,[ga.Aspect.READ_OPERATION,ga.Aspect.RETRYABLE,ga.Aspect.SUPPORTS_RAW_DATA])});var j8=g(function(N0){Object.defineProperty(N0,"__esModule",{value:!0});N0.FindOperation=void 0;var zl=wt(),v8=X(),x8=Pl(),k8=he(),q8=fr(),Si=xt();class $6 extends q8.CommandOperation{constructor(e,t={},r={}){super(void 0,r);if(this.SERVER_COMMAND_RESPONSE_TYPE=zl.CursorResponse,this.options={...r},delete this.options.writeConcern,this.ns=e,typeof t!=="object"||Array.isArray(t))throw new v8.MongoInvalidArgumentError("Query filter must be a plain object or ObjectId");this.filter=t!=null&&t._bsontype==="ObjectId"?{_id:t}:t,this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?zl.ExplainedCursorResponse:zl.CursorResponse}get commandName(){return"find"}buildOptions(e){return{...this.options,...this.bsonOptions,documentsReturnedIn:"firstBatch",session:this.session,timeoutContext:e}}handleOk(e){return e}buildCommandDocument(){return UQ(this.ns,this.filter,this.options)}}N0.FindOperation=$6;function UQ(e,t,r){let n={find:e.collection,filter:t};if(r.sort)n.sort=x8.formatSort(r.sort);if(r.projection){let s=r.projection;if(s&&Array.isArray(s))s=s.length?s.reduce((i,o)=>(i[o]=1,i),{}):{_id:1};n.projection=s}if(r.hint)n.hint=k8.normalizeHintField(r.hint);if(typeof r.skip==="number")n.skip=r.skip;if(typeof r.limit==="number")if(r.limit<0)n.limit=-r.limit,n.singleBatch=!0;else n.limit=r.limit;if(typeof r.batchSize==="number")if(r.batchSize<0)n.limit=-r.batchSize;else if(r.batchSize===r.limit)n.batchSize=r.batchSize+1;else n.batchSize=r.batchSize;if(typeof r.singleBatch==="boolean")n.singleBatch=r.singleBatch;if(r.comment!==void 0)n.comment=r.comment;if(r.max)n.max=r.max;if(r.min)n.min=r.min;if(typeof r.returnKey==="boolean")n.returnKey=r.returnKey;if(typeof r.showRecordId==="boolean")n.showRecordId=r.showRecordId;if(typeof r.tailable==="boolean")n.tailable=r.tailable;if(typeof r.oplogReplay==="boolean")n.oplogReplay=r.oplogReplay;if(typeof r.timeout==="boolean")n.noCursorTimeout=!r.timeout;else if(typeof r.noCursorTimeout==="boolean")n.noCursorTimeout=r.noCursorTimeout;if(typeof r.awaitData==="boolean")n.awaitData=r.awaitData;if(typeof r.allowPartialResults==="boolean")n.allowPartialResults=r.allowPartialResults;if(typeof r.allowDiskUse==="boolean")n.allowDiskUse=r.allowDiskUse;if(r.let)n.let=r.let;return n}Si.defineAspects($6,[Si.Aspect.READ_OPERATION,Si.Aspect.RETRYABLE,Si.Aspect.EXPLAINABLE,Si.Aspect.CURSOR_CREATING,Si.Aspect.SUPPORTS_RAW_DATA])});var x6=g(function(Kl){Object.defineProperty(Kl,"__esModule",{value:!0});Kl.FindCursor=Kl.FLAGS=void 0;var L8=wt(),_r=X(),U8=R6(),Wl=sn(),I0=j8(),Hl=Pl(),_a=he(),V8=b0();Kl.FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];class v6 extends V8.ExplainableCursor{constructor(e,t,r={},n={}){super(e,t,n);if(this.numReturned=0,this.cursorFilter=r,this.findOptions=n,n.sort!=null)this.findOptions.sort=Hl.formatSort(n.sort)}clone(){let e=_a.mergeOptions({},this.findOptions);return delete e.session,new v6(this.client,this.namespace,this.cursorFilter,{...e})}map(e){return super.map(e)}async _initialize(e){let t={...this.findOptions,...this.cursorOptions,session:e,signal:this.signal},r=new I0.FindOperation(this.namespace,this.cursorFilter,t),n=await Wl.executeOperation(this.client,r,this.timeoutContext);return this.numReturned=n.batchSize,{server:r.server,session:e,response:n}}async getMore(){let e=this.numReturned,t=this.findOptions.limit??1/0,r=t-e;if(e===t&&!this.id?.isZero()){try{await this.close()}catch(i){_a.squashError(i)}return L8.CursorResponse.emptyGetMore}let n=_a.noop,{batchSize:s}=this.cursorOptions;if(s!=null&&s>r)this.cursorOptions.batchSize=r,n=()=>{this.cursorOptions.batchSize=s};try{let i=await super.getMore();return this.numReturned=this.numReturned+i.batchSize,i}finally{n?.()}}async count(e){if(_a.emitWarningOnce("cursor.count is deprecated and will be removed in the next major version, please use `collection.estimatedDocumentCount` or `collection.countDocuments` instead "),typeof e==="boolean")throw new _r.MongoInvalidArgumentError("Invalid first parameter to count");return await Wl.executeOperation(this.client,new U8.CountOperation(this.namespace,this.cursorFilter,{...this.findOptions,...this.cursorOptions,...e}))}async explain(e,t){let{explain:r,timeout:n}=this.resolveExplainTimeoutOptions(e,t);return(await Wl.executeOperation(this.client,new I0.FindOperation(this.namespace,this.cursorFilter,{...this.findOptions,...this.cursorOptions,...n,explain:r??!0}))).shift(this.deserializationOptions)}filter(e){return this.throwIfInitialized(),this.cursorFilter=e,this}hint(e){return this.throwIfInitialized(),this.findOptions.hint=e,this}min(e){return this.throwIfInitialized(),this.findOptions.min=e,this}max(e){return this.throwIfInitialized(),this.findOptions.max=e,this}returnKey(e){return this.throwIfInitialized(),this.findOptions.returnKey=e,this}showRecordId(e){return this.throwIfInitialized(),this.findOptions.showRecordId=e,this}addQueryModifier(e,t){if(this.throwIfInitialized(),e[0]!=="$")throw new _r.MongoInvalidArgumentError(`${e} is not a valid query modifier`);switch(e.substr(1)){case"comment":this.findOptions.comment=t;break;case"explain":this.findOptions.explain=t;break;case"hint":this.findOptions.hint=t;break;case"max":this.findOptions.max=t;break;case"maxTimeMS":this.findOptions.maxTimeMS=t;break;case"min":this.findOptions.min=t;break;case"orderby":this.findOptions.sort=Hl.formatSort(t);break;case"query":this.cursorFilter=t;break;case"returnKey":this.findOptions.returnKey=t;break;case"showDiskLoc":this.findOptions.showRecordId=t;break;default:throw new _r.MongoInvalidArgumentError(`Invalid query modifier: ${e}`)}return this}comment(e){return this.throwIfInitialized(),this.findOptions.comment=e,this}maxAwaitTimeMS(e){if(this.throwIfInitialized(),typeof e!=="number")throw new _r.MongoInvalidArgumentError("Argument for maxAwaitTimeMS must be a number");return this.findOptions.maxAwaitTimeMS=e,this}maxTimeMS(e){if(this.throwIfInitialized(),typeof e!=="number")throw new _r.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this.findOptions.maxTimeMS=e,this}project(e){return this.throwIfInitialized(),this.findOptions.projection=e,this}sort(e,t){if(this.throwIfInitialized(),this.findOptions.tailable)throw new _r.MongoTailableCursorError("Tailable cursor does not support sorting");return this.findOptions.sort=Hl.formatSort(e,t),this}allowDiskUse(e=!0){if(this.throwIfInitialized(),!this.findOptions.sort)throw new _r.MongoInvalidArgumentError('Option "allowDiskUse" requires a sort specification');if(!e)return this.findOptions.allowDiskUse=!1,this;return this.findOptions.allowDiskUse=!0,this}collation(e){return this.throwIfInitialized(),this.findOptions.collation=e,this}limit(e){if(this.throwIfInitialized(),this.findOptions.tailable)throw new _r.MongoTailableCursorError("Tailable cursor does not support limit");if(typeof e!=="number")throw new _r.MongoInvalidArgumentError('Operation "limit" requires an integer');return this.findOptions.limit=e,this}skip(e){if(this.throwIfInitialized(),this.findOptions.tailable)throw new _r.MongoTailableCursorError("Tailable cursor does not support skip");if(typeof e!=="number")throw new _r.MongoInvalidArgumentError('Operation "skip" requires an integer');return this.findOptions.skip=e,this}}Kl.FindCursor=v6});var Tf=g(function(Ea){Object.defineProperty(Ea,"__esModule",{value:!0});Ea.ListIndexesOperation=Ea.DropIndexOperation=Ea.CreateIndexesOperation=void 0;var Gl=wt(),z8=he(),Yl=fr(),Er=xt(),VQ=new Set(["background","unique","name","partialFilterExpression","sparse","hidden","expireAfterSeconds","storageEngine","collation","version","weights","default_language","language_override","textIndexVersion","2dsphereIndexVersion","bits","min","max","bucketSize","wildcardProjection"]);function zQ(e){return typeof e==="number"||e==="2d"||e==="2dsphere"||e==="text"||e==="geoHaystack"}function WQ(e){return Array.isArray(e)&&e.length===2&&zQ(e[1])}function HQ(e){let t=new Map,r=!Array.isArray(e)||WQ(e)?[e]:e;for(let n of r)if(typeof n==="string")t.set(n,1);else if(Array.isArray(n))t.set(n[0],n[1]??1);else if(n instanceof Map)for(let[s,i]of n)t.set(s,i);else if(z8.isObject(n))for(let[s,i]of Object.entries(n))t.set(s,i);return t}var KQ=new Map([["version","v"],["defaultLanguage","default_language"],["languageOverride","language_override"]]);function GQ(e,t){let r=Object.entries(e).filter(([n])=>n!=="key"&&(t||VQ.has(n)));return Object.fromEntries(r.map(([n,s])=>[KQ.get(n)??n,s]))}class Df extends Yl.CommandOperation{constructor(e,t,r,n,s){super(e,s);this.SERVER_COMMAND_RESPONSE_TYPE=Gl.MongoDBResponse,this.options={...s},this.options.collation=void 0,this.collectionName=t,this.indexes=r.map((i)=>{let o=i.key instanceof Map?i.key:new Map(Object.entries(i.key)),u=i.name??Array.from(o).flat().join("_");return{...GQ(i,n),name:u,key:o}}),this.ns=e.s.namespace}static fromIndexDescriptionArray(e,t,r,n,s){return new Df(e,t,r,n,s)}static fromIndexSpecification(e,t,r,n,s,i){let o=HQ(r),u={...s,key:o};return new Df(e,t,[u],n,i??s)}get commandName(){return"createIndexes"}buildCommandDocument(e){let t=this.options,r=this.indexes,n={createIndexes:this.collectionName,indexes:r};if(t.commitQuorum!=null)n.commitQuorum=t.commitQuorum;return n}handleOk(e){return this.indexes.map((r)=>r.name||"")}}Ea.CreateIndexesOperation=Df;class k6 extends Yl.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=Gl.MongoDBResponse,this.options=r??{},this.collection=e,this.indexName=t,this.ns=e.fullNamespace}get commandName(){return"dropIndexes"}buildCommandDocument(e){return{dropIndexes:this.collection.collectionName,index:this.indexName}}}Ea.DropIndexOperation=k6;class q6 extends Yl.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=Gl.CursorResponse,this.options={...t},delete this.options.writeConcern,this.collectionNamespace=e.s.namespace}get commandName(){return"listIndexes"}buildCommandDocument(e){let t=this.options.batchSize?{batchSize:this.options.batchSize}:{},r={listIndexes:this.collectionNamespace.collection,cursor:t};if(this.options.comment!==void 0)r.comment=this.options.comment;return r}handleOk(e){return e}}Ea.ListIndexesOperation=q6;Er.defineAspects(q6,[Er.Aspect.READ_OPERATION,Er.Aspect.RETRYABLE,Er.Aspect.CURSOR_CREATING,Er.Aspect.SUPPORTS_RAW_DATA]);Er.defineAspects(Df,[Er.Aspect.WRITE_OPERATION,Er.Aspect.SUPPORTS_RAW_DATA]);Er.defineAspects(k6,[Er.Aspect.WRITE_OPERATION,Er.Aspect.SUPPORTS_RAW_DATA])});var L6=g(function(R0){Object.defineProperty(R0,"__esModule",{value:!0});R0.ListIndexesCursor=void 0;var W8=sn(),H8=Tf(),K8=Ns();class j6 extends K8.AbstractCursor{constructor(e,t){super(e.client,e.s.namespace,{...t});this.parent=e,this.options=t}clone(){return new j6(this.parent,{...this.options,...this.cursorOptions})}async _initialize(e){let t=new H8.ListIndexesOperation(this.parent,{...this.cursorOptions,...this.options,session:e}),r=await W8.executeOperation(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}}R0.ListIndexesCursor=j6});var J8=g(function($0){Object.defineProperty($0,"__esModule",{value:!0});$0.ListSearchIndexesCursor=void 0;var G8=bf();class Y8 extends G8.AggregationCursor{constructor({fullNamespace:e,client:t},r,n={}){let s=r==null?[{$listSearchIndexes:{}}]:[{$listSearchIndexes:{name:r}}];super(t,e,s,n)}}$0.ListSearchIndexesCursor=Y8});var Z8=g(function(v0){Object.defineProperty(v0,"__esModule",{value:!0});v0.DistinctOperation=void 0;var Q8=wt(),X8=fr(),$o=xt();class U6 extends X8.CommandOperation{constructor(e,t,r,n){super(e,n);this.SERVER_COMMAND_RESPONSE_TYPE=Q8.MongoDBResponse,this.options=n??{},this.collection=e,this.key=t,this.query=r}get commandName(){return"distinct"}buildCommandDocument(e){let t={distinct:this.collection.collectionName,key:this.key,query:this.query};if(this.options.comment!==void 0)t.comment=this.options.comment;if(this.options.hint!=null)t.hint=this.options.hint;return t}handleOk(e){if(this.explain)return e.toObject(this.bsonOptions);return e.toObject(this.bsonOptions).values}}v0.DistinctOperation=U6;$o.defineAspects(U6,[$o.Aspect.READ_OPERATION,$o.Aspect.RETRYABLE,$o.Aspect.EXPLAINABLE,$o.Aspect.SUPPORTS_RAW_DATA])});var r5=g(function(x0){Object.defineProperty(x0,"__esModule",{value:!0});x0.EstimatedDocumentCountOperation=void 0;var e5=wt(),t5=fr(),vo=xt();class V6 extends t5.CommandOperation{constructor(e,t={}){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=e5.MongoDBResponse,this.options=t,this.collectionName=e.collectionName}get commandName(){return"count"}buildCommandDocument(e,t){let r={count:this.collectionName};if(typeof this.options.maxTimeMS==="number")r.maxTimeMS=this.options.maxTimeMS;if(this.options.comment!==void 0)r.comment=this.options.comment;return r}handleOk(e){return e.getNumber("n")??0}}x0.EstimatedDocumentCountOperation=V6;vo.defineAspects(V6,[vo.Aspect.READ_OPERATION,vo.Aspect.RETRYABLE,vo.Aspect.CURSOR_CREATING,vo.Aspect.SUPPORTS_RAW_DATA])});var z6=g(function(ti){Object.defineProperty(ti,"__esModule",{value:!0});ti.FindOneAndUpdateOperation=ti.FindOneAndReplaceOperation=ti.FindOneAndDeleteOperation=ti.FindAndModifyOperation=ti.ReturnDocument=void 0;var n5=wt(),Is=X(),s5=Xr(),i5=Pl(),Jl=he(),o5=fr(),xo=xt();ti.ReturnDocument=Object.freeze({BEFORE:"before",AFTER:"after"});function u5(e,t){if(e.new=t.returnDocument===ti.ReturnDocument.AFTER,e.upsert=t.upsert===!0,t.bypassDocumentValidation===!0)e.bypassDocumentValidation=t.bypassDocumentValidation;return e}class Ql extends o5.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=n5.MongoDBResponse,this.options=r,this.readPreference=s5.ReadPreference.primary,this.collection=e,this.query=t}get commandName(){return"findAndModify"}buildCommandDocument(e,t){let r=this.options,n={findAndModify:this.collection.collectionName,query:this.query,remove:!1,new:!1,upsert:!1};r.includeResultMetadata??=!1;let s=i5.formatSort(r.sort);if(s)n.sort=s;if(r.projection)n.fields=r.projection;if(r.maxTimeMS)n.maxTimeMS=r.maxTimeMS;if(r.writeConcern)n.writeConcern=r.writeConcern;if(r.let)n.let=r.let;if(r.comment!==void 0)n.comment=r.comment;if(Jl.decorateWithCollation(n,r),r.hint)n.hint=r.hint;return n}handleOk(e){let t=super.handleOk(e);return this.options.includeResultMetadata?t:t.value??null}}ti.FindAndModifyOperation=Ql;class a5 extends Ql{constructor(e,t,r){if(t==null||typeof t!=="object")throw new Is.MongoInvalidArgumentError('Argument "filter" must be an object');super(e,t,r)}buildCommandDocument(e,t){let r=super.buildCommandDocument(e,t);return r.remove=!0,r}}ti.FindOneAndDeleteOperation=a5;class c5 extends Ql{constructor(e,t,r,n){if(t==null||typeof t!=="object")throw new Is.MongoInvalidArgumentError('Argument "filter" must be an object');if(r==null||typeof r!=="object")throw new Is.MongoInvalidArgumentError('Argument "replacement" must be an object');if(Jl.hasAtomicOperators(r))throw new Is.MongoInvalidArgumentError("Replacement document must not contain atomic operators");super(e,t,n);this.replacement=r}buildCommandDocument(e,t){let r=super.buildCommandDocument(e,t);return r.update=this.replacement,u5(r,this.options),r}}ti.FindOneAndReplaceOperation=c5;class l5 extends Ql{constructor(e,t,r,n){if(t==null||typeof t!=="object")throw new Is.MongoInvalidArgumentError('Argument "filter" must be an object');if(r==null||typeof r!=="object")throw new Is.MongoInvalidArgumentError('Argument "update" must be an object');if(!Jl.hasAtomicOperators(r,n))throw new Is.MongoInvalidArgumentError("Update document requires atomic operators");super(e,t,n);this.update=r,this.options=n}buildCommandDocument(e,t){let r=super.buildCommandDocument(e,t);if(r.update=this.update,u5(r,this.options),this.options.arrayFilters)r.arrayFilters=this.options.arrayFilters;return r}}ti.FindOneAndUpdateOperation=l5;xo.defineAspects(Ql,[xo.Aspect.WRITE_OPERATION,xo.Aspect.RETRYABLE,xo.Aspect.EXPLAINABLE,xo.Aspect.SUPPORTS_RAW_DATA])});var H6=g(function(q0){Object.defineProperty(q0,"__esModule",{value:!0});q0.RenameOperation=void 0;var h5=wt(),f5=Xl(),d5=he(),p5=fr(),k0=xt();class W6 extends p5.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=h5.MongoDBResponse,this.collection=e,this.newName=t,this.options=r,this.ns=new d5.MongoDBNamespace("admin","$cmd")}get commandName(){return"renameCollection"}buildCommandDocument(e,t){let r=this.collection.namespace,n=this.collection.s.namespace.withCollection(this.newName).toString(),s=typeof this.options.dropTarget==="boolean"?this.options.dropTarget:!1;return{renameCollection:r,to:n,dropTarget:s}}handleOk(e){return new f5.Collection(this.collection.db,this.newName,this.collection.s.options)}}q0.RenameOperation=W6;k0.defineAspects(W6,[k0.Aspect.WRITE_OPERATION])});var _5=g(function(j0){Object.defineProperty(j0,"__esModule",{value:!0});j0.CreateSearchIndexesOperation=void 0;var m5=wt(),y5=xt();class g5 extends y5.AbstractOperation{constructor(e,t){super();this.SERVER_COMMAND_RESPONSE_TYPE=m5.MongoDBResponse,this.collection=e,this.descriptions=t,this.ns=e.fullNamespace}get commandName(){return"createSearchIndexes"}buildCommand(e,t){return{createSearchIndexes:this.collection.fullNamespace.collection,indexes:this.descriptions}}handleOk(e){return super.handleOk(e).indexesCreated.map((t)=>t.name)}buildOptions(e){return{session:this.session,timeoutContext:e}}}j0.CreateSearchIndexesOperation=g5});var S5=g(function(U0){Object.defineProperty(U0,"__esModule",{value:!0});U0.DropSearchIndexOperation=void 0;var E5=wt(),L0=X(),A5=xt();class O5 extends A5.AbstractOperation{constructor(e,t){super();this.SERVER_COMMAND_RESPONSE_TYPE=E5.MongoDBResponse,this.collection=e,this.name=t,this.ns=e.fullNamespace}get commandName(){return"dropSearchIndex"}buildCommand(e,t){let n={dropSearchIndex:this.collection.fullNamespace.collection};if(typeof this.name==="string")n.name=this.name;return n}handleOk(e){}buildOptions(e){return{session:this.session,timeoutContext:e}}handleError(e){if(!(e instanceof L0.MongoServerError&&L0.isNamespaceNotFoundError(e)))throw e}}U0.DropSearchIndexOperation=O5});var D5=g(function(V0){Object.defineProperty(V0,"__esModule",{value:!0});V0.UpdateSearchIndexOperation=void 0;var w5=wt(),C5=xt();class b5 extends C5.AbstractOperation{constructor(e,t,r){super();this.SERVER_COMMAND_RESPONSE_TYPE=w5.MongoDBResponse,this.collection=e,this.name=t,this.definition=r,this.ns=e.fullNamespace}get commandName(){return"updateSearchIndex"}buildCommand(e,t){return{updateSearchIndex:this.collection.fullNamespace.collection,name:this.name,definition:this.definition}}handleOk(e){}buildOptions(e){return{session:this.session,timeoutContext:e}}}V0.UpdateSearchIndexOperation=b5});var Xl=g(function(H0){Object.defineProperty(H0,"__esModule",{value:!0});H0.Collection=void 0;var T5=Te(),M5=_6(),P5=E6(),B5=r1(),F5=bf(),N5=x6(),I5=L6(),R5=J8(),Rs=X(),$5=R6(),z0=GE(),v5=Z8(),x5=r5(),Ve=sn(),Zl=z6(),ko=Tf(),k5=r6(),q5=H6(),j5=_5(),L5=S5(),U5=D5(),e1=u6(),V5=lo(),t1=Xr(),me=he(),W0=fs();class z5{constructor(e,t,r){this.db=e,this.s={db:e,options:r,namespace:new me.MongoDBCollectionNamespace(e.databaseName,t),pkFactory:e.options?.pkFactory??me.DEFAULT_PK_FACTORY,readPreference:t1.ReadPreference.fromOptions(r),bsonOptions:T5.resolveBSONOptions(r,e),readConcern:V5.ReadConcern.fromOptions(r),writeConcern:W0.WriteConcern.fromOptions(r)},this.client=e.client}get dbName(){return this.s.namespace.db}get collectionName(){return this.s.namespace.collection}get namespace(){return this.fullNamespace.toString()}get fullNamespace(){return this.s.namespace}get readConcern(){if(this.s.readConcern==null)return this.db.readConcern;return this.s.readConcern}get readPreference(){if(this.s.readPreference==null)return this.db.readPreference;return this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){if(this.s.writeConcern==null)return this.db.writeConcern;return this.s.writeConcern}get hint(){return this.s.collectionHint}set hint(e){this.s.collectionHint=me.normalizeHintField(e)}get timeoutMS(){return}async insertOne(e,t){return await Ve.executeOperation(this.client,new k5.InsertOneOperation(this,e,me.resolveOptions(this,t)))}async insertMany(e,t){if(!Array.isArray(e))throw new Rs.MongoInvalidArgumentError('Argument "docs" must be an array of documents');t=me.resolveOptions(this,t??{});let r=W0.WriteConcern.fromOptions(t)?.w!==0;try{let n=await this.bulkWrite(e.map((s)=>({insertOne:{document:s}})),t);return{acknowledged:r,insertedCount:n.insertedCount,insertedIds:n.insertedIds}}catch(n){if(n&&n.message==="Operation must be an object with an operation key")throw new Rs.MongoInvalidArgumentError("Collection.insertMany() cannot be called with an array that has null/undefined values");throw n}}async bulkWrite(e,t){if(!Array.isArray(e))throw new Rs.MongoInvalidArgumentError('Argument "operations" must be an array of documents');if(t=me.resolveOptions(this,t??{}),this.client.topology==null)await Ve.autoConnect(this.client);let n=t.ordered===!1?this.initializeUnorderedBulkOp(t):this.initializeOrderedBulkOp(t);for(let s of e)n.raw(s);return await n.execute({...t})}async updateOne(e,t,r){return await Ve.executeOperation(this.client,new e1.UpdateOneOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async replaceOne(e,t,r){return await Ve.executeOperation(this.client,new e1.ReplaceOneOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async updateMany(e,t,r){return await Ve.executeOperation(this.client,new e1.UpdateManyOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async deleteOne(e={},t={}){return await Ve.executeOperation(this.client,new z0.DeleteOneOperation(this.s.namespace,e,me.resolveOptions(this,t)))}async deleteMany(e={},t={}){return await Ve.executeOperation(this.client,new z0.DeleteManyOperation(this.s.namespace,e,me.resolveOptions(this,t)))}async rename(e,t){return await Ve.executeOperation(this.client,new q5.RenameOperation(this,e,me.resolveOptions(void 0,{...t,readPreference:t1.ReadPreference.PRIMARY})))}async drop(e){return await this.db.dropCollection(this.collectionName,e)}async findOne(e={},t={}){let{...r}=t;r.singleBatch=!0;let n=this.find(e,r).limit(1),s=await n.next();return await n.close(),s}find(e={},t={}){return new N5.FindCursor(this.client,this.s.namespace,e,me.resolveOptions(this,t))}async options(e){e=me.resolveOptions(this,e);let[t]=await this.db.listCollections({name:this.collectionName},{...e,nameOnly:!1}).toArray();if(t==null||t.options==null)throw new Rs.MongoAPIError(`collection ${this.namespace} not found`);return t.options}async isCapped(e){let{capped:t}=await this.options(e);return Boolean(t)}async createIndex(e,t,r){let n=r==null?ko.CreateIndexesOperation.fromIndexSpecification(this,this.collectionName,e,!1,me.resolveOptions(this,t),void 0):ko.CreateIndexesOperation.fromIndexSpecification(this,this.collectionName,e,!0,t,me.resolveOptions(this,r));return(await Ve.executeOperation(this.client,n))[0]}async createIndexes(e,t,r=!1){return await Ve.executeOperation(this.client,ko.CreateIndexesOperation.fromIndexDescriptionArray(this,this.collectionName,e,r,me.resolveOptions(this,{...t,maxTimeMS:void 0})))}async dropIndex(e,t){return await Ve.executeOperation(this.client,new ko.DropIndexOperation(this,e,{...me.resolveOptions(this,t),readPreference:t1.ReadPreference.primary}))}async dropIndexes(e){try{return await Ve.executeOperation(this.client,new ko.DropIndexOperation(this,"*",me.resolveOptions(this,e))),!0}catch(t){if(t instanceof Rs.MongoServerError&&Rs.isNamespaceNotFoundError(t))return!1;throw t}}listIndexes(e){return new I5.ListIndexesCursor(this,me.resolveOptions(this,e))}async indexExists(e,t){let r=Array.isArray(e)?e:[e],n=new Set(await this.listIndexes(t).map(({name:s})=>s).toArray());return r.every((s)=>n.has(s))}async indexInformation(e){return await this.indexes({...e,full:e?.full??!1})}async estimatedDocumentCount(e){return await Ve.executeOperation(this.client,new x5.EstimatedDocumentCountOperation(this,me.resolveOptions(this,e)))}async countDocuments(e={},t={}){let r=[];if(r.push({$match:e}),typeof t.skip==="number")r.push({$skip:t.skip});if(typeof t.limit==="number")r.push({$limit:t.limit});r.push({$group:{_id:1,n:{$sum:1}}});let n=this.aggregate(r,t),s=await n.next();return await n.close(),s?.n??0}async distinct(e,t={},r={}){return await Ve.executeOperation(this.client,new v5.DistinctOperation(this,e,t,me.resolveOptions(this,r)))}async indexes(e){let t=await this.listIndexes(e).toArray();if(e?.full??!0)return t;return Object.fromEntries(t.map(({name:s,key:i})=>[s,Object.entries(i)]))}async findOneAndDelete(e,t){return await Ve.executeOperation(this.client,new Zl.FindOneAndDeleteOperation(this,e,me.resolveOptions(this,t)))}async findOneAndReplace(e,t,r){return await Ve.executeOperation(this.client,new Zl.FindOneAndReplaceOperation(this,e,t,me.resolveOptions(this,r)))}async findOneAndUpdate(e,t,r){return await Ve.executeOperation(this.client,new Zl.FindOneAndUpdateOperation(this,e,t,me.resolveOptions(this,r)))}aggregate(e=[],t){if(!Array.isArray(e))throw new Rs.MongoInvalidArgumentError('Argument "pipeline" must be an array of aggregation stages');return new F5.AggregationCursor(this.client,this.s.namespace,e,me.resolveOptions(this,t))}watch(e=[],t={}){if(!Array.isArray(e))t=e,e=[];return new B5.ChangeStream(this,e,me.resolveOptions(this,t))}initializeUnorderedBulkOp(e){return new P5.UnorderedBulkOperation(this,me.resolveOptions(this,e))}initializeOrderedBulkOp(e){return new M5.OrderedBulkOperation(this,me.resolveOptions(this,e))}async count(e={},t={}){return await Ve.executeOperation(this.client,new $5.CountOperation(this.fullNamespace,e,me.resolveOptions(this,t)))}listSearchIndexes(e,t){t=typeof e==="object"?e:t==null?{}:t;let r=e==null?null:typeof e==="object"?null:e;return new R5.ListSearchIndexesCursor(this,r,{...t})}async createSearchIndex(e){let[t]=await this.createSearchIndexes([e]);return t}async createSearchIndexes(e){return await Ve.executeOperation(this.client,new j5.CreateSearchIndexesOperation(this,e))}async dropSearchIndex(e){return await Ve.executeOperation(this.client,new L5.DropSearchIndexOperation(this,e))}async updateSearchIndex(e,t){return await Ve.executeOperation(this.client,new U5.UpdateSearchIndexOperation(this,e,t))}}H0.Collection=z5});var G6=g(function(Y0){Object.defineProperty(Y0,"__esModule",{value:!0});Y0.ChangeStreamCursor=void 0;var n1=r1(),K0=Br(),W5=Af(),H5=sn(),G0=he(),K5=Ns();class K6 extends K5.AbstractCursor{constructor(e,t,r=[],n={}){super(e,t,{...n,tailable:!0,awaitData:!0});if(this.pipeline=r,this.changeStreamCursorOptions=n,this._resumeToken=null,this.startAtOperationTime=n.startAtOperationTime??null,n.startAfter)this.resumeToken=n.startAfter;else if(n.resumeAfter)this.resumeToken=n.resumeAfter}set resumeToken(e){this._resumeToken=e,this.emit(n1.ChangeStream.RESUME_TOKEN_CHANGED,e)}get resumeToken(){return this._resumeToken}get resumeOptions(){let e={...this.changeStreamCursorOptions};for(let t of["resumeAfter","startAfter","startAtOperationTime"])delete e[t];if(this.resumeToken!=null)if(this.changeStreamCursorOptions.startAfter&&!this.hasReceived)e.startAfter=this.resumeToken;else e.resumeAfter=this.resumeToken;else if(this.startAtOperationTime!=null)e.startAtOperationTime=this.startAtOperationTime;return e}cacheResumeToken(e){if(this.bufferedCount()===0&&this.postBatchResumeToken)this.resumeToken=this.postBatchResumeToken;else this.resumeToken=e;this.hasReceived=!0}_processBatch(e){let{postBatchResumeToken:t}=e;if(t){if(this.postBatchResumeToken=t,e.batchSize===0)this.resumeToken=t}}clone(){return new K6(this.client,this.namespace,this.pipeline,{...this.cursorOptions})}async _initialize(e){let t=new W5.AggregateOperation(this.namespace,this.pipeline,{...this.cursorOptions,...this.changeStreamCursorOptions,session:e}),r=await H5.executeOperation(e.client,t,this.timeoutContext),n=t.server;if(this.maxWireVersion=G0.maxWireVersion(n),this.startAtOperationTime==null&&this.changeStreamCursorOptions.resumeAfter==null&&this.changeStreamCursorOptions.startAfter==null)this.startAtOperationTime=r.operationTime;return this._processBatch(r),this.emit(K0.INIT,r),this.emit(K0.RESPONSE),{server:n,session:e,response:r}}async getMore(){let e=await super.getMore();return this.maxWireVersion=G0.maxWireVersion(this.server),this._processBatch(e),this.emit(n1.ChangeStream.MORE,e),this.emit(n1.ChangeStream.RESPONSE),e}}Y0.ChangeStreamCursor=K6});var Y5=g(function(J0){Object.defineProperty(J0,"__esModule",{value:!0});J0.ListCollectionsOperation=void 0;var s1=wt(),G5=fr(),qo=xt();class Y6 extends G5.CommandOperation{constructor(e,t,r){super(e,r);if(this.SERVER_COMMAND_RESPONSE_TYPE=s1.CursorResponse,this.options={...r},delete this.options.writeConcern,this.db=e,this.filter=t,this.nameOnly=!!this.options.nameOnly,this.authorizedCollections=!!this.options.authorizedCollections,typeof this.options.batchSize==="number")this.batchSize=this.options.batchSize;this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?s1.ExplainedCursorResponse:s1.CursorResponse}get commandName(){return"listCollections"}buildCommandDocument(e){let t={listCollections:1,filter:this.filter,cursor:this.batchSize?{batchSize:this.batchSize}:{},nameOnly:this.nameOnly,authorizedCollections:this.authorizedCollections};if(this.options.comment!==void 0)t.comment=this.options.comment;return t}handleOk(e){return e}}J0.ListCollectionsOperation=Y6;qo.defineAspects(Y6,[qo.Aspect.READ_OPERATION,qo.Aspect.RETRYABLE,qo.Aspect.CURSOR_CREATING,qo.Aspect.SUPPORTS_RAW_DATA])});var Q6=g(function(Q0){Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ListCollectionsCursor=void 0;var J5=sn(),Q5=Y5(),X5=Ns();class J6 extends X5.AbstractCursor{constructor(e,t,r){super(e.client,e.s.namespace,{...r});this.parent=e,this.filter=t,this.options=r}clone(){return new J6(this.parent,this.filter,{...this.options,...this.cursorOptions})}async _initialize(e){let t=new Q5.ListCollectionsOperation(this.parent,this.filter,{...this.cursorOptions,...this.options,session:e,signal:this.signal}),r=await J5.executeOperation(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}}Q0.ListCollectionsCursor=J6});var sD=g(function(Z0){Object.defineProperty(Z0,"__esModule",{value:!0});Z0.RunCommandCursor=void 0;var wi=X(),X0=sn(),Z5=b6(),eD=Dl(),tD=he(),rD=Ns();class nD extends rD.AbstractCursor{setComment(e){return this.getMoreOptions.comment=e,this}setMaxTimeMS(e){return this.getMoreOptions.maxAwaitTimeMS=e,this}setBatchSize(e){return this.getMoreOptions.batchSize=e,this}clone(){throw new wi.MongoAPIError("Clone not supported, create a new cursor with db.runCursorCommand")}withReadConcern(e){throw new wi.MongoAPIError("RunCommandCursor does not support readConcern it must be attached to the command being run")}addCursorFlag(e,t){throw new wi.MongoAPIError("RunCommandCursor does not support cursor flags, they must be attached to the command being run")}maxTimeMS(e){throw new wi.MongoAPIError("maxTimeMS must be configured on the command document directly, to configure getMore.maxTimeMS use cursor.setMaxTimeMS()")}batchSize(e){throw new wi.MongoAPIError("batchSize must be configured on the command document directly, to configure getMore.batchSize use cursor.setBatchSize()")}constructor(e,t,r={}){super(e.client,tD.ns(e.namespace),r);this.getMoreOptions={},this.db=e,this.command=Object.freeze({...t})}async _initialize(e){let t=new eD.RunCursorCommandOperation(this.db.s.namespace,this.command,{...this.cursorOptions,session:e,readPreference:this.cursorOptions.readPreference}),r=await X0.executeOperation(this.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}async getMore(){if(!this.session)throw new wi.MongoRuntimeError("Unexpected null session. A cursor creating command should have set this");let e=new Z5.GetMoreOperation(this.namespace,this.id,this.server,{...this.cursorOptions,session:this.session,...this.getMoreOptions});return await X0.executeOperation(this.client,e,this.timeoutContext)}}Z0.RunCommandCursor=nD});var fD=g(function(Pf){Object.defineProperty(Pf,"__esModule",{value:!0});Pf.CreateCollectionOperation=void 0;Pf.createCollections=QQ;var em=Cu(),iD=wt(),oD=Xl(),uD=X(),aD=ds(),cD=he(),lD=fr(),i1=sn(),hD=Tf(),tm=xt(),YQ=new Set(["w","wtimeout","timeoutMS","j","fsync","pkFactory","raw","readPreference","session","readConcern","writeConcern","raw","fieldsAsRaw","useBigInt64","promoteLongs","promoteValues","promoteBuffers","bsonRegExp","serializeFunctions","ignoreUndefined","enableUtf8Validation"]),JQ="Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.";class Mf extends lD.CommandOperation{constructor(e,t,r={}){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=iD.MongoDBResponse,this.options=r,this.db=e,this.name=t}get commandName(){return"create"}buildCommandDocument(e,t){let r=([n,s])=>s!=null&&typeof s!=="function"&&!YQ.has(n);return{create:this.name,...Object.fromEntries(Object.entries(this.options).filter(r))}}handleOk(e){return new oD.Collection(this.db,this.name,this.options)}}Pf.CreateCollectionOperation=Mf;async function QQ(e,t,r){let n=aD.TimeoutContext.create({session:r.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:r.timeoutMS}),s=r.encryptedFields??e.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${e.databaseName}.${t}`];if(s){class o extends Mf{buildCommandDocument(c,l){if(!c.description.loadBalanced&&cD.maxWireVersion(c)<em.MIN_SUPPORTED_QE_WIRE_VERSION)throw new uD.MongoCompatibilityError(`${JQ} The minimum server version required is ${em.MIN_SUPPORTED_QE_SERVER_VERSION}`);return super.buildCommandDocument(c,l)}}let u=s.escCollection??`enxcol_.${t}.esc`,a=s.ecocCollection??`enxcol_.${t}.ecoc`;for(let c of[u,a]){let l=new o(e,c,{clusteredIndex:{key:{_id:1},unique:!0},session:r.session});await i1.executeOperation(e.client,l,n)}if(!r.encryptedFields)r={...r,encryptedFields:s}}let i=await i1.executeOperation(e.client,new Mf(e,t,r),n);if(s){let o=hD.CreateIndexesOperation.fromIndexSpecification(e,t,{__safeContent__:1},!1,{session:r.session},void 0);await i1.executeOperation(e.client,o,n)}return i}tm.defineAspects(Mf,[tm.Aspect.WRITE_OPERATION])});var gD=g(function(bc){Object.defineProperty(bc,"__esModule",{value:!0});bc.DropDatabaseOperation=bc.DropCollectionOperation=void 0;bc.dropCollections=XQ;var dD=Oa(),nm=wt(),pD=Ns(),mD=X(),yD=ds(),sm=fr(),rm=sn(),Aa=xt();class Bf extends sm.CommandOperation{constructor(e,t,r={}){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=nm.MongoDBResponse,this.options=r,this.name=t}get commandName(){return"drop"}buildCommandDocument(e,t){return{drop:this.name}}handleOk(e){return!0}handleError(e){if(!(e instanceof dD.MongoServerError&&mD.isNamespaceNotFoundError(e)))throw e;return!1}}bc.DropCollectionOperation=Bf;async function XQ(e,t,r){let n=yD.TimeoutContext.create({session:r.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:r.timeoutMS}),s=e.client.s.options.autoEncryption?.encryptedFieldsMap,i=r.encryptedFields??s?.[`${e.databaseName}.${t}`];if(!i&&s)i=(await e.listCollections({name:t},{nameOnly:!1,session:r.session,timeoutContext:new pD.CursorTimeoutContext(n,Symbol())}).toArray())?.[0]?.options?.encryptedFields;if(i){let o=i.escCollection||`enxcol_.${t}.esc`,u=i.ecocCollection||`enxcol_.${t}.ecoc`;for(let a of[o,u]){let c=new Bf(e,a,r);await rm.executeOperation(e.client,c,n)}}return await rm.executeOperation(e.client,new Bf(e,t,r),n)}class X6 extends sm.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=nm.MongoDBResponse,this.options=t}get commandName(){return"dropDatabase"}buildCommandDocument(e,t){return{dropDatabase:1}}handleOk(e){return!0}}bc.DropDatabaseOperation=X6;Aa.defineAspects(Bf,[Aa.Aspect.WRITE_OPERATION]);Aa.defineAspects(X6,[Aa.Aspect.WRITE_OPERATION])});var wD=g(function(om){Object.defineProperty(om,"__esModule",{value:!0});om.ProfilingLevelOperation=void 0;var _D=Te(),ED=wt(),im=X(),AD=fr();class OD extends ED.MongoDBResponse{get was(){return this.get("was",_D.BSONType.int,!0)}}class SD extends AD.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=OD,this.options=t}get commandName(){return"profile"}buildCommandDocument(e){return{profile:-1}}handleOk(e){if(e.ok===1){let t=e.was;if(t===0)return"off";if(t===1)return"slow_only";if(t===2)return"all";throw new im.MongoUnexpectedServerResponseError(`Illegal profiling level value ${t}`)}else throw new im.MongoUnexpectedServerResponseError("Error with profile command")}}om.ProfilingLevelOperation=SD});var Z6=g(function(jo){Object.defineProperty(jo,"__esModule",{value:!0});jo.SetProfilingLevelOperation=jo.ProfilingLevel=void 0;var CD=wt(),bD=X(),DD=he(),TD=fr(),ZQ=new Set(["off","slow_only","all"]);jo.ProfilingLevel=Object.freeze({off:"off",slowOnly:"slow_only",all:"all"});class MD extends TD.CommandOperation{constructor(e,t,r){super(e,r);switch(this.SERVER_COMMAND_RESPONSE_TYPE=CD.MongoDBResponse,this.options=r,t){case jo.ProfilingLevel.off:this.profile=0;break;case jo.ProfilingLevel.slowOnly:this.profile=1;break;case jo.ProfilingLevel.all:this.profile=2;break;default:this.profile=0;break}this.level=t}get commandName(){return"profile"}buildCommandDocument(e){let t=this.level;if(!ZQ.has(t))throw new bD.MongoInvalidArgumentError(`Profiling level must be one of "${DD.enumToString(jo.ProfilingLevel)}"`);return{profile:this.profile}}handleOk(e){return this.level}}jo.SetProfilingLevelOperation=MD});var FD=g(function(am){Object.defineProperty(am,"__esModule",{value:!0});am.DbStatsOperation=void 0;var PD=wt(),BD=fr(),um=xt();class e3 extends BD.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=PD.MongoDBResponse,this.options=t}get commandName(){return"dbStats"}buildCommandDocument(e){let t={dbStats:!0};if(this.options.scale!=null)t.scale=this.options.scale;return t}}am.DbStatsOperation=e3;um.defineAspects(e3,[um.Aspect.READ_OPERATION])});var mm=g(function(pm){Object.defineProperty(pm,"__esModule",{value:!0});pm.Db=void 0;var ND=g6(),cm=Te(),ID=r1(),lm=Xl(),Ci=Br(),RD=bf(),$D=Q6(),vD=sD(),hm=X(),xD=fD(),fm=gD(),Ln=sn(),kD=Tf(),qD=wD(),jD=y6(),LD=H6(),UD=Dl(),VD=Z6(),zD=FD(),WD=lo(),dm=Xr(),rt=he(),HD=fs(),eX=["writeConcern","readPreference","readPreferenceTags","native_parser","forceServerObjectId","pkFactory","serializeFunctions","raw","authSource","ignoreUndefined","readConcern","retryMiliSeconds","numberOfRetries","useBigInt64","promoteBuffers","promoteLongs","bsonRegExp","enableUtf8Validation","promoteValues","compression","retryWrites"];class KD{static{this.SYSTEM_NAMESPACE_COLLECTION=Ci.SYSTEM_NAMESPACE_COLLECTION}static{this.SYSTEM_INDEX_COLLECTION=Ci.SYSTEM_INDEX_COLLECTION}static{this.SYSTEM_PROFILE_COLLECTION=Ci.SYSTEM_PROFILE_COLLECTION}static{this.SYSTEM_USER_COLLECTION=Ci.SYSTEM_USER_COLLECTION}static{this.SYSTEM_COMMAND_COLLECTION=Ci.SYSTEM_COMMAND_COLLECTION}static{this.SYSTEM_JS_COLLECTION=Ci.SYSTEM_JS_COLLECTION}constructor(e,t,r){if(r=r??{},r=rt.filterOptions(r,eX),typeof t==="string"&&t.includes("."))throw new hm.MongoInvalidArgumentError("Database names cannot contain the character '.'");this.s={options:r,readPreference:dm.ReadPreference.fromOptions(r),bsonOptions:cm.resolveBSONOptions(r,e),pkFactory:r?.pkFactory??rt.DEFAULT_PK_FACTORY,readConcern:WD.ReadConcern.fromOptions(r),writeConcern:HD.WriteConcern.fromOptions(r),namespace:new rt.MongoDBNamespace(t)},this.client=e}get databaseName(){return this.s.namespace.db}get options(){return this.s.options}get secondaryOk(){return this.s.readPreference?.preference!=="primary"||!1}get readConcern(){return this.s.readConcern}get readPreference(){if(this.s.readPreference==null)return this.client.readPreference;return this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get namespace(){return this.s.namespace.toString()}get timeoutMS(){return}async createCollection(e,t){return t=rt.resolveOptions(this,t),await xD.createCollections(this,e,t)}async command(e,t){return await Ln.executeOperation(this.client,new UD.RunCommandOperation(this.s.namespace,e,rt.resolveOptions(void 0,{...cm.resolveBSONOptions(t),timeoutMS:t?.timeoutMS??this.timeoutMS,session:t?.session,readPreference:t?.readPreference,signal:t?.signal})))}aggregate(e=[],t){return new RD.AggregationCursor(this.client,this.s.namespace,e,rt.resolveOptions(this,t))}admin(){return new ND.Admin(this)}collection(e,t={}){if(typeof t==="function")throw new hm.MongoInvalidArgumentError("The callback form of this helper has been removed.");return new lm.Collection(this,e,rt.resolveOptions(this,t))}async stats(e){return await Ln.executeOperation(this.client,new zD.DbStatsOperation(this,rt.resolveOptions(this,e)))}listCollections(e={},t={}){return new $D.ListCollectionsCursor(this,e,rt.resolveOptions(this,t))}async renameCollection(e,t,r){return await Ln.executeOperation(this.client,new LD.RenameOperation(this.collection(e),t,rt.resolveOptions(void 0,{...r,readPreference:dm.ReadPreference.primary})))}async dropCollection(e,t){return t=rt.resolveOptions(this,t),await fm.dropCollections(this,e,t)}async dropDatabase(e){return await Ln.executeOperation(this.client,new fm.DropDatabaseOperation(this,rt.resolveOptions(this,e)))}async collections(e){return e=rt.resolveOptions(this,e),(await this.listCollections({},{...e,nameOnly:!0}).toArray()).filter(({name:r})=>!r.includes("$")).map(({name:r})=>new lm.Collection(this,r,this.s.options))}async createIndex(e,t,r){return(await Ln.executeOperation(this.client,kD.CreateIndexesOperation.fromIndexSpecification(this,e,t,!1,r??{},void 0)))[0]}async removeUser(e,t){return await Ln.executeOperation(this.client,new jD.RemoveUserOperation(this,e,rt.resolveOptions(this,t)))}async setProfilingLevel(e,t){return await Ln.executeOperation(this.client,new VD.SetProfilingLevelOperation(this,e,rt.resolveOptions(this,t)))}async profilingLevel(e){return await Ln.executeOperation(this.client,new qD.ProfilingLevelOperation(this,rt.resolveOptions(this,e)))}async indexInformation(e,t){return await this.collection(e).indexInformation(rt.resolveOptions(this,t))}watch(e=[],t={}){if(!Array.isArray(e))t=e,e=[];return new ID.ChangeStream(this,e,rt.resolveOptions(this,t))}runCursorCommand(e,t){return new vD.RunCommandCursor(this,e,{...t})}}pm.Db=KD});var Sa=g(function(o1){Object.defineProperty(o1,"__esModule",{value:!0});o1.AuthProvider=o1.AuthContext=void 0;var GD=X();class YD{constructor(e,t,r){this.reauthenticating=!1,this.connection=e,this.credentials=t,this.options=r}}o1.AuthContext=YD;class JD{async prepare(e,t){return e}async reauth(e){if(e.reauthenticating)throw new GD.MongoRuntimeError("Reauthentication already in progress.");try{e.reauthenticating=!0,await this.auth(e)}finally{e.reauthenticating=!1}}}o1.AuthProvider=JD});var gm=g(function(yo){Object.defineProperty(yo,"__esModule",{value:!0});yo.GSSAPI=yo.GSSAPICanonicalizationValue=void 0;yo.performGSSAPICanonicalizeHostName=rT;yo.resolveCname=r3;var u1=require("dns"),QD=Fo(),ym=X(),XD=he(),ZD=Sa();yo.GSSAPICanonicalizationValue=Object.freeze({on:!0,off:!1,none:"none",forward:"forward",forwardAndReverse:"forwardAndReverse"});async function t3(e,t){return await e.command(XD.ns("$external.$cmd"),t)}var Ff;class eT extends ZD.AuthProvider{async auth(e){let{connection:t,credentials:r}=e;if(r==null)throw new ym.MongoMissingCredentialsError("Credentials required for GSSAPI authentication");let{username:n}=r,s=await tX(e),i=await s.step(""),o=await t3(t,rX(i)),u=await tT(s,10,o.payload),a=await t3(t,nX(u,o.conversationId)),c=await sX(s,n,a.payload);await t3(t,{saslContinue:1,conversationId:a.conversationId,payload:c})}}yo.GSSAPI=eT;async function tX({options:{hostAddress:e,runtime:t},credentials:r}){if(!e||typeof e.host!=="string"||!r)throw new ym.MongoInvalidArgumentError("Connection must have host and port and credentials defined.");let{os:n}=await t;if(iX(),"kModuleError"in Ff)throw Ff.kModuleError;let{initializeClient:s}=Ff,{username:i,password:o}=r,u=r.mechanismProperties,a=u.SERVICE_NAME??"mongodb",c=await rT(e.host,u),l={};if(o!=null)Object.assign(l,{user:i,password:o});let f=u.SERVICE_HOST??c,h=`${a}${n.platform()==="win32"?"/":"@"}${f}`;if("SERVICE_REALM"in u)h=`${h}@${u.SERVICE_REALM}`;return await s(h,l)}function rX(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}function nX(e,t){return{saslContinue:1,conversationId:t,payload:e}}async function tT(e,t,r){try{return await e.step(r)||""}catch(n){if(t===0)throw n;return await tT(e,t-1,r)}}async function sX(e,t,r){let n=await e.unwrap(r);return await e.wrap(n||"",{user:t})}async function rT(e,t){let r=t.CANONICALIZE_HOST_NAME;if(!r||r===yo.GSSAPICanonicalizationValue.none)return e;if(r===yo.GSSAPICanonicalizationValue.on||r===yo.GSSAPICanonicalizationValue.forwardAndReverse){let{address:n}=await u1.promises.lookup(e);try{let s=await u1.promises.resolve(n,"PTR");return s.length>0?s[0]:e}catch{return await r3(e)}}else return await r3(e)}async function r3(e){try{let t=await u1.promises.resolve(e,"CNAME");return t.length>0?t[0]:e}catch{return e}}function iX(){if(!Ff)Ff=QD.getKerberos()}});var Uo=g(function(Lo){Object.defineProperty(Lo,"__esModule",{value:!0});Lo.AUTH_MECHS_AUTH_SRC_EXTERNAL=Lo.AuthMechanism=void 0;Lo.AuthMechanism=Object.freeze({MONGODB_AWS:"MONGODB-AWS",MONGODB_DEFAULT:"DEFAULT",MONGODB_GSSAPI:"GSSAPI",MONGODB_PLAIN:"PLAIN",MONGODB_SCRAM_SHA1:"SCRAM-SHA-1",MONGODB_SCRAM_SHA256:"SCRAM-SHA-256",MONGODB_X509:"MONGODB-X509",MONGODB_OIDC:"MONGODB-OIDC"});Lo.AUTH_MECHS_AUTH_SRC_EXTERNAL=new Set([Lo.AuthMechanism.MONGODB_GSSAPI,Lo.AuthMechanism.MONGODB_AWS,Lo.AuthMechanism.MONGODB_OIDC,Lo.AuthMechanism.MONGODB_X509])});var Em=g(function(Dc){Object.defineProperty(Dc,"__esModule",{value:!0});Dc.MongoCredentials=Dc.DEFAULT_ALLOWED_HOSTS=void 0;var kt=X(),iT=gm(),Dt=Uo();function oX(e){if(e){if(Array.isArray(e.saslSupportedMechs))return e.saslSupportedMechs.includes(Dt.AuthMechanism.MONGODB_SCRAM_SHA256)?Dt.AuthMechanism.MONGODB_SCRAM_SHA256:Dt.AuthMechanism.MONGODB_SCRAM_SHA1}return Dt.AuthMechanism.MONGODB_SCRAM_SHA256}var nT=["test","azure","gcp","k8s"],sT="Auth mechanism property ALLOWED_HOSTS must be an array of strings.";Dc.DEFAULT_ALLOWED_HOSTS=["*.mongodb.net","*.mongodb-qa.net","*.mongodb-dev.net","*.mongodbgov.net","localhost","127.0.0.1","::1","*.mongo.com"];var uX="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure or gcp.";class _m{constructor(e){if(this.username=e.username??"",this.password=e.password,this.source=e.source,!this.source&&e.db)this.source=e.db;if(this.mechanism=e.mechanism||Dt.AuthMechanism.MONGODB_DEFAULT,this.mechanismProperties=e.mechanismProperties||{},this.mechanism===Dt.AuthMechanism.MONGODB_OIDC&&!this.mechanismProperties.ALLOWED_HOSTS)this.mechanismProperties={...this.mechanismProperties,ALLOWED_HOSTS:Dc.DEFAULT_ALLOWED_HOSTS};Object.freeze(this.mechanismProperties),Object.freeze(this)}equals(e){return this.mechanism===e.mechanism&&this.username===e.username&&this.password===e.password&&this.source===e.source}resolveAuthMechanism(e){if(this.mechanism.match(/DEFAULT/i))return new _m({username:this.username,password:this.password,source:this.source,mechanism:oX(e),mechanismProperties:this.mechanismProperties});return this}validate(){if((this.mechanism===Dt.AuthMechanism.MONGODB_GSSAPI||this.mechanism===Dt.AuthMechanism.MONGODB_PLAIN||this.mechanism===Dt.AuthMechanism.MONGODB_SCRAM_SHA1||this.mechanism===Dt.AuthMechanism.MONGODB_SCRAM_SHA256)&&!this.username)throw new kt.MongoMissingCredentialsError(`Username required for mechanism '${this.mechanism}'`);if(this.mechanism===Dt.AuthMechanism.MONGODB_PLAIN&&(this.username.includes("\x00")||this.password.includes("\x00")))throw new kt.MongoInvalidArgumentError(`Username and password cannot contain NUL characters for mechanism '${this.mechanism}'`);if(this.mechanism===Dt.AuthMechanism.MONGODB_OIDC){if(this.username&&this.mechanismProperties.ENVIRONMENT&&this.mechanismProperties.ENVIRONMENT!=="azure")throw new kt.MongoInvalidArgumentError(`username and a non-azure ENVIRONMENT may not be used together for mechanism '${this.mechanism}'.`);if(this.username&&this.password)throw new kt.MongoInvalidArgumentError(`No password is allowed with a username for '${this.mechanism}'.`);if((this.mechanismProperties.ENVIRONMENT==="azure"||this.mechanismProperties.ENVIRONMENT==="gcp")&&!this.mechanismProperties.TOKEN_RESOURCE)throw new kt.MongoInvalidArgumentError(uX);if(this.mechanismProperties.ENVIRONMENT&&!nT.includes(this.mechanismProperties.ENVIRONMENT))throw new kt.MongoInvalidArgumentError(`Currently only a ENVIRONMENT in ${nT.join(",")} is supported for mechanism '${this.mechanism}'.`);if(!this.mechanismProperties.ENVIRONMENT&&!this.mechanismProperties.OIDC_CALLBACK&&!this.mechanismProperties.OIDC_HUMAN_CALLBACK)throw new kt.MongoInvalidArgumentError(`Either a ENVIRONMENT, OIDC_CALLBACK, or OIDC_HUMAN_CALLBACK must be specified for mechanism '${this.mechanism}'.`);if(this.mechanismProperties.ENVIRONMENT&&(this.mechanismProperties.OIDC_CALLBACK||this.mechanismProperties.OIDC_HUMAN_CALLBACK))throw new kt.MongoInvalidArgumentError(`ENVIRONMENT may not be used together with OIDC_CALLBACK or OIDC_HUMAN_CALLBACK for mechanism '${this.mechanism}'.`);if(this.mechanismProperties.ALLOWED_HOSTS){let t=this.mechanismProperties.ALLOWED_HOSTS;if(!Array.isArray(t))throw new kt.MongoInvalidArgumentError(sT);for(let r of t)if(typeof r!=="string")throw new kt.MongoInvalidArgumentError(sT)}}if(Dt.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(this.mechanism)){if(this.source!=null&&this.source!=="$external")throw new kt.MongoAPIError(`Invalid source for mechanism '${this.mechanism}' specified, it must be '$external'.`)}if(this.mechanism===Dt.AuthMechanism.MONGODB_PLAIN&&this.source==null)throw new kt.MongoAPIError("PLAIN Authentication Mechanism needs an auth source");if(this.mechanism===Dt.AuthMechanism.MONGODB_X509&&this.password!=null){if(this.password===""){Reflect.set(this,"password",void 0);return}throw new kt.MongoAPIError("Password not allowed for mechanism MONGODB-X509")}let e=this.mechanismProperties.CANONICALIZE_HOST_NAME??!1;if(!Object.values(iT.GSSAPICanonicalizationValue).includes(e))throw new kt.MongoAPIError("Invalid CANONICALIZE_HOST_NAME value")}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return r(this.toJSON(),t)}toJSON(){let e={...this,username:"<redacted>",password:"<redacted>"};if(this.mechanismProperties.AWS_SESSION_TOKEN!=null)e.mechanismProperties={...this.mechanismProperties,AWS_SESSION_TOKEN:"<redacted>"};return e}static merge(e,t){return new _m({username:t.username??e?.username??"",password:t.password??e?.password??"",mechanism:t.mechanism??e?.mechanism??Dt.AuthMechanism.MONGODB_DEFAULT,mechanismProperties:t.mechanismProperties??e?.mechanismProperties??{},source:t.source??t.db??e?.source??"admin"})}}Dc.MongoCredentials=_m});var oT=g(function(ome,aX){aX.exports={name:"mongodb",version:"7.9.1",description:"The official MongoDB driver for Node.js",main:"lib/index.js",files:["lib","src","etc/prepare.js","mongodb.d.ts","tsconfig.json"],types:"mongodb.d.ts",repository:{type:"git",url:"git@github.com:mongodb/node-mongodb-native.git"},keywords:["mongodb","driver","official"],author:{name:"The MongoDB NodeJS Team",email:"dbx-node@mongodb.com"},dependencies:{"@mongodb-js/saslprep":"^1.5.0",bson:"^7.3.2","mongodb-connection-string-url":"^7.0.2"},peerDependencies:{"@aws-sdk/credential-providers":"^3.806.0","@mongodb-js/zstd":"^7.0.0","gcp-metadata":"^7.0.1",kerberos:"^7.0.0","mongodb-client-encryption":"^7.2.0",snappy:"^7.3.2",socks:"^2.8.6"},peerDependenciesMeta:{"@aws-sdk/credential-providers":{optional:!0},"@mongodb-js/zstd":{optional:!0},kerberos:{optional:!0},snappy:{optional:!0},"mongodb-client-encryption":{optional:!0},"gcp-metadata":{optional:!0},socks:{optional:!0}},devDependencies:{"@aws-sdk/credential-providers":"^3.1117.0","@iarna/toml":"^2.2.5","@istanbuljs/nyc-config-typescript":"^1.0.2","@microsoft/api-extractor":"^7.59.0","@microsoft/tsdoc-config":"^0.18.1","@mongodb-js/zstd":"^7.0.0","@types/chai-subset":"^1.3.6","@types/express":"^5.0.6","@types/kerberos":"^1.1.5","@types/mocha":"^10.0.10","@types/node":"^22.20.1","@types/saslprep":"^1.0.3","@types/semver":"^7.8.0","@types/sinon":"^17.0.4","@types/whatwg-url":"^13.0.0","@typescript-eslint/eslint-plugin":"^8.68.0","@typescript-eslint/parser":"^8.68.0",aws4:"^1.13.2",chai:"^5.3.3","chai-subset":"^1.6.0",chalk:"^4.1.2",esbuild:"^0.28.2",eslint:"^9.39.5","eslint-config-prettier":"^10.1.8","eslint-plugin-mocha":"^10.5.0","eslint-plugin-prettier":"^5.5.6","eslint-plugin-simple-import-sort":"^12.1.1","eslint-plugin-tsdoc":"^0.5.2","eslint-plugin-unused-imports":"^4.4.1",express:"^5.2.1","gcp-metadata":"^7.0.1","js-yaml":"^4.3.1",mocha:"^11.8.0","mocha-sinon":"^2.1.2","mongodb-client-encryption":"^7.2.1",nyc:"^17.1.0",prettier:"3.6.2",semver:"^7.8.5",sinon:"^18.0.1","sinon-chai":"^4.0.1",snappy:"^7.4.3",socks:"^2.8.9","source-map-support":"^0.5.21","ts-node":"^10.9.2",tsd:"^0.33.0",typescript:"5.8.3","typescript-cached-transpile":"^0.0.6","v8-heapsnapshot":"^1.3.1",yargs:"^18.1.0"},license:"Apache-2.0",engines:{node:">=20.19.0"},bugs:{url:"https://jira.mongodb.org/projects/NODE/issues/"},homepage:"https://github.com/mongodb/node-mongodb-native",scripts:{"build:evergreen":"node .evergreen/generate_evergreen_tasks.js","build:ts":"node ./node_modules/typescript/bin/tsc","build:dts":"npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts","build:docs":"./etc/docs/build.ts","build:typedoc":"typedoc","build:nightly":"node ./.github/scripts/nightly.mjs","check:bench":"npm --prefix test/benchmarks/driver_bench start","check:coverage":"nyc npm run test:all","check:integration-coverage":"nyc npm run check:test","check:lambda":"npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js","check:lambda:aws":"npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js","check:lint":"npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd","check:eslint":"npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test","check:tsd":"tsd --version && tsd","check:dependencies":"npm run build:bundle && mocha test/action/dependency.test.ts","check:dts":"npm run build:bundle && node ./node_modules/typescript/bin/tsc --target es2023 --module commonjs --noEmit mongodb.d.ts && tsd","check:search-indexes":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts","check:test":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration","check:test:debug":"npm run mocha:debug -- --config test/mocha_mongodb.js test/integration","check:test-bundled":"MONGODB_BUNDLED=true npm run check:test","check:unit":"npm run build:bundle && nyc mocha test/unit","check:unit:debug":"npm run mocha:debug -- test/unit","check:unit-bundled":"MONGODB_BUNDLED=true npm run check:unit","check:ts":"node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit","check:atlas":"npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts","check:drivers-atlas-testing":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts","check:aws":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts test/integration/auth/mongodb_aws.prose.test.ts","check:oidc-auth":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts","check:oidc-test":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts","check:kerberos":"npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts","check:tls":"npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts","check:ldap":"npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts","check:socks5":"npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts","check:csfle":"npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption","check:snappy":"npm run build:bundle && nyc mocha test/unit/assorted/snappy.test.js","check:x509":"npm run build:bundle && nyc mocha test/manual/x509_auth.test.ts","check:sfp":"npm run build:bundle && nyc mocha test/manual/sfp.test.ts","mocha:debug":"npm run build:bundle && node --inspect --enable-source-maps --no-experimental-strip-types ./node_modules/mocha/bin/mocha.js","build:bundle":"npm run bundle:driver && npm run bundle:types && npm run build:runtime-barrel","build:runtime-barrel":"node etc/build-runtime-barrel.mjs","bundle:driver":"node etc/bundle-driver.mjs","bundle:types":"npx tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --declarationDir test/tools/runner/bundle/types","fix:eslint":"npm run check:eslint -- --fix",prepare:"node etc/prepare.js","preview:docs":"ts-node etc/docs/preview.ts","switch:to-bundled":"MONGODB_BUNDLED=true npm run build:runtime-barrel","switch:to-unbundled":"MONGODB_BUNDLED=false npm run build:runtime-barrel",test:"npm run check:lint && npm run test:all","test:all":"npm run check:unit && npm run check:test","update:docs":"npm run build:docs -- --yes"},tsd:{directory:"test/types",compilerOptions:{strict:!0,target:"esnext",module:"commonjs",moduleResolution:"node"}}}});var n3=g(function(Tc){Object.defineProperty(Tc,"__esModule",{value:!0});Tc.LimitedSizeDocument=void 0;Tc.isDriverInfoEqual=lX;Tc.makeClientMetadata=hX;Tc.getFAASEnv=cT;var a1=require("process"),Ur=Te(),Am=X(),aT=he(),cX=oT().version;function lX(e,t){let r=(n,s)=>(n||=void 0,s||=void 0,n===s);return r(e.name,t.name)&&r(e.platform,t.platform)&&r(e.version,t.version)}class Om{constructor(e){this.document=new Map,this.documentSize=5,this.maxSize=e}ifItFitsItSits(e,t){let r=Ur.BSON.serialize(new Map().set(e,t)).byteLength-5;if(r+this.documentSize>this.maxSize)return!1;return this.documentSize+=r,this.document.set(e,t),!0}toObject(){return Ur.BSON.deserialize(Ur.BSON.serialize(this.document),{promoteLongs:!1,promoteBuffers:!1,promoteValues:!1,useBigInt64:!1})}}Tc.LimitedSizeDocument=Om;async function hX(e,{appName:t="",runtime:r}){let{os:n}=await r,s=new Om(512);if(t.length>0){let c=Ur.ByteUtils.utf8ByteLength(t)<=128?t:Ur.ByteUtils.toUTF8(Ur.ByteUtils.fromUTF8(t),0,128,!1);s.ifItFitsItSits("application",{name:c})}let i={name:"nodejs",version:cX};for(let{name:c="",version:l=""}of e){if(c.length>0)i.name=`${i.name}|${c}`;if(l.length>0)i.version=`${i.version}|${l}`}if(!s.ifItFitsItSits("driver",i))throw new Am.MongoInvalidArgumentError("Unable to include driverInfo name and version, metadata cannot exceed 512 bytes");let o=pX();for(let{platform:c=""}of e)if(c.length>0)o=`${o}|${c}`;if(!s.ifItFitsItSits("platform",o))throw new Am.MongoInvalidArgumentError("Unable to include driverInfo platform, metadata cannot exceed 512 bytes");let u=new Map().set("name",n.platform()).set("architecture",n.arch()).set("version",n.release()).set("type",n.type());if(!s.ifItFitsItSits("os",u))for(let c of u.keys()){if(u.delete(c),u.size===0)break;if(s.ifItFitsItSits("os",u))break}let a=cT();if(a!=null){if(!s.ifItFitsItSits("env",a))for(let c of a.keys()){if(a.delete(c),a.size===0)break;if(s.ifItFitsItSits("env",a))break}}return await dX(s.toObject())}var uT;async function fX(){uT??=aT.fileIsAccessible("/.dockerenv");let e=await uT,{KUBERNETES_SERVICE_HOST:t=""}=a1.env,r=t.length>0?!0:!1,n={};if(e)n.runtime="docker";if(r)n.orchestrator="kubernetes";return n}async function dX(e){let t=await fX();if(Object.keys(t).length===0)return e;let r=new Om(512),n={...e?.env,container:t};for(let[s,i]of Object.entries(e))if(s!=="env")r.ifItFitsItSits(s,i);else if(!r.ifItFitsItSits("env",n))r.ifItFitsItSits("env",i);if(!("env"in e))r.ifItFitsItSits("env",n);return r.toObject()}function cT(){let{AWS_EXECUTION_ENV:e="",AWS_LAMBDA_RUNTIME_API:t="",FUNCTIONS_WORKER_RUNTIME:r="",K_SERVICE:n="",FUNCTION_NAME:s="",VERCEL:i="",AWS_LAMBDA_FUNCTION_MEMORY_SIZE:o="",AWS_REGION:u="",FUNCTION_MEMORY_MB:a="",FUNCTION_REGION:c="",FUNCTION_TIMEOUT_SEC:l="",VERCEL_REGION:f=""}=a1.env,h=e.startsWith("AWS_Lambda_")||t.length>0,d=r.length>0,p=n.length>0||s.length>0,m=i.length>0,_=new Map;if(m&&!(d||p)){if(f.length>0)_.set("region",f);return _.set("name","vercel"),_}if(h&&!(d||p||m)){if(u.length>0)_.set("region",u);if(o.length>0&&Number.isInteger(+o))_.set("memory_mb",new Ur.Int32(o));return _.set("name","aws.lambda"),_}if(d&&!(p||h||m))return _.set("name","azure.func"),_;if(p&&!(d||h||m)){if(c.length>0)_.set("region",c);if(a.length>0&&Number.isInteger(+a))_.set("memory_mb",new Ur.Int32(a));if(l.length>0&&Number.isInteger(+l))_.set("timeout_sec",new Ur.Int32(l));return _.set("name","gcp.func"),_}return null}function pX(){let e=Ur.NumberUtils.isBigEndian?"BE":"LE";if("Deno"in globalThis)return`Deno v${typeof Deno?.version?.deno==="string"?Deno?.version?.deno:"0.0.0-unknown"}, ${e}`;if("Bun"in globalThis)return`Bun v${typeof Bun?.version==="string"?Bun?.version:"0.0.0-unknown"}, ${e}`;return`Node.js ${a1.version}, ${e}`}});var wm=g(function(ut){function er(e,t,r){if(r.globals)e=r.globals[e.name];return new e(`${r.context?r.context:"Value"} ${t}.`)}function c1(e,t){if(typeof e==="bigint")throw er(TypeError,"is a BigInt which cannot be converted to a number",t);if(!t.globals)return Number(e);return t.globals.Number(e)}function hT(e){if(e>0&&e%1===0.5&&(e&1)===0||e<0&&e%1===-0.5&&(e&1)===1)return Nf(Math.floor(e));return Nf(Math.round(e))}function Sm(e){return Nf(Math.trunc(e))}function lT(e){return e<0?-1:1}function mX(e,t){let r=e%t;if(lT(t)!==lT(r))return r+t;return r}function Nf(e){return e===0?0:e}function l1(e,{unsigned:t}){let r,n;if(t)r=0,n=2**e-1;else r=-(2**(e-1)),n=2**(e-1)-1;let s=2**e,i=2**(e-1);return(o,u={})=>{let a=c1(o,u);if(a=Nf(a),u.enforceRange){if(!Number.isFinite(a))throw er(TypeError,"is not a finite number",u);if(a=Sm(a),a<r||a>n)throw er(TypeError,`is outside the accepted range of ${r} to ${n}, inclusive`,u);return a}if(!Number.isNaN(a)&&u.clamp)return a=Math.min(Math.max(a,r),n),a=hT(a),a;if(!Number.isFinite(a)||a===0)return 0;if(a=Sm(a),a>=r&&a<=n)return a;if(a=mX(a,s),!t&&a>=i)return a-s;return a}}function fT(e,{unsigned:t}){let r=Number.MAX_SAFE_INTEGER,n=t?0:Number.MIN_SAFE_INTEGER,s=t?BigInt.asUintN:BigInt.asIntN;return(i,o={})=>{let u=c1(i,o);if(u=Nf(u),o.enforceRange){if(!Number.isFinite(u))throw er(TypeError,"is not a finite number",o);if(u=Sm(u),u<n||u>r)throw er(TypeError,`is outside the accepted range of ${n} to ${r}, inclusive`,o);return u}if(!Number.isNaN(u)&&o.clamp)return u=Math.min(Math.max(u,n),r),u=hT(u),u;if(!Number.isFinite(u)||u===0)return 0;let a=BigInt(Sm(u));return a=s(e,a),Number(a)}}ut.any=(e)=>e;ut.undefined=()=>{return};ut.boolean=(e)=>Boolean(e);ut.byte=l1(8,{unsigned:!1});ut.octet=l1(8,{unsigned:!0});ut.short=l1(16,{unsigned:!1});ut["unsigned short"]=l1(16,{unsigned:!0});ut.long=l1(32,{unsigned:!1});ut["unsigned long"]=l1(32,{unsigned:!0});ut["long long"]=fT(64,{unsigned:!1});ut["unsigned long long"]=fT(64,{unsigned:!0});ut.double=(e,t={})=>{let r=c1(e,t);if(!Number.isFinite(r))throw er(TypeError,"is not a finite floating-point value",t);return r};ut["unrestricted double"]=(e,t={})=>c1(e,t);ut.float=(e,t={})=>{let r=c1(e,t);if(!Number.isFinite(r))throw er(TypeError,"is not a finite floating-point value",t);if(Object.is(r,-0))return r;let n=Math.fround(r);if(!Number.isFinite(n))throw er(TypeError,"is outside the range of a single-precision floating-point value",t);return n};ut["unrestricted float"]=(e,t={})=>{let r=c1(e,t);if(isNaN(r))return r;if(Object.is(r,-0))return r;return Math.fround(r)};ut.DOMString=(e,t={})=>{if(t.treatNullAsEmptyString&&e===null)return"";if(typeof e==="symbol")throw er(TypeError,"is a symbol, which cannot be converted to a string",t);return(t.globals?t.globals.String:String)(e)};ut.ByteString=(e,t={})=>{let r=ut.DOMString(e,t);if(/[^\x00-\xFF]/.test(r))throw er(TypeError,"is not a valid ByteString",t);return r};ut.USVString=(e,t={})=>ut.DOMString(e,t).toWellFormed();ut.object=(e,t={})=>{if(e===null||typeof e!=="object"&&typeof e!=="function")throw er(TypeError,"is not an object",t);return e};var yX=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get,gX=Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,"byteLength").get;function dT(e){try{return yX.call(e),!0}catch{return!1}}function s3(e){try{return gX.call(e),!0}catch{return!1}}var _X=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"resizable").get,EX=Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,"growable").get;function pT(e){try{return _X.call(e)}catch{return!1}}function mT(e){try{return EX.call(e)}catch{return!1}}function yT(e){try{return new Uint8Array(e),!1}catch{return!0}}ut.ArrayBuffer=(e,t={})=>{if(!dT(e))throw er(TypeError,"is not an ArrayBuffer",t);if(!t.allowResizable&&pT(e))throw er(TypeError,"is a resizable ArrayBuffer",t);if(yT(e))throw er(TypeError,"is a detached ArrayBuffer",t);return e};ut.SharedArrayBuffer=(e,t={})=>{if(!s3(e))throw er(TypeError,"is not a SharedArrayBuffer",t);if(!t.allowResizable&&mT(e))throw er(TypeError,"is a growable SharedArrayBuffer",t);return e};var AX=Object.getOwnPropertyDescriptor(DataView.prototype,"byteLength").get;ut.DataView=(e,t={})=>{try{AX.call(e)}catch{throw er(TypeError,"is not a DataView",t)}return ut.ArrayBufferView(e,t)};var OX=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array).prototype,Symbol.toStringTag).get;[Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Uint8ClampedArray,Float32Array,Float64Array].forEach((e)=>{let{name:t}=e,r=/^[AEIOU]/u.test(t)?"an":"a";ut[t]=(n,s={})=>{if(!ArrayBuffer.isView(n)||OX.call(n)!==t)throw er(TypeError,`is not ${r} ${t} object`,s);return ut.ArrayBufferView(n,s)}});ut.ArrayBufferView=(e,t={})=>{if(!ArrayBuffer.isView(e))throw er(TypeError,"is not a view on an ArrayBuffer or SharedArrayBuffer",t);if(!t.allowShared&&s3(e.buffer))throw er(TypeError,"is a view on a SharedArrayBuffer, which is not allowed",t);if(!t.allowResizable){if(pT(e.buffer))throw er(TypeError,"is a view on a resizable ArrayBuffer, which is not allowed",t);else if(mT(e.buffer))throw er(TypeError,"is a view on a growable SharedArrayBuffer, which is not allowed",t)}if(yT(e.buffer))throw er(TypeError,"is a view on a detached ArrayBuffer",t);return e};ut.BufferSource=(e,t={})=>{if(ArrayBuffer.isView(e))return ut.ArrayBufferView(e,t);if(dT(e))return ut.ArrayBuffer(e,t);else if(t.allowShared&&s3(e))return ut.SharedArrayBuffer(e,t);if(t.allowShared)throw er(TypeError,"is not an ArrayBuffer, SharedArrayBuffer, or a view on one",t);else throw er(TypeError,"is not an ArrayBuffer or a view on one",t)};ut.DOMTimeStamp=ut["unsigned long long"]});var bm=g(function(wT,CT){function gT(e){return typeof e==="object"&&e!==null||typeof e==="function"}var SX=Function.call.bind(Function.call);function wX(e,t){for(let r of Reflect.ownKeys(t)){let n=Reflect.getOwnPropertyDescriptor(t,r);if(n&&!Reflect.defineProperty(e,r,n))throw TypeError(`Cannot redefine property: ${String(r)}`)}}function CX(e,t){let r=AT(e);return Object.defineProperties(Object.create(r["%Object.prototype%"]),Object.getOwnPropertyDescriptors(t))}var _T=Symbol("wrapper"),ET=Symbol("impl"),h1=Symbol("SameObject caches"),Cm=Symbol.for("[webidl2js] constructor registry"),bX=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);function AT(e){if(Object.hasOwn(e,Cm))return e[Cm];let t=Object.create(null);t["%Object.prototype%"]=e.Object.prototype,t["%IteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf(new e.Array()[Symbol.iterator]()));try{t["%AsyncIteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf(e.eval("(async function* () {})").prototype))}catch{t["%AsyncIteratorPrototype%"]=bX}return e[Cm]=t,t}function DX(e,t,r){if(!e[h1])e[h1]=Object.create(null);if(t in e[h1])return e[h1][t];return e[h1][t]=r(),e[h1][t]}function OT(e){return e?e[_T]:null}function ST(e){return e?e[ET]:null}function TX(e){let t=OT(e);return t?t:e}function MX(e){let t=ST(e);return t?t:e}var PX=Symbol("internal");function BX(e){if(typeof e!=="string")return!1;let t=e>>>0;if(t===4294967295)return!1;let r=`${t}`;if(e!==r)return!1;return!0}var FX=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get;function NX(e){try{return FX.call(e),!0}catch{return!1}}function IX([e,t],r){let n;switch(r){case"key":n=e;break;case"value":n=t;break;case"key+value":n=[e,t];break}return{value:n,done:!1}}function RX(e,t,r,n,s){if(s===void 0){let o=Reflect.getPrototypeOf(e);if(o!==null)return Reflect.set(o,t,r,n);s={writable:!0,enumerable:!0,configurable:!0,value:void 0}}if($X(s)){if(!s.writable)return!1;if(!gT(n))return!1;let o=Reflect.getOwnPropertyDescriptor(n,t);if(o!==void 0){if(vX(o))return!1;if(o.writable===!1)return!1;return Reflect.defineProperty(n,t,{value:r})}return Reflect.defineProperty(n,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}let i=s.set;if(i===void 0)return!1;return SX(i,n,r),!0}function $X(e){return Object.hasOwn(e,"value")||Object.hasOwn(e,"writable")}function vX(e){return Object.hasOwn(e,"get")||Object.hasOwn(e,"set")}var xX=Symbol("supports property index"),kX=Symbol("supported property indices"),qX=Symbol("supports property name"),jX=Symbol("supported property names"),LX=Symbol("indexed property get"),UX=Symbol("indexed property set new"),VX=Symbol("indexed property set existing"),zX=Symbol("named property get"),WX=Symbol("named property set new"),HX=Symbol("named property set existing"),KX=Symbol("named property delete"),GX=Symbol("async iterator get the next iteration result"),YX=Symbol("async iterator return steps"),JX=Symbol("async iterator initialization steps"),QX=Symbol("async iterator end of iteration");CT.exports=wT={isObject:gT,define:wX,newObjectInRealm:CX,wrapperSymbol:_T,implSymbol:ET,getSameObject:DX,ctorRegistrySymbol:Cm,initCtorRegistry:AT,wrapperForImpl:OT,implForWrapper:ST,tryWrapperForImpl:TX,tryImplForWrapper:MX,iterInternalSymbol:PX,isArrayBuffer:NX,isArrayIndexPropName:BX,supportsPropertyIndex:xX,supportedPropertyIndices:kX,supportsPropertyName:qX,supportedPropertyNames:jX,indexedGet:LX,indexedSetNew:UX,indexedSetExisting:VX,namedGet:zX,namedSetNew:WX,namedSetExisting:HX,namedDelete:KX,asyncIteratorNext:GX,asyncIteratorReturn:YX,asyncIteratorInit:JX,asyncIteratorEOI:QX,iteratorResult:IX,ordinarySetWithOwnDescriptor:RX}});var NT=g(function(cme,FT){var XX=/^xn--/,ZX=/[^\0-\x7F]/,eZ=/[\x2E\u3002\uFF0E\uFF61]/g,tZ={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Vo=Math.floor,i3=String.fromCharCode;function wa(e){throw RangeError(tZ[e])}function rZ(e,t){let r=[],n=e.length;while(n--)r[n]=t(e[n]);return r}function DT(e,t){let r=e.split("@"),n="";if(r.length>1)n=r[0]+"@",e=r[1];e=e.replace(eZ,".");let s=e.split("."),i=rZ(s,t).join(".");return n+i}function TT(e){let t=[],r=0,n=e.length;while(r<n){let s=e.charCodeAt(r++);if(s>=55296&&s<=56319&&r<n){let i=e.charCodeAt(r++);if((i&64512)==56320)t.push(((s&1023)<<10)+(i&1023)+65536);else t.push(s),r--}else t.push(s)}return t}var nZ=(e)=>String.fromCodePoint(...e),sZ=function(e){if(e>=48&&e<58)return 26+(e-48);if(e>=65&&e<91)return e-65;if(e>=97&&e<123)return e-97;return 36},bT=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},MT=function(e,t,r){let n=0;e=r?Vo(e/700):e>>1,e+=Vo(e/t);for(;e>455;n+=36)e=Vo(e/35);return Vo(n+36*e/(e+38))},PT=function(e){let t=[],r=e.length,n=0,s=128,i=72,o=e.lastIndexOf("-");if(o<0)o=0;for(let u=0;u<o;++u){if(e.charCodeAt(u)>=128)wa("not-basic");t.push(e.charCodeAt(u))}for(let u=o>0?o+1:0;u<r;){let a=n;for(let l=1,f=36;;f+=36){if(u>=r)wa("invalid-input");let h=sZ(e.charCodeAt(u++));if(h>=36)wa("invalid-input");if(h>Vo((2147483647-n)/l))wa("overflow");n+=h*l;let d=f<=i?1:f>=i+26?26:f-i;if(h<d)break;let p=36-d;if(l>Vo(2147483647/p))wa("overflow");l*=p}let c=t.length+1;if(i=MT(n-a,c,a==0),Vo(n/c)>2147483647-s)wa("overflow");s+=Vo(n/c),n%=c,t.splice(n++,0,s)}return String.fromCodePoint(...t)},BT=function(e){let t=[];e=TT(e);let r=e.length,n=128,s=0,i=72;for(let a of e)if(a<128)t.push(i3(a));let o=t.length,u=o;if(o)t.push("-");while(u<r){let a=2147483647;for(let l of e)if(l>=n&&l<a)a=l;let c=u+1;if(a-n>Vo((2147483647-s)/c))wa("overflow");s+=(a-n)*c,n=a;for(let l of e){if(l<n&&++s>2147483647)wa("overflow");if(l===n){let f=s;for(let h=36;;h+=36){let d=h<=i?1:h>=i+26?26:h-i;if(f<d)break;let p=f-d,m=36-d;t.push(i3(bT(d+p%m,0))),f=Vo(p/m)}t.push(i3(bT(f,0))),i=MT(s,c,u===o),s=0,++u}}++s,++n}return t.join("")},iZ=function(e){return DT(e,function(t){return XX.test(t)?PT(t.slice(4).toLowerCase()):t})},oZ=function(e){return DT(e,function(t){return ZX.test(t)?"xn--"+BT(t):t})},uZ={version:"2.3.1",ucs2:{decode:TT,encode:nZ},decode:PT,encode:BT,toASCII:oZ,toUnicode:iZ};FT.exports=uZ});var RT=g(function(lme,IT){var aZ=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11000}-\u{11002}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11082}\u{110B0}-\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{11134}\u{11145}\u{11146}\u{11173}\u{11180}-\u{11182}\u{111B3}-\u{111C0}\u{111C9}-\u{111CC}\u{111CE}\u{111CF}\u{1122C}-\u{11237}\u{1123E}\u{11241}\u{112DF}-\u{112EA}\u{11300}-\u{11303}\u{1133B}\u{1133C}\u{1133E}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11357}\u{11362}\u{11363}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113B8}-\u{113C0}\u{113C2}\u{113C5}\u{113C7}-\u{113CA}\u{113CC}-\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11435}-\u{11446}\u{1145E}\u{114B0}-\u{114C3}\u{115AF}-\u{115B5}\u{115B8}-\u{115C0}\u{115DC}\u{115DD}\u{11630}-\u{11640}\u{116AB}-\u{116B7}\u{1171D}-\u{1172B}\u{1182C}-\u{1183A}\u{11930}-\u{11935}\u{11937}\u{11938}\u{1193B}-\u{1193E}\u{11940}\u{11942}\u{11943}\u{119D1}-\u{119D7}\u{119DA}-\u{119E0}\u{119E4}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A39}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A5B}\u{11A8A}-\u{11A99}\u{11B60}-\u{11B67}\u{11C2F}-\u{11C36}\u{11C38}-\u{11C3F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D8A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D97}\u{11EF3}-\u{11EF6}\u{11F00}\u{11F01}\u{11F03}\u{11F34}-\u{11F3A}\u{11F3E}-\u{11F42}\u{11F5A}\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F51}-\u{16F87}\u{16F8F}-\u{16F92}\u{16FE4}\u{16FF0}\u{16FF1}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D165}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]/u,cZ=/[\u094D\u09CD\u0A4D\u0ACD\u0B4D\u0BCD\u0C4D\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0EBA\u0F84\u1039\u103A\u1714\u1715\u1734\u17D2\u1A60\u1B44\u1BAA\u1BAB\u1BF2\u1BF3\u2D7F\uA806\uA82C\uA8C4\uA953\uA9C0\uAAF6\uABED\u{10A3F}\u{11046}\u{11070}\u{1107F}\u{110B9}\u{11133}\u{11134}\u{111C0}\u{11235}\u{112EA}\u{1134D}\u{113CE}-\u{113D0}\u{11442}\u{114C2}\u{115BF}\u{1163F}\u{116B6}\u{1172B}\u{11839}\u{1193D}\u{1193E}\u{119E0}\u{11A34}\u{11A47}\u{11A99}\u{11C3F}\u{11D44}\u{11D45}\u{11D97}\u{11F41}\u{11F42}\u{1612F}]/u,lZ=/[\u0620\u0626\u0628\u062A-\u062E\u0633-\u063F\u0641-\u0647\u0649\u064A\u066E\u066F\u0678-\u0687\u069A-\u06BF\u06C1\u06C2\u06CC\u06CE\u06D0\u06D1\u06FA-\u06FC\u06FF\u0712-\u0714\u071A-\u071D\u071F-\u0727\u0729\u072B\u072D\u072E\u074E-\u0758\u075C-\u076A\u076D-\u0770\u0772\u0775-\u0777\u077A-\u077F\u07CA-\u07EA\u0841-\u0845\u0848\u084A-\u0853\u0855\u0860\u0862-\u0865\u0868\u0886\u0889-\u088D\u088F\u08A0-\u08A9\u08AF\u08B0\u08B3-\u08B8\u08BA-\u08C8\u1807\u1820-\u1878\u1887-\u18A8\u18AA\uA840-\uA872\u{10AC0}-\u{10AC4}\u{10ACD}\u{10AD3}-\u{10ADC}\u{10ADE}-\u{10AE0}\u{10AEB}-\u{10AEE}\u{10B80}\u{10B82}\u{10B86}-\u{10B88}\u{10B8A}\u{10B8B}\u{10B8D}\u{10B90}\u{10BAD}\u{10BAE}\u{10D00}-\u{10D21}\u{10D23}\u{10EC3}\u{10EC4}\u{10EC6}\u{10EC7}\u{10F30}-\u{10F32}\u{10F34}-\u{10F44}\u{10F51}-\u{10F53}\u{10F70}-\u{10F73}\u{10F76}-\u{10F81}\u{10FB0}\u{10FB2}\u{10FB3}\u{10FB8}\u{10FBB}\u{10FBC}\u{10FBE}\u{10FBF}\u{10FC1}\u{10FC4}\u{10FCA}\u{10FCB}\u{1E900}-\u{1E943}][\xAD\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u061C\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200B\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFEFF\uFFF9-\uFFFB\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113BB}-\u{113C0}\u{113CE}\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C3F}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11F00}\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F42}\u{11F5A}\u{13430}-\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94B}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*\u200C[\xAD\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u061C\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200B\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFEFF\uFFF9-\uFFFB\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113BB}-\u{113C0}\u{113CE}\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C3F}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11F00}\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F42}\u{11F5A}\u{13430}-\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94B}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*[\u0620\u0622-\u063F\u0641-\u064A\u066E\u066F\u0671-\u0673\u0675-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u077F\u07CA-\u07EA\u0840-\u0858\u0860\u0862-\u0865\u0867-\u086A\u0870-\u0882\u0886\u0889-\u088F\u08A0-\u08AC\u08AE-\u08C8\u1807\u1820-\u1878\u1887-\u18A8\u18AA\uA840-\uA871\u{10AC0}-\u{10AC5}\u{10AC7}\u{10AC9}\u{10ACA}\u{10ACE}-\u{10AD6}\u{10AD8}-\u{10AE1}\u{10AE4}\u{10AEB}-\u{10AEF}\u{10B80}-\u{10B91}\u{10BA9}-\u{10BAE}\u{10D01}-\u{10D23}\u{10EC2}-\u{10EC4}\u{10EC6}\u{10EC7}\u{10F30}-\u{10F44}\u{10F51}-\u{10F54}\u{10F70}-\u{10F81}\u{10FB0}\u{10FB2}-\u{10FB6}\u{10FB8}-\u{10FBF}\u{10FC1}-\u{10FC4}\u{10FC9}\u{10FCA}\u{1E900}-\u{1E943}]/u,hZ=/[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u0891\u08A0-\u08C9\u08E2\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}-\u{10959}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10D40}-\u{10D65}\u{10D6F}-\u{10D85}\u{10D8E}\u{10D8F}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC7}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u,fZ=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B4E-\u1B6A\u1B74-\u1B7F\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u249C-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31BF\u31F0-\u321C\u3220-\u324F\u3260-\u327B\u327F-\u32B0\u32C0-\u32CB\u32D0-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA60C\uA610-\uA62B\uA640-\uA66E\uA680-\uA69D\uA6A0-\uA6EF\uA6F2-\uA6F7\uA722-\uA787\uA789-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA824\uA827\uA830-\uA837\uA840-\uA873\uA880-\uA8C3\uA8CE-\uA8D9\uA8F2-\uA8FE\uA900-\uA925\uA92E-\uA946\uA952\uA953\uA95F-\uA97C\uA983-\uA9B2\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA2F\uAA30\uAA33\uAA34\uAA40-\uAA42\uAA44-\uAA4B\uAA4D\uAA50-\uAA59\uAA5C-\uAA7B\uAA7D-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAAEB\uAAEE-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB69\uAB70-\uABE4\uABE6\uABE7\uABE9-\uABEC\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1013F}\u{1018D}\u{1018E}\u{101D0}-\u{101FC}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{11000}\u{11002}-\u{11037}\u{11047}-\u{1104D}\u{11066}-\u{1106F}\u{11071}\u{11072}\u{11075}\u{11082}-\u{110B2}\u{110B7}\u{110B8}\u{110BB}-\u{110C1}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11103}-\u{11126}\u{1112C}\u{11136}-\u{11147}\u{11150}-\u{11172}\u{11174}-\u{11176}\u{11182}-\u{111B5}\u{111BF}-\u{111C8}\u{111CD}\u{111CE}\u{111D0}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1122E}\u{11232}\u{11233}\u{11235}\u{11238}-\u{1123D}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112DE}\u{112E0}-\u{112E2}\u{112F0}-\u{112F9}\u{11302}\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}-\u{1133F}\u{11341}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}-\u{113BA}\u{113C2}\u{113C5}\u{113C7}-\u{113CA}\u{113CC}\u{113CD}\u{113CF}\u{113D1}\u{113D3}-\u{113D5}\u{113D7}\u{113D8}\u{11400}-\u{11437}\u{11440}\u{11441}\u{11445}\u{11447}-\u{1145B}\u{1145D}\u{1145F}-\u{11461}\u{11480}-\u{114B2}\u{114B9}\u{114BB}-\u{114BE}\u{114C1}\u{114C4}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{115C1}-\u{115DB}\u{11600}-\u{11632}\u{1163B}\u{1163C}\u{1163E}\u{11641}-\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116AA}\u{116AC}\u{116AE}\u{116AF}\u{116B6}\u{116B8}\u{116B9}\u{116C0}-\u{116C9}\u{116D0}-\u{116E3}\u{11700}-\u{1171A}\u{1171E}\u{11720}\u{11721}\u{11726}\u{11730}-\u{11746}\u{11800}-\u{1182E}\u{11838}\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193D}\u{1193F}-\u{11942}\u{11944}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D3}\u{119DC}-\u{119DF}\u{119E1}-\u{119E4}\u{11A00}\u{11A07}\u{11A08}\u{11A0B}-\u{11A32}\u{11A39}\u{11A3A}\u{11A3F}-\u{11A46}\u{11A50}\u{11A57}\u{11A58}\u{11A5C}-\u{11A89}\u{11A97}\u{11A9A}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11B00}-\u{11B09}\u{11B61}\u{11B65}\u{11B67}\u{11BC0}-\u{11BE1}\u{11BF0}-\u{11BF9}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2F}\u{11C3E}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D93}\u{11D94}\u{11D96}\u{11D98}\u{11DA0}-\u{11DA9}\u{11DB0}-\u{11DDB}\u{11DE0}-\u{11DE9}\u{11EE0}-\u{11EF2}\u{11EF5}-\u{11EF8}\u{11F02}-\u{11F10}\u{11F12}-\u{11F35}\u{11F3E}\u{11F3F}\u{11F41}\u{11F43}-\u{11F59}\u{11FB0}\u{11FC0}-\u{11FD4}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{1343F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{1612A}-\u{1612C}\u{16130}-\u{16139}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF5}\u{16B00}-\u{16B2F}\u{16B37}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D79}\u{16E40}-\u{16E9A}\u{16EA0}-\u{16EB8}\u{16EBB}-\u{16ED3}\u{16F00}-\u{16F4A}\u{16F50}-\u{16F87}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{16FF0}-\u{16FF6}\u{17000}-\u{18CD5}\u{18CFF}-\u{18D1E}\u{18D80}-\u{18DF2}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}\u{1BC9F}\u{1CCD6}-\u{1CCEF}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D166}\u{1D16A}-\u{1D172}\u{1D183}\u{1D184}\u{1D18C}-\u{1D1A9}\u{1D1AE}-\u{1D1E8}\u{1D2C0}-\u{1D2D3}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D800}-\u{1D9FF}\u{1DA37}-\u{1DA3A}\u{1DA6D}-\u{1DA74}\u{1DA76}-\u{1DA83}\u{1DA85}-\u{1DA8B}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E4D0}-\u{1E4EB}\u{1E4F0}-\u{1E4F9}\u{1E5D0}-\u{1E5ED}\u{1E5F0}-\u{1E5FA}\u{1E5FF}\u{1E6C0}-\u{1E6DE}\u{1E6E0}-\u{1E6E2}\u{1E6E4}\u{1E6E5}\u{1E6E7}-\u{1E6ED}\u{1E6F0}-\u{1E6F4}\u{1E6FE}\u{1E6FF}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1F110}-\u{1F12E}\u{1F130}-\u{1F169}\u{1F170}-\u{1F1AC}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B81D}\u{2B820}-\u{2CEAD}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{33479}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]/u,dZ=/[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088F\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}-\u{10959}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10D8E}\u{10D8F}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC7}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u,pZ=/^[\0-\x08\x0E-\x1B!-@\[-`\{-\x84\x86-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02B9\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u036F\u0374\u0375\u037E\u0384\u0385\u0387\u03F6\u0483-\u0489\u058A\u058D-\u058F\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09F2\u09F3\u09FB\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AF1\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0BF3-\u0BFA\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C78-\u0C7E\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E3F\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39-\u0F3D\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1390-\u1399\u1400\u169B\u169C\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DB\u17DD\u17F0-\u17F9\u1800-\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1940\u1944\u1945\u19DE-\u19FF\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u200B-\u200D\u200F-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20C1\u20D0-\u20F0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189-\u218B\u2190-\u2335\u237B-\u2394\u2396-\u2429\u2440-\u244A\u2460-\u249B\u24EA-\u26AB\u26AD-\u27FF\u2900-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF9-\u2CFF\u2D7F\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u3004\u3008-\u3020\u302A-\u302D\u3030\u3036\u3037\u303D-\u303F\u3099-\u309C\u30A0\u30FB\u31C0-\u31E5\u31EF\u321D\u321E\u3250-\u325F\u327C-\u327E\u32B1-\u32BF\u32CC-\u32CF\u3377-\u337A\u33DE\u33DF\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA60D-\uA60F\uA66F-\uA67F\uA69E\uA69F\uA6F0\uA6F1\uA700-\uA721\uA788\uA802\uA806\uA80B\uA825\uA826\uA828-\uA82C\uA838\uA839\uA874-\uA877\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uAB6A\uAB6B\uABE5\uABE8\uABED\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFDCF\uFDF0-\uFE19\uFE20-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFE70-\uFE74\uFE76-\uFEFC\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD\u{10101}\u{10140}-\u{1018C}\u{10190}-\u{1019C}\u{101A0}\u{101FD}\u{102E0}-\u{102FB}\u{10376}-\u{1037A}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{1091F}-\u{10939}\u{1093F}-\u{10959}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A38}-\u{10A3A}\u{10A3F}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE6}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B39}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D27}\u{10D30}-\u{10D39}\u{10D40}-\u{10D65}\u{10D69}-\u{10D85}\u{10D8E}\u{10D8F}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAB}-\u{10EAD}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC7}\u{10ED0}-\u{10ED8}\u{10EFA}-\u{10F27}\u{10F30}-\u{10F59}\u{10F70}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{11001}\u{11038}-\u{11046}\u{11052}-\u{11065}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113BB}-\u{113C0}\u{113CE}\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{11660}-\u{1166C}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11F00}\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F42}\u{11F5A}\u{11FD5}-\u{11FF1}\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE2}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1CC00}-\u{1CCD5}\u{1CCF0}-\u{1CCFC}\u{1CD00}-\u{1CEB3}\u{1CEBA}-\u{1CED0}\u{1CEE0}-\u{1CEF0}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D1E9}\u{1D1EA}\u{1D200}-\u{1D245}\u{1D300}-\u{1D356}\u{1D6C1}\u{1D6DB}\u{1D6FB}\u{1D715}\u{1D735}\u{1D74F}\u{1D76F}\u{1D789}\u{1D7A9}\u{1D7C3}\u{1D7CE}-\u{1D7FF}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E2FF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8D6}\u{1E900}-\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1EEF0}\u{1EEF1}\u{1F000}-\u{1F02B}\u{1F030}-\u{1F093}\u{1F0A0}-\u{1F0AE}\u{1F0B1}-\u{1F0BF}\u{1F0C1}-\u{1F0CF}\u{1F0D1}-\u{1F0F5}\u{1F100}-\u{1F10F}\u{1F12F}\u{1F16A}-\u{1F16F}\u{1F1AD}\u{1F260}-\u{1F265}\u{1F300}-\u{1F6D8}\u{1F6DC}-\u{1F6EC}\u{1F6F0}-\u{1F6FC}\u{1F700}-\u{1F7D9}\u{1F7E0}-\u{1F7EB}\u{1F7F0}\u{1F800}-\u{1F80B}\u{1F810}-\u{1F847}\u{1F850}-\u{1F859}\u{1F860}-\u{1F887}\u{1F890}-\u{1F8AD}\u{1F8B0}-\u{1F8BB}\u{1F8C0}\u{1F8C1}\u{1F8D0}-\u{1F8D8}\u{1F900}-\u{1FA57}\u{1FA60}-\u{1FA6D}\u{1FA70}-\u{1FA7C}\u{1FA80}-\u{1FA8A}\u{1FA8E}-\u{1FAC6}\u{1FAC8}\u{1FACD}-\u{1FADC}\u{1FADF}-\u{1FAEA}\u{1FAEF}-\u{1FAF8}\u{1FB00}-\u{1FB92}\u{1FB94}-\u{1FBFA}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*$/u,mZ=/[0-9\xB2\xB3\xB9\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u0891\u08A0-\u08C9\u08E2\u200F\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\u{102E1}-\u{102FB}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}-\u{10959}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10D40}-\u{10D65}\u{10D6F}-\u{10D85}\u{10D8E}\u{10D8F}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC7}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1CCF0}-\u{1CCF9}\u{1D7CE}-\u{1D7FF}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}][\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113BB}-\u{113C0}\u{113CE}\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11F00}\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F42}\u{11F5A}\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]*$/u,yZ=/[0-9\xB2\xB3\xB9\u06F0-\u06F9\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFF10-\uFF19\u{102E1}-\u{102FB}\u{1CCF0}-\u{1CCF9}\u{1D7CE}-\u{1D7FF}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}]/u,gZ=/[\u0600-\u0605\u0660-\u0669\u066B\u066C\u06DD\u0890\u0891\u08E2\u{10D30}-\u{10D39}\u{10D40}-\u{10D49}\u{10E60}-\u{10E7E}]/u,_Z=/^[\0-\x08\x0E-\x1B!-\x84\x86-\u0377\u037A-\u037F\u0384-\u038A\u038C\u038E-\u03A1\u03A3-\u052F\u0531-\u0556\u0559-\u058A\u058D-\u058F\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0606\u0607\u0609\u060A\u060C\u060E-\u061A\u064B-\u065F\u066A\u0670\u06D6-\u06DC\u06DE-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07F6-\u07F9\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A76\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5C\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C77-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E3A\u0E3F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FDA\u1000-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u13A0-\u13F5\u13F8-\u13FD\u1400-\u167F\u1681-\u169C\u16A0-\u16F8\u1700-\u1715\u171F-\u1736\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u1800-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE-\u1A1B\u1A1E-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B4C\u1B4E-\u1BF3\u1BFC-\u1C37\u1C3B-\u1C49\u1C4D-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD0-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u200B-\u200E\u2010-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2071\u2074-\u208E\u2090-\u209C\u20A0-\u20C1\u20D0-\u20F0\u2100-\u218B\u2190-\u2429\u2440-\u244A\u2460-\u2B73\u2B76-\u2CF3\u2CF9-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u303F\u3041-\u3096\u3099-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31E5\u31EF-\u321E\u3220-\uA48C\uA490-\uA4C6\uA4D0-\uA62B\uA640-\uA6F7\uA700-\uA7DC\uA7F1-\uA82C\uA830-\uA839\uA840-\uA877\uA880-\uA8C5\uA8CE-\uA8D9\uA8E0-\uA953\uA95F-\uA97C\uA980-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAAC2\uAADB-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB6B\uAB70-\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1E\uFB29\uFBC3-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFD-\uFE19\uFE20-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}-\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1018E}\u{10190}-\u{1019C}\u{101A0}\u{101D0}-\u{101FD}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E0}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{1037A}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{1091F}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10B39}-\u{10B3F}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6E}\u{10EAB}\u{10EAC}\u{10ED0}-\u{10ED8}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11000}-\u{1104D}\u{11052}-\u{11075}\u{1107F}-\u{110C2}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11100}-\u{11134}\u{11136}-\u{11147}\u{11150}-\u{11176}\u{11180}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{11241}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112EA}\u{112F0}-\u{112F9}\u{11300}-\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133B}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}-\u{113C0}\u{113C2}\u{113C5}\u{113C7}-\u{113CA}\u{113CC}-\u{113D5}\u{113D7}\u{113D8}\u{113E1}\u{113E2}\u{11400}-\u{1145B}\u{1145D}-\u{11461}\u{11480}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B5}\u{115B8}-\u{115DD}\u{11600}-\u{11644}\u{11650}-\u{11659}\u{11660}-\u{1166C}\u{11680}-\u{116B9}\u{116C0}-\u{116C9}\u{116D0}-\u{116E3}\u{11700}-\u{1171A}\u{1171D}-\u{1172B}\u{11730}-\u{11746}\u{11800}-\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193B}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D7}\u{119DA}-\u{119E4}\u{11A00}-\u{11A47}\u{11A50}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11B00}-\u{11B09}\u{11B60}-\u{11B67}\u{11BC0}-\u{11BE1}\u{11BF0}-\u{11BF9}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C36}\u{11C38}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D47}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D98}\u{11DA0}-\u{11DA9}\u{11DB0}-\u{11DDB}\u{11DE0}-\u{11DE9}\u{11EE0}-\u{11EF8}\u{11F00}-\u{11F10}\u{11F12}-\u{11F3A}\u{11F3E}-\u{11F5A}\u{11FB0}\u{11FC0}-\u{11FF1}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{13455}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{16139}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF0}-\u{16AF5}\u{16B00}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D79}\u{16E40}-\u{16E9A}\u{16EA0}-\u{16EB8}\u{16EBB}-\u{16ED3}\u{16F00}-\u{16F4A}\u{16F4F}-\u{16F87}\u{16F8F}-\u{16F9F}\u{16FE0}-\u{16FE4}\u{16FF0}-\u{16FF6}\u{17000}-\u{18CD5}\u{18CFF}-\u{18D1E}\u{18D80}-\u{18DF2}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}-\u{1BCA3}\u{1CC00}-\u{1CCFC}\u{1CD00}-\u{1CEB3}\u{1CEBA}-\u{1CED0}\u{1CEE0}-\u{1CEF0}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D1EA}\u{1D200}-\u{1D245}\u{1D2C0}-\u{1D2D3}\u{1D2E0}-\u{1D2F3}\u{1D300}-\u{1D356}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D7CB}\u{1D7CE}-\u{1DA8B}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E030}-\u{1E06D}\u{1E08F}\u{1E100}-\u{1E12C}\u{1E130}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AE}\u{1E2C0}-\u{1E2F9}\u{1E2FF}\u{1E4D0}-\u{1E4F9}\u{1E5D0}-\u{1E5FA}\u{1E5FF}\u{1E6C0}-\u{1E6DE}\u{1E6E0}-\u{1E6F5}\u{1E6FE}\u{1E6FF}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{1EEF0}\u{1EEF1}\u{1F000}-\u{1F02B}\u{1F030}-\u{1F093}\u{1F0A0}-\u{1F0AE}\u{1F0B1}-\u{1F0BF}\u{1F0C1}-\u{1F0CF}\u{1F0D1}-\u{1F0F5}\u{1F100}-\u{1F1AD}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{1F260}-\u{1F265}\u{1F300}-\u{1F6D8}\u{1F6DC}-\u{1F6EC}\u{1F6F0}-\u{1F6FC}\u{1F700}-\u{1F7D9}\u{1F7E0}-\u{1F7EB}\u{1F7F0}\u{1F800}-\u{1F80B}\u{1F810}-\u{1F847}\u{1F850}-\u{1F859}\u{1F860}-\u{1F887}\u{1F890}-\u{1F8AD}\u{1F8B0}-\u{1F8BB}\u{1F8C0}\u{1F8C1}\u{1F8D0}-\u{1F8D8}\u{1F900}-\u{1FA57}\u{1FA60}-\u{1FA6D}\u{1FA70}-\u{1FA7C}\u{1FA80}-\u{1FA8A}\u{1FA8E}-\u{1FAC6}\u{1FAC8}\u{1FACD}-\u{1FADC}\u{1FADF}-\u{1FAEA}\u{1FAEF}-\u{1FAF8}\u{1FB00}-\u{1FB92}\u{1FB94}-\u{1FBFA}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B81D}\u{2B820}-\u{2CEAD}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{33479}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]*$/u,EZ=/[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u06F0-\u06F9\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B4E-\u1B6A\u1B74-\u1B7F\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u2488-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31BF\u31F0-\u321C\u3220-\u324F\u3260-\u327B\u327F-\u32B0\u32C0-\u32CB\u32D0-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA60C\uA610-\uA62B\uA640-\uA66E\uA680-\uA69D\uA6A0-\uA6EF\uA6F2-\uA6F7\uA722-\uA787\uA789-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA824\uA827\uA830-\uA837\uA840-\uA873\uA880-\uA8C3\uA8CE-\uA8D9\uA8F2-\uA8FE\uA900-\uA925\uA92E-\uA946\uA952\uA953\uA95F-\uA97C\uA983-\uA9B2\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA2F\uAA30\uAA33\uAA34\uAA40-\uAA42\uAA44-\uAA4B\uAA4D\uAA50-\uAA59\uAA5C-\uAA7B\uAA7D-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAAEB\uAAEE-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB69\uAB70-\uABE4\uABE6\uABE7\uABE9-\uABEC\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1013F}\u{1018D}\u{1018E}\u{101D0}-\u{101FC}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E1}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{11000}\u{11002}-\u{11037}\u{11047}-\u{1104D}\u{11066}-\u{1106F}\u{11071}\u{11072}\u{11075}\u{11082}-\u{110B2}\u{110B7}\u{110B8}\u{110BB}-\u{110C1}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11103}-\u{11126}\u{1112C}\u{11136}-\u{11147}\u{11150}-\u{11172}\u{11174}-\u{11176}\u{11182}-\u{111B5}\u{111BF}-\u{111C8}\u{111CD}\u{111CE}\u{111D0}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1122E}\u{11232}\u{11233}\u{11235}\u{11238}-\u{1123D}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112DE}\u{112E0}-\u{112E2}\u{112F0}-\u{112F9}\u{11302}\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}-\u{1133F}\u{11341}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}-\u{113BA}\u{113C2}\u{113C5}\u{113C7}-\u{113CA}\u{113CC}\u{113CD}\u{113CF}\u{113D1}\u{113D3}-\u{113D5}\u{113D7}\u{113D8}\u{11400}-\u{11437}\u{11440}\u{11441}\u{11445}\u{11447}-\u{1145B}\u{1145D}\u{1145F}-\u{11461}\u{11480}-\u{114B2}\u{114B9}\u{114BB}-\u{114BE}\u{114C1}\u{114C4}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{115C1}-\u{115DB}\u{11600}-\u{11632}\u{1163B}\u{1163C}\u{1163E}\u{11641}-\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116AA}\u{116AC}\u{116AE}\u{116AF}\u{116B6}\u{116B8}\u{116B9}\u{116C0}-\u{116C9}\u{116D0}-\u{116E3}\u{11700}-\u{1171A}\u{1171E}\u{11720}\u{11721}\u{11726}\u{11730}-\u{11746}\u{11800}-\u{1182E}\u{11838}\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193D}\u{1193F}-\u{11942}\u{11944}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D3}\u{119DC}-\u{119DF}\u{119E1}-\u{119E4}\u{11A00}\u{11A07}\u{11A08}\u{11A0B}-\u{11A32}\u{11A39}\u{11A3A}\u{11A3F}-\u{11A46}\u{11A50}\u{11A57}\u{11A58}\u{11A5C}-\u{11A89}\u{11A97}\u{11A9A}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11B00}-\u{11B09}\u{11B61}\u{11B65}\u{11B67}\u{11BC0}-\u{11BE1}\u{11BF0}-\u{11BF9}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2F}\u{11C3E}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D93}\u{11D94}\u{11D96}\u{11D98}\u{11DA0}-\u{11DA9}\u{11DB0}-\u{11DDB}\u{11DE0}-\u{11DE9}\u{11EE0}-\u{11EF2}\u{11EF5}-\u{11EF8}\u{11F02}-\u{11F10}\u{11F12}-\u{11F35}\u{11F3E}\u{11F3F}\u{11F41}\u{11F43}-\u{11F59}\u{11FB0}\u{11FC0}-\u{11FD4}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{1343F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{1612A}-\u{1612C}\u{16130}-\u{16139}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF5}\u{16B00}-\u{16B2F}\u{16B37}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D79}\u{16E40}-\u{16E9A}\u{16EA0}-\u{16EB8}\u{16EBB}-\u{16ED3}\u{16F00}-\u{16F4A}\u{16F50}-\u{16F87}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{16FF0}-\u{16FF6}\u{17000}-\u{18CD5}\u{18CFF}-\u{18D1E}\u{18D80}-\u{18DF2}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}\u{1BC9F}\u{1CCD6}-\u{1CCF9}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D166}\u{1D16A}-\u{1D172}\u{1D183}\u{1D184}\u{1D18C}-\u{1D1A9}\u{1D1AE}-\u{1D1E8}\u{1D2C0}-\u{1D2D3}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D7CE}-\u{1D9FF}\u{1DA37}-\u{1DA3A}\u{1DA6D}-\u{1DA74}\u{1DA76}-\u{1DA83}\u{1DA85}-\u{1DA8B}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E4D0}-\u{1E4EB}\u{1E4F0}-\u{1E4F9}\u{1E5D0}-\u{1E5ED}\u{1E5F0}-\u{1E5FA}\u{1E5FF}\u{1E6C0}-\u{1E6DE}\u{1E6E0}-\u{1E6E2}\u{1E6E4}\u{1E6E5}\u{1E6E7}-\u{1E6ED}\u{1E6F0}-\u{1E6F4}\u{1E6FE}\u{1E6FF}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1F100}-\u{1F10A}\u{1F110}-\u{1F12E}\u{1F130}-\u{1F169}\u{1F170}-\u{1F1AC}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{1FBF0}-\u{1FBF9}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B81D}\u{2B820}-\u{2CEAD}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{33479}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}][\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113BB}-\u{113C0}\u{113CE}\u{113D0}\u{113D2}\u{113E1}\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11F00}\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F42}\u{11F5A}\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]*$/u;IT.exports={combiningMarks:aZ,combiningClassVirama:cZ,validZWNJ:lZ,bidiDomain:hZ,bidiS1LTR:fZ,bidiS1RTL:dZ,bidiS2:pZ,bidiS3:mZ,bidiS4EN:yZ,bidiS4AN:gZ,bidiS5:_Z,bidiS6:EZ}});var $T=g(function(hme,AZ){AZ.exports=[[[0,44],2],[[45,46],2],[47,2],[[48,57],2],[[58,64],2],[65,1,"a"],[66,1,"b"],[67,1,"c"],[68,1,"d"],[69,1,"e"],[70,1,"f"],[71,1,"g"],[72,1,"h"],[73,1,"i"],[74,1,"j"],[75,1,"k"],[76,1,"l"],[77,1,"m"],[78,1,"n"],[79,1,"o"],[80,1,"p"],[81,1,"q"],[82,1,"r"],[83,1,"s"],[84,1,"t"],[85,1,"u"],[86,1,"v"],[87,1,"w"],[88,1,"x"],[89,1,"y"],[90,1,"z"],[[91,96],2],[[97,122],2],[[123,127],2],[[128,159],3],[160,1," "],[[161,167],2],[168,1," ̈"],[169,2],[170,1,"a"],[[171,172],2],[173,7],[174,2],[175,1," ̄"],[[176,177],2],[178,1,"2"],[179,1,"3"],[180,1," ́"],[181,1,"μ"],[182,2],[183,2],[184,1," ̧"],[185,1,"1"],[186,1,"o"],[187,2],[188,1,"1⁄4"],[189,1,"1⁄2"],[190,1,"3⁄4"],[191,2],[192,1,"à"],[193,1,"á"],[194,1,"â"],[195,1,"ã"],[196,1,"ä"],[197,1,"å"],[198,1,"æ"],[199,1,"ç"],[200,1,"è"],[201,1,"é"],[202,1,"ê"],[203,1,"ë"],[204,1,"ì"],[205,1,"í"],[206,1,"î"],[207,1,"ï"],[208,1,"ð"],[209,1,"ñ"],[210,1,"ò"],[211,1,"ó"],[212,1,"ô"],[213,1,"õ"],[214,1,"ö"],[215,2],[216,1,"ø"],[217,1,"ù"],[218,1,"ú"],[219,1,"û"],[220,1,"ü"],[221,1,"ý"],[222,1,"þ"],[223,6,"ss"],[[224,246],2],[247,2],[[248,255],2],[256,1,"ā"],[257,2],[258,1,"ă"],[259,2],[260,1,"ą"],[261,2],[262,1,"ć"],[263,2],[264,1,"ĉ"],[265,2],[266,1,"ċ"],[267,2],[268,1,"č"],[269,2],[270,1,"ď"],[271,2],[272,1,"đ"],[273,2],[274,1,"ē"],[275,2],[276,1,"ĕ"],[277,2],[278,1,"ė"],[279,2],[280,1,"ę"],[281,2],[282,1,"ě"],[283,2],[284,1,"ĝ"],[285,2],[286,1,"ğ"],[287,2],[288,1,"ġ"],[289,2],[290,1,"ģ"],[291,2],[292,1,"ĥ"],[293,2],[294,1,"ħ"],[295,2],[296,1,"ĩ"],[297,2],[298,1,"ī"],[299,2],[300,1,"ĭ"],[301,2],[302,1,"į"],[303,2],[304,1,"i̇"],[305,2],[[306,307],1,"ij"],[308,1,"ĵ"],[309,2],[310,1,"ķ"],[[311,312],2],[313,1,"ĺ"],[314,2],[315,1,"ļ"],[316,2],[317,1,"ľ"],[318,2],[[319,320],1,"l·"],[321,1,"ł"],[322,2],[323,1,"ń"],[324,2],[325,1,"ņ"],[326,2],[327,1,"ň"],[328,2],[329,1,"ʼn"],[330,1,"ŋ"],[331,2],[332,1,"ō"],[333,2],[334,1,"ŏ"],[335,2],[336,1,"ő"],[337,2],[338,1,"œ"],[339,2],[340,1,"ŕ"],[341,2],[342,1,"ŗ"],[343,2],[344,1,"ř"],[345,2],[346,1,"ś"],[347,2],[348,1,"ŝ"],[349,2],[350,1,"ş"],[351,2],[352,1,"š"],[353,2],[354,1,"ţ"],[355,2],[356,1,"ť"],[357,2],[358,1,"ŧ"],[359,2],[360,1,"ũ"],[361,2],[362,1,"ū"],[363,2],[364,1,"ŭ"],[365,2],[366,1,"ů"],[367,2],[368,1,"ű"],[369,2],[370,1,"ų"],[371,2],[372,1,"ŵ"],[373,2],[374,1,"ŷ"],[375,2],[376,1,"ÿ"],[377,1,"ź"],[378,2],[379,1,"ż"],[380,2],[381,1,"ž"],[382,2],[383,1,"s"],[384,2],[385,1,"ɓ"],[386,1,"ƃ"],[387,2],[388,1,"ƅ"],[389,2],[390,1,"ɔ"],[391,1,"ƈ"],[392,2],[393,1,"ɖ"],[394,1,"ɗ"],[395,1,"ƌ"],[[396,397],2],[398,1,"ǝ"],[399,1,"ə"],[400,1,"ɛ"],[401,1,"ƒ"],[402,2],[403,1,"ɠ"],[404,1,"ɣ"],[405,2],[406,1,"ɩ"],[407,1,"ɨ"],[408,1,"ƙ"],[[409,411],2],[412,1,"ɯ"],[413,1,"ɲ"],[414,2],[415,1,"ɵ"],[416,1,"ơ"],[417,2],[418,1,"ƣ"],[419,2],[420,1,"ƥ"],[421,2],[422,1,"ʀ"],[423,1,"ƨ"],[424,2],[425,1,"ʃ"],[[426,427],2],[428,1,"ƭ"],[429,2],[430,1,"ʈ"],[431,1,"ư"],[432,2],[433,1,"ʊ"],[434,1,"ʋ"],[435,1,"ƴ"],[436,2],[437,1,"ƶ"],[438,2],[439,1,"ʒ"],[440,1,"ƹ"],[[441,443],2],[444,1,"ƽ"],[[445,451],2],[[452,454],1,"dž"],[[455,457],1,"lj"],[[458,460],1,"nj"],[461,1,"ǎ"],[462,2],[463,1,"ǐ"],[464,2],[465,1,"ǒ"],[466,2],[467,1,"ǔ"],[468,2],[469,1,"ǖ"],[470,2],[471,1,"ǘ"],[472,2],[473,1,"ǚ"],[474,2],[475,1,"ǜ"],[[476,477],2],[478,1,"ǟ"],[479,2],[480,1,"ǡ"],[481,2],[482,1,"ǣ"],[483,2],[484,1,"ǥ"],[485,2],[486,1,"ǧ"],[487,2],[488,1,"ǩ"],[489,2],[490,1,"ǫ"],[491,2],[492,1,"ǭ"],[493,2],[494,1,"ǯ"],[[495,496],2],[[497,499],1,"dz"],[500,1,"ǵ"],[501,2],[502,1,"ƕ"],[503,1,"ƿ"],[504,1,"ǹ"],[505,2],[506,1,"ǻ"],[507,2],[508,1,"ǽ"],[509,2],[510,1,"ǿ"],[511,2],[512,1,"ȁ"],[513,2],[514,1,"ȃ"],[515,2],[516,1,"ȅ"],[517,2],[518,1,"ȇ"],[519,2],[520,1,"ȉ"],[521,2],[522,1,"ȋ"],[523,2],[524,1,"ȍ"],[525,2],[526,1,"ȏ"],[527,2],[528,1,"ȑ"],[529,2],[530,1,"ȓ"],[531,2],[532,1,"ȕ"],[533,2],[534,1,"ȗ"],[535,2],[536,1,"ș"],[537,2],[538,1,"ț"],[539,2],[540,1,"ȝ"],[541,2],[542,1,"ȟ"],[543,2],[544,1,"ƞ"],[545,2],[546,1,"ȣ"],[547,2],[548,1,"ȥ"],[549,2],[550,1,"ȧ"],[551,2],[552,1,"ȩ"],[553,2],[554,1,"ȫ"],[555,2],[556,1,"ȭ"],[557,2],[558,1,"ȯ"],[559,2],[560,1,"ȱ"],[561,2],[562,1,"ȳ"],[563,2],[[564,566],2],[[567,569],2],[570,1,"ⱥ"],[571,1,"ȼ"],[572,2],[573,1,"ƚ"],[574,1,"ⱦ"],[[575,576],2],[577,1,"ɂ"],[578,2],[579,1,"ƀ"],[580,1,"ʉ"],[581,1,"ʌ"],[582,1,"ɇ"],[583,2],[584,1,"ɉ"],[585,2],[586,1,"ɋ"],[587,2],[588,1,"ɍ"],[589,2],[590,1,"ɏ"],[591,2],[[592,680],2],[[681,685],2],[[686,687],2],[688,1,"h"],[689,1,"ɦ"],[690,1,"j"],[691,1,"r"],[692,1,"ɹ"],[693,1,"ɻ"],[694,1,"ʁ"],[695,1,"w"],[696,1,"y"],[[697,705],2],[[706,709],2],[[710,721],2],[[722,727],2],[728,1," ̆"],[729,1," ̇"],[730,1," ̊"],[731,1," ̨"],[732,1," ̃"],[733,1," ̋"],[734,2],[735,2],[736,1,"ɣ"],[737,1,"l"],[738,1,"s"],[739,1,"x"],[740,1,"ʕ"],[[741,745],2],[[746,747],2],[748,2],[749,2],[750,2],[[751,767],2],[[768,831],2],[832,1,"̀"],[833,1,"́"],[834,2],[835,1,"̓"],[836,1,"̈́"],[837,1,"ι"],[[838,846],2],[847,7],[[848,855],2],[[856,860],2],[[861,863],2],[[864,865],2],[866,2],[[867,879],2],[880,1,"ͱ"],[881,2],[882,1,"ͳ"],[883,2],[884,1,"ʹ"],[885,2],[886,1,"ͷ"],[887,2],[[888,889],3],[890,1," ι"],[[891,893],2],[894,1,";"],[895,1,"ϳ"],[[896,899],3],[900,1," ́"],[901,1," ̈́"],[902,1,"ά"],[903,1,"·"],[904,1,"έ"],[905,1,"ή"],[906,1,"ί"],[907,3],[908,1,"ό"],[909,3],[910,1,"ύ"],[911,1,"ώ"],[912,2],[913,1,"α"],[914,1,"β"],[915,1,"γ"],[916,1,"δ"],[917,1,"ε"],[918,1,"ζ"],[919,1,"η"],[920,1,"θ"],[921,1,"ι"],[922,1,"κ"],[923,1,"λ"],[924,1,"μ"],[925,1,"ν"],[926,1,"ξ"],[927,1,"ο"],[928,1,"π"],[929,1,"ρ"],[930,3],[931,1,"σ"],[932,1,"τ"],[933,1,"υ"],[934,1,"φ"],[935,1,"χ"],[936,1,"ψ"],[937,1,"ω"],[938,1,"ϊ"],[939,1,"ϋ"],[[940,961],2],[962,6,"σ"],[[963,974],2],[975,1,"ϗ"],[976,1,"β"],[977,1,"θ"],[978,1,"υ"],[979,1,"ύ"],[980,1,"ϋ"],[981,1,"φ"],[982,1,"π"],[983,2],[984,1,"ϙ"],[985,2],[986,1,"ϛ"],[987,2],[988,1,"ϝ"],[989,2],[990,1,"ϟ"],[991,2],[992,1,"ϡ"],[993,2],[994,1,"ϣ"],[995,2],[996,1,"ϥ"],[997,2],[998,1,"ϧ"],[999,2],[1000,1,"ϩ"],[1001,2],[1002,1,"ϫ"],[1003,2],[1004,1,"ϭ"],[1005,2],[1006,1,"ϯ"],[1007,2],[1008,1,"κ"],[1009,1,"ρ"],[1010,1,"σ"],[1011,2],[1012,1,"θ"],[1013,1,"ε"],[1014,2],[1015,1,"ϸ"],[1016,2],[1017,1,"σ"],[1018,1,"ϻ"],[1019,2],[1020,2],[1021,1,"ͻ"],[1022,1,"ͼ"],[1023,1,"ͽ"],[1024,1,"ѐ"],[1025,1,"ё"],[1026,1,"ђ"],[1027,1,"ѓ"],[1028,1,"є"],[1029,1,"ѕ"],[1030,1,"і"],[1031,1,"ї"],[1032,1,"ј"],[1033,1,"љ"],[1034,1,"њ"],[1035,1,"ћ"],[1036,1,"ќ"],[1037,1,"ѝ"],[1038,1,"ў"],[1039,1,"џ"],[1040,1,"а"],[1041,1,"б"],[1042,1,"в"],[1043,1,"г"],[1044,1,"д"],[1045,1,"е"],[1046,1,"ж"],[1047,1,"з"],[1048,1,"и"],[1049,1,"й"],[1050,1,"к"],[1051,1,"л"],[1052,1,"м"],[1053,1,"н"],[1054,1,"о"],[1055,1,"п"],[1056,1,"р"],[1057,1,"с"],[1058,1,"т"],[1059,1,"у"],[1060,1,"ф"],[1061,1,"х"],[1062,1,"ц"],[1063,1,"ч"],[1064,1,"ш"],[1065,1,"щ"],[1066,1,"ъ"],[1067,1,"ы"],[1068,1,"ь"],[1069,1,"э"],[1070,1,"ю"],[1071,1,"я"],[[1072,1103],2],[1104,2],[[1105,1116],2],[1117,2],[[1118,1119],2],[1120,1,"ѡ"],[1121,2],[1122,1,"ѣ"],[1123,2],[1124,1,"ѥ"],[1125,2],[1126,1,"ѧ"],[1127,2],[1128,1,"ѩ"],[1129,2],[1130,1,"ѫ"],[1131,2],[1132,1,"ѭ"],[1133,2],[1134,1,"ѯ"],[1135,2],[1136,1,"ѱ"],[1137,2],[1138,1,"ѳ"],[1139,2],[1140,1,"ѵ"],[1141,2],[1142,1,"ѷ"],[1143,2],[1144,1,"ѹ"],[1145,2],[1146,1,"ѻ"],[1147,2],[1148,1,"ѽ"],[1149,2],[1150,1,"ѿ"],[1151,2],[1152,1,"ҁ"],[1153,2],[1154,2],[[1155,1158],2],[1159,2],[[1160,1161],2],[1162,1,"ҋ"],[1163,2],[1164,1,"ҍ"],[1165,2],[1166,1,"ҏ"],[1167,2],[1168,1,"ґ"],[1169,2],[1170,1,"ғ"],[1171,2],[1172,1,"ҕ"],[1173,2],[1174,1,"җ"],[1175,2],[1176,1,"ҙ"],[1177,2],[1178,1,"қ"],[1179,2],[1180,1,"ҝ"],[1181,2],[1182,1,"ҟ"],[1183,2],[1184,1,"ҡ"],[1185,2],[1186,1,"ң"],[1187,2],[1188,1,"ҥ"],[1189,2],[1190,1,"ҧ"],[1191,2],[1192,1,"ҩ"],[1193,2],[1194,1,"ҫ"],[1195,2],[1196,1,"ҭ"],[1197,2],[1198,1,"ү"],[1199,2],[1200,1,"ұ"],[1201,2],[1202,1,"ҳ"],[1203,2],[1204,1,"ҵ"],[1205,2],[1206,1,"ҷ"],[1207,2],[1208,1,"ҹ"],[1209,2],[1210,1,"һ"],[1211,2],[1212,1,"ҽ"],[1213,2],[1214,1,"ҿ"],[1215,2],[1216,1,"ӏ"],[1217,1,"ӂ"],[1218,2],[1219,1,"ӄ"],[1220,2],[1221,1,"ӆ"],[1222,2],[1223,1,"ӈ"],[1224,2],[1225,1,"ӊ"],[1226,2],[1227,1,"ӌ"],[1228,2],[1229,1,"ӎ"],[1230,2],[1231,2],[1232,1,"ӑ"],[1233,2],[1234,1,"ӓ"],[1235,2],[1236,1,"ӕ"],[1237,2],[1238,1,"ӗ"],[1239,2],[1240,1,"ә"],[1241,2],[1242,1,"ӛ"],[1243,2],[1244,1,"ӝ"],[1245,2],[1246,1,"ӟ"],[1247,2],[1248,1,"ӡ"],[1249,2],[1250,1,"ӣ"],[1251,2],[1252,1,"ӥ"],[1253,2],[1254,1,"ӧ"],[1255,2],[1256,1,"ө"],[1257,2],[1258,1,"ӫ"],[1259,2],[1260,1,"ӭ"],[1261,2],[1262,1,"ӯ"],[1263,2],[1264,1,"ӱ"],[1265,2],[1266,1,"ӳ"],[1267,2],[1268,1,"ӵ"],[1269,2],[1270,1,"ӷ"],[1271,2],[1272,1,"ӹ"],[1273,2],[1274,1,"ӻ"],[1275,2],[1276,1,"ӽ"],[1277,2],[1278,1,"ӿ"],[1279,2],[1280,1,"ԁ"],[1281,2],[1282,1,"ԃ"],[1283,2],[1284,1,"ԅ"],[1285,2],[1286,1,"ԇ"],[1287,2],[1288,1,"ԉ"],[1289,2],[1290,1,"ԋ"],[1291,2],[1292,1,"ԍ"],[1293,2],[1294,1,"ԏ"],[1295,2],[1296,1,"ԑ"],[1297,2],[1298,1,"ԓ"],[1299,2],[1300,1,"ԕ"],[1301,2],[1302,1,"ԗ"],[1303,2],[1304,1,"ԙ"],[1305,2],[1306,1,"ԛ"],[1307,2],[1308,1,"ԝ"],[1309,2],[1310,1,"ԟ"],[1311,2],[1312,1,"ԡ"],[1313,2],[1314,1,"ԣ"],[1315,2],[1316,1,"ԥ"],[1317,2],[1318,1,"ԧ"],[1319,2],[1320,1,"ԩ"],[1321,2],[1322,1,"ԫ"],[1323,2],[1324,1,"ԭ"],[1325,2],[1326,1,"ԯ"],[1327,2],[1328,3],[1329,1,"ա"],[1330,1,"բ"],[1331,1,"գ"],[1332,1,"դ"],[1333,1,"ե"],[1334,1,"զ"],[1335,1,"է"],[1336,1,"ը"],[1337,1,"թ"],[1338,1,"ժ"],[1339,1,"ի"],[1340,1,"լ"],[1341,1,"խ"],[1342,1,"ծ"],[1343,1,"կ"],[1344,1,"հ"],[1345,1,"ձ"],[1346,1,"ղ"],[1347,1,"ճ"],[1348,1,"մ"],[1349,1,"յ"],[1350,1,"ն"],[1351,1,"շ"],[1352,1,"ո"],[1353,1,"չ"],[1354,1,"պ"],[1355,1,"ջ"],[1356,1,"ռ"],[1357,1,"ս"],[1358,1,"վ"],[1359,1,"տ"],[1360,1,"ր"],[1361,1,"ց"],[1362,1,"ւ"],[1363,1,"փ"],[1364,1,"ք"],[1365,1,"օ"],[1366,1,"ֆ"],[[1367,1368],3],[1369,2],[[1370,1375],2],[1376,2],[[1377,1414],2],[1415,1,"եւ"],[1416,2],[1417,2],[1418,2],[[1419,1420],3],[[1421,1422],2],[1423,2],[1424,3],[[1425,1441],2],[1442,2],[[1443,1455],2],[[1456,1465],2],[1466,2],[[1467,1469],2],[1470,2],[1471,2],[1472,2],[[1473,1474],2],[1475,2],[1476,2],[1477,2],[1478,2],[1479,2],[[1480,1487],3],[[1488,1514],2],[[1515,1518],3],[1519,2],[[1520,1524],2],[[1525,1535],3],[[1536,1539],3],[1540,3],[1541,3],[[1542,1546],2],[1547,2],[1548,2],[[1549,1551],2],[[1552,1557],2],[[1558,1562],2],[1563,2],[1564,3],[1565,2],[1566,2],[1567,2],[1568,2],[[1569,1594],2],[[1595,1599],2],[1600,2],[[1601,1618],2],[[1619,1621],2],[[1622,1624],2],[[1625,1630],2],[1631,2],[[1632,1641],2],[[1642,1645],2],[[1646,1647],2],[[1648,1652],2],[1653,1,"اٴ"],[1654,1,"وٴ"],[1655,1,"ۇٴ"],[1656,1,"يٴ"],[[1657,1719],2],[[1720,1721],2],[[1722,1726],2],[1727,2],[[1728,1742],2],[1743,2],[[1744,1747],2],[1748,2],[[1749,1756],2],[1757,3],[1758,2],[[1759,1768],2],[1769,2],[[1770,1773],2],[[1774,1775],2],[[1776,1785],2],[[1786,1790],2],[1791,2],[[1792,1805],2],[1806,3],[1807,3],[[1808,1836],2],[[1837,1839],2],[[1840,1866],2],[[1867,1868],3],[[1869,1871],2],[[1872,1901],2],[[1902,1919],2],[[1920,1968],2],[1969,2],[[1970,1983],3],[[1984,2037],2],[[2038,2042],2],[[2043,2044],3],[2045,2],[[2046,2047],2],[[2048,2093],2],[[2094,2095],3],[[2096,2110],2],[2111,3],[[2112,2139],2],[[2140,2141],3],[2142,2],[2143,3],[[2144,2154],2],[[2155,2159],3],[[2160,2183],2],[2184,2],[[2185,2190],2],[2191,2],[[2192,2193],3],[[2194,2198],3],[2199,2],[[2200,2207],2],[2208,2],[2209,2],[[2210,2220],2],[[2221,2226],2],[[2227,2228],2],[2229,2],[[2230,2237],2],[[2238,2247],2],[[2248,2258],2],[2259,2],[[2260,2273],2],[2274,3],[2275,2],[[2276,2302],2],[2303,2],[2304,2],[[2305,2307],2],[2308,2],[[2309,2361],2],[[2362,2363],2],[[2364,2381],2],[2382,2],[2383,2],[[2384,2388],2],[2389,2],[[2390,2391],2],[2392,1,"क़"],[2393,1,"ख़"],[2394,1,"ग़"],[2395,1,"ज़"],[2396,1,"ड़"],[2397,1,"ढ़"],[2398,1,"फ़"],[2399,1,"य़"],[[2400,2403],2],[[2404,2405],2],[[2406,2415],2],[2416,2],[[2417,2418],2],[[2419,2423],2],[2424,2],[[2425,2426],2],[[2427,2428],2],[2429,2],[[2430,2431],2],[2432,2],[[2433,2435],2],[2436,3],[[2437,2444],2],[[2445,2446],3],[[2447,2448],2],[[2449,2450],3],[[2451,2472],2],[2473,3],[[2474,2480],2],[2481,3],[2482,2],[[2483,2485],3],[[2486,2489],2],[[2490,2491],3],[2492,2],[2493,2],[[2494,2500],2],[[2501,2502],3],[[2503,2504],2],[[2505,2506],3],[[2507,2509],2],[2510,2],[[2511,2518],3],[2519,2],[[2520,2523],3],[2524,1,"ড়"],[2525,1,"ঢ়"],[2526,3],[2527,1,"য়"],[[2528,2531],2],[[2532,2533],3],[[2534,2545],2],[[2546,2554],2],[2555,2],[2556,2],[2557,2],[2558,2],[[2559,2560],3],[2561,2],[2562,2],[2563,2],[2564,3],[[2565,2570],2],[[2571,2574],3],[[2575,2576],2],[[2577,2578],3],[[2579,2600],2],[2601,3],[[2602,2608],2],[2609,3],[2610,2],[2611,1,"ਲ਼"],[2612,3],[2613,2],[2614,1,"ਸ਼"],[2615,3],[[2616,2617],2],[[2618,2619],3],[2620,2],[2621,3],[[2622,2626],2],[[2627,2630],3],[[2631,2632],2],[[2633,2634],3],[[2635,2637],2],[[2638,2640],3],[2641,2],[[2642,2648],3],[2649,1,"ਖ਼"],[2650,1,"ਗ਼"],[2651,1,"ਜ਼"],[2652,2],[2653,3],[2654,1,"ਫ਼"],[[2655,2661],3],[[2662,2676],2],[2677,2],[2678,2],[[2679,2688],3],[[2689,2691],2],[2692,3],[[2693,2699],2],[2700,2],[2701,2],[2702,3],[[2703,2705],2],[2706,3],[[2707,2728],2],[2729,3],[[2730,2736],2],[2737,3],[[2738,2739],2],[2740,3],[[2741,2745],2],[[2746,2747],3],[[2748,2757],2],[2758,3],[[2759,2761],2],[2762,3],[[2763,2765],2],[[2766,2767],3],[2768,2],[[2769,2783],3],[2784,2],[[2785,2787],2],[[2788,2789],3],[[2790,2799],2],[2800,2],[2801,2],[[2802,2808],3],[2809,2],[[2810,2815],2],[2816,3],[[2817,2819],2],[2820,3],[[2821,2828],2],[[2829,2830],3],[[2831,2832],2],[[2833,2834],3],[[2835,2856],2],[2857,3],[[2858,2864],2],[2865,3],[[2866,2867],2],[2868,3],[2869,2],[[2870,2873],2],[[2874,2875],3],[[2876,2883],2],[2884,2],[[2885,2886],3],[[2887,2888],2],[[2889,2890],3],[[2891,2893],2],[[2894,2900],3],[2901,2],[[2902,2903],2],[[2904,2907],3],[2908,1,"ଡ଼"],[2909,1,"ଢ଼"],[2910,3],[[2911,2913],2],[[2914,2915],2],[[2916,2917],3],[[2918,2927],2],[2928,2],[2929,2],[[2930,2935],2],[[2936,2945],3],[[2946,2947],2],[2948,3],[[2949,2954],2],[[2955,2957],3],[[2958,2960],2],[2961,3],[[2962,2965],2],[[2966,2968],3],[[2969,2970],2],[2971,3],[2972,2],[2973,3],[[2974,2975],2],[[2976,2978],3],[[2979,2980],2],[[2981,2983],3],[[2984,2986],2],[[2987,2989],3],[[2990,2997],2],[2998,2],[[2999,3001],2],[[3002,3005],3],[[3006,3010],2],[[3011,3013],3],[[3014,3016],2],[3017,3],[[3018,3021],2],[[3022,3023],3],[3024,2],[[3025,3030],3],[3031,2],[[3032,3045],3],[3046,2],[[3047,3055],2],[[3056,3058],2],[[3059,3066],2],[[3067,3071],3],[3072,2],[[3073,3075],2],[3076,2],[[3077,3084],2],[3085,3],[[3086,3088],2],[3089,3],[[3090,3112],2],[3113,3],[[3114,3123],2],[3124,2],[[3125,3129],2],[[3130,3131],3],[3132,2],[3133,2],[[3134,3140],2],[3141,3],[[3142,3144],2],[3145,3],[[3146,3149],2],[[3150,3156],3],[[3157,3158],2],[3159,3],[[3160,3161],2],[3162,2],[3163,3],[3164,2],[3165,2],[[3166,3167],3],[[3168,3169],2],[[3170,3171],2],[[3172,3173],3],[[3174,3183],2],[[3184,3190],3],[3191,2],[[3192,3199],2],[3200,2],[3201,2],[[3202,3203],2],[3204,2],[[3205,3212],2],[3213,3],[[3214,3216],2],[3217,3],[[3218,3240],2],[3241,3],[[3242,3251],2],[3252,3],[[3253,3257],2],[[3258,3259],3],[[3260,3261],2],[[3262,3268],2],[3269,3],[[3270,3272],2],[3273,3],[[3274,3277],2],[[3278,3284],3],[[3285,3286],2],[[3287,3291],3],[3292,2],[3293,2],[3294,2],[3295,3],[[3296,3297],2],[[3298,3299],2],[[3300,3301],3],[[3302,3311],2],[3312,3],[[3313,3314],2],[3315,2],[[3316,3327],3],[3328,2],[3329,2],[[3330,3331],2],[3332,2],[[3333,3340],2],[3341,3],[[3342,3344],2],[3345,3],[[3346,3368],2],[3369,2],[[3370,3385],2],[3386,2],[[3387,3388],2],[3389,2],[[3390,3395],2],[3396,2],[3397,3],[[3398,3400],2],[3401,3],[[3402,3405],2],[3406,2],[3407,2],[[3408,3411],3],[[3412,3414],2],[3415,2],[[3416,3422],2],[3423,2],[[3424,3425],2],[[3426,3427],2],[[3428,3429],3],[[3430,3439],2],[[3440,3445],2],[[3446,3448],2],[3449,2],[[3450,3455],2],[3456,3],[3457,2],[[3458,3459],2],[3460,3],[[3461,3478],2],[[3479,3481],3],[[3482,3505],2],[3506,3],[[3507,3515],2],[3516,3],[3517,2],[[3518,3519],3],[[3520,3526],2],[[3527,3529],3],[3530,2],[[3531,3534],3],[[3535,3540],2],[3541,3],[3542,2],[3543,3],[[3544,3551],2],[[3552,3557],3],[[3558,3567],2],[[3568,3569],3],[[3570,3571],2],[3572,2],[[3573,3584],3],[[3585,3634],2],[3635,1,"ํา"],[[3636,3642],2],[[3643,3646],3],[3647,2],[[3648,3662],2],[3663,2],[[3664,3673],2],[[3674,3675],2],[[3676,3712],3],[[3713,3714],2],[3715,3],[3716,2],[3717,3],[3718,2],[[3719,3720],2],[3721,2],[3722,2],[3723,3],[3724,2],[3725,2],[[3726,3731],2],[[3732,3735],2],[3736,2],[[3737,3743],2],[3744,2],[[3745,3747],2],[3748,3],[3749,2],[3750,3],[3751,2],[[3752,3753],2],[[3754,3755],2],[3756,2],[[3757,3762],2],[3763,1,"ໍາ"],[[3764,3769],2],[3770,2],[[3771,3773],2],[[3774,3775],3],[[3776,3780],2],[3781,3],[3782,2],[3783,3],[[3784,3789],2],[3790,2],[3791,3],[[3792,3801],2],[[3802,3803],3],[3804,1,"ຫນ"],[3805,1,"ຫມ"],[[3806,3807],2],[[3808,3839],3],[3840,2],[[3841,3850],2],[3851,2],[3852,1,"་"],[[3853,3863],2],[[3864,3865],2],[[3866,3871],2],[[3872,3881],2],[[3882,3892],2],[3893,2],[3894,2],[3895,2],[3896,2],[3897,2],[[3898,3901],2],[[3902,3906],2],[3907,1,"གྷ"],[[3908,3911],2],[3912,3],[[3913,3916],2],[3917,1,"ཌྷ"],[[3918,3921],2],[3922,1,"དྷ"],[[3923,3926],2],[3927,1,"བྷ"],[[3928,3931],2],[3932,1,"ཛྷ"],[[3933,3944],2],[3945,1,"ཀྵ"],[3946,2],[[3947,3948],2],[[3949,3952],3],[[3953,3954],2],[3955,1,"ཱི"],[3956,2],[3957,1,"ཱུ"],[3958,1,"ྲྀ"],[3959,1,"ྲཱྀ"],[3960,1,"ླྀ"],[3961,1,"ླཱྀ"],[[3962,3968],2],[3969,1,"ཱྀ"],[[3970,3972],2],[3973,2],[[3974,3979],2],[[3980,3983],2],[[3984,3986],2],[3987,1,"ྒྷ"],[[3988,3989],2],[3990,2],[3991,2],[3992,3],[[3993,3996],2],[3997,1,"ྜྷ"],[[3998,4001],2],[4002,1,"ྡྷ"],[[4003,4006],2],[4007,1,"ྦྷ"],[[4008,4011],2],[4012,1,"ྫྷ"],[4013,2],[[4014,4016],2],[[4017,4023],2],[4024,2],[4025,1,"ྐྵ"],[[4026,4028],2],[4029,3],[[4030,4037],2],[4038,2],[[4039,4044],2],[4045,3],[4046,2],[4047,2],[[4048,4049],2],[[4050,4052],2],[[4053,4056],2],[[4057,4058],2],[[4059,4095],3],[[4096,4129],2],[4130,2],[[4131,4135],2],[4136,2],[[4137,4138],2],[4139,2],[[4140,4146],2],[[4147,4149],2],[[4150,4153],2],[[4154,4159],2],[[4160,4169],2],[[4170,4175],2],[[4176,4185],2],[[4186,4249],2],[[4250,4253],2],[[4254,4255],2],[4256,1,"ⴀ"],[4257,1,"ⴁ"],[4258,1,"ⴂ"],[4259,1,"ⴃ"],[4260,1,"ⴄ"],[4261,1,"ⴅ"],[4262,1,"ⴆ"],[4263,1,"ⴇ"],[4264,1,"ⴈ"],[4265,1,"ⴉ"],[4266,1,"ⴊ"],[4267,1,"ⴋ"],[4268,1,"ⴌ"],[4269,1,"ⴍ"],[4270,1,"ⴎ"],[4271,1,"ⴏ"],[4272,1,"ⴐ"],[4273,1,"ⴑ"],[4274,1,"ⴒ"],[4275,1,"ⴓ"],[4276,1,"ⴔ"],[4277,1,"ⴕ"],[4278,1,"ⴖ"],[4279,1,"ⴗ"],[4280,1,"ⴘ"],[4281,1,"ⴙ"],[4282,1,"ⴚ"],[4283,1,"ⴛ"],[4284,1,"ⴜ"],[4285,1,"ⴝ"],[4286,1,"ⴞ"],[4287,1,"ⴟ"],[4288,1,"ⴠ"],[4289,1,"ⴡ"],[4290,1,"ⴢ"],[4291,1,"ⴣ"],[4292,1,"ⴤ"],[4293,1,"ⴥ"],[4294,3],[4295,1,"ⴧ"],[[4296,4300],3],[4301,1,"ⴭ"],[[4302,4303],3],[[4304,4342],2],[[4343,4344],2],[[4345,4346],2],[4347,2],[4348,1,"ნ"],[[4349,4351],2],[[4352,4441],2],[[4442,4446],2],[[4447,4448],7],[[4449,4514],2],[[4515,4519],2],[[4520,4601],2],[[4602,4607],2],[[4608,4614],2],[4615,2],[[4616,4678],2],[4679,2],[4680,2],[4681,3],[[4682,4685],2],[[4686,4687],3],[[4688,4694],2],[4695,3],[4696,2],[4697,3],[[4698,4701],2],[[4702,4703],3],[[4704,4742],2],[4743,2],[4744,2],[4745,3],[[4746,4749],2],[[4750,4751],3],[[4752,4782],2],[4783,2],[4784,2],[4785,3],[[4786,4789],2],[[4790,4791],3],[[4792,4798],2],[4799,3],[4800,2],[4801,3],[[4802,4805],2],[[4806,4807],3],[[4808,4814],2],[4815,2],[[4816,4822],2],[4823,3],[[4824,4846],2],[4847,2],[[4848,4878],2],[4879,2],[4880,2],[4881,3],[[4882,4885],2],[[4886,4887],3],[[4888,4894],2],[4895,2],[[4896,4934],2],[4935,2],[[4936,4954],2],[[4955,4956],3],[[4957,4958],2],[4959,2],[4960,2],[[4961,4988],2],[[4989,4991],3],[[4992,5007],2],[[5008,5017],2],[[5018,5023],3],[[5024,5108],2],[5109,2],[[5110,5111],3],[5112,1,"Ᏸ"],[5113,1,"Ᏹ"],[5114,1,"Ᏺ"],[5115,1,"Ᏻ"],[5116,1,"Ᏼ"],[5117,1,"Ᏽ"],[[5118,5119],3],[5120,2],[[5121,5740],2],[[5741,5742],2],[[5743,5750],2],[[5751,5759],2],[5760,3],[[5761,5786],2],[[5787,5788],2],[[5789,5791],3],[[5792,5866],2],[[5867,5872],2],[[5873,5880],2],[[5881,5887],3],[[5888,5900],2],[5901,2],[[5902,5908],2],[5909,2],[[5910,5918],3],[5919,2],[[5920,5940],2],[[5941,5942],2],[[5943,5951],3],[[5952,5971],2],[[5972,5983],3],[[5984,5996],2],[5997,3],[[5998,6000],2],[6001,3],[[6002,6003],2],[[6004,6015],3],[[6016,6067],2],[[6068,6069],7],[[6070,6099],2],[[6100,6102],2],[6103,2],[[6104,6107],2],[6108,2],[6109,2],[[6110,6111],3],[[6112,6121],2],[[6122,6127],3],[[6128,6137],2],[[6138,6143],3],[[6144,6154],2],[[6155,6158],7],[6159,7],[[6160,6169],2],[[6170,6175],3],[[6176,6263],2],[6264,2],[[6265,6271],3],[[6272,6313],2],[6314,2],[[6315,6319],3],[[6320,6389],2],[[6390,6399],3],[[6400,6428],2],[[6429,6430],2],[6431,3],[[6432,6443],2],[[6444,6447],3],[[6448,6459],2],[[6460,6463],3],[6464,2],[[6465,6467],3],[[6468,6469],2],[[6470,6509],2],[[6510,6511],3],[[6512,6516],2],[[6517,6527],3],[[6528,6569],2],[[6570,6571],2],[[6572,6575],3],[[6576,6601],2],[[6602,6607],3],[[6608,6617],2],[6618,2],[[6619,6621],3],[[6622,6623],2],[[6624,6655],2],[[6656,6683],2],[[6684,6685],3],[[6686,6687],2],[[6688,6750],2],[6751,3],[[6752,6780],2],[[6781,6782],3],[[6783,6793],2],[[6794,6799],3],[[6800,6809],2],[[6810,6815],3],[[6816,6822],2],[6823,2],[[6824,6829],2],[[6830,6831],3],[[6832,6845],2],[6846,2],[[6847,6848],2],[[6849,6862],2],[[6863,6877],2],[[6878,6879],3],[[6880,6891],2],[[6892,6911],3],[[6912,6987],2],[6988,2],[6989,3],[[6990,6991],2],[[6992,7001],2],[[7002,7018],2],[[7019,7027],2],[[7028,7036],2],[[7037,7038],2],[7039,2],[[7040,7082],2],[[7083,7085],2],[[7086,7097],2],[[7098,7103],2],[[7104,7155],2],[[7156,7163],3],[[7164,7167],2],[[7168,7223],2],[[7224,7226],3],[[7227,7231],2],[[7232,7241],2],[[7242,7244],3],[[7245,7293],2],[[7294,7295],2],[7296,1,"в"],[7297,1,"д"],[7298,1,"о"],[7299,1,"с"],[[7300,7301],1,"т"],[7302,1,"ъ"],[7303,1,"ѣ"],[7304,1,"ꙋ"],[7305,1,"ᲊ"],[7306,2],[[7307,7311],3],[7312,1,"ა"],[7313,1,"ბ"],[7314,1,"გ"],[7315,1,"დ"],[7316,1,"ე"],[7317,1,"ვ"],[7318,1,"ზ"],[7319,1,"თ"],[7320,1,"ი"],[7321,1,"კ"],[7322,1,"ლ"],[7323,1,"მ"],[7324,1,"ნ"],[7325,1,"ო"],[7326,1,"პ"],[7327,1,"ჟ"],[7328,1,"რ"],[7329,1,"ს"],[7330,1,"ტ"],[7331,1,"უ"],[7332,1,"ფ"],[7333,1,"ქ"],[7334,1,"ღ"],[7335,1,"ყ"],[7336,1,"შ"],[7337,1,"ჩ"],[7338,1,"ც"],[7339,1,"ძ"],[7340,1,"წ"],[7341,1,"ჭ"],[7342,1,"ხ"],[7343,1,"ჯ"],[7344,1,"ჰ"],[7345,1,"ჱ"],[7346,1,"ჲ"],[7347,1,"ჳ"],[7348,1,"ჴ"],[7349,1,"ჵ"],[7350,1,"ჶ"],[7351,1,"ჷ"],[7352,1,"ჸ"],[7353,1,"ჹ"],[7354,1,"ჺ"],[[7355,7356],3],[7357,1,"ჽ"],[7358,1,"ჾ"],[7359,1,"ჿ"],[[7360,7367],2],[[7368,7375],3],[[7376,7378],2],[7379,2],[[7380,7410],2],[[7411,7414],2],[7415,2],[[7416,7417],2],[7418,2],[[7419,7423],3],[[7424,7467],2],[7468,1,"a"],[7469,1,"æ"],[7470,1,"b"],[7471,2],[7472,1,"d"],[7473,1,"e"],[7474,1,"ǝ"],[7475,1,"g"],[7476,1,"h"],[7477,1,"i"],[7478,1,"j"],[7479,1,"k"],[7480,1,"l"],[7481,1,"m"],[7482,1,"n"],[7483,2],[7484,1,"o"],[7485,1,"ȣ"],[7486,1,"p"],[7487,1,"r"],[7488,1,"t"],[7489,1,"u"],[7490,1,"w"],[7491,1,"a"],[7492,1,"ɐ"],[7493,1,"ɑ"],[7494,1,"ᴂ"],[7495,1,"b"],[7496,1,"d"],[7497,1,"e"],[7498,1,"ə"],[7499,1,"ɛ"],[7500,1,"ɜ"],[7501,1,"g"],[7502,2],[7503,1,"k"],[7504,1,"m"],[7505,1,"ŋ"],[7506,1,"o"],[7507,1,"ɔ"],[7508,1,"ᴖ"],[7509,1,"ᴗ"],[7510,1,"p"],[7511,1,"t"],[7512,1,"u"],[7513,1,"ᴝ"],[7514,1,"ɯ"],[7515,1,"v"],[7516,1,"ᴥ"],[7517,1,"β"],[7518,1,"γ"],[7519,1,"δ"],[7520,1,"φ"],[7521,1,"χ"],[7522,1,"i"],[7523,1,"r"],[7524,1,"u"],[7525,1,"v"],[7526,1,"β"],[7527,1,"γ"],[7528,1,"ρ"],[7529,1,"φ"],[7530,1,"χ"],[7531,2],[[7532,7543],2],[7544,1,"н"],[[7545,7578],2],[7579,1,"ɒ"],[7580,1,"c"],[7581,1,"ɕ"],[7582,1,"ð"],[7583,1,"ɜ"],[7584,1,"f"],[7585,1,"ɟ"],[7586,1,"ɡ"],[7587,1,"ɥ"],[7588,1,"ɨ"],[7589,1,"ɩ"],[7590,1,"ɪ"],[7591,1,"ᵻ"],[7592,1,"ʝ"],[7593,1,"ɭ"],[7594,1,"ᶅ"],[7595,1,"ʟ"],[7596,1,"ɱ"],[7597,1,"ɰ"],[7598,1,"ɲ"],[7599,1,"ɳ"],[7600,1,"ɴ"],[7601,1,"ɵ"],[7602,1,"ɸ"],[7603,1,"ʂ"],[7604,1,"ʃ"],[7605,1,"ƫ"],[7606,1,"ʉ"],[7607,1,"ʊ"],[7608,1,"ᴜ"],[7609,1,"ʋ"],[7610,1,"ʌ"],[7611,1,"z"],[7612,1,"ʐ"],[7613,1,"ʑ"],[7614,1,"ʒ"],[7615,1,"θ"],[[7616,7619],2],[[7620,7626],2],[[7627,7654],2],[[7655,7669],2],[[7670,7673],2],[7674,2],[7675,2],[7676,2],[7677,2],[[7678,7679],2],[7680,1,"ḁ"],[7681,2],[7682,1,"ḃ"],[7683,2],[7684,1,"ḅ"],[7685,2],[7686,1,"ḇ"],[7687,2],[7688,1,"ḉ"],[7689,2],[7690,1,"ḋ"],[7691,2],[7692,1,"ḍ"],[7693,2],[7694,1,"ḏ"],[7695,2],[7696,1,"ḑ"],[7697,2],[7698,1,"ḓ"],[7699,2],[7700,1,"ḕ"],[7701,2],[7702,1,"ḗ"],[7703,2],[7704,1,"ḙ"],[7705,2],[7706,1,"ḛ"],[7707,2],[7708,1,"ḝ"],[7709,2],[7710,1,"ḟ"],[7711,2],[7712,1,"ḡ"],[7713,2],[7714,1,"ḣ"],[7715,2],[7716,1,"ḥ"],[7717,2],[7718,1,"ḧ"],[7719,2],[7720,1,"ḩ"],[7721,2],[7722,1,"ḫ"],[7723,2],[7724,1,"ḭ"],[7725,2],[7726,1,"ḯ"],[7727,2],[7728,1,"ḱ"],[7729,2],[7730,1,"ḳ"],[7731,2],[7732,1,"ḵ"],[7733,2],[7734,1,"ḷ"],[7735,2],[7736,1,"ḹ"],[7737,2],[7738,1,"ḻ"],[7739,2],[7740,1,"ḽ"],[7741,2],[7742,1,"ḿ"],[7743,2],[7744,1,"ṁ"],[7745,2],[7746,1,"ṃ"],[7747,2],[7748,1,"ṅ"],[7749,2],[7750,1,"ṇ"],[7751,2],[7752,1,"ṉ"],[7753,2],[7754,1,"ṋ"],[7755,2],[7756,1,"ṍ"],[7757,2],[7758,1,"ṏ"],[7759,2],[7760,1,"ṑ"],[7761,2],[7762,1,"ṓ"],[7763,2],[7764,1,"ṕ"],[7765,2],[7766,1,"ṗ"],[7767,2],[7768,1,"ṙ"],[7769,2],[7770,1,"ṛ"],[7771,2],[7772,1,"ṝ"],[7773,2],[7774,1,"ṟ"],[7775,2],[7776,1,"ṡ"],[7777,2],[7778,1,"ṣ"],[7779,2],[7780,1,"ṥ"],[7781,2],[7782,1,"ṧ"],[7783,2],[7784,1,"ṩ"],[7785,2],[7786,1,"ṫ"],[7787,2],[7788,1,"ṭ"],[7789,2],[7790,1,"ṯ"],[7791,2],[7792,1,"ṱ"],[7793,2],[7794,1,"ṳ"],[7795,2],[7796,1,"ṵ"],[7797,2],[7798,1,"ṷ"],[7799,2],[7800,1,"ṹ"],[7801,2],[7802,1,"ṻ"],[7803,2],[7804,1,"ṽ"],[7805,2],[7806,1,"ṿ"],[7807,2],[7808,1,"ẁ"],[7809,2],[7810,1,"ẃ"],[7811,2],[7812,1,"ẅ"],[7813,2],[7814,1,"ẇ"],[7815,2],[7816,1,"ẉ"],[7817,2],[7818,1,"ẋ"],[7819,2],[7820,1,"ẍ"],[7821,2],[7822,1,"ẏ"],[7823,2],[7824,1,"ẑ"],[7825,2],[7826,1,"ẓ"],[7827,2],[7828,1,"ẕ"],[[7829,7833],2],[7834,1,"aʾ"],[7835,1,"ṡ"],[[7836,7837],2],[7838,1,"ß"],[7839,2],[7840,1,"ạ"],[7841,2],[7842,1,"ả"],[7843,2],[7844,1,"ấ"],[7845,2],[7846,1,"ầ"],[7847,2],[7848,1,"ẩ"],[7849,2],[7850,1,"ẫ"],[7851,2],[7852,1,"ậ"],[7853,2],[7854,1,"ắ"],[7855,2],[7856,1,"ằ"],[7857,2],[7858,1,"ẳ"],[7859,2],[7860,1,"ẵ"],[7861,2],[7862,1,"ặ"],[7863,2],[7864,1,"ẹ"],[7865,2],[7866,1,"ẻ"],[7867,2],[7868,1,"ẽ"],[7869,2],[7870,1,"ế"],[7871,2],[7872,1,"ề"],[7873,2],[7874,1,"ể"],[7875,2],[7876,1,"ễ"],[7877,2],[7878,1,"ệ"],[7879,2],[7880,1,"ỉ"],[7881,2],[7882,1,"ị"],[7883,2],[7884,1,"ọ"],[7885,2],[7886,1,"ỏ"],[7887,2],[7888,1,"ố"],[7889,2],[7890,1,"ồ"],[7891,2],[7892,1,"ổ"],[7893,2],[7894,1,"ỗ"],[7895,2],[7896,1,"ộ"],[7897,2],[7898,1,"ớ"],[7899,2],[7900,1,"ờ"],[7901,2],[7902,1,"ở"],[7903,2],[7904,1,"ỡ"],[7905,2],[7906,1,"ợ"],[7907,2],[7908,1,"ụ"],[7909,2],[7910,1,"ủ"],[7911,2],[7912,1,"ứ"],[7913,2],[7914,1,"ừ"],[7915,2],[7916,1,"ử"],[7917,2],[7918,1,"ữ"],[7919,2],[7920,1,"ự"],[7921,2],[7922,1,"ỳ"],[7923,2],[7924,1,"ỵ"],[7925,2],[7926,1,"ỷ"],[7927,2],[7928,1,"ỹ"],[7929,2],[7930,1,"ỻ"],[7931,2],[7932,1,"ỽ"],[7933,2],[7934,1,"ỿ"],[7935,2],[[7936,7943],2],[7944,1,"ἀ"],[7945,1,"ἁ"],[7946,1,"ἂ"],[7947,1,"ἃ"],[7948,1,"ἄ"],[7949,1,"ἅ"],[7950,1,"ἆ"],[7951,1,"ἇ"],[[7952,7957],2],[[7958,7959],3],[7960,1,"ἐ"],[7961,1,"ἑ"],[7962,1,"ἒ"],[7963,1,"ἓ"],[7964,1,"ἔ"],[7965,1,"ἕ"],[[7966,7967],3],[[7968,7975],2],[7976,1,"ἠ"],[7977,1,"ἡ"],[7978,1,"ἢ"],[7979,1,"ἣ"],[7980,1,"ἤ"],[7981,1,"ἥ"],[7982,1,"ἦ"],[7983,1,"ἧ"],[[7984,7991],2],[7992,1,"ἰ"],[7993,1,"ἱ"],[7994,1,"ἲ"],[7995,1,"ἳ"],[7996,1,"ἴ"],[7997,1,"ἵ"],[7998,1,"ἶ"],[7999,1,"ἷ"],[[8000,8005],2],[[8006,8007],3],[8008,1,"ὀ"],[8009,1,"ὁ"],[8010,1,"ὂ"],[8011,1,"ὃ"],[8012,1,"ὄ"],[8013,1,"ὅ"],[[8014,8015],3],[[8016,8023],2],[8024,3],[8025,1,"ὑ"],[8026,3],[8027,1,"ὓ"],[8028,3],[8029,1,"ὕ"],[8030,3],[8031,1,"ὗ"],[[8032,8039],2],[8040,1,"ὠ"],[8041,1,"ὡ"],[8042,1,"ὢ"],[8043,1,"ὣ"],[8044,1,"ὤ"],[8045,1,"ὥ"],[8046,1,"ὦ"],[8047,1,"ὧ"],[8048,2],[8049,1,"ά"],[8050,2],[8051,1,"έ"],[8052,2],[8053,1,"ή"],[8054,2],[8055,1,"ί"],[8056,2],[8057,1,"ό"],[8058,2],[8059,1,"ύ"],[8060,2],[8061,1,"ώ"],[[8062,8063],3],[8064,1,"ἀι"],[8065,1,"ἁι"],[8066,1,"ἂι"],[8067,1,"ἃι"],[8068,1,"ἄι"],[8069,1,"ἅι"],[8070,1,"ἆι"],[8071,1,"ἇι"],[8072,1,"ἀι"],[8073,1,"ἁι"],[8074,1,"ἂι"],[8075,1,"ἃι"],[8076,1,"ἄι"],[8077,1,"ἅι"],[8078,1,"ἆι"],[8079,1,"ἇι"],[8080,1,"ἠι"],[8081,1,"ἡι"],[8082,1,"ἢι"],[8083,1,"ἣι"],[8084,1,"ἤι"],[8085,1,"ἥι"],[8086,1,"ἦι"],[8087,1,"ἧι"],[8088,1,"ἠι"],[8089,1,"ἡι"],[8090,1,"ἢι"],[8091,1,"ἣι"],[8092,1,"ἤι"],[8093,1,"ἥι"],[8094,1,"ἦι"],[8095,1,"ἧι"],[8096,1,"ὠι"],[8097,1,"ὡι"],[8098,1,"ὢι"],[8099,1,"ὣι"],[8100,1,"ὤι"],[8101,1,"ὥι"],[8102,1,"ὦι"],[8103,1,"ὧι"],[8104,1,"ὠι"],[8105,1,"ὡι"],[8106,1,"ὢι"],[8107,1,"ὣι"],[8108,1,"ὤι"],[8109,1,"ὥι"],[8110,1,"ὦι"],[8111,1,"ὧι"],[[8112,8113],2],[8114,1,"ὰι"],[8115,1,"αι"],[8116,1,"άι"],[8117,3],[8118,2],[8119,1,"ᾶι"],[8120,1,"ᾰ"],[8121,1,"ᾱ"],[8122,1,"ὰ"],[8123,1,"ά"],[8124,1,"αι"],[8125,1," ̓"],[8126,1,"ι"],[8127,1," ̓"],[8128,1," ͂"],[8129,1," ̈͂"],[8130,1,"ὴι"],[8131,1,"ηι"],[8132,1,"ήι"],[8133,3],[8134,2],[8135,1,"ῆι"],[8136,1,"ὲ"],[8137,1,"έ"],[8138,1,"ὴ"],[8139,1,"ή"],[8140,1,"ηι"],[8141,1," ̓̀"],[8142,1," ̓́"],[8143,1," ̓͂"],[[8144,8146],2],[8147,1,"ΐ"],[[8148,8149],3],[[8150,8151],2],[8152,1,"ῐ"],[8153,1,"ῑ"],[8154,1,"ὶ"],[8155,1,"ί"],[8156,3],[8157,1," ̔̀"],[8158,1," ̔́"],[8159,1," ̔͂"],[[8160,8162],2],[8163,1,"ΰ"],[[8164,8167],2],[8168,1,"ῠ"],[8169,1,"ῡ"],[8170,1,"ὺ"],[8171,1,"ύ"],[8172,1,"ῥ"],[8173,1," ̈̀"],[8174,1," ̈́"],[8175,1,"`"],[[8176,8177],3],[8178,1,"ὼι"],[8179,1,"ωι"],[8180,1,"ώι"],[8181,3],[8182,2],[8183,1,"ῶι"],[8184,1,"ὸ"],[8185,1,"ό"],[8186,1,"ὼ"],[8187,1,"ώ"],[8188,1,"ωι"],[8189,1," ́"],[8190,1," ̔"],[8191,3],[[8192,8202],1," "],[8203,7],[[8204,8205],6,""],[[8206,8207],3],[8208,2],[8209,1,"‐"],[[8210,8214],2],[8215,1," ̳"],[[8216,8227],2],[[8228,8230],3],[8231,2],[[8232,8238],3],[8239,1," "],[[8240,8242],2],[8243,1,"′′"],[8244,1,"′′′"],[8245,2],[8246,1,"‵‵"],[8247,1,"‵‵‵"],[[8248,8251],2],[8252,1,"!!"],[8253,2],[8254,1," ̅"],[[8255,8262],2],[8263,1,"??"],[8264,1,"?!"],[8265,1,"!?"],[[8266,8269],2],[[8270,8274],2],[[8275,8276],2],[[8277,8278],2],[8279,1,"′′′′"],[[8280,8286],2],[8287,1," "],[[8288,8291],7],[8292,7],[8293,3],[[8294,8297],3],[[8298,8303],7],[8304,1,"0"],[8305,1,"i"],[[8306,8307],3],[8308,1,"4"],[8309,1,"5"],[8310,1,"6"],[8311,1,"7"],[8312,1,"8"],[8313,1,"9"],[8314,1,"+"],[8315,1,"−"],[8316,1,"="],[8317,1,"("],[8318,1,")"],[8319,1,"n"],[8320,1,"0"],[8321,1,"1"],[8322,1,"2"],[8323,1,"3"],[8324,1,"4"],[8325,1,"5"],[8326,1,"6"],[8327,1,"7"],[8328,1,"8"],[8329,1,"9"],[8330,1,"+"],[8331,1,"−"],[8332,1,"="],[8333,1,"("],[8334,1,")"],[8335,3],[8336,1,"a"],[8337,1,"e"],[8338,1,"o"],[8339,1,"x"],[8340,1,"ə"],[8341,1,"h"],[8342,1,"k"],[8343,1,"l"],[8344,1,"m"],[8345,1,"n"],[8346,1,"p"],[8347,1,"s"],[8348,1,"t"],[[8349,8351],3],[[8352,8359],2],[8360,1,"rs"],[[8361,8362],2],[8363,2],[8364,2],[[8365,8367],2],[[8368,8369],2],[[8370,8373],2],[[8374,8376],2],[8377,2],[8378,2],[[8379,8381],2],[8382,2],[8383,2],[8384,2],[8385,2],[[8386,8399],3],[[8400,8417],2],[[8418,8419],2],[[8420,8426],2],[8427,2],[[8428,8431],2],[8432,2],[[8433,8447],3],[8448,1,"a/c"],[8449,1,"a/s"],[8450,1,"c"],[8451,1,"°c"],[8452,2],[8453,1,"c/o"],[8454,1,"c/u"],[8455,1,"ɛ"],[8456,2],[8457,1,"°f"],[8458,1,"g"],[[8459,8462],1,"h"],[8463,1,"ħ"],[[8464,8465],1,"i"],[[8466,8467],1,"l"],[8468,2],[8469,1,"n"],[8470,1,"no"],[[8471,8472],2],[8473,1,"p"],[8474,1,"q"],[[8475,8477],1,"r"],[[8478,8479],2],[8480,1,"sm"],[8481,1,"tel"],[8482,1,"tm"],[8483,2],[8484,1,"z"],[8485,2],[8486,1,"ω"],[8487,2],[8488,1,"z"],[8489,2],[8490,1,"k"],[8491,1,"å"],[8492,1,"b"],[8493,1,"c"],[8494,2],[[8495,8496],1,"e"],[8497,1,"f"],[8498,1,"ⅎ"],[8499,1,"m"],[8500,1,"o"],[8501,1,"א"],[8502,1,"ב"],[8503,1,"ג"],[8504,1,"ד"],[8505,1,"i"],[8506,2],[8507,1,"fax"],[8508,1,"π"],[[8509,8510],1,"γ"],[8511,1,"π"],[8512,1,"∑"],[[8513,8516],2],[[8517,8518],1,"d"],[8519,1,"e"],[8520,1,"i"],[8521,1,"j"],[[8522,8523],2],[8524,2],[8525,2],[8526,2],[8527,2],[8528,1,"1⁄7"],[8529,1,"1⁄9"],[8530,1,"1⁄10"],[8531,1,"1⁄3"],[8532,1,"2⁄3"],[8533,1,"1⁄5"],[8534,1,"2⁄5"],[8535,1,"3⁄5"],[8536,1,"4⁄5"],[8537,1,"1⁄6"],[8538,1,"5⁄6"],[8539,1,"1⁄8"],[8540,1,"3⁄8"],[8541,1,"5⁄8"],[8542,1,"7⁄8"],[8543,1,"1⁄"],[8544,1,"i"],[8545,1,"ii"],[8546,1,"iii"],[8547,1,"iv"],[8548,1,"v"],[8549,1,"vi"],[8550,1,"vii"],[8551,1,"viii"],[8552,1,"ix"],[8553,1,"x"],[8554,1,"xi"],[8555,1,"xii"],[8556,1,"l"],[8557,1,"c"],[8558,1,"d"],[8559,1,"m"],[8560,1,"i"],[8561,1,"ii"],[8562,1,"iii"],[8563,1,"iv"],[8564,1,"v"],[8565,1,"vi"],[8566,1,"vii"],[8567,1,"viii"],[8568,1,"ix"],[8569,1,"x"],[8570,1,"xi"],[8571,1,"xii"],[8572,1,"l"],[8573,1,"c"],[8574,1,"d"],[8575,1,"m"],[[8576,8578],2],[8579,1,"ↄ"],[8580,2],[[8581,8584],2],[8585,1,"0⁄3"],[[8586,8587],2],[[8588,8591],3],[[8592,8682],2],[[8683,8691],2],[[8692,8703],2],[[8704,8747],2],[8748,1,"∫∫"],[8749,1,"∫∫∫"],[8750,2],[8751,1,"∮∮"],[8752,1,"∮∮∮"],[[8753,8945],2],[[8946,8959],2],[8960,2],[8961,2],[[8962,9000],2],[9001,1,"〈"],[9002,1,"〉"],[[9003,9082],2],[9083,2],[9084,2],[[9085,9114],2],[[9115,9166],2],[[9167,9168],2],[[9169,9179],2],[[9180,9191],2],[9192,2],[[9193,9203],2],[[9204,9210],2],[[9211,9214],2],[9215,2],[[9216,9252],2],[[9253,9254],2],[[9255,9257],2],[[9258,9279],3],[[9280,9290],2],[[9291,9311],3],[9312,1,"1"],[9313,1,"2"],[9314,1,"3"],[9315,1,"4"],[9316,1,"5"],[9317,1,"6"],[9318,1,"7"],[9319,1,"8"],[9320,1,"9"],[9321,1,"10"],[9322,1,"11"],[9323,1,"12"],[9324,1,"13"],[9325,1,"14"],[9326,1,"15"],[9327,1,"16"],[9328,1,"17"],[9329,1,"18"],[9330,1,"19"],[9331,1,"20"],[9332,1,"(1)"],[9333,1,"(2)"],[9334,1,"(3)"],[9335,1,"(4)"],[9336,1,"(5)"],[9337,1,"(6)"],[9338,1,"(7)"],[9339,1,"(8)"],[9340,1,"(9)"],[9341,1,"(10)"],[9342,1,"(11)"],[9343,1,"(12)"],[9344,1,"(13)"],[9345,1,"(14)"],[9346,1,"(15)"],[9347,1,"(16)"],[9348,1,"(17)"],[9349,1,"(18)"],[9350,1,"(19)"],[9351,1,"(20)"],[[9352,9371],3],[9372,1,"(a)"],[9373,1,"(b)"],[9374,1,"(c)"],[9375,1,"(d)"],[9376,1,"(e)"],[9377,1,"(f)"],[9378,1,"(g)"],[9379,1,"(h)"],[9380,1,"(i)"],[9381,1,"(j)"],[9382,1,"(k)"],[9383,1,"(l)"],[9384,1,"(m)"],[9385,1,"(n)"],[9386,1,"(o)"],[9387,1,"(p)"],[9388,1,"(q)"],[9389,1,"(r)"],[9390,1,"(s)"],[9391,1,"(t)"],[9392,1,"(u)"],[9393,1,"(v)"],[9394,1,"(w)"],[9395,1,"(x)"],[9396,1,"(y)"],[9397,1,"(z)"],[9398,1,"a"],[9399,1,"b"],[9400,1,"c"],[9401,1,"d"],[9402,1,"e"],[9403,1,"f"],[9404,1,"g"],[9405,1,"h"],[9406,1,"i"],[9407,1,"j"],[9408,1,"k"],[9409,1,"l"],[9410,1,"m"],[9411,1,"n"],[9412,1,"o"],[9413,1,"p"],[9414,1,"q"],[9415,1,"r"],[9416,1,"s"],[9417,1,"t"],[9418,1,"u"],[9419,1,"v"],[9420,1,"w"],[9421,1,"x"],[9422,1,"y"],[9423,1,"z"],[9424,1,"a"],[9425,1,"b"],[9426,1,"c"],[9427,1,"d"],[9428,1,"e"],[9429,1,"f"],[9430,1,"g"],[9431,1,"h"],[9432,1,"i"],[9433,1,"j"],[9434,1,"k"],[9435,1,"l"],[9436,1,"m"],[9437,1,"n"],[9438,1,"o"],[9439,1,"p"],[9440,1,"q"],[9441,1,"r"],[9442,1,"s"],[9443,1,"t"],[9444,1,"u"],[9445,1,"v"],[9446,1,"w"],[9447,1,"x"],[9448,1,"y"],[9449,1,"z"],[9450,1,"0"],[[9451,9470],2],[9471,2],[[9472,9621],2],[[9622,9631],2],[[9632,9711],2],[[9712,9719],2],[[9720,9727],2],[[9728,9747],2],[[9748,9749],2],[[9750,9751],2],[9752,2],[9753,2],[[9754,9839],2],[[9840,9841],2],[[9842,9853],2],[[9854,9855],2],[[9856,9865],2],[[9866,9873],2],[[9874,9884],2],[9885,2],[[9886,9887],2],[[9888,9889],2],[[9890,9905],2],[9906,2],[[9907,9916],2],[[9917,9919],2],[[9920,9923],2],[[9924,9933],2],[9934,2],[[9935,9953],2],[9954,2],[9955,2],[[9956,9959],2],[[9960,9983],2],[9984,2],[[9985,9988],2],[9989,2],[[9990,9993],2],[[9994,9995],2],[[9996,10023],2],[10024,2],[[10025,10059],2],[10060,2],[10061,2],[10062,2],[[10063,10066],2],[[10067,10069],2],[10070,2],[10071,2],[[10072,10078],2],[[10079,10080],2],[[10081,10087],2],[[10088,10101],2],[[10102,10132],2],[[10133,10135],2],[[10136,10159],2],[10160,2],[[10161,10174],2],[10175,2],[[10176,10182],2],[[10183,10186],2],[10187,2],[10188,2],[10189,2],[[10190,10191],2],[[10192,10219],2],[[10220,10223],2],[[10224,10239],2],[[10240,10495],2],[[10496,10763],2],[10764,1,"∫∫∫∫"],[[10765,10867],2],[10868,1,"::="],[10869,1,"=="],[10870,1,"==="],[[10871,10971],2],[10972,1,"⫝̸"],[[10973,11007],2],[[11008,11021],2],[[11022,11027],2],[[11028,11034],2],[[11035,11039],2],[[11040,11043],2],[[11044,11084],2],[[11085,11087],2],[[11088,11092],2],[[11093,11097],2],[[11098,11123],2],[[11124,11125],3],[[11126,11157],2],[11158,2],[11159,2],[[11160,11193],2],[[11194,11196],2],[[11197,11208],2],[11209,2],[[11210,11217],2],[11218,2],[[11219,11243],2],[[11244,11247],2],[[11248,11262],2],[11263,2],[11264,1,"ⰰ"],[11265,1,"ⰱ"],[11266,1,"ⰲ"],[11267,1,"ⰳ"],[11268,1,"ⰴ"],[11269,1,"ⰵ"],[11270,1,"ⰶ"],[11271,1,"ⰷ"],[11272,1,"ⰸ"],[11273,1,"ⰹ"],[11274,1,"ⰺ"],[11275,1,"ⰻ"],[11276,1,"ⰼ"],[11277,1,"ⰽ"],[11278,1,"ⰾ"],[11279,1,"ⰿ"],[11280,1,"ⱀ"],[11281,1,"ⱁ"],[11282,1,"ⱂ"],[11283,1,"ⱃ"],[11284,1,"ⱄ"],[11285,1,"ⱅ"],[11286,1,"ⱆ"],[11287,1,"ⱇ"],[11288,1,"ⱈ"],[11289,1,"ⱉ"],[11290,1,"ⱊ"],[11291,1,"ⱋ"],[11292,1,"ⱌ"],[11293,1,"ⱍ"],[11294,1,"ⱎ"],[11295,1,"ⱏ"],[11296,1,"ⱐ"],[11297,1,"ⱑ"],[11298,1,"ⱒ"],[11299,1,"ⱓ"],[11300,1,"ⱔ"],[11301,1,"ⱕ"],[11302,1,"ⱖ"],[11303,1,"ⱗ"],[11304,1,"ⱘ"],[11305,1,"ⱙ"],[11306,1,"ⱚ"],[11307,1,"ⱛ"],[11308,1,"ⱜ"],[11309,1,"ⱝ"],[11310,1,"ⱞ"],[11311,1,"ⱟ"],[[11312,11358],2],[11359,2],[11360,1,"ⱡ"],[11361,2],[11362,1,"ɫ"],[11363,1,"ᵽ"],[11364,1,"ɽ"],[[11365,11366],2],[11367,1,"ⱨ"],[11368,2],[11369,1,"ⱪ"],[11370,2],[11371,1,"ⱬ"],[11372,2],[11373,1,"ɑ"],[11374,1,"ɱ"],[11375,1,"ɐ"],[11376,1,"ɒ"],[11377,2],[11378,1,"ⱳ"],[11379,2],[11380,2],[11381,1,"ⱶ"],[[11382,11383],2],[[11384,11387],2],[11388,1,"j"],[11389,1,"v"],[11390,1,"ȿ"],[11391,1,"ɀ"],[11392,1,"ⲁ"],[11393,2],[11394,1,"ⲃ"],[11395,2],[11396,1,"ⲅ"],[11397,2],[11398,1,"ⲇ"],[11399,2],[11400,1,"ⲉ"],[11401,2],[11402,1,"ⲋ"],[11403,2],[11404,1,"ⲍ"],[11405,2],[11406,1,"ⲏ"],[11407,2],[11408,1,"ⲑ"],[11409,2],[11410,1,"ⲓ"],[11411,2],[11412,1,"ⲕ"],[11413,2],[11414,1,"ⲗ"],[11415,2],[11416,1,"ⲙ"],[11417,2],[11418,1,"ⲛ"],[11419,2],[11420,1,"ⲝ"],[11421,2],[11422,1,"ⲟ"],[11423,2],[11424,1,"ⲡ"],[11425,2],[11426,1,"ⲣ"],[11427,2],[11428,1,"ⲥ"],[11429,2],[11430,1,"ⲧ"],[11431,2],[11432,1,"ⲩ"],[11433,2],[11434,1,"ⲫ"],[11435,2],[11436,1,"ⲭ"],[11437,2],[11438,1,"ⲯ"],[11439,2],[11440,1,"ⲱ"],[11441,2],[11442,1,"ⲳ"],[11443,2],[11444,1,"ⲵ"],[11445,2],[11446,1,"ⲷ"],[11447,2],[11448,1,"ⲹ"],[11449,2],[11450,1,"ⲻ"],[11451,2],[11452,1,"ⲽ"],[11453,2],[11454,1,"ⲿ"],[11455,2],[11456,1,"ⳁ"],[11457,2],[11458,1,"ⳃ"],[11459,2],[11460,1,"ⳅ"],[11461,2],[11462,1,"ⳇ"],[11463,2],[11464,1,"ⳉ"],[11465,2],[11466,1,"ⳋ"],[11467,2],[11468,1,"ⳍ"],[11469,2],[11470,1,"ⳏ"],[11471,2],[11472,1,"ⳑ"],[11473,2],[11474,1,"ⳓ"],[11475,2],[11476,1,"ⳕ"],[11477,2],[11478,1,"ⳗ"],[11479,2],[11480,1,"ⳙ"],[11481,2],[11482,1,"ⳛ"],[11483,2],[11484,1,"ⳝ"],[11485,2],[11486,1,"ⳟ"],[11487,2],[11488,1,"ⳡ"],[11489,2],[11490,1,"ⳣ"],[[11491,11492],2],[[11493,11498],2],[11499,1,"ⳬ"],[11500,2],[11501,1,"ⳮ"],[[11502,11505],2],[11506,1,"ⳳ"],[11507,2],[[11508,11512],3],[[11513,11519],2],[[11520,11557],2],[11558,3],[11559,2],[[11560,11564],3],[11565,2],[[11566,11567],3],[[11568,11621],2],[[11622,11623],2],[[11624,11630],3],[11631,1,"ⵡ"],[11632,2],[[11633,11646],3],[11647,2],[[11648,11670],2],[[11671,11679],3],[[11680,11686],2],[11687,3],[[11688,11694],2],[11695,3],[[11696,11702],2],[11703,3],[[11704,11710],2],[11711,3],[[11712,11718],2],[11719,3],[[11720,11726],2],[11727,3],[[11728,11734],2],[11735,3],[[11736,11742],2],[11743,3],[[11744,11775],2],[[11776,11799],2],[[11800,11803],2],[[11804,11805],2],[[11806,11822],2],[11823,2],[11824,2],[11825,2],[[11826,11835],2],[[11836,11842],2],[[11843,11844],2],[[11845,11849],2],[[11850,11854],2],[11855,2],[[11856,11858],2],[[11859,11869],2],[[11870,11903],3],[[11904,11929],2],[11930,3],[[11931,11934],2],[11935,1,"母"],[[11936,12018],2],[12019,1,"龟"],[[12020,12031],3],[12032,1,"一"],[12033,1,"丨"],[12034,1,"丶"],[12035,1,"丿"],[12036,1,"乙"],[12037,1,"亅"],[12038,1,"二"],[12039,1,"亠"],[12040,1,"人"],[12041,1,"儿"],[12042,1,"入"],[12043,1,"八"],[12044,1,"冂"],[12045,1,"冖"],[12046,1,"冫"],[12047,1,"几"],[12048,1,"凵"],[12049,1,"刀"],[12050,1,"力"],[12051,1,"勹"],[12052,1,"匕"],[12053,1,"匚"],[12054,1,"匸"],[12055,1,"十"],[12056,1,"卜"],[12057,1,"卩"],[12058,1,"厂"],[12059,1,"厶"],[12060,1,"又"],[12061,1,"口"],[12062,1,"囗"],[12063,1,"土"],[12064,1,"士"],[12065,1,"夂"],[12066,1,"夊"],[12067,1,"夕"],[12068,1,"大"],[12069,1,"女"],[12070,1,"子"],[12071,1,"宀"],[12072,1,"寸"],[12073,1,"小"],[12074,1,"尢"],[12075,1,"尸"],[12076,1,"屮"],[12077,1,"山"],[12078,1,"巛"],[12079,1,"工"],[12080,1,"己"],[12081,1,"巾"],[12082,1,"干"],[12083,1,"幺"],[12084,1,"广"],[12085,1,"廴"],[12086,1,"廾"],[12087,1,"弋"],[12088,1,"弓"],[12089,1,"彐"],[12090,1,"彡"],[12091,1,"彳"],[12092,1,"心"],[12093,1,"戈"],[12094,1,"戶"],[12095,1,"手"],[12096,1,"支"],[12097,1,"攴"],[12098,1,"文"],[12099,1,"斗"],[12100,1,"斤"],[12101,1,"方"],[12102,1,"无"],[12103,1,"日"],[12104,1,"曰"],[12105,1,"月"],[12106,1,"木"],[12107,1,"欠"],[12108,1,"止"],[12109,1,"歹"],[12110,1,"殳"],[12111,1,"毋"],[12112,1,"比"],[12113,1,"毛"],[12114,1,"氏"],[12115,1,"气"],[12116,1,"水"],[12117,1,"火"],[12118,1,"爪"],[12119,1,"父"],[12120,1,"爻"],[12121,1,"爿"],[12122,1,"片"],[12123,1,"牙"],[12124,1,"牛"],[12125,1,"犬"],[12126,1,"玄"],[12127,1,"玉"],[12128,1,"瓜"],[12129,1,"瓦"],[12130,1,"甘"],[12131,1,"生"],[12132,1,"用"],[12133,1,"田"],[12134,1,"疋"],[12135,1,"疒"],[12136,1,"癶"],[12137,1,"白"],[12138,1,"皮"],[12139,1,"皿"],[12140,1,"目"],[12141,1,"矛"],[12142,1,"矢"],[12143,1,"石"],[12144,1,"示"],[12145,1,"禸"],[12146,1,"禾"],[12147,1,"穴"],[12148,1,"立"],[12149,1,"竹"],[12150,1,"米"],[12151,1,"糸"],[12152,1,"缶"],[12153,1,"网"],[12154,1,"羊"],[12155,1,"羽"],[12156,1,"老"],[12157,1,"而"],[12158,1,"耒"],[12159,1,"耳"],[12160,1,"聿"],[12161,1,"肉"],[12162,1,"臣"],[12163,1,"自"],[12164,1,"至"],[12165,1,"臼"],[12166,1,"舌"],[12167,1,"舛"],[12168,1,"舟"],[12169,1,"艮"],[12170,1,"色"],[12171,1,"艸"],[12172,1,"虍"],[12173,1,"虫"],[12174,1,"血"],[12175,1,"行"],[12176,1,"衣"],[12177,1,"襾"],[12178,1,"見"],[12179,1,"角"],[12180,1,"言"],[12181,1,"谷"],[12182,1,"豆"],[12183,1,"豕"],[12184,1,"豸"],[12185,1,"貝"],[12186,1,"赤"],[12187,1,"走"],[12188,1,"足"],[12189,1,"身"],[12190,1,"車"],[12191,1,"辛"],[12192,1,"辰"],[12193,1,"辵"],[12194,1,"邑"],[12195,1,"酉"],[12196,1,"釆"],[12197,1,"里"],[12198,1,"金"],[12199,1,"長"],[12200,1,"門"],[12201,1,"阜"],[12202,1,"隶"],[12203,1,"隹"],[12204,1,"雨"],[12205,1,"靑"],[12206,1,"非"],[12207,1,"面"],[12208,1,"革"],[12209,1,"韋"],[12210,1,"韭"],[12211,1,"音"],[12212,1,"頁"],[12213,1,"風"],[12214,1,"飛"],[12215,1,"食"],[12216,1,"首"],[12217,1,"香"],[12218,1,"馬"],[12219,1,"骨"],[12220,1,"高"],[12221,1,"髟"],[12222,1,"鬥"],[12223,1,"鬯"],[12224,1,"鬲"],[12225,1,"鬼"],[12226,1,"魚"],[12227,1,"鳥"],[12228,1,"鹵"],[12229,1,"鹿"],[12230,1,"麥"],[12231,1,"麻"],[12232,1,"黃"],[12233,1,"黍"],[12234,1,"黑"],[12235,1,"黹"],[12236,1,"黽"],[12237,1,"鼎"],[12238,1,"鼓"],[12239,1,"鼠"],[12240,1,"鼻"],[12241,1,"齊"],[12242,1,"齒"],[12243,1,"龍"],[12244,1,"龜"],[12245,1,"龠"],[[12246,12271],3],[[12272,12283],3],[[12284,12287],3],[12288,1," "],[12289,2],[12290,1,"."],[[12291,12292],2],[[12293,12295],2],[[12296,12329],2],[[12330,12333],2],[[12334,12341],2],[12342,1,"〒"],[12343,2],[12344,1,"十"],[12345,1,"卄"],[12346,1,"卅"],[12347,2],[12348,2],[12349,2],[12350,2],[12351,2],[12352,3],[[12353,12436],2],[[12437,12438],2],[[12439,12440],3],[[12441,12442],2],[12443,1," ゙"],[12444,1," ゚"],[[12445,12446],2],[12447,1,"より"],[12448,2],[[12449,12542],2],[12543,1,"コト"],[[12544,12548],3],[[12549,12588],2],[12589,2],[12590,2],[12591,2],[12592,3],[12593,1,"ᄀ"],[12594,1,"ᄁ"],[12595,1,"ᆪ"],[12596,1,"ᄂ"],[12597,1,"ᆬ"],[12598,1,"ᆭ"],[12599,1,"ᄃ"],[12600,1,"ᄄ"],[12601,1,"ᄅ"],[12602,1,"ᆰ"],[12603,1,"ᆱ"],[12604,1,"ᆲ"],[12605,1,"ᆳ"],[12606,1,"ᆴ"],[12607,1,"ᆵ"],[12608,1,"ᄚ"],[12609,1,"ᄆ"],[12610,1,"ᄇ"],[12611,1,"ᄈ"],[12612,1,"ᄡ"],[12613,1,"ᄉ"],[12614,1,"ᄊ"],[12615,1,"ᄋ"],[12616,1,"ᄌ"],[12617,1,"ᄍ"],[12618,1,"ᄎ"],[12619,1,"ᄏ"],[12620,1,"ᄐ"],[12621,1,"ᄑ"],[12622,1,"ᄒ"],[12623,1,"ᅡ"],[12624,1,"ᅢ"],[12625,1,"ᅣ"],[12626,1,"ᅤ"],[12627,1,"ᅥ"],[12628,1,"ᅦ"],[12629,1,"ᅧ"],[12630,1,"ᅨ"],[12631,1,"ᅩ"],[12632,1,"ᅪ"],[12633,1,"ᅫ"],[12634,1,"ᅬ"],[12635,1,"ᅭ"],[12636,1,"ᅮ"],[12637,1,"ᅯ"],[12638,1,"ᅰ"],[12639,1,"ᅱ"],[12640,1,"ᅲ"],[12641,1,"ᅳ"],[12642,1,"ᅴ"],[12643,1,"ᅵ"],[12644,7],[12645,1,"ᄔ"],[12646,1,"ᄕ"],[12647,1,"ᇇ"],[12648,1,"ᇈ"],[12649,1,"ᇌ"],[12650,1,"ᇎ"],[12651,1,"ᇓ"],[12652,1,"ᇗ"],[12653,1,"ᇙ"],[12654,1,"ᄜ"],[12655,1,"ᇝ"],[12656,1,"ᇟ"],[12657,1,"ᄝ"],[12658,1,"ᄞ"],[12659,1,"ᄠ"],[12660,1,"ᄢ"],[12661,1,"ᄣ"],[12662,1,"ᄧ"],[12663,1,"ᄩ"],[12664,1,"ᄫ"],[12665,1,"ᄬ"],[12666,1,"ᄭ"],[12667,1,"ᄮ"],[12668,1,"ᄯ"],[12669,1,"ᄲ"],[12670,1,"ᄶ"],[12671,1,"ᅀ"],[12672,1,"ᅇ"],[12673,1,"ᅌ"],[12674,1,"ᇱ"],[12675,1,"ᇲ"],[12676,1,"ᅗ"],[12677,1,"ᅘ"],[12678,1,"ᅙ"],[12679,1,"ᆄ"],[12680,1,"ᆅ"],[12681,1,"ᆈ"],[12682,1,"ᆑ"],[12683,1,"ᆒ"],[12684,1,"ᆔ"],[12685,1,"ᆞ"],[12686,1,"ᆡ"],[12687,3],[[12688,12689],2],[12690,1,"一"],[12691,1,"二"],[12692,1,"三"],[12693,1,"四"],[12694,1,"上"],[12695,1,"中"],[12696,1,"下"],[12697,1,"甲"],[12698,1,"乙"],[12699,1,"丙"],[12700,1,"丁"],[12701,1,"天"],[12702,1,"地"],[12703,1,"人"],[[12704,12727],2],[[12728,12730],2],[[12731,12735],2],[[12736,12751],2],[[12752,12771],2],[[12772,12773],2],[[12774,12782],3],[12783,3],[[12784,12799],2],[12800,1,"(ᄀ)"],[12801,1,"(ᄂ)"],[12802,1,"(ᄃ)"],[12803,1,"(ᄅ)"],[12804,1,"(ᄆ)"],[12805,1,"(ᄇ)"],[12806,1,"(ᄉ)"],[12807,1,"(ᄋ)"],[12808,1,"(ᄌ)"],[12809,1,"(ᄎ)"],[12810,1,"(ᄏ)"],[12811,1,"(ᄐ)"],[12812,1,"(ᄑ)"],[12813,1,"(ᄒ)"],[12814,1,"(가)"],[12815,1,"(나)"],[12816,1,"(다)"],[12817,1,"(라)"],[12818,1,"(마)"],[12819,1,"(바)"],[12820,1,"(사)"],[12821,1,"(아)"],[12822,1,"(자)"],[12823,1,"(차)"],[12824,1,"(카)"],[12825,1,"(타)"],[12826,1,"(파)"],[12827,1,"(하)"],[12828,1,"(주)"],[12829,1,"(오전)"],[12830,1,"(오후)"],[12831,3],[12832,1,"(一)"],[12833,1,"(二)"],[12834,1,"(三)"],[12835,1,"(四)"],[12836,1,"(五)"],[12837,1,"(六)"],[12838,1,"(七)"],[12839,1,"(八)"],[12840,1,"(九)"],[12841,1,"(十)"],[12842,1,"(月)"],[12843,1,"(火)"],[12844,1,"(水)"],[12845,1,"(木)"],[12846,1,"(金)"],[12847,1,"(土)"],[12848,1,"(日)"],[12849,1,"(株)"],[12850,1,"(有)"],[12851,1,"(社)"],[12852,1,"(名)"],[12853,1,"(特)"],[12854,1,"(財)"],[12855,1,"(祝)"],[12856,1,"(労)"],[12857,1,"(代)"],[12858,1,"(呼)"],[12859,1,"(学)"],[12860,1,"(監)"],[12861,1,"(企)"],[12862,1,"(資)"],[12863,1,"(協)"],[12864,1,"(祭)"],[12865,1,"(休)"],[12866,1,"(自)"],[12867,1,"(至)"],[12868,1,"問"],[12869,1,"幼"],[12870,1,"文"],[12871,1,"箏"],[[12872,12879],2],[12880,1,"pte"],[12881,1,"21"],[12882,1,"22"],[12883,1,"23"],[12884,1,"24"],[12885,1,"25"],[12886,1,"26"],[12887,1,"27"],[12888,1,"28"],[12889,1,"29"],[12890,1,"30"],[12891,1,"31"],[12892,1,"32"],[12893,1,"33"],[12894,1,"34"],[12895,1,"35"],[12896,1,"ᄀ"],[12897,1,"ᄂ"],[12898,1,"ᄃ"],[12899,1,"ᄅ"],[12900,1,"ᄆ"],[12901,1,"ᄇ"],[12902,1,"ᄉ"],[12903,1,"ᄋ"],[12904,1,"ᄌ"],[12905,1,"ᄎ"],[12906,1,"ᄏ"],[12907,1,"ᄐ"],[12908,1,"ᄑ"],[12909,1,"ᄒ"],[12910,1,"가"],[12911,1,"나"],[12912,1,"다"],[12913,1,"라"],[12914,1,"마"],[12915,1,"바"],[12916,1,"사"],[12917,1,"아"],[12918,1,"자"],[12919,1,"차"],[12920,1,"카"],[12921,1,"타"],[12922,1,"파"],[12923,1,"하"],[12924,1,"참고"],[12925,1,"주의"],[12926,1,"우"],[12927,2],[12928,1,"一"],[12929,1,"二"],[12930,1,"三"],[12931,1,"四"],[12932,1,"五"],[12933,1,"六"],[12934,1,"七"],[12935,1,"八"],[12936,1,"九"],[12937,1,"十"],[12938,1,"月"],[12939,1,"火"],[12940,1,"水"],[12941,1,"木"],[12942,1,"金"],[12943,1,"土"],[12944,1,"日"],[12945,1,"株"],[12946,1,"有"],[12947,1,"社"],[12948,1,"名"],[12949,1,"特"],[12950,1,"財"],[12951,1,"祝"],[12952,1,"労"],[12953,1,"秘"],[12954,1,"男"],[12955,1,"女"],[12956,1,"適"],[12957,1,"優"],[12958,1,"印"],[12959,1,"注"],[12960,1,"項"],[12961,1,"休"],[12962,1,"写"],[12963,1,"正"],[12964,1,"上"],[12965,1,"中"],[12966,1,"下"],[12967,1,"左"],[12968,1,"右"],[12969,1,"医"],[12970,1,"宗"],[12971,1,"学"],[12972,1,"監"],[12973,1,"企"],[12974,1,"資"],[12975,1,"協"],[12976,1,"夜"],[12977,1,"36"],[12978,1,"37"],[12979,1,"38"],[12980,1,"39"],[12981,1,"40"],[12982,1,"41"],[12983,1,"42"],[12984,1,"43"],[12985,1,"44"],[12986,1,"45"],[12987,1,"46"],[12988,1,"47"],[12989,1,"48"],[12990,1,"49"],[12991,1,"50"],[12992,1,"1月"],[12993,1,"2月"],[12994,1,"3月"],[12995,1,"4月"],[12996,1,"5月"],[12997,1,"6月"],[12998,1,"7月"],[12999,1,"8月"],[13000,1,"9月"],[13001,1,"10月"],[13002,1,"11月"],[13003,1,"12月"],[13004,1,"hg"],[13005,1,"erg"],[13006,1,"ev"],[13007,1,"ltd"],[13008,1,"ア"],[13009,1,"イ"],[13010,1,"ウ"],[13011,1,"エ"],[13012,1,"オ"],[13013,1,"カ"],[13014,1,"キ"],[13015,1,"ク"],[13016,1,"ケ"],[13017,1,"コ"],[13018,1,"サ"],[13019,1,"シ"],[13020,1,"ス"],[13021,1,"セ"],[13022,1,"ソ"],[13023,1,"タ"],[13024,1,"チ"],[13025,1,"ツ"],[13026,1,"テ"],[13027,1,"ト"],[13028,1,"ナ"],[13029,1,"ニ"],[13030,1,"ヌ"],[13031,1,"ネ"],[13032,1,"ノ"],[13033,1,"ハ"],[13034,1,"ヒ"],[13035,1,"フ"],[13036,1,"ヘ"],[13037,1,"ホ"],[13038,1,"マ"],[13039,1,"ミ"],[13040,1,"ム"],[13041,1,"メ"],[13042,1,"モ"],[13043,1,"ヤ"],[13044,1,"ユ"],[13045,1,"ヨ"],[13046,1,"ラ"],[13047,1,"リ"],[13048,1,"ル"],[13049,1,"レ"],[13050,1,"ロ"],[13051,1,"ワ"],[13052,1,"ヰ"],[13053,1,"ヱ"],[13054,1,"ヲ"],[13055,1,"令和"],[13056,1,"アパート"],[13057,1,"アルファ"],[13058,1,"アンペア"],[13059,1,"アール"],[13060,1,"イニング"],[13061,1,"インチ"],[13062,1,"ウォン"],[13063,1,"エスクード"],[13064,1,"エーカー"],[13065,1,"オンス"],[13066,1,"オーム"],[13067,1,"カイリ"],[13068,1,"カラット"],[13069,1,"カロリー"],[13070,1,"ガロン"],[13071,1,"ガンマ"],[13072,1,"ギガ"],[13073,1,"ギニー"],[13074,1,"キュリー"],[13075,1,"ギルダー"],[13076,1,"キロ"],[13077,1,"キログラム"],[13078,1,"キロメートル"],[13079,1,"キロワット"],[13080,1,"グラム"],[13081,1,"グラムトン"],[13082,1,"クルゼイロ"],[13083,1,"クローネ"],[13084,1,"ケース"],[13085,1,"コルナ"],[13086,1,"コーポ"],[13087,1,"サイクル"],[13088,1,"サンチーム"],[13089,1,"シリング"],[13090,1,"センチ"],[13091,1,"セント"],[13092,1,"ダース"],[13093,1,"デシ"],[13094,1,"ドル"],[13095,1,"トン"],[13096,1,"ナノ"],[13097,1,"ノット"],[13098,1,"ハイツ"],[13099,1,"パーセント"],[13100,1,"パーツ"],[13101,1,"バーレル"],[13102,1,"ピアストル"],[13103,1,"ピクル"],[13104,1,"ピコ"],[13105,1,"ビル"],[13106,1,"ファラッド"],[13107,1,"フィート"],[13108,1,"ブッシェル"],[13109,1,"フラン"],[13110,1,"ヘクタール"],[13111,1,"ペソ"],[13112,1,"ペニヒ"],[13113,1,"ヘルツ"],[13114,1,"ペンス"],[13115,1,"ページ"],[13116,1,"ベータ"],[13117,1,"ポイント"],[13118,1,"ボルト"],[13119,1,"ホン"],[13120,1,"ポンド"],[13121,1,"ホール"],[13122,1,"ホーン"],[13123,1,"マイクロ"],[13124,1,"マイル"],[13125,1,"マッハ"],[13126,1,"マルク"],[13127,1,"マンション"],[13128,1,"ミクロン"],[13129,1,"ミリ"],[13130,1,"ミリバール"],[13131,1,"メガ"],[13132,1,"メガトン"],[13133,1,"メートル"],[13134,1,"ヤード"],[13135,1,"ヤール"],[13136,1,"ユアン"],[13137,1,"リットル"],[13138,1,"リラ"],[13139,1,"ルピー"],[13140,1,"ルーブル"],[13141,1,"レム"],[13142,1,"レントゲン"],[13143,1,"ワット"],[13144,1,"0点"],[13145,1,"1点"],[13146,1,"2点"],[13147,1,"3点"],[13148,1,"4点"],[13149,1,"5点"],[13150,1,"6点"],[13151,1,"7点"],[13152,1,"8点"],[13153,1,"9点"],[13154,1,"10点"],[13155,1,"11点"],[13156,1,"12点"],[13157,1,"13点"],[13158,1,"14点"],[13159,1,"15点"],[13160,1,"16点"],[13161,1,"17点"],[13162,1,"18点"],[13163,1,"19点"],[13164,1,"20点"],[13165,1,"21点"],[13166,1,"22点"],[13167,1,"23点"],[13168,1,"24点"],[13169,1,"hpa"],[13170,1,"da"],[13171,1,"au"],[13172,1,"bar"],[13173,1,"ov"],[13174,1,"pc"],[13175,1,"dm"],[13176,1,"dm2"],[13177,1,"dm3"],[13178,1,"iu"],[13179,1,"平成"],[13180,1,"昭和"],[13181,1,"大正"],[13182,1,"明治"],[13183,1,"株式会社"],[13184,1,"pa"],[13185,1,"na"],[13186,1,"μa"],[13187,1,"ma"],[13188,1,"ka"],[13189,1,"kb"],[13190,1,"mb"],[13191,1,"gb"],[13192,1,"cal"],[13193,1,"kcal"],[13194,1,"pf"],[13195,1,"nf"],[13196,1,"μf"],[13197,1,"μg"],[13198,1,"mg"],[13199,1,"kg"],[13200,1,"hz"],[13201,1,"khz"],[13202,1,"mhz"],[13203,1,"ghz"],[13204,1,"thz"],[13205,1,"μl"],[13206,1,"ml"],[13207,1,"dl"],[13208,1,"kl"],[13209,1,"fm"],[13210,1,"nm"],[13211,1,"μm"],[13212,1,"mm"],[13213,1,"cm"],[13214,1,"km"],[13215,1,"mm2"],[13216,1,"cm2"],[13217,1,"m2"],[13218,1,"km2"],[13219,1,"mm3"],[13220,1,"cm3"],[13221,1,"m3"],[13222,1,"km3"],[13223,1,"m∕s"],[13224,1,"m∕s2"],[13225,1,"pa"],[13226,1,"kpa"],[13227,1,"mpa"],[13228,1,"gpa"],[13229,1,"rad"],[13230,1,"rad∕s"],[13231,1,"rad∕s2"],[13232,1,"ps"],[13233,1,"ns"],[13234,1,"μs"],[13235,1,"ms"],[13236,1,"pv"],[13237,1,"nv"],[13238,1,"μv"],[13239,1,"mv"],[13240,1,"kv"],[13241,1,"mv"],[13242,1,"pw"],[13243,1,"nw"],[13244,1,"μw"],[13245,1,"mw"],[13246,1,"kw"],[13247,1,"mw"],[13248,1,"kω"],[13249,1,"mω"],[13250,3],[13251,1,"bq"],[13252,1,"cc"],[13253,1,"cd"],[13254,1,"c∕kg"],[13255,3],[13256,1,"db"],[13257,1,"gy"],[13258,1,"ha"],[13259,1,"hp"],[13260,1,"in"],[13261,1,"kk"],[13262,1,"km"],[13263,1,"kt"],[13264,1,"lm"],[13265,1,"ln"],[13266,1,"log"],[13267,1,"lx"],[13268,1,"mb"],[13269,1,"mil"],[13270,1,"mol"],[13271,1,"ph"],[13272,3],[13273,1,"ppm"],[13274,1,"pr"],[13275,1,"sr"],[13276,1,"sv"],[13277,1,"wb"],[13278,1,"v∕m"],[13279,1,"a∕m"],[13280,1,"1日"],[13281,1,"2日"],[13282,1,"3日"],[13283,1,"4日"],[13284,1,"5日"],[13285,1,"6日"],[13286,1,"7日"],[13287,1,"8日"],[13288,1,"9日"],[13289,1,"10日"],[13290,1,"11日"],[13291,1,"12日"],[13292,1,"13日"],[13293,1,"14日"],[13294,1,"15日"],[13295,1,"16日"],[13296,1,"17日"],[13297,1,"18日"],[13298,1,"19日"],[13299,1,"20日"],[13300,1,"21日"],[13301,1,"22日"],[13302,1,"23日"],[13303,1,"24日"],[13304,1,"25日"],[13305,1,"26日"],[13306,1,"27日"],[13307,1,"28日"],[13308,1,"29日"],[13309,1,"30日"],[13310,1,"31日"],[13311,1,"gal"],[[13312,19893],2],[[19894,19903],2],[[19904,19967],2],[[19968,40869],2],[[40870,40891],2],[[40892,40899],2],[[40900,40907],2],[40908,2],[[40909,40917],2],[[40918,40938],2],[[40939,40943],2],[[40944,40956],2],[[40957,40959],2],[[40960,42124],2],[[42125,42127],3],[[42128,42145],2],[[42146,42147],2],[[42148,42163],2],[42164,2],[[42165,42176],2],[42177,2],[[42178,42180],2],[42181,2],[42182,2],[[42183,42191],3],[[42192,42237],2],[[42238,42239],2],[[42240,42508],2],[[42509,42511],2],[[42512,42539],2],[[42540,42559],3],[42560,1,"ꙁ"],[42561,2],[42562,1,"ꙃ"],[42563,2],[42564,1,"ꙅ"],[42565,2],[42566,1,"ꙇ"],[42567,2],[42568,1,"ꙉ"],[42569,2],[42570,1,"ꙋ"],[42571,2],[42572,1,"ꙍ"],[42573,2],[42574,1,"ꙏ"],[42575,2],[42576,1,"ꙑ"],[42577,2],[42578,1,"ꙓ"],[42579,2],[42580,1,"ꙕ"],[42581,2],[42582,1,"ꙗ"],[42583,2],[42584,1,"ꙙ"],[42585,2],[42586,1,"ꙛ"],[42587,2],[42588,1,"ꙝ"],[42589,2],[42590,1,"ꙟ"],[42591,2],[42592,1,"ꙡ"],[42593,2],[42594,1,"ꙣ"],[42595,2],[42596,1,"ꙥ"],[42597,2],[42598,1,"ꙧ"],[42599,2],[42600,1,"ꙩ"],[42601,2],[42602,1,"ꙫ"],[42603,2],[42604,1,"ꙭ"],[[42605,42607],2],[[42608,42611],2],[[42612,42619],2],[[42620,42621],2],[42622,2],[42623,2],[42624,1,"ꚁ"],[42625,2],[42626,1,"ꚃ"],[42627,2],[42628,1,"ꚅ"],[42629,2],[42630,1,"ꚇ"],[42631,2],[42632,1,"ꚉ"],[42633,2],[42634,1,"ꚋ"],[42635,2],[42636,1,"ꚍ"],[42637,2],[42638,1,"ꚏ"],[42639,2],[42640,1,"ꚑ"],[42641,2],[42642,1,"ꚓ"],[42643,2],[42644,1,"ꚕ"],[42645,2],[42646,1,"ꚗ"],[42647,2],[42648,1,"ꚙ"],[42649,2],[42650,1,"ꚛ"],[42651,2],[42652,1,"ъ"],[42653,1,"ь"],[42654,2],[42655,2],[[42656,42725],2],[[42726,42735],2],[[42736,42737],2],[[42738,42743],2],[[42744,42751],3],[[42752,42774],2],[[42775,42778],2],[[42779,42783],2],[[42784,42785],2],[42786,1,"ꜣ"],[42787,2],[42788,1,"ꜥ"],[42789,2],[42790,1,"ꜧ"],[42791,2],[42792,1,"ꜩ"],[42793,2],[42794,1,"ꜫ"],[42795,2],[42796,1,"ꜭ"],[42797,2],[42798,1,"ꜯ"],[[42799,42801],2],[42802,1,"ꜳ"],[42803,2],[42804,1,"ꜵ"],[42805,2],[42806,1,"ꜷ"],[42807,2],[42808,1,"ꜹ"],[42809,2],[42810,1,"ꜻ"],[42811,2],[42812,1,"ꜽ"],[42813,2],[42814,1,"ꜿ"],[42815,2],[42816,1,"ꝁ"],[42817,2],[42818,1,"ꝃ"],[42819,2],[42820,1,"ꝅ"],[42821,2],[42822,1,"ꝇ"],[42823,2],[42824,1,"ꝉ"],[42825,2],[42826,1,"ꝋ"],[42827,2],[42828,1,"ꝍ"],[42829,2],[42830,1,"ꝏ"],[42831,2],[42832,1,"ꝑ"],[42833,2],[42834,1,"ꝓ"],[42835,2],[42836,1,"ꝕ"],[42837,2],[42838,1,"ꝗ"],[42839,2],[42840,1,"ꝙ"],[42841,2],[42842,1,"ꝛ"],[42843,2],[42844,1,"ꝝ"],[42845,2],[42846,1,"ꝟ"],[42847,2],[42848,1,"ꝡ"],[42849,2],[42850,1,"ꝣ"],[42851,2],[42852,1,"ꝥ"],[42853,2],[42854,1,"ꝧ"],[42855,2],[42856,1,"ꝩ"],[42857,2],[42858,1,"ꝫ"],[42859,2],[42860,1,"ꝭ"],[42861,2],[42862,1,"ꝯ"],[42863,2],[42864,1,"ꝯ"],[[42865,42872],2],[42873,1,"ꝺ"],[42874,2],[42875,1,"ꝼ"],[42876,2],[42877,1,"ᵹ"],[42878,1,"ꝿ"],[42879,2],[42880,1,"ꞁ"],[42881,2],[42882,1,"ꞃ"],[42883,2],[42884,1,"ꞅ"],[42885,2],[42886,1,"ꞇ"],[[42887,42888],2],[[42889,42890],2],[42891,1,"ꞌ"],[42892,2],[42893,1,"ɥ"],[42894,2],[42895,2],[42896,1,"ꞑ"],[42897,2],[42898,1,"ꞓ"],[42899,2],[[42900,42901],2],[42902,1,"ꞗ"],[42903,2],[42904,1,"ꞙ"],[42905,2],[42906,1,"ꞛ"],[42907,2],[42908,1,"ꞝ"],[42909,2],[42910,1,"ꞟ"],[42911,2],[42912,1,"ꞡ"],[42913,2],[42914,1,"ꞣ"],[42915,2],[42916,1,"ꞥ"],[42917,2],[42918,1,"ꞧ"],[42919,2],[42920,1,"ꞩ"],[42921,2],[42922,1,"ɦ"],[42923,1,"ɜ"],[42924,1,"ɡ"],[42925,1,"ɬ"],[42926,1,"ɪ"],[42927,2],[42928,1,"ʞ"],[42929,1,"ʇ"],[42930,1,"ʝ"],[42931,1,"ꭓ"],[42932,1,"ꞵ"],[42933,2],[42934,1,"ꞷ"],[42935,2],[42936,1,"ꞹ"],[42937,2],[42938,1,"ꞻ"],[42939,2],[42940,1,"ꞽ"],[42941,2],[42942,1,"ꞿ"],[42943,2],[42944,1,"ꟁ"],[42945,2],[42946,1,"ꟃ"],[42947,2],[42948,1,"ꞔ"],[42949,1,"ʂ"],[42950,1,"ᶎ"],[42951,1,"ꟈ"],[42952,2],[42953,1,"ꟊ"],[42954,2],[42955,1,"ɤ"],[42956,1,"ꟍ"],[42957,2],[42958,1,"꟏"],[42959,2],[42960,1,"ꟑ"],[42961,2],[42962,1,"ꟓ"],[42963,2],[42964,1,"ꟕ"],[42965,2],[42966,1,"ꟗ"],[42967,2],[42968,1,"ꟙ"],[42969,2],[42970,1,"ꟛ"],[42971,2],[42972,1,"ƛ"],[[42973,42992],3],[42993,1,"s"],[42994,1,"c"],[42995,1,"f"],[42996,1,"q"],[42997,1,"ꟶ"],[42998,2],[42999,2],[43000,1,"ħ"],[43001,1,"œ"],[43002,2],[[43003,43007],2],[[43008,43047],2],[[43048,43051],2],[43052,2],[[43053,43055],3],[[43056,43065],2],[[43066,43071],3],[[43072,43123],2],[[43124,43127],2],[[43128,43135],3],[[43136,43204],2],[43205,2],[[43206,43213],3],[[43214,43215],2],[[43216,43225],2],[[43226,43231],3],[[43232,43255],2],[[43256,43258],2],[43259,2],[43260,2],[43261,2],[[43262,43263],2],[[43264,43309],2],[[43310,43311],2],[[43312,43347],2],[[43348,43358],3],[43359,2],[[43360,43388],2],[[43389,43391],3],[[43392,43456],2],[[43457,43469],2],[43470,3],[[43471,43481],2],[[43482,43485],3],[[43486,43487],2],[[43488,43518],2],[43519,3],[[43520,43574],2],[[43575,43583],3],[[43584,43597],2],[[43598,43599],3],[[43600,43609],2],[[43610,43611],3],[[43612,43615],2],[[43616,43638],2],[[43639,43641],2],[[43642,43643],2],[[43644,43647],2],[[43648,43714],2],[[43715,43738],3],[[43739,43741],2],[[43742,43743],2],[[43744,43759],2],[[43760,43761],2],[[43762,43766],2],[[43767,43776],3],[[43777,43782],2],[[43783,43784],3],[[43785,43790],2],[[43791,43792],3],[[43793,43798],2],[[43799,43807],3],[[43808,43814],2],[43815,3],[[43816,43822],2],[43823,3],[[43824,43866],2],[43867,2],[43868,1,"ꜧ"],[43869,1,"ꬷ"],[43870,1,"ɫ"],[43871,1,"ꭒ"],[[43872,43875],2],[[43876,43877],2],[[43878,43879],2],[43880,2],[43881,1,"ʍ"],[[43882,43883],2],[[43884,43887],3],[43888,1,"Ꭰ"],[43889,1,"Ꭱ"],[43890,1,"Ꭲ"],[43891,1,"Ꭳ"],[43892,1,"Ꭴ"],[43893,1,"Ꭵ"],[43894,1,"Ꭶ"],[43895,1,"Ꭷ"],[43896,1,"Ꭸ"],[43897,1,"Ꭹ"],[43898,1,"Ꭺ"],[43899,1,"Ꭻ"],[43900,1,"Ꭼ"],[43901,1,"Ꭽ"],[43902,1,"Ꭾ"],[43903,1,"Ꭿ"],[43904,1,"Ꮀ"],[43905,1,"Ꮁ"],[43906,1,"Ꮂ"],[43907,1,"Ꮃ"],[43908,1,"Ꮄ"],[43909,1,"Ꮅ"],[43910,1,"Ꮆ"],[43911,1,"Ꮇ"],[43912,1,"Ꮈ"],[43913,1,"Ꮉ"],[43914,1,"Ꮊ"],[43915,1,"Ꮋ"],[43916,1,"Ꮌ"],[43917,1,"Ꮍ"],[43918,1,"Ꮎ"],[43919,1,"Ꮏ"],[43920,1,"Ꮐ"],[43921,1,"Ꮑ"],[43922,1,"Ꮒ"],[43923,1,"Ꮓ"],[43924,1,"Ꮔ"],[43925,1,"Ꮕ"],[43926,1,"Ꮖ"],[43927,1,"Ꮗ"],[43928,1,"Ꮘ"],[43929,1,"Ꮙ"],[43930,1,"Ꮚ"],[43931,1,"Ꮛ"],[43932,1,"Ꮜ"],[43933,1,"Ꮝ"],[43934,1,"Ꮞ"],[43935,1,"Ꮟ"],[43936,1,"Ꮠ"],[43937,1,"Ꮡ"],[43938,1,"Ꮢ"],[43939,1,"Ꮣ"],[43940,1,"Ꮤ"],[43941,1,"Ꮥ"],[43942,1,"Ꮦ"],[43943,1,"Ꮧ"],[43944,1,"Ꮨ"],[43945,1,"Ꮩ"],[43946,1,"Ꮪ"],[43947,1,"Ꮫ"],[43948,1,"Ꮬ"],[43949,1,"Ꮭ"],[43950,1,"Ꮮ"],[43951,1,"Ꮯ"],[43952,1,"Ꮰ"],[43953,1,"Ꮱ"],[43954,1,"Ꮲ"],[43955,1,"Ꮳ"],[43956,1,"Ꮴ"],[43957,1,"Ꮵ"],[43958,1,"Ꮶ"],[43959,1,"Ꮷ"],[43960,1,"Ꮸ"],[43961,1,"Ꮹ"],[43962,1,"Ꮺ"],[43963,1,"Ꮻ"],[43964,1,"Ꮼ"],[43965,1,"Ꮽ"],[43966,1,"Ꮾ"],[43967,1,"Ꮿ"],[[43968,44010],2],[44011,2],[[44012,44013],2],[[44014,44015],3],[[44016,44025],2],[[44026,44031],3],[[44032,55203],2],[[55204,55215],3],[[55216,55238],2],[[55239,55242],3],[[55243,55291],2],[[55292,55295],3],[[55296,57343],3],[[57344,63743],3],[63744,1,"豈"],[63745,1,"更"],[63746,1,"車"],[63747,1,"賈"],[63748,1,"滑"],[63749,1,"串"],[63750,1,"句"],[[63751,63752],1,"龜"],[63753,1,"契"],[63754,1,"金"],[63755,1,"喇"],[63756,1,"奈"],[63757,1,"懶"],[63758,1,"癩"],[63759,1,"羅"],[63760,1,"蘿"],[63761,1,"螺"],[63762,1,"裸"],[63763,1,"邏"],[63764,1,"樂"],[63765,1,"洛"],[63766,1,"烙"],[63767,1,"珞"],[63768,1,"落"],[63769,1,"酪"],[63770,1,"駱"],[63771,1,"亂"],[63772,1,"卵"],[63773,1,"欄"],[63774,1,"爛"],[63775,1,"蘭"],[63776,1,"鸞"],[63777,1,"嵐"],[63778,1,"濫"],[63779,1,"藍"],[63780,1,"襤"],[63781,1,"拉"],[63782,1,"臘"],[63783,1,"蠟"],[63784,1,"廊"],[63785,1,"朗"],[63786,1,"浪"],[63787,1,"狼"],[63788,1,"郎"],[63789,1,"來"],[63790,1,"冷"],[63791,1,"勞"],[63792,1,"擄"],[63793,1,"櫓"],[63794,1,"爐"],[63795,1,"盧"],[63796,1,"老"],[63797,1,"蘆"],[63798,1,"虜"],[63799,1,"路"],[63800,1,"露"],[63801,1,"魯"],[63802,1,"鷺"],[63803,1,"碌"],[63804,1,"祿"],[63805,1,"綠"],[63806,1,"菉"],[63807,1,"錄"],[63808,1,"鹿"],[63809,1,"論"],[63810,1,"壟"],[63811,1,"弄"],[63812,1,"籠"],[63813,1,"聾"],[63814,1,"牢"],[63815,1,"磊"],[63816,1,"賂"],[63817,1,"雷"],[63818,1,"壘"],[63819,1,"屢"],[63820,1,"樓"],[63821,1,"淚"],[63822,1,"漏"],[63823,1,"累"],[63824,1,"縷"],[63825,1,"陋"],[63826,1,"勒"],[63827,1,"肋"],[63828,1,"凜"],[63829,1,"凌"],[63830,1,"稜"],[63831,1,"綾"],[63832,1,"菱"],[63833,1,"陵"],[63834,1,"讀"],[63835,1,"拏"],[63836,1,"樂"],[63837,1,"諾"],[63838,1,"丹"],[63839,1,"寧"],[63840,1,"怒"],[63841,1,"率"],[63842,1,"異"],[63843,1,"北"],[63844,1,"磻"],[63845,1,"便"],[63846,1,"復"],[63847,1,"不"],[63848,1,"泌"],[63849,1,"數"],[63850,1,"索"],[63851,1,"參"],[63852,1,"塞"],[63853,1,"省"],[63854,1,"葉"],[63855,1,"說"],[63856,1,"殺"],[63857,1,"辰"],[63858,1,"沈"],[63859,1,"拾"],[63860,1,"若"],[63861,1,"掠"],[63862,1,"略"],[63863,1,"亮"],[63864,1,"兩"],[63865,1,"凉"],[63866,1,"梁"],[63867,1,"糧"],[63868,1,"良"],[63869,1,"諒"],[63870,1,"量"],[63871,1,"勵"],[63872,1,"呂"],[63873,1,"女"],[63874,1,"廬"],[63875,1,"旅"],[63876,1,"濾"],[63877,1,"礪"],[63878,1,"閭"],[63879,1,"驪"],[63880,1,"麗"],[63881,1,"黎"],[63882,1,"力"],[63883,1,"曆"],[63884,1,"歷"],[63885,1,"轢"],[63886,1,"年"],[63887,1,"憐"],[63888,1,"戀"],[63889,1,"撚"],[63890,1,"漣"],[63891,1,"煉"],[63892,1,"璉"],[63893,1,"秊"],[63894,1,"練"],[63895,1,"聯"],[63896,1,"輦"],[63897,1,"蓮"],[63898,1,"連"],[63899,1,"鍊"],[63900,1,"列"],[63901,1,"劣"],[63902,1,"咽"],[63903,1,"烈"],[63904,1,"裂"],[63905,1,"說"],[63906,1,"廉"],[63907,1,"念"],[63908,1,"捻"],[63909,1,"殮"],[63910,1,"簾"],[63911,1,"獵"],[63912,1,"令"],[63913,1,"囹"],[63914,1,"寧"],[63915,1,"嶺"],[63916,1,"怜"],[63917,1,"玲"],[63918,1,"瑩"],[63919,1,"羚"],[63920,1,"聆"],[63921,1,"鈴"],[63922,1,"零"],[63923,1,"靈"],[63924,1,"領"],[63925,1,"例"],[63926,1,"禮"],[63927,1,"醴"],[63928,1,"隸"],[63929,1,"惡"],[63930,1,"了"],[63931,1,"僚"],[63932,1,"寮"],[63933,1,"尿"],[63934,1,"料"],[63935,1,"樂"],[63936,1,"燎"],[63937,1,"療"],[63938,1,"蓼"],[63939,1,"遼"],[63940,1,"龍"],[63941,1,"暈"],[63942,1,"阮"],[63943,1,"劉"],[63944,1,"杻"],[63945,1,"柳"],[63946,1,"流"],[63947,1,"溜"],[63948,1,"琉"],[63949,1,"留"],[63950,1,"硫"],[63951,1,"紐"],[63952,1,"類"],[63953,1,"六"],[63954,1,"戮"],[63955,1,"陸"],[63956,1,"倫"],[63957,1,"崙"],[63958,1,"淪"],[63959,1,"輪"],[63960,1,"律"],[63961,1,"慄"],[63962,1,"栗"],[63963,1,"率"],[63964,1,"隆"],[63965,1,"利"],[63966,1,"吏"],[63967,1,"履"],[63968,1,"易"],[63969,1,"李"],[63970,1,"梨"],[63971,1,"泥"],[63972,1,"理"],[63973,1,"痢"],[63974,1,"罹"],[63975,1,"裏"],[63976,1,"裡"],[63977,1,"里"],[63978,1,"離"],[63979,1,"匿"],[63980,1,"溺"],[63981,1,"吝"],[63982,1,"燐"],[63983,1,"璘"],[63984,1,"藺"],[63985,1,"隣"],[63986,1,"鱗"],[63987,1,"麟"],[63988,1,"林"],[63989,1,"淋"],[63990,1,"臨"],[63991,1,"立"],[63992,1,"笠"],[63993,1,"粒"],[63994,1,"狀"],[63995,1,"炙"],[63996,1,"識"],[63997,1,"什"],[63998,1,"茶"],[63999,1,"刺"],[64000,1,"切"],[64001,1,"度"],[64002,1,"拓"],[64003,1,"糖"],[64004,1,"宅"],[64005,1,"洞"],[64006,1,"暴"],[64007,1,"輻"],[64008,1,"行"],[64009,1,"降"],[64010,1,"見"],[64011,1,"廓"],[64012,1,"兀"],[64013,1,"嗀"],[[64014,64015],2],[64016,1,"塚"],[64017,2],[64018,1,"晴"],[[64019,64020],2],[64021,1,"凞"],[64022,1,"猪"],[64023,1,"益"],[64024,1,"礼"],[64025,1,"神"],[64026,1,"祥"],[64027,1,"福"],[64028,1,"靖"],[64029,1,"精"],[64030,1,"羽"],[64031,2],[64032,1,"蘒"],[64033,2],[64034,1,"諸"],[[64035,64036],2],[64037,1,"逸"],[64038,1,"都"],[[64039,64041],2],[64042,1,"飯"],[64043,1,"飼"],[64044,1,"館"],[64045,1,"鶴"],[64046,1,"郞"],[64047,1,"隷"],[64048,1,"侮"],[64049,1,"僧"],[64050,1,"免"],[64051,1,"勉"],[64052,1,"勤"],[64053,1,"卑"],[64054,1,"喝"],[64055,1,"嘆"],[64056,1,"器"],[64057,1,"塀"],[64058,1,"墨"],[64059,1,"層"],[64060,1,"屮"],[64061,1,"悔"],[64062,1,"慨"],[64063,1,"憎"],[64064,1,"懲"],[64065,1,"敏"],[64066,1,"既"],[64067,1,"暑"],[64068,1,"梅"],[64069,1,"海"],[64070,1,"渚"],[64071,1,"漢"],[64072,1,"煮"],[64073,1,"爫"],[64074,1,"琢"],[64075,1,"碑"],[64076,1,"社"],[64077,1,"祉"],[64078,1,"祈"],[64079,1,"祐"],[64080,1,"祖"],[64081,1,"祝"],[64082,1,"禍"],[64083,1,"禎"],[64084,1,"穀"],[64085,1,"突"],[64086,1,"節"],[64087,1,"練"],[64088,1,"縉"],[64089,1,"繁"],[64090,1,"署"],[64091,1,"者"],[64092,1,"臭"],[[64093,64094],1,"艹"],[64095,1,"著"],[64096,1,"褐"],[64097,1,"視"],[64098,1,"謁"],[64099,1,"謹"],[64100,1,"賓"],[64101,1,"贈"],[64102,1,"辶"],[64103,1,"逸"],[64104,1,"難"],[64105,1,"響"],[64106,1,"頻"],[64107,1,"恵"],[64108,1,"𤋮"],[64109,1,"舘"],[[64110,64111],3],[64112,1,"並"],[64113,1,"况"],[64114,1,"全"],[64115,1,"侀"],[64116,1,"充"],[64117,1,"冀"],[64118,1,"勇"],[64119,1,"勺"],[64120,1,"喝"],[64121,1,"啕"],[64122,1,"喙"],[64123,1,"嗢"],[64124,1,"塚"],[64125,1,"墳"],[64126,1,"奄"],[64127,1,"奔"],[64128,1,"婢"],[64129,1,"嬨"],[64130,1,"廒"],[64131,1,"廙"],[64132,1,"彩"],[64133,1,"徭"],[64134,1,"惘"],[64135,1,"慎"],[64136,1,"愈"],[64137,1,"憎"],[64138,1,"慠"],[64139,1,"懲"],[64140,1,"戴"],[64141,1,"揄"],[64142,1,"搜"],[64143,1,"摒"],[64144,1,"敖"],[64145,1,"晴"],[64146,1,"朗"],[64147,1,"望"],[64148,1,"杖"],[64149,1,"歹"],[64150,1,"殺"],[64151,1,"流"],[64152,1,"滛"],[64153,1,"滋"],[64154,1,"漢"],[64155,1,"瀞"],[64156,1,"煮"],[64157,1,"瞧"],[64158,1,"爵"],[64159,1,"犯"],[64160,1,"猪"],[64161,1,"瑱"],[64162,1,"甆"],[64163,1,"画"],[64164,1,"瘝"],[64165,1,"瘟"],[64166,1,"益"],[64167,1,"盛"],[64168,1,"直"],[64169,1,"睊"],[64170,1,"着"],[64171,1,"磌"],[64172,1,"窱"],[64173,1,"節"],[64174,1,"类"],[64175,1,"絛"],[64176,1,"練"],[64177,1,"缾"],[64178,1,"者"],[64179,1,"荒"],[64180,1,"華"],[64181,1,"蝹"],[64182,1,"襁"],[64183,1,"覆"],[64184,1,"視"],[64185,1,"調"],[64186,1,"諸"],[64187,1,"請"],[64188,1,"謁"],[64189,1,"諾"],[64190,1,"諭"],[64191,1,"謹"],[64192,1,"變"],[64193,1,"贈"],[64194,1,"輸"],[64195,1,"遲"],[64196,1,"醙"],[64197,1,"鉶"],[64198,1,"陼"],[64199,1,"難"],[64200,1,"靖"],[64201,1,"韛"],[64202,1,"響"],[64203,1,"頋"],[64204,1,"頻"],[64205,1,"鬒"],[64206,1,"龜"],[64207,1,"𢡊"],[64208,1,"𢡄"],[64209,1,"𣏕"],[64210,1,"㮝"],[64211,1,"䀘"],[64212,1,"䀹"],[64213,1,"𥉉"],[64214,1,"𥳐"],[64215,1,"𧻓"],[64216,1,"齃"],[64217,1,"龎"],[[64218,64255],3],[64256,1,"ff"],[64257,1,"fi"],[64258,1,"fl"],[64259,1,"ffi"],[64260,1,"ffl"],[[64261,64262],1,"st"],[[64263,64274],3],[64275,1,"մն"],[64276,1,"մե"],[64277,1,"մի"],[64278,1,"վն"],[64279,1,"մխ"],[[64280,64284],3],[64285,1,"יִ"],[64286,2],[64287,1,"ײַ"],[64288,1,"ע"],[64289,1,"א"],[64290,1,"ד"],[64291,1,"ה"],[64292,1,"כ"],[64293,1,"ל"],[64294,1,"ם"],[64295,1,"ר"],[64296,1,"ת"],[64297,1,"+"],[64298,1,"שׁ"],[64299,1,"שׂ"],[64300,1,"שּׁ"],[64301,1,"שּׂ"],[64302,1,"אַ"],[64303,1,"אָ"],[64304,1,"אּ"],[64305,1,"בּ"],[64306,1,"גּ"],[64307,1,"דּ"],[64308,1,"הּ"],[64309,1,"וּ"],[64310,1,"זּ"],[64311,3],[64312,1,"טּ"],[64313,1,"יּ"],[64314,1,"ךּ"],[64315,1,"כּ"],[64316,1,"לּ"],[64317,3],[64318,1,"מּ"],[64319,3],[64320,1,"נּ"],[64321,1,"סּ"],[64322,3],[64323,1,"ףּ"],[64324,1,"פּ"],[64325,3],[64326,1,"צּ"],[64327,1,"קּ"],[64328,1,"רּ"],[64329,1,"שּ"],[64330,1,"תּ"],[64331,1,"וֹ"],[64332,1,"בֿ"],[64333,1,"כֿ"],[64334,1,"פֿ"],[64335,1,"אל"],[[64336,64337],1,"ٱ"],[[64338,64341],1,"ٻ"],[[64342,64345],1,"پ"],[[64346,64349],1,"ڀ"],[[64350,64353],1,"ٺ"],[[64354,64357],1,"ٿ"],[[64358,64361],1,"ٹ"],[[64362,64365],1,"ڤ"],[[64366,64369],1,"ڦ"],[[64370,64373],1,"ڄ"],[[64374,64377],1,"ڃ"],[[64378,64381],1,"چ"],[[64382,64385],1,"ڇ"],[[64386,64387],1,"ڍ"],[[64388,64389],1,"ڌ"],[[64390,64391],1,"ڎ"],[[64392,64393],1,"ڈ"],[[64394,64395],1,"ژ"],[[64396,64397],1,"ڑ"],[[64398,64401],1,"ک"],[[64402,64405],1,"گ"],[[64406,64409],1,"ڳ"],[[64410,64413],1,"ڱ"],[[64414,64415],1,"ں"],[[64416,64419],1,"ڻ"],[[64420,64421],1,"ۀ"],[[64422,64425],1,"ہ"],[[64426,64429],1,"ھ"],[[64430,64431],1,"ے"],[[64432,64433],1,"ۓ"],[[64434,64449],2],[64450,2],[[64451,64466],2],[[64467,64470],1,"ڭ"],[[64471,64472],1,"ۇ"],[[64473,64474],1,"ۆ"],[[64475,64476],1,"ۈ"],[64477,1,"ۇٴ"],[[64478,64479],1,"ۋ"],[[64480,64481],1,"ۅ"],[[64482,64483],1,"ۉ"],[[64484,64487],1,"ې"],[[64488,64489],1,"ى"],[[64490,64491],1,"ئا"],[[64492,64493],1,"ئە"],[[64494,64495],1,"ئو"],[[64496,64497],1,"ئۇ"],[[64498,64499],1,"ئۆ"],[[64500,64501],1,"ئۈ"],[[64502,64504],1,"ئې"],[[64505,64507],1,"ئى"],[[64508,64511],1,"ی"],[64512,1,"ئج"],[64513,1,"ئح"],[64514,1,"ئم"],[64515,1,"ئى"],[64516,1,"ئي"],[64517,1,"بج"],[64518,1,"بح"],[64519,1,"بخ"],[64520,1,"بم"],[64521,1,"بى"],[64522,1,"بي"],[64523,1,"تج"],[64524,1,"تح"],[64525,1,"تخ"],[64526,1,"تم"],[64527,1,"تى"],[64528,1,"تي"],[64529,1,"ثج"],[64530,1,"ثم"],[64531,1,"ثى"],[64532,1,"ثي"],[64533,1,"جح"],[64534,1,"جم"],[64535,1,"حج"],[64536,1,"حم"],[64537,1,"خج"],[64538,1,"خح"],[64539,1,"خم"],[64540,1,"سج"],[64541,1,"سح"],[64542,1,"سخ"],[64543,1,"سم"],[64544,1,"صح"],[64545,1,"صم"],[64546,1,"ضج"],[64547,1,"ضح"],[64548,1,"ضخ"],[64549,1,"ضم"],[64550,1,"طح"],[64551,1,"طم"],[64552,1,"ظم"],[64553,1,"عج"],[64554,1,"عم"],[64555,1,"غج"],[64556,1,"غم"],[64557,1,"فج"],[64558,1,"فح"],[64559,1,"فخ"],[64560,1,"فم"],[64561,1,"فى"],[64562,1,"في"],[64563,1,"قح"],[64564,1,"قم"],[64565,1,"قى"],[64566,1,"قي"],[64567,1,"كا"],[64568,1,"كج"],[64569,1,"كح"],[64570,1,"كخ"],[64571,1,"كل"],[64572,1,"كم"],[64573,1,"كى"],[64574,1,"كي"],[64575,1,"لج"],[64576,1,"لح"],[64577,1,"لخ"],[64578,1,"لم"],[64579,1,"لى"],[64580,1,"لي"],[64581,1,"مج"],[64582,1,"مح"],[64583,1,"مخ"],[64584,1,"مم"],[64585,1,"مى"],[64586,1,"مي"],[64587,1,"نج"],[64588,1,"نح"],[64589,1,"نخ"],[64590,1,"نم"],[64591,1,"نى"],[64592,1,"ني"],[64593,1,"هج"],[64594,1,"هم"],[64595,1,"هى"],[64596,1,"هي"],[64597,1,"يج"],[64598,1,"يح"],[64599,1,"يخ"],[64600,1,"يم"],[64601,1,"يى"],[64602,1,"يي"],[64603,1,"ذٰ"],[64604,1,"رٰ"],[64605,1,"ىٰ"],[64606,1," ٌّ"],[64607,1," ٍّ"],[64608,1," َّ"],[64609,1," ُّ"],[64610,1," ِّ"],[64611,1," ّٰ"],[64612,1,"ئر"],[64613,1,"ئز"],[64614,1,"ئم"],[64615,1,"ئن"],[64616,1,"ئى"],[64617,1,"ئي"],[64618,1,"بر"],[64619,1,"بز"],[64620,1,"بم"],[64621,1,"بن"],[64622,1,"بى"],[64623,1,"بي"],[64624,1,"تر"],[64625,1,"تز"],[64626,1,"تم"],[64627,1,"تن"],[64628,1,"تى"],[64629,1,"تي"],[64630,1,"ثر"],[64631,1,"ثز"],[64632,1,"ثم"],[64633,1,"ثن"],[64634,1,"ثى"],[64635,1,"ثي"],[64636,1,"فى"],[64637,1,"في"],[64638,1,"قى"],[64639,1,"قي"],[64640,1,"كا"],[64641,1,"كل"],[64642,1,"كم"],[64643,1,"كى"],[64644,1,"كي"],[64645,1,"لم"],[64646,1,"لى"],[64647,1,"لي"],[64648,1,"ما"],[64649,1,"مم"],[64650,1,"نر"],[64651,1,"نز"],[64652,1,"نم"],[64653,1,"نن"],[64654,1,"نى"],[64655,1,"ني"],[64656,1,"ىٰ"],[64657,1,"ير"],[64658,1,"يز"],[64659,1,"يم"],[64660,1,"ين"],[64661,1,"يى"],[64662,1,"يي"],[64663,1,"ئج"],[64664,1,"ئح"],[64665,1,"ئخ"],[64666,1,"ئم"],[64667,1,"ئه"],[64668,1,"بج"],[64669,1,"بح"],[64670,1,"بخ"],[64671,1,"بم"],[64672,1,"به"],[64673,1,"تج"],[64674,1,"تح"],[64675,1,"تخ"],[64676,1,"تم"],[64677,1,"ته"],[64678,1,"ثم"],[64679,1,"جح"],[64680,1,"جم"],[64681,1,"حج"],[64682,1,"حم"],[64683,1,"خج"],[64684,1,"خم"],[64685,1,"سج"],[64686,1,"سح"],[64687,1,"سخ"],[64688,1,"سم"],[64689,1,"صح"],[64690,1,"صخ"],[64691,1,"صم"],[64692,1,"ضج"],[64693,1,"ضح"],[64694,1,"ضخ"],[64695,1,"ضم"],[64696,1,"طح"],[64697,1,"ظم"],[64698,1,"عج"],[64699,1,"عم"],[64700,1,"غج"],[64701,1,"غم"],[64702,1,"فج"],[64703,1,"فح"],[64704,1,"فخ"],[64705,1,"فم"],[64706,1,"قح"],[64707,1,"قم"],[64708,1,"كج"],[64709,1,"كح"],[64710,1,"كخ"],[64711,1,"كل"],[64712,1,"كم"],[64713,1,"لج"],[64714,1,"لح"],[64715,1,"لخ"],[64716,1,"لم"],[64717,1,"له"],[64718,1,"مج"],[64719,1,"مح"],[64720,1,"مخ"],[64721,1,"مم"],[64722,1,"نج"],[64723,1,"نح"],[64724,1,"نخ"],[64725,1,"نم"],[64726,1,"نه"],[64727,1,"هج"],[64728,1,"هم"],[64729,1,"هٰ"],[64730,1,"يج"],[64731,1,"يح"],[64732,1,"يخ"],[64733,1,"يم"],[64734,1,"يه"],[64735,1,"ئم"],[64736,1,"ئه"],[64737,1,"بم"],[64738,1,"به"],[64739,1,"تم"],[64740,1,"ته"],[64741,1,"ثم"],[64742,1,"ثه"],[64743,1,"سم"],[64744,1,"سه"],[64745,1,"شم"],[64746,1,"شه"],[64747,1,"كل"],[64748,1,"كم"],[64749,1,"لم"],[64750,1,"نم"],[64751,1,"نه"],[64752,1,"يم"],[64753,1,"يه"],[64754,1,"ـَّ"],[64755,1,"ـُّ"],[64756,1,"ـِّ"],[64757,1,"طى"],[64758,1,"طي"],[64759,1,"عى"],[64760,1,"عي"],[64761,1,"غى"],[64762,1,"غي"],[64763,1,"سى"],[64764,1,"سي"],[64765,1,"شى"],[64766,1,"شي"],[64767,1,"حى"],[64768,1,"حي"],[64769,1,"جى"],[64770,1,"جي"],[64771,1,"خى"],[64772,1,"خي"],[64773,1,"صى"],[64774,1,"صي"],[64775,1,"ضى"],[64776,1,"ضي"],[64777,1,"شج"],[64778,1,"شح"],[64779,1,"شخ"],[64780,1,"شم"],[64781,1,"شر"],[64782,1,"سر"],[64783,1,"صر"],[64784,1,"ضر"],[64785,1,"طى"],[64786,1,"طي"],[64787,1,"عى"],[64788,1,"عي"],[64789,1,"غى"],[64790,1,"غي"],[64791,1,"سى"],[64792,1,"سي"],[64793,1,"شى"],[64794,1,"شي"],[64795,1,"حى"],[64796,1,"حي"],[64797,1,"جى"],[64798,1,"جي"],[64799,1,"خى"],[64800,1,"خي"],[64801,1,"صى"],[64802,1,"صي"],[64803,1,"ضى"],[64804,1,"ضي"],[64805,1,"شج"],[64806,1,"شح"],[64807,1,"شخ"],[64808,1,"شم"],[64809,1,"شر"],[64810,1,"سر"],[64811,1,"صر"],[64812,1,"ضر"],[64813,1,"شج"],[64814,1,"شح"],[64815,1,"شخ"],[64816,1,"شم"],[64817,1,"سه"],[64818,1,"شه"],[64819,1,"طم"],[64820,1,"سج"],[64821,1,"سح"],[64822,1,"سخ"],[64823,1,"شج"],[64824,1,"شح"],[64825,1,"شخ"],[64826,1,"طم"],[64827,1,"ظم"],[[64828,64829],1,"اً"],[[64830,64831],2],[[64832,64847],2],[64848,1,"تجم"],[[64849,64850],1,"تحج"],[64851,1,"تحم"],[64852,1,"تخم"],[64853,1,"تمج"],[64854,1,"تمح"],[64855,1,"تمخ"],[[64856,64857],1,"جمح"],[64858,1,"حمي"],[64859,1,"حمى"],[64860,1,"سحج"],[64861,1,"سجح"],[64862,1,"سجى"],[[64863,64864],1,"سمح"],[64865,1,"سمج"],[[64866,64867],1,"سمم"],[[64868,64869],1,"صحح"],[64870,1,"صمم"],[[64871,64872],1,"شحم"],[64873,1,"شجي"],[[64874,64875],1,"شمخ"],[[64876,64877],1,"شمم"],[64878,1,"ضحى"],[[64879,64880],1,"ضخم"],[[64881,64882],1,"طمح"],[64883,1,"طمم"],[64884,1,"طمي"],[64885,1,"عجم"],[[64886,64887],1,"عمم"],[64888,1,"عمى"],[64889,1,"غمم"],[64890,1,"غمي"],[64891,1,"غمى"],[[64892,64893],1,"فخم"],[64894,1,"قمح"],[64895,1,"قمم"],[64896,1,"لحم"],[64897,1,"لحي"],[64898,1,"لحى"],[[64899,64900],1,"لجج"],[[64901,64902],1,"لخم"],[[64903,64904],1,"لمح"],[64905,1,"محج"],[64906,1,"محم"],[64907,1,"محي"],[64908,1,"مجح"],[64909,1,"مجم"],[64910,1,"مخج"],[64911,1,"مخم"],[[64912,64913],2],[64914,1,"مجخ"],[64915,1,"همج"],[64916,1,"همم"],[64917,1,"نحم"],[64918,1,"نحى"],[[64919,64920],1,"نجم"],[64921,1,"نجى"],[64922,1,"نمي"],[64923,1,"نمى"],[[64924,64925],1,"يمم"],[64926,1,"بخي"],[64927,1,"تجي"],[64928,1,"تجى"],[64929,1,"تخي"],[64930,1,"تخى"],[64931,1,"تمي"],[64932,1,"تمى"],[64933,1,"جمي"],[64934,1,"جحى"],[64935,1,"جمى"],[64936,1,"سخى"],[64937,1,"صحي"],[64938,1,"شحي"],[64939,1,"ضحي"],[64940,1,"لجي"],[64941,1,"لمي"],[64942,1,"يحي"],[64943,1,"يجي"],[64944,1,"يمي"],[64945,1,"ممي"],[64946,1,"قمي"],[64947,1,"نحي"],[64948,1,"قمح"],[64949,1,"لحم"],[64950,1,"عمي"],[64951,1,"كمي"],[64952,1,"نجح"],[64953,1,"مخي"],[64954,1,"لجم"],[64955,1,"كمم"],[64956,1,"لجم"],[64957,1,"نجح"],[64958,1,"جحي"],[64959,1,"حجي"],[64960,1,"مجي"],[64961,1,"فمي"],[64962,1,"بحي"],[64963,1,"كمم"],[64964,1,"عجم"],[64965,1,"صمم"],[64966,1,"سخي"],[64967,1,"نجي"],[[64968,64974],2],[64975,2],[[64976,65007],3],[65008,1,"صلے"],[65009,1,"قلے"],[65010,1,"الله"],[65011,1,"اكبر"],[65012,1,"محمد"],[65013,1,"صلعم"],[65014,1,"رسول"],[65015,1,"عليه"],[65016,1,"وسلم"],[65017,1,"صلى"],[65018,1,"صلى الله عليه وسلم"],[65019,1,"جل جلاله"],[65020,1,"ریال"],[65021,2],[[65022,65023],2],[[65024,65039],7],[65040,1,","],[65041,1,"、"],[65042,3],[65043,1,":"],[65044,1,";"],[65045,1,"!"],[65046,1,"?"],[65047,1,"〖"],[65048,1,"〗"],[65049,3],[[65050,65055],3],[[65056,65059],2],[[65060,65062],2],[[65063,65069],2],[[65070,65071],2],[65072,3],[65073,1,"—"],[65074,1,"–"],[[65075,65076],1,"_"],[65077,1,"("],[65078,1,")"],[65079,1,"{"],[65080,1,"}"],[65081,1,"〔"],[65082,1,"〕"],[65083,1,"【"],[65084,1,"】"],[65085,1,"《"],[65086,1,"》"],[65087,1,"〈"],[65088,1,"〉"],[65089,1,"「"],[65090,1,"」"],[65091,1,"『"],[65092,1,"』"],[[65093,65094],2],[65095,1,"["],[65096,1,"]"],[[65097,65100],1," ̅"],[[65101,65103],1,"_"],[65104,1,","],[65105,1,"、"],[65106,3],[65107,3],[65108,1,";"],[65109,1,":"],[65110,1,"?"],[65111,1,"!"],[65112,1,"—"],[65113,1,"("],[65114,1,")"],[65115,1,"{"],[65116,1,"}"],[65117,1,"〔"],[65118,1,"〕"],[65119,1,"#"],[65120,1,"&"],[65121,1,"*"],[65122,1,"+"],[65123,1,"-"],[65124,1,"<"],[65125,1,">"],[65126,1,"="],[65127,3],[65128,1,"\\"],[65129,1,"$"],[65130,1,"%"],[65131,1,"@"],[[65132,65135],3],[65136,1," ً"],[65137,1,"ـً"],[65138,1," ٌ"],[65139,2],[65140,1," ٍ"],[65141,3],[65142,1," َ"],[65143,1,"ـَ"],[65144,1," ُ"],[65145,1,"ـُ"],[65146,1," ِ"],[65147,1,"ـِ"],[65148,1," ّ"],[65149,1,"ـّ"],[65150,1," ْ"],[65151,1,"ـْ"],[65152,1,"ء"],[[65153,65154],1,"آ"],[[65155,65156],1,"أ"],[[65157,65158],1,"ؤ"],[[65159,65160],1,"إ"],[[65161,65164],1,"ئ"],[[65165,65166],1,"ا"],[[65167,65170],1,"ب"],[[65171,65172],1,"ة"],[[65173,65176],1,"ت"],[[65177,65180],1,"ث"],[[65181,65184],1,"ج"],[[65185,65188],1,"ح"],[[65189,65192],1,"خ"],[[65193,65194],1,"د"],[[65195,65196],1,"ذ"],[[65197,65198],1,"ر"],[[65199,65200],1,"ز"],[[65201,65204],1,"س"],[[65205,65208],1,"ش"],[[65209,65212],1,"ص"],[[65213,65216],1,"ض"],[[65217,65220],1,"ط"],[[65221,65224],1,"ظ"],[[65225,65228],1,"ع"],[[65229,65232],1,"غ"],[[65233,65236],1,"ف"],[[65237,65240],1,"ق"],[[65241,65244],1,"ك"],[[65245,65248],1,"ل"],[[65249,65252],1,"م"],[[65253,65256],1,"ن"],[[65257,65260],1,"ه"],[[65261,65262],1,"و"],[[65263,65264],1,"ى"],[[65265,65268],1,"ي"],[[65269,65270],1,"لآ"],[[65271,65272],1,"لأ"],[[65273,65274],1,"لإ"],[[65275,65276],1,"لا"],[[65277,65278],3],[65279,7],[65280,3],[65281,1,"!"],[65282,1,'"'],[65283,1,"#"],[65284,1,"$"],[65285,1,"%"],[65286,1,"&"],[65287,1,"'"],[65288,1,"("],[65289,1,")"],[65290,1,"*"],[65291,1,"+"],[65292,1,","],[65293,1,"-"],[65294,1,"."],[65295,1,"/"],[65296,1,"0"],[65297,1,"1"],[65298,1,"2"],[65299,1,"3"],[65300,1,"4"],[65301,1,"5"],[65302,1,"6"],[65303,1,"7"],[65304,1,"8"],[65305,1,"9"],[65306,1,":"],[65307,1,";"],[65308,1,"<"],[65309,1,"="],[65310,1,">"],[65311,1,"?"],[65312,1,"@"],[65313,1,"a"],[65314,1,"b"],[65315,1,"c"],[65316,1,"d"],[65317,1,"e"],[65318,1,"f"],[65319,1,"g"],[65320,1,"h"],[65321,1,"i"],[65322,1,"j"],[65323,1,"k"],[65324,1,"l"],[65325,1,"m"],[65326,1,"n"],[65327,1,"o"],[65328,1,"p"],[65329,1,"q"],[65330,1,"r"],[65331,1,"s"],[65332,1,"t"],[65333,1,"u"],[65334,1,"v"],[65335,1,"w"],[65336,1,"x"],[65337,1,"y"],[65338,1,"z"],[65339,1,"["],[65340,1,"\\"],[65341,1,"]"],[65342,1,"^"],[65343,1,"_"],[65344,1,"`"],[65345,1,"a"],[65346,1,"b"],[65347,1,"c"],[65348,1,"d"],[65349,1,"e"],[65350,1,"f"],[65351,1,"g"],[65352,1,"h"],[65353,1,"i"],[65354,1,"j"],[65355,1,"k"],[65356,1,"l"],[65357,1,"m"],[65358,1,"n"],[65359,1,"o"],[65360,1,"p"],[65361,1,"q"],[65362,1,"r"],[65363,1,"s"],[65364,1,"t"],[65365,1,"u"],[65366,1,"v"],[65367,1,"w"],[65368,1,"x"],[65369,1,"y"],[65370,1,"z"],[65371,1,"{"],[65372,1,"|"],[65373,1,"}"],[65374,1,"~"],[65375,1,"⦅"],[65376,1,"⦆"],[65377,1,"."],[65378,1,"「"],[65379,1,"」"],[65380,1,"、"],[65381,1,"・"],[65382,1,"ヲ"],[65383,1,"ァ"],[65384,1,"ィ"],[65385,1,"ゥ"],[65386,1,"ェ"],[65387,1,"ォ"],[65388,1,"ャ"],[65389,1,"ュ"],[65390,1,"ョ"],[65391,1,"ッ"],[65392,1,"ー"],[65393,1,"ア"],[65394,1,"イ"],[65395,1,"ウ"],[65396,1,"エ"],[65397,1,"オ"],[65398,1,"カ"],[65399,1,"キ"],[65400,1,"ク"],[65401,1,"ケ"],[65402,1,"コ"],[65403,1,"サ"],[65404,1,"シ"],[65405,1,"ス"],[65406,1,"セ"],[65407,1,"ソ"],[65408,1,"タ"],[65409,1,"チ"],[65410,1,"ツ"],[65411,1,"テ"],[65412,1,"ト"],[65413,1,"ナ"],[65414,1,"ニ"],[65415,1,"ヌ"],[65416,1,"ネ"],[65417,1,"ノ"],[65418,1,"ハ"],[65419,1,"ヒ"],[65420,1,"フ"],[65421,1,"ヘ"],[65422,1,"ホ"],[65423,1,"マ"],[65424,1,"ミ"],[65425,1,"ム"],[65426,1,"メ"],[65427,1,"モ"],[65428,1,"ヤ"],[65429,1,"ユ"],[65430,1,"ヨ"],[65431,1,"ラ"],[65432,1,"リ"],[65433,1,"ル"],[65434,1,"レ"],[65435,1,"ロ"],[65436,1,"ワ"],[65437,1,"ン"],[65438,1,"゙"],[65439,1,"゚"],[65440,7],[65441,1,"ᄀ"],[65442,1,"ᄁ"],[65443,1,"ᆪ"],[65444,1,"ᄂ"],[65445,1,"ᆬ"],[65446,1,"ᆭ"],[65447,1,"ᄃ"],[65448,1,"ᄄ"],[65449,1,"ᄅ"],[65450,1,"ᆰ"],[65451,1,"ᆱ"],[65452,1,"ᆲ"],[65453,1,"ᆳ"],[65454,1,"ᆴ"],[65455,1,"ᆵ"],[65456,1,"ᄚ"],[65457,1,"ᄆ"],[65458,1,"ᄇ"],[65459,1,"ᄈ"],[65460,1,"ᄡ"],[65461,1,"ᄉ"],[65462,1,"ᄊ"],[65463,1,"ᄋ"],[65464,1,"ᄌ"],[65465,1,"ᄍ"],[65466,1,"ᄎ"],[65467,1,"ᄏ"],[65468,1,"ᄐ"],[65469,1,"ᄑ"],[65470,1,"ᄒ"],[[65471,65473],3],[65474,1,"ᅡ"],[65475,1,"ᅢ"],[65476,1,"ᅣ"],[65477,1,"ᅤ"],[65478,1,"ᅥ"],[65479,1,"ᅦ"],[[65480,65481],3],[65482,1,"ᅧ"],[65483,1,"ᅨ"],[65484,1,"ᅩ"],[65485,1,"ᅪ"],[65486,1,"ᅫ"],[65487,1,"ᅬ"],[[65488,65489],3],[65490,1,"ᅭ"],[65491,1,"ᅮ"],[65492,1,"ᅯ"],[65493,1,"ᅰ"],[65494,1,"ᅱ"],[65495,1,"ᅲ"],[[65496,65497],3],[65498,1,"ᅳ"],[65499,1,"ᅴ"],[65500,1,"ᅵ"],[[65501,65503],3],[65504,1,"¢"],[65505,1,"£"],[65506,1,"¬"],[65507,1," ̄"],[65508,1,"¦"],[65509,1,"¥"],[65510,1,"₩"],[65511,3],[65512,1,"│"],[65513,1,"←"],[65514,1,"↑"],[65515,1,"→"],[65516,1,"↓"],[65517,1,"■"],[65518,1,"○"],[[65519,65528],3],[[65529,65531],3],[65532,3],[65533,3],[[65534,65535],3],[[65536,65547],2],[65548,3],[[65549,65574],2],[65575,3],[[65576,65594],2],[65595,3],[[65596,65597],2],[65598,3],[[65599,65613],2],[[65614,65615],3],[[65616,65629],2],[[65630,65663],3],[[65664,65786],2],[[65787,65791],3],[[65792,65794],2],[[65795,65798],3],[[65799,65843],2],[[65844,65846],3],[[65847,65855],2],[[65856,65930],2],[[65931,65932],2],[[65933,65934],2],[65935,3],[[65936,65947],2],[65948,2],[[65949,65951],3],[65952,2],[[65953,65999],3],[[66000,66044],2],[66045,2],[[66046,66175],3],[[66176,66204],2],[[66205,66207],3],[[66208,66256],2],[[66257,66271],3],[66272,2],[[66273,66299],2],[[66300,66303],3],[[66304,66334],2],[66335,2],[[66336,66339],2],[[66340,66348],3],[[66349,66351],2],[[66352,66368],2],[66369,2],[[66370,66377],2],[66378,2],[[66379,66383],3],[[66384,66426],2],[[66427,66431],3],[[66432,66461],2],[66462,3],[66463,2],[[66464,66499],2],[[66500,66503],3],[[66504,66511],2],[[66512,66517],2],[[66518,66559],3],[66560,1,"𐐨"],[66561,1,"𐐩"],[66562,1,"𐐪"],[66563,1,"𐐫"],[66564,1,"𐐬"],[66565,1,"𐐭"],[66566,1,"𐐮"],[66567,1,"𐐯"],[66568,1,"𐐰"],[66569,1,"𐐱"],[66570,1,"𐐲"],[66571,1,"𐐳"],[66572,1,"𐐴"],[66573,1,"𐐵"],[66574,1,"𐐶"],[66575,1,"𐐷"],[66576,1,"𐐸"],[66577,1,"𐐹"],[66578,1,"𐐺"],[66579,1,"𐐻"],[66580,1,"𐐼"],[66581,1,"𐐽"],[66582,1,"𐐾"],[66583,1,"𐐿"],[66584,1,"𐑀"],[66585,1,"𐑁"],[66586,1,"𐑂"],[66587,1,"𐑃"],[66588,1,"𐑄"],[66589,1,"𐑅"],[66590,1,"𐑆"],[66591,1,"𐑇"],[66592,1,"𐑈"],[66593,1,"𐑉"],[66594,1,"𐑊"],[66595,1,"𐑋"],[66596,1,"𐑌"],[66597,1,"𐑍"],[66598,1,"𐑎"],[66599,1,"𐑏"],[[66600,66637],2],[[66638,66717],2],[[66718,66719],3],[[66720,66729],2],[[66730,66735],3],[66736,1,"𐓘"],[66737,1,"𐓙"],[66738,1,"𐓚"],[66739,1,"𐓛"],[66740,1,"𐓜"],[66741,1,"𐓝"],[66742,1,"𐓞"],[66743,1,"𐓟"],[66744,1,"𐓠"],[66745,1,"𐓡"],[66746,1,"𐓢"],[66747,1,"𐓣"],[66748,1,"𐓤"],[66749,1,"𐓥"],[66750,1,"𐓦"],[66751,1,"𐓧"],[66752,1,"𐓨"],[66753,1,"𐓩"],[66754,1,"𐓪"],[66755,1,"𐓫"],[66756,1,"𐓬"],[66757,1,"𐓭"],[66758,1,"𐓮"],[66759,1,"𐓯"],[66760,1,"𐓰"],[66761,1,"𐓱"],[66762,1,"𐓲"],[66763,1,"𐓳"],[66764,1,"𐓴"],[66765,1,"𐓵"],[66766,1,"𐓶"],[66767,1,"𐓷"],[66768,1,"𐓸"],[66769,1,"𐓹"],[66770,1,"𐓺"],[66771,1,"𐓻"],[[66772,66775],3],[[66776,66811],2],[[66812,66815],3],[[66816,66855],2],[[66856,66863],3],[[66864,66915],2],[[66916,66926],3],[66927,2],[66928,1,"𐖗"],[66929,1,"𐖘"],[66930,1,"𐖙"],[66931,1,"𐖚"],[66932,1,"𐖛"],[66933,1,"𐖜"],[66934,1,"𐖝"],[66935,1,"𐖞"],[66936,1,"𐖟"],[66937,1,"𐖠"],[66938,1,"𐖡"],[66939,3],[66940,1,"𐖣"],[66941,1,"𐖤"],[66942,1,"𐖥"],[66943,1,"𐖦"],[66944,1,"𐖧"],[66945,1,"𐖨"],[66946,1,"𐖩"],[66947,1,"𐖪"],[66948,1,"𐖫"],[66949,1,"𐖬"],[66950,1,"𐖭"],[66951,1,"𐖮"],[66952,1,"𐖯"],[66953,1,"𐖰"],[66954,1,"𐖱"],[66955,3],[66956,1,"𐖳"],[66957,1,"𐖴"],[66958,1,"𐖵"],[66959,1,"𐖶"],[66960,1,"𐖷"],[66961,1,"𐖸"],[66962,1,"𐖹"],[66963,3],[66964,1,"𐖻"],[66965,1,"𐖼"],[66966,3],[[66967,66977],2],[66978,3],[[66979,66993],2],[66994,3],[[66995,67001],2],[67002,3],[[67003,67004],2],[[67005,67007],3],[[67008,67059],2],[[67060,67071],3],[[67072,67382],2],[[67383,67391],3],[[67392,67413],2],[[67414,67423],3],[[67424,67431],2],[[67432,67455],3],[67456,2],[67457,1,"ː"],[67458,1,"ˑ"],[67459,1,"æ"],[67460,1,"ʙ"],[67461,1,"ɓ"],[67462,3],[67463,1,"ʣ"],[67464,1,"ꭦ"],[67465,1,"ʥ"],[67466,1,"ʤ"],[67467,1,"ɖ"],[67468,1,"ɗ"],[67469,1,"ᶑ"],[67470,1,"ɘ"],[67471,1,"ɞ"],[67472,1,"ʩ"],[67473,1,"ɤ"],[67474,1,"ɢ"],[67475,1,"ɠ"],[67476,1,"ʛ"],[67477,1,"ħ"],[67478,1,"ʜ"],[67479,1,"ɧ"],[67480,1,"ʄ"],[67481,1,"ʪ"],[67482,1,"ʫ"],[67483,1,"ɬ"],[67484,1,"𝼄"],[67485,1,"ꞎ"],[67486,1,"ɮ"],[67487,1,"𝼅"],[67488,1,"ʎ"],[67489,1,"𝼆"],[67490,1,"ø"],[67491,1,"ɶ"],[67492,1,"ɷ"],[67493,1,"q"],[67494,1,"ɺ"],[67495,1,"𝼈"],[67496,1,"ɽ"],[67497,1,"ɾ"],[67498,1,"ʀ"],[67499,1,"ʨ"],[67500,1,"ʦ"],[67501,1,"ꭧ"],[67502,1,"ʧ"],[67503,1,"ʈ"],[67504,1,"ⱱ"],[67505,3],[67506,1,"ʏ"],[67507,1,"ʡ"],[67508,1,"ʢ"],[67509,1,"ʘ"],[67510,1,"ǀ"],[67511,1,"ǁ"],[67512,1,"ǂ"],[67513,1,"𝼊"],[67514,1,"𝼞"],[[67515,67583],3],[[67584,67589],2],[[67590,67591],3],[67592,2],[67593,3],[[67594,67637],2],[67638,3],[[67639,67640],2],[[67641,67643],3],[67644,2],[[67645,67646],3],[67647,2],[[67648,67669],2],[67670,3],[[67671,67679],2],[[67680,67702],2],[[67703,67711],2],[[67712,67742],2],[[67743,67750],3],[[67751,67759],2],[[67760,67807],3],[[67808,67826],2],[67827,3],[[67828,67829],2],[[67830,67834],3],[[67835,67839],2],[[67840,67861],2],[[67862,67865],2],[[67866,67867],2],[[67868,67870],3],[67871,2],[[67872,67897],2],[[67898,67902],3],[67903,2],[[67904,67929],2],[[67930,67967],3],[[67968,68023],2],[[68024,68027],3],[[68028,68029],2],[[68030,68031],2],[[68032,68047],2],[[68048,68049],3],[[68050,68095],2],[[68096,68099],2],[68100,3],[[68101,68102],2],[[68103,68107],3],[[68108,68115],2],[68116,3],[[68117,68119],2],[68120,3],[[68121,68147],2],[[68148,68149],2],[[68150,68151],3],[[68152,68154],2],[[68155,68158],3],[68159,2],[[68160,68167],2],[68168,2],[[68169,68175],3],[[68176,68184],2],[[68185,68191],3],[[68192,68220],2],[[68221,68223],2],[[68224,68252],2],[[68253,68255],2],[[68256,68287],3],[[68288,68295],2],[68296,2],[[68297,68326],2],[[68327,68330],3],[[68331,68342],2],[[68343,68351],3],[[68352,68405],2],[[68406,68408],3],[[68409,68415],2],[[68416,68437],2],[[68438,68439],3],[[68440,68447],2],[[68448,68466],2],[[68467,68471],3],[[68472,68479],2],[[68480,68497],2],[[68498,68504],3],[[68505,68508],2],[[68509,68520],3],[[68521,68527],2],[[68528,68607],3],[[68608,68680],2],[[68681,68735],3],[68736,1,"𐳀"],[68737,1,"𐳁"],[68738,1,"𐳂"],[68739,1,"𐳃"],[68740,1,"𐳄"],[68741,1,"𐳅"],[68742,1,"𐳆"],[68743,1,"𐳇"],[68744,1,"𐳈"],[68745,1,"𐳉"],[68746,1,"𐳊"],[68747,1,"𐳋"],[68748,1,"𐳌"],[68749,1,"𐳍"],[68750,1,"𐳎"],[68751,1,"𐳏"],[68752,1,"𐳐"],[68753,1,"𐳑"],[68754,1,"𐳒"],[68755,1,"𐳓"],[68756,1,"𐳔"],[68757,1,"𐳕"],[68758,1,"𐳖"],[68759,1,"𐳗"],[68760,1,"𐳘"],[68761,1,"𐳙"],[68762,1,"𐳚"],[68763,1,"𐳛"],[68764,1,"𐳜"],[68765,1,"𐳝"],[68766,1,"𐳞"],[68767,1,"𐳟"],[68768,1,"𐳠"],[68769,1,"𐳡"],[68770,1,"𐳢"],[68771,1,"𐳣"],[68772,1,"𐳤"],[68773,1,"𐳥"],[68774,1,"𐳦"],[68775,1,"𐳧"],[68776,1,"𐳨"],[68777,1,"𐳩"],[68778,1,"𐳪"],[68779,1,"𐳫"],[68780,1,"𐳬"],[68781,1,"𐳭"],[68782,1,"𐳮"],[68783,1,"𐳯"],[68784,1,"𐳰"],[68785,1,"𐳱"],[68786,1,"𐳲"],[[68787,68799],3],[[68800,68850],2],[[68851,68857],3],[[68858,68863],2],[[68864,68903],2],[[68904,68911],3],[[68912,68921],2],[[68922,68927],3],[[68928,68943],2],[68944,1,"𐵰"],[68945,1,"𐵱"],[68946,1,"𐵲"],[68947,1,"𐵳"],[68948,1,"𐵴"],[68949,1,"𐵵"],[68950,1,"𐵶"],[68951,1,"𐵷"],[68952,1,"𐵸"],[68953,1,"𐵹"],[68954,1,"𐵺"],[68955,1,"𐵻"],[68956,1,"𐵼"],[68957,1,"𐵽"],[68958,1,"𐵾"],[68959,1,"𐵿"],[68960,1,"𐶀"],[68961,1,"𐶁"],[68962,1,"𐶂"],[68963,1,"𐶃"],[68964,1,"𐶄"],[68965,1,"𐶅"],[[68966,68968],3],[[68969,68973],2],[68974,2],[[68975,68997],2],[[68998,69005],3],[[69006,69007],2],[[69008,69215],3],[[69216,69246],2],[69247,3],[[69248,69289],2],[69290,3],[[69291,69292],2],[69293,2],[[69294,69295],3],[[69296,69297],2],[[69298,69313],3],[[69314,69316],2],[[69317,69319],2],[[69320,69327],3],[[69328,69336],2],[[69337,69369],3],[[69370,69371],2],[69372,2],[[69373,69375],2],[[69376,69404],2],[[69405,69414],2],[69415,2],[[69416,69423],3],[[69424,69456],2],[[69457,69465],2],[[69466,69487],3],[[69488,69509],2],[[69510,69513],2],[[69514,69551],3],[[69552,69572],2],[[69573,69579],2],[[69580,69599],3],[[69600,69622],2],[[69623,69631],3],[[69632,69702],2],[[69703,69709],2],[[69710,69713],3],[[69714,69733],2],[[69734,69743],2],[[69744,69749],2],[[69750,69758],3],[69759,2],[[69760,69818],2],[[69819,69820],2],[69821,3],[[69822,69825],2],[69826,2],[[69827,69836],3],[69837,3],[[69838,69839],3],[[69840,69864],2],[[69865,69871],3],[[69872,69881],2],[[69882,69887],3],[[69888,69940],2],[69941,3],[[69942,69951],2],[[69952,69955],2],[[69956,69958],2],[69959,2],[[69960,69967],3],[[69968,70003],2],[[70004,70005],2],[70006,2],[[70007,70015],3],[[70016,70084],2],[[70085,70088],2],[[70089,70092],2],[70093,2],[[70094,70095],2],[[70096,70105],2],[70106,2],[70107,2],[70108,2],[[70109,70111],2],[70112,3],[[70113,70132],2],[[70133,70143],3],[[70144,70161],2],[70162,3],[[70163,70199],2],[[70200,70205],2],[70206,2],[[70207,70209],2],[[70210,70271],3],[[70272,70278],2],[70279,3],[70280,2],[70281,3],[[70282,70285],2],[70286,3],[[70287,70301],2],[70302,3],[[70303,70312],2],[70313,2],[[70314,70319],3],[[70320,70378],2],[[70379,70383],3],[[70384,70393],2],[[70394,70399],3],[70400,2],[[70401,70403],2],[70404,3],[[70405,70412],2],[[70413,70414],3],[[70415,70416],2],[[70417,70418],3],[[70419,70440],2],[70441,3],[[70442,70448],2],[70449,3],[[70450,70451],2],[70452,3],[[70453,70457],2],[70458,3],[70459,2],[[70460,70468],2],[[70469,70470],3],[[70471,70472],2],[[70473,70474],3],[[70475,70477],2],[[70478,70479],3],[70480,2],[[70481,70486],3],[70487,2],[[70488,70492],3],[[70493,70499],2],[[70500,70501],3],[[70502,70508],2],[[70509,70511],3],[[70512,70516],2],[[70517,70527],3],[[70528,70537],2],[70538,3],[70539,2],[[70540,70541],3],[70542,2],[70543,3],[[70544,70581],2],[70582,3],[[70583,70592],2],[70593,3],[70594,2],[[70595,70596],3],[70597,2],[70598,3],[[70599,70602],2],[70603,3],[[70604,70611],2],[[70612,70613],2],[70614,3],[[70615,70616],2],[[70617,70624],3],[[70625,70626],2],[[70627,70655],3],[[70656,70730],2],[[70731,70735],2],[[70736,70745],2],[70746,2],[70747,2],[70748,3],[70749,2],[70750,2],[70751,2],[[70752,70753],2],[[70754,70783],3],[[70784,70853],2],[70854,2],[70855,2],[[70856,70863],3],[[70864,70873],2],[[70874,71039],3],[[71040,71093],2],[[71094,71095],3],[[71096,71104],2],[[71105,71113],2],[[71114,71127],2],[[71128,71133],2],[[71134,71167],3],[[71168,71232],2],[[71233,71235],2],[71236,2],[[71237,71247],3],[[71248,71257],2],[[71258,71263],3],[[71264,71276],2],[[71277,71295],3],[[71296,71351],2],[71352,2],[71353,2],[[71354,71359],3],[[71360,71369],2],[[71370,71375],3],[[71376,71395],2],[[71396,71423],3],[[71424,71449],2],[71450,2],[[71451,71452],3],[[71453,71467],2],[[71468,71471],3],[[71472,71481],2],[[71482,71487],2],[[71488,71494],2],[[71495,71679],3],[[71680,71738],2],[71739,2],[[71740,71839],3],[71840,1,"𑣀"],[71841,1,"𑣁"],[71842,1,"𑣂"],[71843,1,"𑣃"],[71844,1,"𑣄"],[71845,1,"𑣅"],[71846,1,"𑣆"],[71847,1,"𑣇"],[71848,1,"𑣈"],[71849,1,"𑣉"],[71850,1,"𑣊"],[71851,1,"𑣋"],[71852,1,"𑣌"],[71853,1,"𑣍"],[71854,1,"𑣎"],[71855,1,"𑣏"],[71856,1,"𑣐"],[71857,1,"𑣑"],[71858,1,"𑣒"],[71859,1,"𑣓"],[71860,1,"𑣔"],[71861,1,"𑣕"],[71862,1,"𑣖"],[71863,1,"𑣗"],[71864,1,"𑣘"],[71865,1,"𑣙"],[71866,1,"𑣚"],[71867,1,"𑣛"],[71868,1,"𑣜"],[71869,1,"𑣝"],[71870,1,"𑣞"],[71871,1,"𑣟"],[[71872,71913],2],[[71914,71922],2],[[71923,71934],3],[71935,2],[[71936,71942],2],[[71943,71944],3],[71945,2],[[71946,71947],3],[[71948,71955],2],[71956,3],[[71957,71958],2],[71959,3],[[71960,71989],2],[71990,3],[[71991,71992],2],[[71993,71994],3],[[71995,72003],2],[[72004,72006],2],[[72007,72015],3],[[72016,72025],2],[[72026,72095],3],[[72096,72103],2],[[72104,72105],3],[[72106,72151],2],[[72152,72153],3],[[72154,72161],2],[72162,2],[[72163,72164],2],[[72165,72191],3],[[72192,72254],2],[[72255,72262],2],[72263,2],[[72264,72271],3],[[72272,72323],2],[[72324,72325],2],[[72326,72345],2],[[72346,72348],2],[72349,2],[[72350,72354],2],[[72355,72367],3],[[72368,72383],2],[[72384,72440],2],[[72441,72447],3],[[72448,72457],2],[[72458,72543],3],[[72544,72551],2],[[72552,72639],3],[[72640,72672],2],[72673,2],[[72674,72687],3],[[72688,72697],2],[[72698,72703],3],[[72704,72712],2],[72713,3],[[72714,72758],2],[72759,3],[[72760,72768],2],[[72769,72773],2],[[72774,72783],3],[[72784,72793],2],[[72794,72812],2],[[72813,72815],3],[[72816,72817],2],[[72818,72847],2],[[72848,72849],3],[[72850,72871],2],[72872,3],[[72873,72886],2],[[72887,72959],3],[[72960,72966],2],[72967,3],[[72968,72969],2],[72970,3],[[72971,73014],2],[[73015,73017],3],[73018,2],[73019,3],[[73020,73021],2],[73022,3],[[73023,73031],2],[[73032,73039],3],[[73040,73049],2],[[73050,73055],3],[[73056,73061],2],[73062,3],[[73063,73064],2],[73065,3],[[73066,73102],2],[73103,3],[[73104,73105],2],[73106,3],[[73107,73112],2],[[73113,73119],3],[[73120,73129],2],[[73130,73135],3],[[73136,73179],2],[[73180,73183],3],[[73184,73193],2],[[73194,73439],3],[[73440,73462],2],[[73463,73464],2],[[73465,73471],3],[[73472,73488],2],[73489,3],[[73490,73530],2],[[73531,73533],3],[[73534,73538],2],[[73539,73551],2],[[73552,73561],2],[73562,2],[[73563,73647],3],[73648,2],[[73649,73663],3],[[73664,73713],2],[[73714,73726],3],[73727,2],[[73728,74606],2],[[74607,74648],2],[74649,2],[[74650,74751],3],[[74752,74850],2],[[74851,74862],2],[74863,3],[[74864,74867],2],[74868,2],[[74869,74879],3],[[74880,75075],2],[[75076,77711],3],[[77712,77808],2],[[77809,77810],2],[[77811,77823],3],[[77824,78894],2],[78895,2],[[78896,78904],3],[[78905,78911],3],[[78912,78933],2],[[78934,78943],3],[[78944,82938],2],[[82939,82943],3],[[82944,83526],2],[[83527,90367],3],[[90368,90425],2],[[90426,92159],3],[[92160,92728],2],[[92729,92735],3],[[92736,92766],2],[92767,3],[[92768,92777],2],[[92778,92781],3],[[92782,92783],2],[[92784,92862],2],[92863,3],[[92864,92873],2],[[92874,92879],3],[[92880,92909],2],[[92910,92911],3],[[92912,92916],2],[92917,2],[[92918,92927],3],[[92928,92982],2],[[92983,92991],2],[[92992,92995],2],[[92996,92997],2],[[92998,93007],3],[[93008,93017],2],[93018,3],[[93019,93025],2],[93026,3],[[93027,93047],2],[[93048,93052],3],[[93053,93071],2],[[93072,93503],3],[[93504,93548],2],[[93549,93551],2],[[93552,93561],2],[[93562,93759],3],[93760,1,"𖹠"],[93761,1,"𖹡"],[93762,1,"𖹢"],[93763,1,"𖹣"],[93764,1,"𖹤"],[93765,1,"𖹥"],[93766,1,"𖹦"],[93767,1,"𖹧"],[93768,1,"𖹨"],[93769,1,"𖹩"],[93770,1,"𖹪"],[93771,1,"𖹫"],[93772,1,"𖹬"],[93773,1,"𖹭"],[93774,1,"𖹮"],[93775,1,"𖹯"],[93776,1,"𖹰"],[93777,1,"𖹱"],[93778,1,"𖹲"],[93779,1,"𖹳"],[93780,1,"𖹴"],[93781,1,"𖹵"],[93782,1,"𖹶"],[93783,1,"𖹷"],[93784,1,"𖹸"],[93785,1,"𖹹"],[93786,1,"𖹺"],[93787,1,"𖹻"],[93788,1,"𖹼"],[93789,1,"𖹽"],[93790,1,"𖹾"],[93791,1,"𖹿"],[[93792,93823],2],[[93824,93850],2],[[93851,93855],3],[93856,1,"𖺻"],[93857,1,"𖺼"],[93858,1,"𖺽"],[93859,1,"𖺾"],[93860,1,"𖺿"],[93861,1,"𖻀"],[93862,1,"𖻁"],[93863,1,"𖻂"],[93864,1,"𖻃"],[93865,1,"𖻄"],[93866,1,"𖻅"],[93867,1,"𖻆"],[93868,1,"𖻇"],[93869,1,"𖻈"],[93870,1,"𖻉"],[93871,1,"𖻊"],[93872,1,"𖻋"],[93873,1,"𖻌"],[93874,1,"𖻍"],[93875,1,"𖻎"],[93876,1,"𖻏"],[93877,1,"𖻐"],[93878,1,"𖻑"],[93879,1,"𖻒"],[93880,1,"𖻓"],[[93881,93882],3],[[93883,93907],2],[[93908,93951],3],[[93952,94020],2],[[94021,94026],2],[[94027,94030],3],[94031,2],[[94032,94078],2],[[94079,94087],2],[[94088,94094],3],[[94095,94111],2],[[94112,94175],3],[94176,2],[94177,2],[94178,2],[94179,2],[94180,2],[[94181,94191],3],[[94192,94193],2],[[94194,94195],2],[[94196,94198],2],[[94199,94207],3],[[94208,100332],2],[[100333,100337],2],[[100338,100343],2],[[100344,100351],2],[[100352,101106],2],[[101107,101589],2],[[101590,101630],3],[101631,2],[[101632,101640],2],[[101641,101662],2],[[101663,101759],3],[[101760,101874],2],[[101875,110575],3],[[110576,110579],2],[110580,3],[[110581,110587],2],[110588,3],[[110589,110590],2],[110591,3],[[110592,110593],2],[[110594,110878],2],[[110879,110882],2],[[110883,110897],3],[110898,2],[[110899,110927],3],[[110928,110930],2],[[110931,110932],3],[110933,2],[[110934,110947],3],[[110948,110951],2],[[110952,110959],3],[[110960,111355],2],[[111356,113663],3],[[113664,113770],2],[[113771,113775],3],[[113776,113788],2],[[113789,113791],3],[[113792,113800],2],[[113801,113807],3],[[113808,113817],2],[[113818,113819],3],[113820,2],[[113821,113822],2],[113823,2],[[113824,113827],7],[[113828,117759],3],[[117760,117973],2],[117974,1,"a"],[117975,1,"b"],[117976,1,"c"],[117977,1,"d"],[117978,1,"e"],[117979,1,"f"],[117980,1,"g"],[117981,1,"h"],[117982,1,"i"],[117983,1,"j"],[117984,1,"k"],[117985,1,"l"],[117986,1,"m"],[117987,1,"n"],[117988,1,"o"],[117989,1,"p"],[117990,1,"q"],[117991,1,"r"],[117992,1,"s"],[117993,1,"t"],[117994,1,"u"],[117995,1,"v"],[117996,1,"w"],[117997,1,"x"],[117998,1,"y"],[117999,1,"z"],[118000,1,"0"],[118001,1,"1"],[118002,1,"2"],[118003,1,"3"],[118004,1,"4"],[118005,1,"5"],[118006,1,"6"],[118007,1,"7"],[118008,1,"8"],[118009,1,"9"],[[118010,118012],2],[[118013,118015],3],[[118016,118451],2],[[118452,118457],3],[[118458,118480],2],[[118481,118495],3],[[118496,118512],2],[[118513,118527],3],[[118528,118573],2],[[118574,118575],3],[[118576,118598],2],[[118599,118607],3],[[118608,118723],2],[[118724,118783],3],[[118784,119029],2],[[119030,119039],3],[[119040,119078],2],[[119079,119080],3],[119081,2],[[119082,119133],2],[119134,1,"𝅗𝅥"],[119135,1,"𝅘𝅥"],[119136,1,"𝅘𝅥𝅮"],[119137,1,"𝅘𝅥𝅯"],[119138,1,"𝅘𝅥𝅰"],[119139,1,"𝅘𝅥𝅱"],[119140,1,"𝅘𝅥𝅲"],[[119141,119154],2],[[119155,119162],7],[[119163,119226],2],[119227,1,"𝆹𝅥"],[119228,1,"𝆺𝅥"],[119229,1,"𝆹𝅥𝅮"],[119230,1,"𝆺𝅥𝅮"],[119231,1,"𝆹𝅥𝅯"],[119232,1,"𝆺𝅥𝅯"],[[119233,119261],2],[[119262,119272],2],[[119273,119274],2],[[119275,119295],3],[[119296,119365],2],[[119366,119487],3],[[119488,119507],2],[[119508,119519],3],[[119520,119539],2],[[119540,119551],3],[[119552,119638],2],[[119639,119647],3],[[119648,119665],2],[[119666,119672],2],[[119673,119807],3],[119808,1,"a"],[119809,1,"b"],[119810,1,"c"],[119811,1,"d"],[119812,1,"e"],[119813,1,"f"],[119814,1,"g"],[119815,1,"h"],[119816,1,"i"],[119817,1,"j"],[119818,1,"k"],[119819,1,"l"],[119820,1,"m"],[119821,1,"n"],[119822,1,"o"],[119823,1,"p"],[119824,1,"q"],[119825,1,"r"],[119826,1,"s"],[119827,1,"t"],[119828,1,"u"],[119829,1,"v"],[119830,1,"w"],[119831,1,"x"],[119832,1,"y"],[119833,1,"z"],[119834,1,"a"],[119835,1,"b"],[119836,1,"c"],[119837,1,"d"],[119838,1,"e"],[119839,1,"f"],[119840,1,"g"],[119841,1,"h"],[119842,1,"i"],[119843,1,"j"],[119844,1,"k"],[119845,1,"l"],[119846,1,"m"],[119847,1,"n"],[119848,1,"o"],[119849,1,"p"],[119850,1,"q"],[119851,1,"r"],[119852,1,"s"],[119853,1,"t"],[119854,1,"u"],[119855,1,"v"],[119856,1,"w"],[119857,1,"x"],[119858,1,"y"],[119859,1,"z"],[119860,1,"a"],[119861,1,"b"],[119862,1,"c"],[119863,1,"d"],[119864,1,"e"],[119865,1,"f"],[119866,1,"g"],[119867,1,"h"],[119868,1,"i"],[119869,1,"j"],[119870,1,"k"],[119871,1,"l"],[119872,1,"m"],[119873,1,"n"],[119874,1,"o"],[119875,1,"p"],[119876,1,"q"],[119877,1,"r"],[119878,1,"s"],[119879,1,"t"],[119880,1,"u"],[119881,1,"v"],[119882,1,"w"],[119883,1,"x"],[119884,1,"y"],[119885,1,"z"],[119886,1,"a"],[119887,1,"b"],[119888,1,"c"],[119889,1,"d"],[119890,1,"e"],[119891,1,"f"],[119892,1,"g"],[119893,3],[119894,1,"i"],[119895,1,"j"],[119896,1,"k"],[119897,1,"l"],[119898,1,"m"],[119899,1,"n"],[119900,1,"o"],[119901,1,"p"],[119902,1,"q"],[119903,1,"r"],[119904,1,"s"],[119905,1,"t"],[119906,1,"u"],[119907,1,"v"],[119908,1,"w"],[119909,1,"x"],[119910,1,"y"],[119911,1,"z"],[119912,1,"a"],[119913,1,"b"],[119914,1,"c"],[119915,1,"d"],[119916,1,"e"],[119917,1,"f"],[119918,1,"g"],[119919,1,"h"],[119920,1,"i"],[119921,1,"j"],[119922,1,"k"],[119923,1,"l"],[119924,1,"m"],[119925,1,"n"],[119926,1,"o"],[119927,1,"p"],[119928,1,"q"],[119929,1,"r"],[119930,1,"s"],[119931,1,"t"],[119932,1,"u"],[119933,1,"v"],[119934,1,"w"],[119935,1,"x"],[119936,1,"y"],[119937,1,"z"],[119938,1,"a"],[119939,1,"b"],[119940,1,"c"],[119941,1,"d"],[119942,1,"e"],[119943,1,"f"],[119944,1,"g"],[119945,1,"h"],[119946,1,"i"],[119947,1,"j"],[119948,1,"k"],[119949,1,"l"],[119950,1,"m"],[119951,1,"n"],[119952,1,"o"],[119953,1,"p"],[119954,1,"q"],[119955,1,"r"],[119956,1,"s"],[119957,1,"t"],[119958,1,"u"],[119959,1,"v"],[119960,1,"w"],[119961,1,"x"],[119962,1,"y"],[119963,1,"z"],[119964,1,"a"],[119965,3],[119966,1,"c"],[119967,1,"d"],[[119968,119969],3],[119970,1,"g"],[[119971,119972],3],[119973,1,"j"],[119974,1,"k"],[[119975,119976],3],[119977,1,"n"],[119978,1,"o"],[119979,1,"p"],[119980,1,"q"],[119981,3],[119982,1,"s"],[119983,1,"t"],[119984,1,"u"],[119985,1,"v"],[119986,1,"w"],[119987,1,"x"],[119988,1,"y"],[119989,1,"z"],[119990,1,"a"],[119991,1,"b"],[119992,1,"c"],[119993,1,"d"],[119994,3],[119995,1,"f"],[119996,3],[119997,1,"h"],[119998,1,"i"],[119999,1,"j"],[120000,1,"k"],[120001,1,"l"],[120002,1,"m"],[120003,1,"n"],[120004,3],[120005,1,"p"],[120006,1,"q"],[120007,1,"r"],[120008,1,"s"],[120009,1,"t"],[120010,1,"u"],[120011,1,"v"],[120012,1,"w"],[120013,1,"x"],[120014,1,"y"],[120015,1,"z"],[120016,1,"a"],[120017,1,"b"],[120018,1,"c"],[120019,1,"d"],[120020,1,"e"],[120021,1,"f"],[120022,1,"g"],[120023,1,"h"],[120024,1,"i"],[120025,1,"j"],[120026,1,"k"],[120027,1,"l"],[120028,1,"m"],[120029,1,"n"],[120030,1,"o"],[120031,1,"p"],[120032,1,"q"],[120033,1,"r"],[120034,1,"s"],[120035,1,"t"],[120036,1,"u"],[120037,1,"v"],[120038,1,"w"],[120039,1,"x"],[120040,1,"y"],[120041,1,"z"],[120042,1,"a"],[120043,1,"b"],[120044,1,"c"],[120045,1,"d"],[120046,1,"e"],[120047,1,"f"],[120048,1,"g"],[120049,1,"h"],[120050,1,"i"],[120051,1,"j"],[120052,1,"k"],[120053,1,"l"],[120054,1,"m"],[120055,1,"n"],[120056,1,"o"],[120057,1,"p"],[120058,1,"q"],[120059,1,"r"],[120060,1,"s"],[120061,1,"t"],[120062,1,"u"],[120063,1,"v"],[120064,1,"w"],[120065,1,"x"],[120066,1,"y"],[120067,1,"z"],[120068,1,"a"],[120069,1,"b"],[120070,3],[120071,1,"d"],[120072,1,"e"],[120073,1,"f"],[120074,1,"g"],[[120075,120076],3],[120077,1,"j"],[120078,1,"k"],[120079,1,"l"],[120080,1,"m"],[120081,1,"n"],[120082,1,"o"],[120083,1,"p"],[120084,1,"q"],[120085,3],[120086,1,"s"],[120087,1,"t"],[120088,1,"u"],[120089,1,"v"],[120090,1,"w"],[120091,1,"x"],[120092,1,"y"],[120093,3],[120094,1,"a"],[120095,1,"b"],[120096,1,"c"],[120097,1,"d"],[120098,1,"e"],[120099,1,"f"],[120100,1,"g"],[120101,1,"h"],[120102,1,"i"],[120103,1,"j"],[120104,1,"k"],[120105,1,"l"],[120106,1,"m"],[120107,1,"n"],[120108,1,"o"],[120109,1,"p"],[120110,1,"q"],[120111,1,"r"],[120112,1,"s"],[120113,1,"t"],[120114,1,"u"],[120115,1,"v"],[120116,1,"w"],[120117,1,"x"],[120118,1,"y"],[120119,1,"z"],[120120,1,"a"],[120121,1,"b"],[120122,3],[120123,1,"d"],[120124,1,"e"],[120125,1,"f"],[120126,1,"g"],[120127,3],[120128,1,"i"],[120129,1,"j"],[120130,1,"k"],[120131,1,"l"],[120132,1,"m"],[120133,3],[120134,1,"o"],[[120135,120137],3],[120138,1,"s"],[120139,1,"t"],[120140,1,"u"],[120141,1,"v"],[120142,1,"w"],[120143,1,"x"],[120144,1,"y"],[120145,3],[120146,1,"a"],[120147,1,"b"],[120148,1,"c"],[120149,1,"d"],[120150,1,"e"],[120151,1,"f"],[120152,1,"g"],[120153,1,"h"],[120154,1,"i"],[120155,1,"j"],[120156,1,"k"],[120157,1,"l"],[120158,1,"m"],[120159,1,"n"],[120160,1,"o"],[120161,1,"p"],[120162,1,"q"],[120163,1,"r"],[120164,1,"s"],[120165,1,"t"],[120166,1,"u"],[120167,1,"v"],[120168,1,"w"],[120169,1,"x"],[120170,1,"y"],[120171,1,"z"],[120172,1,"a"],[120173,1,"b"],[120174,1,"c"],[120175,1,"d"],[120176,1,"e"],[120177,1,"f"],[120178,1,"g"],[120179,1,"h"],[120180,1,"i"],[120181,1,"j"],[120182,1,"k"],[120183,1,"l"],[120184,1,"m"],[120185,1,"n"],[120186,1,"o"],[120187,1,"p"],[120188,1,"q"],[120189,1,"r"],[120190,1,"s"],[120191,1,"t"],[120192,1,"u"],[120193,1,"v"],[120194,1,"w"],[120195,1,"x"],[120196,1,"y"],[120197,1,"z"],[120198,1,"a"],[120199,1,"b"],[120200,1,"c"],[120201,1,"d"],[120202,1,"e"],[120203,1,"f"],[120204,1,"g"],[120205,1,"h"],[120206,1,"i"],[120207,1,"j"],[120208,1,"k"],[120209,1,"l"],[120210,1,"m"],[120211,1,"n"],[120212,1,"o"],[120213,1,"p"],[120214,1,"q"],[120215,1,"r"],[120216,1,"s"],[120217,1,"t"],[120218,1,"u"],[120219,1,"v"],[120220,1,"w"],[120221,1,"x"],[120222,1,"y"],[120223,1,"z"],[120224,1,"a"],[120225,1,"b"],[120226,1,"c"],[120227,1,"d"],[120228,1,"e"],[120229,1,"f"],[120230,1,"g"],[120231,1,"h"],[120232,1,"i"],[120233,1,"j"],[120234,1,"k"],[120235,1,"l"],[120236,1,"m"],[120237,1,"n"],[120238,1,"o"],[120239,1,"p"],[120240,1,"q"],[120241,1,"r"],[120242,1,"s"],[120243,1,"t"],[120244,1,"u"],[120245,1,"v"],[120246,1,"w"],[120247,1,"x"],[120248,1,"y"],[120249,1,"z"],[120250,1,"a"],[120251,1,"b"],[120252,1,"c"],[120253,1,"d"],[120254,1,"e"],[120255,1,"f"],[120256,1,"g"],[120257,1,"h"],[120258,1,"i"],[120259,1,"j"],[120260,1,"k"],[120261,1,"l"],[120262,1,"m"],[120263,1,"n"],[120264,1,"o"],[120265,1,"p"],[120266,1,"q"],[120267,1,"r"],[120268,1,"s"],[120269,1,"t"],[120270,1,"u"],[120271,1,"v"],[120272,1,"w"],[120273,1,"x"],[120274,1,"y"],[120275,1,"z"],[120276,1,"a"],[120277,1,"b"],[120278,1,"c"],[120279,1,"d"],[120280,1,"e"],[120281,1,"f"],[120282,1,"g"],[120283,1,"h"],[120284,1,"i"],[120285,1,"j"],[120286,1,"k"],[120287,1,"l"],[120288,1,"m"],[120289,1,"n"],[120290,1,"o"],[120291,1,"p"],[120292,1,"q"],[120293,1,"r"],[120294,1,"s"],[120295,1,"t"],[120296,1,"u"],[120297,1,"v"],[120298,1,"w"],[120299,1,"x"],[120300,1,"y"],[120301,1,"z"],[120302,1,"a"],[120303,1,"b"],[120304,1,"c"],[120305,1,"d"],[120306,1,"e"],[120307,1,"f"],[120308,1,"g"],[120309,1,"h"],[120310,1,"i"],[120311,1,"j"],[120312,1,"k"],[120313,1,"l"],[120314,1,"m"],[120315,1,"n"],[120316,1,"o"],[120317,1,"p"],[120318,1,"q"],[120319,1,"r"],[120320,1,"s"],[120321,1,"t"],[120322,1,"u"],[120323,1,"v"],[120324,1,"w"],[120325,1,"x"],[120326,1,"y"],[120327,1,"z"],[120328,1,"a"],[120329,1,"b"],[120330,1,"c"],[120331,1,"d"],[120332,1,"e"],[120333,1,"f"],[120334,1,"g"],[120335,1,"h"],[120336,1,"i"],[120337,1,"j"],[120338,1,"k"],[120339,1,"l"],[120340,1,"m"],[120341,1,"n"],[120342,1,"o"],[120343,1,"p"],[120344,1,"q"],[120345,1,"r"],[120346,1,"s"],[120347,1,"t"],[120348,1,"u"],[120349,1,"v"],[120350,1,"w"],[120351,1,"x"],[120352,1,"y"],[120353,1,"z"],[120354,1,"a"],[120355,1,"b"],[120356,1,"c"],[120357,1,"d"],[120358,1,"e"],[120359,1,"f"],[120360,1,"g"],[120361,1,"h"],[120362,1,"i"],[120363,1,"j"],[120364,1,"k"],[120365,1,"l"],[120366,1,"m"],[120367,1,"n"],[120368,1,"o"],[120369,1,"p"],[120370,1,"q"],[120371,1,"r"],[120372,1,"s"],[120373,1,"t"],[120374,1,"u"],[120375,1,"v"],[120376,1,"w"],[120377,1,"x"],[120378,1,"y"],[120379,1,"z"],[120380,1,"a"],[120381,1,"b"],[120382,1,"c"],[120383,1,"d"],[120384,1,"e"],[120385,1,"f"],[120386,1,"g"],[120387,1,"h"],[120388,1,"i"],[120389,1,"j"],[120390,1,"k"],[120391,1,"l"],[120392,1,"m"],[120393,1,"n"],[120394,1,"o"],[120395,1,"p"],[120396,1,"q"],[120397,1,"r"],[120398,1,"s"],[120399,1,"t"],[120400,1,"u"],[120401,1,"v"],[120402,1,"w"],[120403,1,"x"],[120404,1,"y"],[120405,1,"z"],[120406,1,"a"],[120407,1,"b"],[120408,1,"c"],[120409,1,"d"],[120410,1,"e"],[120411,1,"f"],[120412,1,"g"],[120413,1,"h"],[120414,1,"i"],[120415,1,"j"],[120416,1,"k"],[120417,1,"l"],[120418,1,"m"],[120419,1,"n"],[120420,1,"o"],[120421,1,"p"],[120422,1,"q"],[120423,1,"r"],[120424,1,"s"],[120425,1,"t"],[120426,1,"u"],[120427,1,"v"],[120428,1,"w"],[120429,1,"x"],[120430,1,"y"],[120431,1,"z"],[120432,1,"a"],[120433,1,"b"],[120434,1,"c"],[120435,1,"d"],[120436,1,"e"],[120437,1,"f"],[120438,1,"g"],[120439,1,"h"],[120440,1,"i"],[120441,1,"j"],[120442,1,"k"],[120443,1,"l"],[120444,1,"m"],[120445,1,"n"],[120446,1,"o"],[120447,1,"p"],[120448,1,"q"],[120449,1,"r"],[120450,1,"s"],[120451,1,"t"],[120452,1,"u"],[120453,1,"v"],[120454,1,"w"],[120455,1,"x"],[120456,1,"y"],[120457,1,"z"],[120458,1,"a"],[120459,1,"b"],[120460,1,"c"],[120461,1,"d"],[120462,1,"e"],[120463,1,"f"],[120464,1,"g"],[120465,1,"h"],[120466,1,"i"],[120467,1,"j"],[120468,1,"k"],[120469,1,"l"],[120470,1,"m"],[120471,1,"n"],[120472,1,"o"],[120473,1,"p"],[120474,1,"q"],[120475,1,"r"],[120476,1,"s"],[120477,1,"t"],[120478,1,"u"],[120479,1,"v"],[120480,1,"w"],[120481,1,"x"],[120482,1,"y"],[120483,1,"z"],[120484,1,"ı"],[120485,1,"ȷ"],[[120486,120487],3],[120488,1,"α"],[120489,1,"β"],[120490,1,"γ"],[120491,1,"δ"],[120492,1,"ε"],[120493,1,"ζ"],[120494,1,"η"],[120495,1,"θ"],[120496,1,"ι"],[120497,1,"κ"],[120498,1,"λ"],[120499,1,"μ"],[120500,1,"ν"],[120501,1,"ξ"],[120502,1,"ο"],[120503,1,"π"],[120504,1,"ρ"],[120505,1,"θ"],[120506,1,"σ"],[120507,1,"τ"],[120508,1,"υ"],[120509,1,"φ"],[120510,1,"χ"],[120511,1,"ψ"],[120512,1,"ω"],[120513,1,"∇"],[120514,1,"α"],[120515,1,"β"],[120516,1,"γ"],[120517,1,"δ"],[120518,1,"ε"],[120519,1,"ζ"],[120520,1,"η"],[120521,1,"θ"],[120522,1,"ι"],[120523,1,"κ"],[120524,1,"λ"],[120525,1,"μ"],[120526,1,"ν"],[120527,1,"ξ"],[120528,1,"ο"],[120529,1,"π"],[120530,1,"ρ"],[[120531,120532],1,"σ"],[120533,1,"τ"],[120534,1,"υ"],[120535,1,"φ"],[120536,1,"χ"],[120537,1,"ψ"],[120538,1,"ω"],[120539,1,"∂"],[120540,1,"ε"],[120541,1,"θ"],[120542,1,"κ"],[120543,1,"φ"],[120544,1,"ρ"],[120545,1,"π"],[120546,1,"α"],[120547,1,"β"],[120548,1,"γ"],[120549,1,"δ"],[120550,1,"ε"],[120551,1,"ζ"],[120552,1,"η"],[120553,1,"θ"],[120554,1,"ι"],[120555,1,"κ"],[120556,1,"λ"],[120557,1,"μ"],[120558,1,"ν"],[120559,1,"ξ"],[120560,1,"ο"],[120561,1,"π"],[120562,1,"ρ"],[120563,1,"θ"],[120564,1,"σ"],[120565,1,"τ"],[120566,1,"υ"],[120567,1,"φ"],[120568,1,"χ"],[120569,1,"ψ"],[120570,1,"ω"],[120571,1,"∇"],[120572,1,"α"],[120573,1,"β"],[120574,1,"γ"],[120575,1,"δ"],[120576,1,"ε"],[120577,1,"ζ"],[120578,1,"η"],[120579,1,"θ"],[120580,1,"ι"],[120581,1,"κ"],[120582,1,"λ"],[120583,1,"μ"],[120584,1,"ν"],[120585,1,"ξ"],[120586,1,"ο"],[120587,1,"π"],[120588,1,"ρ"],[[120589,120590],1,"σ"],[120591,1,"τ"],[120592,1,"υ"],[120593,1,"φ"],[120594,1,"χ"],[120595,1,"ψ"],[120596,1,"ω"],[120597,1,"∂"],[120598,1,"ε"],[120599,1,"θ"],[120600,1,"κ"],[120601,1,"φ"],[120602,1,"ρ"],[120603,1,"π"],[120604,1,"α"],[120605,1,"β"],[120606,1,"γ"],[120607,1,"δ"],[120608,1,"ε"],[120609,1,"ζ"],[120610,1,"η"],[120611,1,"θ"],[120612,1,"ι"],[120613,1,"κ"],[120614,1,"λ"],[120615,1,"μ"],[120616,1,"ν"],[120617,1,"ξ"],[120618,1,"ο"],[120619,1,"π"],[120620,1,"ρ"],[120621,1,"θ"],[120622,1,"σ"],[120623,1,"τ"],[120624,1,"υ"],[120625,1,"φ"],[120626,1,"χ"],[120627,1,"ψ"],[120628,1,"ω"],[120629,1,"∇"],[120630,1,"α"],[120631,1,"β"],[120632,1,"γ"],[120633,1,"δ"],[120634,1,"ε"],[120635,1,"ζ"],[120636,1,"η"],[120637,1,"θ"],[120638,1,"ι"],[120639,1,"κ"],[120640,1,"λ"],[120641,1,"μ"],[120642,1,"ν"],[120643,1,"ξ"],[120644,1,"ο"],[120645,1,"π"],[120646,1,"ρ"],[[120647,120648],1,"σ"],[120649,1,"τ"],[120650,1,"υ"],[120651,1,"φ"],[120652,1,"χ"],[120653,1,"ψ"],[120654,1,"ω"],[120655,1,"∂"],[120656,1,"ε"],[120657,1,"θ"],[120658,1,"κ"],[120659,1,"φ"],[120660,1,"ρ"],[120661,1,"π"],[120662,1,"α"],[120663,1,"β"],[120664,1,"γ"],[120665,1,"δ"],[120666,1,"ε"],[120667,1,"ζ"],[120668,1,"η"],[120669,1,"θ"],[120670,1,"ι"],[120671,1,"κ"],[120672,1,"λ"],[120673,1,"μ"],[120674,1,"ν"],[120675,1,"ξ"],[120676,1,"ο"],[120677,1,"π"],[120678,1,"ρ"],[120679,1,"θ"],[120680,1,"σ"],[120681,1,"τ"],[120682,1,"υ"],[120683,1,"φ"],[120684,1,"χ"],[120685,1,"ψ"],[120686,1,"ω"],[120687,1,"∇"],[120688,1,"α"],[120689,1,"β"],[120690,1,"γ"],[120691,1,"δ"],[120692,1,"ε"],[120693,1,"ζ"],[120694,1,"η"],[120695,1,"θ"],[120696,1,"ι"],[120697,1,"κ"],[120698,1,"λ"],[120699,1,"μ"],[120700,1,"ν"],[120701,1,"ξ"],[120702,1,"ο"],[120703,1,"π"],[120704,1,"ρ"],[[120705,120706],1,"σ"],[120707,1,"τ"],[120708,1,"υ"],[120709,1,"φ"],[120710,1,"χ"],[120711,1,"ψ"],[120712,1,"ω"],[120713,1,"∂"],[120714,1,"ε"],[120715,1,"θ"],[120716,1,"κ"],[120717,1,"φ"],[120718,1,"ρ"],[120719,1,"π"],[120720,1,"α"],[120721,1,"β"],[120722,1,"γ"],[120723,1,"δ"],[120724,1,"ε"],[120725,1,"ζ"],[120726,1,"η"],[120727,1,"θ"],[120728,1,"ι"],[120729,1,"κ"],[120730,1,"λ"],[120731,1,"μ"],[120732,1,"ν"],[120733,1,"ξ"],[120734,1,"ο"],[120735,1,"π"],[120736,1,"ρ"],[120737,1,"θ"],[120738,1,"σ"],[120739,1,"τ"],[120740,1,"υ"],[120741,1,"φ"],[120742,1,"χ"],[120743,1,"ψ"],[120744,1,"ω"],[120745,1,"∇"],[120746,1,"α"],[120747,1,"β"],[120748,1,"γ"],[120749,1,"δ"],[120750,1,"ε"],[120751,1,"ζ"],[120752,1,"η"],[120753,1,"θ"],[120754,1,"ι"],[120755,1,"κ"],[120756,1,"λ"],[120757,1,"μ"],[120758,1,"ν"],[120759,1,"ξ"],[120760,1,"ο"],[120761,1,"π"],[120762,1,"ρ"],[[120763,120764],1,"σ"],[120765,1,"τ"],[120766,1,"υ"],[120767,1,"φ"],[120768,1,"χ"],[120769,1,"ψ"],[120770,1,"ω"],[120771,1,"∂"],[120772,1,"ε"],[120773,1,"θ"],[120774,1,"κ"],[120775,1,"φ"],[120776,1,"ρ"],[120777,1,"π"],[[120778,120779],1,"ϝ"],[[120780,120781],3],[120782,1,"0"],[120783,1,"1"],[120784,1,"2"],[120785,1,"3"],[120786,1,"4"],[120787,1,"5"],[120788,1,"6"],[120789,1,"7"],[120790,1,"8"],[120791,1,"9"],[120792,1,"0"],[120793,1,"1"],[120794,1,"2"],[120795,1,"3"],[120796,1,"4"],[120797,1,"5"],[120798,1,"6"],[120799,1,"7"],[120800,1,"8"],[120801,1,"9"],[120802,1,"0"],[120803,1,"1"],[120804,1,"2"],[120805,1,"3"],[120806,1,"4"],[120807,1,"5"],[120808,1,"6"],[120809,1,"7"],[120810,1,"8"],[120811,1,"9"],[120812,1,"0"],[120813,1,"1"],[120814,1,"2"],[120815,1,"3"],[120816,1,"4"],[120817,1,"5"],[120818,1,"6"],[120819,1,"7"],[120820,1,"8"],[120821,1,"9"],[120822,1,"0"],[120823,1,"1"],[120824,1,"2"],[120825,1,"3"],[120826,1,"4"],[120827,1,"5"],[120828,1,"6"],[120829,1,"7"],[120830,1,"8"],[120831,1,"9"],[[120832,121343],2],[[121344,121398],2],[[121399,121402],2],[[121403,121452],2],[[121453,121460],2],[121461,2],[[121462,121475],2],[121476,2],[[121477,121483],2],[[121484,121498],3],[[121499,121503],2],[121504,3],[[121505,121519],2],[[121520,122623],3],[[122624,122654],2],[[122655,122660],3],[[122661,122666],2],[[122667,122879],3],[[122880,122886],2],[122887,3],[[122888,122904],2],[[122905,122906],3],[[122907,122913],2],[122914,3],[[122915,122916],2],[122917,3],[[122918,122922],2],[[122923,122927],3],[122928,1,"а"],[122929,1,"б"],[122930,1,"в"],[122931,1,"г"],[122932,1,"д"],[122933,1,"е"],[122934,1,"ж"],[122935,1,"з"],[122936,1,"и"],[122937,1,"к"],[122938,1,"л"],[122939,1,"м"],[122940,1,"о"],[122941,1,"п"],[122942,1,"р"],[122943,1,"с"],[122944,1,"т"],[122945,1,"у"],[122946,1,"ф"],[122947,1,"х"],[122948,1,"ц"],[122949,1,"ч"],[122950,1,"ш"],[122951,1,"ы"],[122952,1,"э"],[122953,1,"ю"],[122954,1,"ꚉ"],[122955,1,"ә"],[122956,1,"і"],[122957,1,"ј"],[122958,1,"ө"],[122959,1,"ү"],[122960,1,"ӏ"],[122961,1,"а"],[122962,1,"б"],[122963,1,"в"],[122964,1,"г"],[122965,1,"д"],[122966,1,"е"],[122967,1,"ж"],[122968,1,"з"],[122969,1,"и"],[122970,1,"к"],[122971,1,"л"],[122972,1,"о"],[122973,1,"п"],[122974,1,"с"],[122975,1,"у"],[122976,1,"ф"],[122977,1,"х"],[122978,1,"ц"],[122979,1,"ч"],[122980,1,"ш"],[122981,1,"ъ"],[122982,1,"ы"],[122983,1,"ґ"],[122984,1,"і"],[122985,1,"ѕ"],[122986,1,"џ"],[122987,1,"ҫ"],[122988,1,"ꙑ"],[122989,1,"ұ"],[[122990,123022],3],[123023,2],[[123024,123135],3],[[123136,123180],2],[[123181,123183],3],[[123184,123197],2],[[123198,123199],3],[[123200,123209],2],[[123210,123213],3],[123214,2],[123215,2],[[123216,123535],3],[[123536,123566],2],[[123567,123583],3],[[123584,123641],2],[[123642,123646],3],[123647,2],[[123648,124111],3],[[124112,124153],2],[[124154,124367],3],[[124368,124410],2],[[124411,124414],3],[124415,2],[[124416,124607],3],[[124608,124638],2],[124639,3],[[124640,124661],2],[[124662,124669],3],[[124670,124671],2],[[124672,124895],3],[[124896,124902],2],[124903,3],[[124904,124907],2],[124908,3],[[124909,124910],2],[124911,3],[[124912,124926],2],[124927,3],[[124928,125124],2],[[125125,125126],3],[[125127,125135],2],[[125136,125142],2],[[125143,125183],3],[125184,1,"𞤢"],[125185,1,"𞤣"],[125186,1,"𞤤"],[125187,1,"𞤥"],[125188,1,"𞤦"],[125189,1,"𞤧"],[125190,1,"𞤨"],[125191,1,"𞤩"],[125192,1,"𞤪"],[125193,1,"𞤫"],[125194,1,"𞤬"],[125195,1,"𞤭"],[125196,1,"𞤮"],[125197,1,"𞤯"],[125198,1,"𞤰"],[125199,1,"𞤱"],[125200,1,"𞤲"],[125201,1,"𞤳"],[125202,1,"𞤴"],[125203,1,"𞤵"],[125204,1,"𞤶"],[125205,1,"𞤷"],[125206,1,"𞤸"],[125207,1,"𞤹"],[125208,1,"𞤺"],[125209,1,"𞤻"],[125210,1,"𞤼"],[125211,1,"𞤽"],[125212,1,"𞤾"],[125213,1,"𞤿"],[125214,1,"𞥀"],[125215,1,"𞥁"],[125216,1,"𞥂"],[125217,1,"𞥃"],[[125218,125258],2],[125259,2],[[125260,125263],3],[[125264,125273],2],[[125274,125277],3],[[125278,125279],2],[[125280,126064],3],[[126065,126132],2],[[126133,126208],3],[[126209,126269],2],[[126270,126463],3],[126464,1,"ا"],[126465,1,"ب"],[126466,1,"ج"],[126467,1,"د"],[126468,3],[126469,1,"و"],[126470,1,"ز"],[126471,1,"ح"],[126472,1,"ط"],[126473,1,"ي"],[126474,1,"ك"],[126475,1,"ل"],[126476,1,"م"],[126477,1,"ن"],[126478,1,"س"],[126479,1,"ع"],[126480,1,"ف"],[126481,1,"ص"],[126482,1,"ق"],[126483,1,"ر"],[126484,1,"ش"],[126485,1,"ت"],[126486,1,"ث"],[126487,1,"خ"],[126488,1,"ذ"],[126489,1,"ض"],[126490,1,"ظ"],[126491,1,"غ"],[126492,1,"ٮ"],[126493,1,"ں"],[126494,1,"ڡ"],[126495,1,"ٯ"],[126496,3],[126497,1,"ب"],[126498,1,"ج"],[126499,3],[126500,1,"ه"],[[126501,126502],3],[126503,1,"ح"],[126504,3],[126505,1,"ي"],[126506,1,"ك"],[126507,1,"ل"],[126508,1,"م"],[126509,1,"ن"],[126510,1,"س"],[126511,1,"ع"],[126512,1,"ف"],[126513,1,"ص"],[126514,1,"ق"],[126515,3],[126516,1,"ش"],[126517,1,"ت"],[126518,1,"ث"],[126519,1,"خ"],[126520,3],[126521,1,"ض"],[126522,3],[126523,1,"غ"],[[126524,126529],3],[126530,1,"ج"],[[126531,126534],3],[126535,1,"ح"],[126536,3],[126537,1,"ي"],[126538,3],[126539,1,"ل"],[126540,3],[126541,1,"ن"],[126542,1,"س"],[126543,1,"ع"],[126544,3],[126545,1,"ص"],[126546,1,"ق"],[126547,3],[126548,1,"ش"],[[126549,126550],3],[126551,1,"خ"],[126552,3],[126553,1,"ض"],[126554,3],[126555,1,"غ"],[126556,3],[126557,1,"ں"],[126558,3],[126559,1,"ٯ"],[126560,3],[126561,1,"ب"],[126562,1,"ج"],[126563,3],[126564,1,"ه"],[[126565,126566],3],[126567,1,"ح"],[126568,1,"ط"],[126569,1,"ي"],[126570,1,"ك"],[126571,3],[126572,1,"م"],[126573,1,"ن"],[126574,1,"س"],[126575,1,"ع"],[126576,1,"ف"],[126577,1,"ص"],[126578,1,"ق"],[126579,3],[126580,1,"ش"],[126581,1,"ت"],[126582,1,"ث"],[126583,1,"خ"],[126584,3],[126585,1,"ض"],[126586,1,"ظ"],[126587,1,"غ"],[126588,1,"ٮ"],[126589,3],[126590,1,"ڡ"],[126591,3],[126592,1,"ا"],[126593,1,"ب"],[126594,1,"ج"],[126595,1,"د"],[126596,1,"ه"],[126597,1,"و"],[126598,1,"ز"],[126599,1,"ح"],[126600,1,"ط"],[126601,1,"ي"],[126602,3],[126603,1,"ل"],[126604,1,"م"],[126605,1,"ن"],[126606,1,"س"],[126607,1,"ع"],[126608,1,"ف"],[126609,1,"ص"],[126610,1,"ق"],[126611,1,"ر"],[126612,1,"ش"],[126613,1,"ت"],[126614,1,"ث"],[126615,1,"خ"],[126616,1,"ذ"],[126617,1,"ض"],[126618,1,"ظ"],[126619,1,"غ"],[[126620,126624],3],[126625,1,"ب"],[126626,1,"ج"],[126627,1,"د"],[126628,3],[126629,1,"و"],[126630,1,"ز"],[126631,1,"ح"],[126632,1,"ط"],[126633,1,"ي"],[126634,3],[126635,1,"ل"],[126636,1,"م"],[126637,1,"ن"],[126638,1,"س"],[126639,1,"ع"],[126640,1,"ف"],[126641,1,"ص"],[126642,1,"ق"],[126643,1,"ر"],[126644,1,"ش"],[126645,1,"ت"],[126646,1,"ث"],[126647,1,"خ"],[126648,1,"ذ"],[126649,1,"ض"],[126650,1,"ظ"],[126651,1,"غ"],[[126652,126703],3],[[126704,126705],2],[[126706,126975],3],[[126976,127019],2],[[127020,127023],3],[[127024,127123],2],[[127124,127135],3],[[127136,127150],2],[[127151,127152],3],[[127153,127166],2],[127167,2],[127168,3],[[127169,127183],2],[127184,3],[[127185,127199],2],[[127200,127221],2],[[127222,127231],3],[127232,3],[127233,1,"0,"],[127234,1,"1,"],[127235,1,"2,"],[127236,1,"3,"],[127237,1,"4,"],[127238,1,"5,"],[127239,1,"6,"],[127240,1,"7,"],[127241,1,"8,"],[127242,1,"9,"],[[127243,127244],2],[[127245,127247],2],[127248,1,"(a)"],[127249,1,"(b)"],[127250,1,"(c)"],[127251,1,"(d)"],[127252,1,"(e)"],[127253,1,"(f)"],[127254,1,"(g)"],[127255,1,"(h)"],[127256,1,"(i)"],[127257,1,"(j)"],[127258,1,"(k)"],[127259,1,"(l)"],[127260,1,"(m)"],[127261,1,"(n)"],[127262,1,"(o)"],[127263,1,"(p)"],[127264,1,"(q)"],[127265,1,"(r)"],[127266,1,"(s)"],[127267,1,"(t)"],[127268,1,"(u)"],[127269,1,"(v)"],[127270,1,"(w)"],[127271,1,"(x)"],[127272,1,"(y)"],[127273,1,"(z)"],[127274,1,"〔s〕"],[127275,1,"c"],[127276,1,"r"],[127277,1,"cd"],[127278,1,"wz"],[127279,2],[127280,1,"a"],[127281,1,"b"],[127282,1,"c"],[127283,1,"d"],[127284,1,"e"],[127285,1,"f"],[127286,1,"g"],[127287,1,"h"],[127288,1,"i"],[127289,1,"j"],[127290,1,"k"],[127291,1,"l"],[127292,1,"m"],[127293,1,"n"],[127294,1,"o"],[127295,1,"p"],[127296,1,"q"],[127297,1,"r"],[127298,1,"s"],[127299,1,"t"],[127300,1,"u"],[127301,1,"v"],[127302,1,"w"],[127303,1,"x"],[127304,1,"y"],[127305,1,"z"],[127306,1,"hv"],[127307,1,"mv"],[127308,1,"sd"],[127309,1,"ss"],[127310,1,"ppv"],[127311,1,"wc"],[[127312,127318],2],[127319,2],[[127320,127326],2],[127327,2],[[127328,127337],2],[127338,1,"mc"],[127339,1,"md"],[127340,1,"mr"],[[127341,127343],2],[[127344,127352],2],[127353,2],[127354,2],[[127355,127356],2],[[127357,127358],2],[127359,2],[[127360,127369],2],[[127370,127373],2],[[127374,127375],2],[127376,1,"dj"],[[127377,127386],2],[[127387,127404],2],[127405,2],[[127406,127461],3],[[127462,127487],2],[127488,1,"ほか"],[127489,1,"ココ"],[127490,1,"サ"],[[127491,127503],3],[127504,1,"手"],[127505,1,"字"],[127506,1,"双"],[127507,1,"デ"],[127508,1,"二"],[127509,1,"多"],[127510,1,"解"],[127511,1,"天"],[127512,1,"交"],[127513,1,"映"],[127514,1,"無"],[127515,1,"料"],[127516,1,"前"],[127517,1,"後"],[127518,1,"再"],[127519,1,"新"],[127520,1,"初"],[127521,1,"終"],[127522,1,"生"],[127523,1,"販"],[127524,1,"声"],[127525,1,"吹"],[127526,1,"演"],[127527,1,"投"],[127528,1,"捕"],[127529,1,"一"],[127530,1,"三"],[127531,1,"遊"],[127532,1,"左"],[127533,1,"中"],[127534,1,"右"],[127535,1,"指"],[127536,1,"走"],[127537,1,"打"],[127538,1,"禁"],[127539,1,"空"],[127540,1,"合"],[127541,1,"満"],[127542,1,"有"],[127543,1,"月"],[127544,1,"申"],[127545,1,"割"],[127546,1,"営"],[127547,1,"配"],[[127548,127551],3],[127552,1,"〔本〕"],[127553,1,"〔三〕"],[127554,1,"〔二〕"],[127555,1,"〔安〕"],[127556,1,"〔点〕"],[127557,1,"〔打〕"],[127558,1,"〔盗〕"],[127559,1,"〔勝〕"],[127560,1,"〔敗〕"],[[127561,127567],3],[127568,1,"得"],[127569,1,"可"],[[127570,127583],3],[[127584,127589],2],[[127590,127743],3],[[127744,127776],2],[[127777,127788],2],[[127789,127791],2],[[127792,127797],2],[127798,2],[[127799,127868],2],[127869,2],[[127870,127871],2],[[127872,127891],2],[[127892,127903],2],[[127904,127940],2],[127941,2],[[127942,127946],2],[[127947,127950],2],[[127951,127955],2],[[127956,127967],2],[[127968,127984],2],[[127985,127991],2],[[127992,127999],2],[[128000,128062],2],[128063,2],[128064,2],[128065,2],[[128066,128247],2],[128248,2],[[128249,128252],2],[[128253,128254],2],[128255,2],[[128256,128317],2],[[128318,128319],2],[[128320,128323],2],[[128324,128330],2],[[128331,128335],2],[[128336,128359],2],[[128360,128377],2],[128378,2],[[128379,128419],2],[128420,2],[[128421,128506],2],[[128507,128511],2],[128512,2],[[128513,128528],2],[128529,2],[[128530,128532],2],[128533,2],[128534,2],[128535,2],[128536,2],[128537,2],[128538,2],[128539,2],[[128540,128542],2],[128543,2],[[128544,128549],2],[[128550,128551],2],[[128552,128555],2],[128556,2],[128557,2],[[128558,128559],2],[[128560,128563],2],[128564,2],[[128565,128576],2],[[128577,128578],2],[[128579,128580],2],[[128581,128591],2],[[128592,128639],2],[[128640,128709],2],[[128710,128719],2],[128720,2],[[128721,128722],2],[[128723,128724],2],[128725,2],[[128726,128727],2],[128728,2],[[128729,128731],3],[128732,2],[[128733,128735],2],[[128736,128748],2],[[128749,128751],3],[[128752,128755],2],[[128756,128758],2],[[128759,128760],2],[128761,2],[128762,2],[[128763,128764],2],[[128765,128767],3],[[128768,128883],2],[[128884,128886],2],[[128887,128890],2],[[128891,128895],2],[[128896,128980],2],[[128981,128984],2],[128985,2],[[128986,128991],3],[[128992,129003],2],[[129004,129007],3],[129008,2],[[129009,129023],3],[[129024,129035],2],[[129036,129039],3],[[129040,129095],2],[[129096,129103],3],[[129104,129113],2],[[129114,129119],3],[[129120,129159],2],[[129160,129167],3],[[129168,129197],2],[[129198,129199],3],[[129200,129201],2],[[129202,129211],2],[[129212,129215],3],[[129216,129217],2],[[129218,129231],3],[[129232,129240],2],[[129241,129279],3],[[129280,129291],2],[129292,2],[[129293,129295],2],[[129296,129304],2],[[129305,129310],2],[129311,2],[[129312,129319],2],[[129320,129327],2],[129328,2],[[129329,129330],2],[[129331,129342],2],[129343,2],[[129344,129355],2],[129356,2],[[129357,129359],2],[[129360,129374],2],[[129375,129387],2],[[129388,129392],2],[129393,2],[129394,2],[[129395,129398],2],[[129399,129400],2],[129401,2],[129402,2],[129403,2],[[129404,129407],2],[[129408,129412],2],[[129413,129425],2],[[129426,129431],2],[[129432,129442],2],[[129443,129444],2],[[129445,129450],2],[[129451,129453],2],[[129454,129455],2],[[129456,129465],2],[[129466,129471],2],[129472,2],[[129473,129474],2],[[129475,129482],2],[129483,2],[129484,2],[[129485,129487],2],[[129488,129510],2],[[129511,129535],2],[[129536,129619],2],[[129620,129623],2],[[129624,129631],3],[[129632,129645],2],[[129646,129647],3],[[129648,129651],2],[129652,2],[[129653,129655],2],[[129656,129658],2],[[129659,129660],2],[[129661,129663],3],[[129664,129666],2],[[129667,129670],2],[[129671,129672],2],[129673,2],[129674,2],[[129675,129677],3],[129678,2],[129679,2],[[129680,129685],2],[[129686,129704],2],[[129705,129708],2],[[129709,129711],2],[[129712,129718],2],[[129719,129722],2],[[129723,129725],2],[129726,2],[129727,2],[[129728,129730],2],[[129731,129733],2],[129734,2],[129735,3],[129736,2],[[129737,129740],3],[129741,2],[[129742,129743],2],[[129744,129750],2],[[129751,129753],2],[[129754,129755],2],[129756,2],[[129757,129758],3],[129759,2],[[129760,129767],2],[129768,2],[129769,2],[129770,2],[[129771,129774],3],[129775,2],[[129776,129782],2],[[129783,129784],2],[[129785,129791],3],[[129792,129938],2],[129939,3],[[129940,129994],2],[[129995,130031],2],[130032,1,"0"],[130033,1,"1"],[130034,1,"2"],[130035,1,"3"],[130036,1,"4"],[130037,1,"5"],[130038,1,"6"],[130039,1,"7"],[130040,1,"8"],[130041,1,"9"],[130042,2],[[130043,131069],3],[[131070,131071],3],[[131072,173782],2],[[173783,173789],2],[[173790,173791],2],[[173792,173823],3],[[173824,177972],2],[[177973,177976],2],[177977,2],[[177978,177983],2],[[177984,178205],2],[[178206,178207],3],[[178208,183969],2],[[183970,183981],2],[[183982,183983],3],[[183984,191456],2],[[191457,191471],3],[[191472,192093],2],[[192094,194559],3],[194560,1,"丽"],[194561,1,"丸"],[194562,1,"乁"],[194563,1,"𠄢"],[194564,1,"你"],[194565,1,"侮"],[194566,1,"侻"],[194567,1,"倂"],[194568,1,"偺"],[194569,1,"備"],[194570,1,"僧"],[194571,1,"像"],[194572,1,"㒞"],[194573,1,"𠘺"],[194574,1,"免"],[194575,1,"兔"],[194576,1,"兤"],[194577,1,"具"],[194578,1,"𠔜"],[194579,1,"㒹"],[194580,1,"內"],[194581,1,"再"],[194582,1,"𠕋"],[194583,1,"冗"],[194584,1,"冤"],[194585,1,"仌"],[194586,1,"冬"],[194587,1,"况"],[194588,1,"𩇟"],[194589,1,"凵"],[194590,1,"刃"],[194591,1,"㓟"],[194592,1,"刻"],[194593,1,"剆"],[194594,1,"割"],[194595,1,"剷"],[194596,1,"㔕"],[194597,1,"勇"],[194598,1,"勉"],[194599,1,"勤"],[194600,1,"勺"],[194601,1,"包"],[194602,1,"匆"],[194603,1,"北"],[194604,1,"卉"],[194605,1,"卑"],[194606,1,"博"],[194607,1,"即"],[194608,1,"卽"],[[194609,194611],1,"卿"],[194612,1,"𠨬"],[194613,1,"灰"],[194614,1,"及"],[194615,1,"叟"],[194616,1,"𠭣"],[194617,1,"叫"],[194618,1,"叱"],[194619,1,"吆"],[194620,1,"咞"],[194621,1,"吸"],[194622,1,"呈"],[194623,1,"周"],[194624,1,"咢"],[194625,1,"哶"],[194626,1,"唐"],[194627,1,"啓"],[194628,1,"啣"],[[194629,194630],1,"善"],[194631,1,"喙"],[194632,1,"喫"],[194633,1,"喳"],[194634,1,"嗂"],[194635,1,"圖"],[194636,1,"嘆"],[194637,1,"圗"],[194638,1,"噑"],[194639,1,"噴"],[194640,1,"切"],[194641,1,"壮"],[194642,1,"城"],[194643,1,"埴"],[194644,1,"堍"],[194645,1,"型"],[194646,1,"堲"],[194647,1,"報"],[194648,1,"墬"],[194649,1,"𡓤"],[194650,1,"売"],[194651,1,"壷"],[194652,1,"夆"],[194653,1,"多"],[194654,1,"夢"],[194655,1,"奢"],[194656,1,"𡚨"],[194657,1,"𡛪"],[194658,1,"姬"],[194659,1,"娛"],[194660,1,"娧"],[194661,1,"姘"],[194662,1,"婦"],[194663,1,"㛮"],[194664,1,"㛼"],[194665,1,"嬈"],[[194666,194667],1,"嬾"],[194668,1,"𡧈"],[194669,1,"寃"],[194670,1,"寘"],[194671,1,"寧"],[194672,1,"寳"],[194673,1,"𡬘"],[194674,1,"寿"],[194675,1,"将"],[194676,1,"当"],[194677,1,"尢"],[194678,1,"㞁"],[194679,1,"屠"],[194680,1,"屮"],[194681,1,"峀"],[194682,1,"岍"],[194683,1,"𡷤"],[194684,1,"嵃"],[194685,1,"𡷦"],[194686,1,"嵮"],[194687,1,"嵫"],[194688,1,"嵼"],[194689,1,"巡"],[194690,1,"巢"],[194691,1,"㠯"],[194692,1,"巽"],[194693,1,"帨"],[194694,1,"帽"],[194695,1,"幩"],[194696,1,"㡢"],[194697,1,"𢆃"],[194698,1,"㡼"],[194699,1,"庰"],[194700,1,"庳"],[194701,1,"庶"],[194702,1,"廊"],[194703,1,"𪎒"],[194704,1,"廾"],[[194705,194706],1,"𢌱"],[194707,1,"舁"],[[194708,194709],1,"弢"],[194710,1,"㣇"],[194711,1,"𣊸"],[194712,1,"𦇚"],[194713,1,"形"],[194714,1,"彫"],[194715,1,"㣣"],[194716,1,"徚"],[194717,1,"忍"],[194718,1,"志"],[194719,1,"忹"],[194720,1,"悁"],[194721,1,"㤺"],[194722,1,"㤜"],[194723,1,"悔"],[194724,1,"𢛔"],[194725,1,"惇"],[194726,1,"慈"],[194727,1,"慌"],[194728,1,"慎"],[194729,1,"慌"],[194730,1,"慺"],[194731,1,"憎"],[194732,1,"憲"],[194733,1,"憤"],[194734,1,"憯"],[194735,1,"懞"],[194736,1,"懲"],[194737,1,"懶"],[194738,1,"成"],[194739,1,"戛"],[194740,1,"扝"],[194741,1,"抱"],[194742,1,"拔"],[194743,1,"捐"],[194744,1,"𢬌"],[194745,1,"挽"],[194746,1,"拼"],[194747,1,"捨"],[194748,1,"掃"],[194749,1,"揤"],[194750,1,"𢯱"],[194751,1,"搢"],[194752,1,"揅"],[194753,1,"掩"],[194754,1,"㨮"],[194755,1,"摩"],[194756,1,"摾"],[194757,1,"撝"],[194758,1,"摷"],[194759,1,"㩬"],[194760,1,"敏"],[194761,1,"敬"],[194762,1,"𣀊"],[194763,1,"旣"],[194764,1,"書"],[194765,1,"晉"],[194766,1,"㬙"],[194767,1,"暑"],[194768,1,"㬈"],[194769,1,"㫤"],[194770,1,"冒"],[194771,1,"冕"],[194772,1,"最"],[194773,1,"暜"],[194774,1,"肭"],[194775,1,"䏙"],[194776,1,"朗"],[194777,1,"望"],[194778,1,"朡"],[194779,1,"杞"],[194780,1,"杓"],[194781,1,"𣏃"],[194782,1,"㭉"],[194783,1,"柺"],[194784,1,"枅"],[194785,1,"桒"],[194786,1,"梅"],[194787,1,"𣑭"],[194788,1,"梎"],[194789,1,"栟"],[194790,1,"椔"],[194791,1,"㮝"],[194792,1,"楂"],[194793,1,"榣"],[194794,1,"槪"],[194795,1,"檨"],[194796,1,"𣚣"],[194797,1,"櫛"],[194798,1,"㰘"],[194799,1,"次"],[194800,1,"𣢧"],[194801,1,"歔"],[194802,1,"㱎"],[194803,1,"歲"],[194804,1,"殟"],[194805,1,"殺"],[194806,1,"殻"],[194807,1,"𣪍"],[194808,1,"𡴋"],[194809,1,"𣫺"],[194810,1,"汎"],[194811,1,"𣲼"],[194812,1,"沿"],[194813,1,"泍"],[194814,1,"汧"],[194815,1,"洖"],[194816,1,"派"],[194817,1,"海"],[194818,1,"流"],[194819,1,"浩"],[194820,1,"浸"],[194821,1,"涅"],[194822,1,"𣴞"],[194823,1,"洴"],[194824,1,"港"],[194825,1,"湮"],[194826,1,"㴳"],[194827,1,"滋"],[194828,1,"滇"],[194829,1,"𣻑"],[194830,1,"淹"],[194831,1,"潮"],[194832,1,"𣽞"],[194833,1,"𣾎"],[194834,1,"濆"],[194835,1,"瀹"],[194836,1,"瀞"],[194837,1,"瀛"],[194838,1,"㶖"],[194839,1,"灊"],[194840,1,"災"],[194841,1,"灷"],[194842,1,"炭"],[194843,1,"𠔥"],[194844,1,"煅"],[194845,1,"𤉣"],[194846,1,"熜"],[194847,1,"𤎫"],[194848,1,"爨"],[194849,1,"爵"],[194850,1,"牐"],[194851,1,"𤘈"],[194852,1,"犀"],[194853,1,"犕"],[194854,1,"𤜵"],[194855,1,"𤠔"],[194856,1,"獺"],[194857,1,"王"],[194858,1,"㺬"],[194859,1,"玥"],[[194860,194861],1,"㺸"],[194862,1,"瑇"],[194863,1,"瑜"],[194864,1,"瑱"],[194865,1,"璅"],[194866,1,"瓊"],[194867,1,"㼛"],[194868,1,"甤"],[194869,1,"𤰶"],[194870,1,"甾"],[194871,1,"𤲒"],[194872,1,"異"],[194873,1,"𢆟"],[194874,1,"瘐"],[194875,1,"𤾡"],[194876,1,"𤾸"],[194877,1,"𥁄"],[194878,1,"㿼"],[194879,1,"䀈"],[194880,1,"直"],[194881,1,"𥃳"],[194882,1,"𥃲"],[194883,1,"𥄙"],[194884,1,"𥄳"],[194885,1,"眞"],[[194886,194887],1,"真"],[194888,1,"睊"],[194889,1,"䀹"],[194890,1,"瞋"],[194891,1,"䁆"],[194892,1,"䂖"],[194893,1,"𥐝"],[194894,1,"硎"],[194895,1,"碌"],[194896,1,"磌"],[194897,1,"䃣"],[194898,1,"𥘦"],[194899,1,"祖"],[194900,1,"𥚚"],[194901,1,"𥛅"],[194902,1,"福"],[194903,1,"秫"],[194904,1,"䄯"],[194905,1,"穀"],[194906,1,"穊"],[194907,1,"穏"],[194908,1,"𥥼"],[[194909,194910],1,"𥪧"],[194911,1,"竮"],[194912,1,"䈂"],[194913,1,"𥮫"],[194914,1,"篆"],[194915,1,"築"],[194916,1,"䈧"],[194917,1,"𥲀"],[194918,1,"糒"],[194919,1,"䊠"],[194920,1,"糨"],[194921,1,"糣"],[194922,1,"紀"],[194923,1,"𥾆"],[194924,1,"絣"],[194925,1,"䌁"],[194926,1,"緇"],[194927,1,"縂"],[194928,1,"繅"],[194929,1,"䌴"],[194930,1,"𦈨"],[194931,1,"𦉇"],[194932,1,"䍙"],[194933,1,"𦋙"],[194934,1,"罺"],[194935,1,"𦌾"],[194936,1,"羕"],[194937,1,"翺"],[194938,1,"者"],[194939,1,"𦓚"],[194940,1,"𦔣"],[194941,1,"聠"],[194942,1,"𦖨"],[194943,1,"聰"],[194944,1,"𣍟"],[194945,1,"䏕"],[194946,1,"育"],[194947,1,"脃"],[194948,1,"䐋"],[194949,1,"脾"],[194950,1,"媵"],[194951,1,"𦞧"],[194952,1,"𦞵"],[194953,1,"𣎓"],[194954,1,"𣎜"],[194955,1,"舁"],[194956,1,"舄"],[194957,1,"辞"],[194958,1,"䑫"],[194959,1,"芑"],[194960,1,"芋"],[194961,1,"芝"],[194962,1,"劳"],[194963,1,"花"],[194964,1,"芳"],[194965,1,"芽"],[194966,1,"苦"],[194967,1,"𦬼"],[194968,1,"若"],[194969,1,"茝"],[194970,1,"荣"],[194971,1,"莭"],[194972,1,"茣"],[194973,1,"莽"],[194974,1,"菧"],[194975,1,"著"],[194976,1,"荓"],[194977,1,"菊"],[194978,1,"菌"],[194979,1,"菜"],[194980,1,"𦰶"],[194981,1,"𦵫"],[194982,1,"𦳕"],[194983,1,"䔫"],[194984,1,"蓱"],[194985,1,"蓳"],[194986,1,"蔖"],[194987,1,"𧏊"],[194988,1,"蕤"],[194989,1,"𦼬"],[194990,1,"䕝"],[194991,1,"䕡"],[194992,1,"𦾱"],[194993,1,"𧃒"],[194994,1,"䕫"],[194995,1,"虐"],[194996,1,"虜"],[194997,1,"虧"],[194998,1,"虩"],[194999,1,"蚩"],[195000,1,"蚈"],[195001,1,"蜎"],[195002,1,"蛢"],[195003,1,"蝹"],[195004,1,"蜨"],[195005,1,"蝫"],[195006,1,"螆"],[195007,1,"䗗"],[195008,1,"蟡"],[195009,1,"蠁"],[195010,1,"䗹"],[195011,1,"衠"],[195012,1,"衣"],[195013,1,"𧙧"],[195014,1,"裗"],[195015,1,"裞"],[195016,1,"䘵"],[195017,1,"裺"],[195018,1,"㒻"],[195019,1,"𧢮"],[195020,1,"𧥦"],[195021,1,"䚾"],[195022,1,"䛇"],[195023,1,"誠"],[195024,1,"諭"],[195025,1,"變"],[195026,1,"豕"],[195027,1,"𧲨"],[195028,1,"貫"],[195029,1,"賁"],[195030,1,"贛"],[195031,1,"起"],[195032,1,"𧼯"],[195033,1,"𠠄"],[195034,1,"跋"],[195035,1,"趼"],[195036,1,"跰"],[195037,1,"𠣞"],[195038,1,"軔"],[195039,1,"輸"],[195040,1,"𨗒"],[195041,1,"𨗭"],[195042,1,"邔"],[195043,1,"郱"],[195044,1,"鄑"],[195045,1,"𨜮"],[195046,1,"鄛"],[195047,1,"鈸"],[195048,1,"鋗"],[195049,1,"鋘"],[195050,1,"鉼"],[195051,1,"鏹"],[195052,1,"鐕"],[195053,1,"𨯺"],[195054,1,"開"],[195055,1,"䦕"],[195056,1,"閷"],[195057,1,"𨵷"],[195058,1,"䧦"],[195059,1,"雃"],[195060,1,"嶲"],[195061,1,"霣"],[195062,1,"𩅅"],[195063,1,"𩈚"],[195064,1,"䩮"],[195065,1,"䩶"],[195066,1,"韠"],[195067,1,"𩐊"],[195068,1,"䪲"],[195069,1,"𩒖"],[[195070,195071],1,"頋"],[195072,1,"頩"],[195073,1,"𩖶"],[195074,1,"飢"],[195075,1,"䬳"],[195076,1,"餩"],[195077,1,"馧"],[195078,1,"駂"],[195079,1,"駾"],[195080,1,"䯎"],[195081,1,"𩬰"],[195082,1,"鬒"],[195083,1,"鱀"],[195084,1,"鳽"],[195085,1,"䳎"],[195086,1,"䳭"],[195087,1,"鵧"],[195088,1,"𪃎"],[195089,1,"䳸"],[195090,1,"𪄅"],[195091,1,"𪈎"],[195092,1,"𪊑"],[195093,1,"麻"],[195094,1,"䵖"],[195095,1,"黹"],[195096,1,"黾"],[195097,1,"鼅"],[195098,1,"鼏"],[195099,1,"鼖"],[195100,1,"鼻"],[195101,1,"𪘀"],[[195102,196605],3],[[196606,196607],3],[[196608,201546],2],[[201547,201551],3],[[201552,205743],2],[[205744,210041],2],[[210042,262141],3],[[262142,262143],3],[[262144,327677],3],[[327678,327679],3],[[327680,393213],3],[[393214,393215],3],[[393216,458749],3],[[458750,458751],3],[[458752,524285],3],[[524286,524287],3],[[524288,589821],3],[[589822,589823],3],[[589824,655357],3],[[655358,655359],3],[[655360,720893],3],[[720894,720895],3],[[720896,786429],3],[[786430,786431],3],[[786432,851965],3],[[851966,851967],3],[[851968,917501],3],[[917502,917503],3],[917504,3],[917505,3],[[917506,917535],3],[[917536,917631],3],[[917632,917759],3],[[917760,917999],7],[[918000,983037],3],[[983038,983039],3],[[983040,1048573],3],[[1048574,1048575],3],[[1048576,1114109],3],[[1114110,1114111],3]]});var xT=g(function(fme,vT){vT.exports.STATUS_MAPPING={mapped:1,valid:2,disallowed:3,deviation:6,ignored:7}});var LT=g(function(dme,jT){var f1=NT(),ir=RT(),o3=$T(),{STATUS_MAPPING:Ca}=xT();function u3(e){return/[^\x00-\x7F]/u.test(e)}function kT(e){let t=0,r=o3.length-1;while(t<=r){let n=Math.floor((t+r)/2),s=o3[n],i=Array.isArray(s[0])?s[0][0]:s[0],o=Array.isArray(s[0])?s[0][1]:s[0];if(i<=e&&o>=e)return s.slice(1);else if(i>e)r=n-1;else t=n+1}return null}function OZ(e,{transitionalProcessing:t}){let r="";for(let n of e){let[s,i]=kT(n.codePointAt(0));switch(s){case Ca.disallowed:r+=n;break;case Ca.ignored:break;case Ca.mapped:if(t&&n==="ẞ")r+="ss";else r+=i;break;case Ca.deviation:if(t)r+=i;else r+=n;break;case Ca.valid:r+=n;break}}return r}function SZ(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,transitionalProcessing:s,useSTD3ASCIIRules:i,isBidi:o}){if(e.length===0)return!0;if(e.normalize("NFC")!==e)return!1;let u=Array.from(e);if(t){if(u[2]==="-"&&u[3]==="-"||(e.startsWith("-")||e.endsWith("-")))return!1}if(!t){if(e.startsWith("xn--"))return!1}if(e.includes("."))return!1;if(ir.combiningMarks.test(u[0]))return!1;for(let a of u){let c=a.codePointAt(0),[l]=kT(c);if(s){if(l!==Ca.valid)return!1}else if(l!==Ca.valid&&l!==Ca.deviation)return!1;if(i&&c<=127){if(!/^(?:[a-z]|[0-9]|-)$/u.test(a))return!1}}if(n){let a=0;for(let[c,l]of u.entries())if(l==="‌"||l==="‍"){if(c>0){if(ir.combiningClassVirama.test(u[c-1]))continue;if(l==="‌"){let f=u.indexOf("‌",c+1),h=f<0?u.slice(a):u.slice(a,f);if(ir.validZWNJ.test(h.join(""))){a=c+1;continue}}}return!1}}if(r&&o){let a;if(ir.bidiS1LTR.test(u[0]))a=!1;else if(ir.bidiS1RTL.test(u[0]))a=!0;else return!1;if(a){if(!ir.bidiS2.test(e)||!ir.bidiS3.test(e)||ir.bidiS4EN.test(e)&&ir.bidiS4AN.test(e))return!1}else if(!ir.bidiS5.test(e)||!ir.bidiS6.test(e))return!1}return!0}function wZ(e){let t=e.map((r)=>{if(r.startsWith("xn--"))try{return f1.decode(r.substring(4))}catch{return""}return r}).join(".");return ir.bidiDomain.test(t)}function qT(e,t){let r=OZ(e,t);r=r.normalize("NFC");let n=r.split("."),s=wZ(n),i=!1;for(let[o,u]of n.entries()){let a=u,c=t.transitionalProcessing;if(a.startsWith("xn--")){if(u3(a)){i=!0;continue}try{a=f1.decode(a.substring(4))}catch{if(!t.ignoreInvalidPunycode){i=!0;continue}}if(n[o]=a,a===""||!u3(a))i=!0;c=!1}if(i)continue;if(!SZ(a,{...t,transitionalProcessing:c,isBidi:s}))i=!0}return{string:n.join("."),error:i}}function CZ(e,{checkHyphens:t=!1,checkBidi:r=!1,checkJoiners:n=!1,useSTD3ASCIIRules:s=!1,verifyDNSLength:i=!1,transitionalProcessing:o=!1,ignoreInvalidPunycode:u=!1}={}){let a=qT(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,useSTD3ASCIIRules:s,transitionalProcessing:o,ignoreInvalidPunycode:u}),c=a.string.split(".");if(c=c.map((l)=>{if(u3(l))try{return`xn--${f1.encode(l)}`}catch{a.error=!0}return l}),i){let l=c.join(".").length;if(l>253||l===0)a.error=!0;for(let f=0;f<c.length;++f)if(c[f].length>63||c[f].length===0){a.error=!0;break}}if(a.error)return null;return c.join(".")}function bZ(e,{checkHyphens:t=!1,checkBidi:r=!1,checkJoiners:n=!1,useSTD3ASCIIRules:s=!1,transitionalProcessing:i=!1,ignoreInvalidPunycode:o=!1}={}){let u=qT(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,useSTD3ASCIIRules:s,transitionalProcessing:i,ignoreInvalidPunycode:o});return{domain:u.string,error:u.error}}jT.exports={toASCII:CZ,toUnicode:bZ}});var c3=g(function(pme,VT){function a3(e){return e>=48&&e<=57}function UT(e){return e>=65&&e<=90||e>=97&&e<=122}function DZ(e){return UT(e)||a3(e)}function TZ(e){return a3(e)||e>=65&&e<=70||e>=97&&e<=102}VT.exports={isASCIIDigit:a3,isASCIIAlpha:UT,isASCIIAlphanumeric:DZ,isASCIIHex:TZ}});var Dm=g(function(mme,zT){var MZ=new TextEncoder,PZ=new TextDecoder("utf-8",{ignoreBOM:!0});function BZ(e){return MZ.encode(e)}function FZ(e){return PZ.decode(e)}zT.exports={utf8Encode:BZ,utf8DecodeWithoutBOM:FZ}});var Tm=g(function(yme,QT){var{isASCIIHex:WT}=c3(),{utf8Encode:HT}=Dm();function at(e){return e.codePointAt(0)}function NZ(e){let t=e.toString(16).toUpperCase();if(t.length===1)t=`0${t}`;return`%${t}`}function KT(e){let t=new Uint8Array(e.byteLength),r=0;for(let n=0;n<e.byteLength;++n){let s=e[n];if(s!==37)t[r++]=s;else if(s===37&&(!WT(e[n+1])||!WT(e[n+2])))t[r++]=s;else{let i=parseInt(String.fromCodePoint(e[n+1],e[n+2]),16);t[r++]=i,n+=2}}return t.slice(0,r)}function IZ(e){let t=HT(e);return KT(t)}function l3(e){return e<=31||e>126}var RZ=new Set([at(" "),at('"'),at("<"),at(">"),at("`")]);function $Z(e){return l3(e)||RZ.has(e)}var vZ=new Set([at(" "),at('"'),at("#"),at("<"),at(">")]);function h3(e){return l3(e)||vZ.has(e)}function xZ(e){return h3(e)||e===at("'")}var kZ=new Set([at("?"),at("`"),at("{"),at("}"),at("^")]);function GT(e){return h3(e)||kZ.has(e)}var qZ=new Set([at("/"),at(":"),at(";"),at("="),at("@"),at("["),at("\\"),at("]"),at("|")]);function YT(e){return GT(e)||qZ.has(e)}var jZ=new Set([at("$"),at("%"),at("&"),at("+"),at(",")]);function LZ(e){return YT(e)||jZ.has(e)}var UZ=new Set([at("!"),at("'"),at("("),at(")"),at("~")]);function VZ(e){return LZ(e)||UZ.has(e)}function JT(e,t){let r=HT(e),n="";for(let s of r)if(!t(s))n+=String.fromCharCode(s);else n+=NZ(s);return n}function zZ(e,t){return JT(String.fromCodePoint(e),t)}function WZ(e,t,r=!1){let n="";for(let s of e)if(r&&s===" ")n+="+";else n+=JT(s,t);return n}QT.exports={isC0ControlPercentEncode:l3,isFragmentPercentEncode:$Z,isQueryPercentEncode:h3,isSpecialQueryPercentEncode:xZ,isPathPercentEncode:GT,isUserinfoPercentEncode:YT,isURLEncodedPercentEncode:VZ,percentDecodeString:IZ,percentDecodeBytes:KT,utf8PercentEncodeString:WZ,utf8PercentEncodeCodePoint:zZ}});var g3=g(function(gme,ps){var tM=LT(),ft=c3(),{utf8DecodeWithoutBOM:HZ}=Dm(),{percentDecodeString:KZ,utf8PercentEncodeCodePoint:Pm,utf8PercentEncodeString:Bm,isC0ControlPercentEncode:rM,isFragmentPercentEncode:GZ,isQueryPercentEncode:YZ,isSpecialQueryPercentEncode:JZ,isPathPercentEncode:QZ,isUserinfoPercentEncode:p3}=Tm();function K(e){return e.codePointAt(0)}var nM={ftp:21,file:null,http:80,https:443,ws:80,wss:443},qe=Symbol("failure");function XT(e){return[...e].length}function ZT(e,t){let r=e[t];return isNaN(r)?void 0:String.fromCodePoint(r)}function eM(e){return e==="."||e.toLowerCase()==="%2e"}function XZ(e){return e=e.toLowerCase(),e===".."||e==="%2e."||e===".%2e"||e==="%2e%2e"}function ZZ(e,t){return ft.isASCIIAlpha(e)&&(t===K(":")||t===K("|"))}function sM(e){return e.length===2&&ft.isASCIIAlpha(e.codePointAt(0))&&(e[1]===":"||e[1]==="|")}function eee(e){return e.length===2&&ft.isASCIIAlpha(e.codePointAt(0))&&e[1]===":"}function iM(e){return e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function tee(e){return iM(e)||e.search(/[\u0000-\u001F]|%|\u007F/u)!==-1}function Mm(e){return nM[e]!==void 0}function Tn(e){return Mm(e.scheme)}function f3(e){return!Mm(e.scheme)}function oM(e){return nM[e]}function uM(e){if(e==="")return qe;let t=10;if(e.length>=2&&e.charAt(0)==="0"&&e.charAt(1).toLowerCase()==="x")e=e.substring(2),t=16;else if(e.length>=2&&e.charAt(0)==="0")e=e.substring(1),t=8;if(e==="")return 0;let r=/[^0-7]/u;if(t===10)r=/[^0-9]/u;if(t===16)r=/[^0-9A-Fa-f]/u;if(r.test(e))return qe;return parseInt(e,t)}function ree(e){let t=e.split(".");if(t[t.length-1]===""){if(t.length>1)t.pop()}if(t.length>4)return qe;let r=[];for(let i of t){let o=uM(i);if(o===qe)return qe;r.push(o)}for(let i=0;i<r.length-1;++i)if(r[i]>255)return qe;if(r[r.length-1]>=256**(5-r.length))return qe;let n=r.pop(),s=0;for(let i of r)n+=i*256**(3-s),++s;return n}function nee(e){let t="",r=e;for(let n=1;n<=4;++n){if(t=String(r%256)+t,n!==4)t=`.${t}`;r=Math.floor(r/256)}return t}function see(e){let t=[0,0,0,0,0,0,0,0],r=0,n=null,s=0;if(e=Array.from(e,(i)=>i.codePointAt(0)),e[s]===K(":")){if(e[s+1]!==K(":"))return qe;s+=2,++r,n=r}while(s<e.length){if(r===8)return qe;if(e[s]===K(":")){if(n!==null)return qe;++s,++r,n=r;continue}let i=0,o=0;while(o<4&&ft.isASCIIHex(e[s]))i=i*16+parseInt(ZT(e,s),16),++s,++o;if(e[s]===K(".")){if(o===0)return qe;if(s-=o,r>6)return qe;let u=0;while(e[s]!==void 0){let a=null;if(u>0)if(e[s]===K(".")&&u<4)++s;else return qe;if(!ft.isASCIIDigit(e[s]))return qe;while(ft.isASCIIDigit(e[s])){let c=parseInt(ZT(e,s));if(a===null)a=c;else if(a===0)return qe;else a=a*10+c;if(a>255)return qe;++s}if(t[r]=t[r]*256+a,++u,u===2||u===4)++r}if(u!==4)return qe;break}else if(e[s]===K(":")){if(++s,e[s]===void 0)return qe}else if(e[s]!==void 0)return qe;t[r]=i,++r}if(n!==null){let i=r-n;r=7;while(r!==0&&i>0){let o=t[n+i-1];t[n+i-1]=t[r],t[r]=o,--r,--i}}else if(n===null&&r!==8)return qe;return t}function iee(e){let t="",r=aee(e),n=!1;for(let s=0;s<=7;++s){if(n&&e[s]===0)continue;else if(n)n=!1;if(r===s){t+=s===0?"::":":",n=!0;continue}if(t+=e[s].toString(16),s!==7)t+=":"}return t}function d3(e,t=!1){if(e[0]==="["){if(e[e.length-1]!=="]")return qe;return see(e.substring(1,e.length-1))}if(t)return uee(e);let r=HZ(KZ(e)),n=cee(r);if(n===qe)return qe;if(oee(n))return ree(n);return n}function oee(e){let t=e.split(".");if(t[t.length-1]===""){if(t.length===1)return!1;t.pop()}let r=t[t.length-1];if(uM(r)!==qe)return!0;if(/^[0-9]+$/u.test(r))return!0;return!1}function uee(e){if(iM(e))return qe;return Bm(e,rM)}function aee(e){let t=null,r=1,n=null,s=0;for(let i=0;i<e.length;++i)if(e[i]!==0){if(s>r)t=n,r=s;n=null,s=0}else{if(n===null)n=i;++s}if(s>r)return n;return t}function m3(e){if(typeof e==="number")return nee(e);if(e instanceof Array)return`[${iee(e)}]`;return e}function cee(e,t=!1){let r=tM.toASCII(e,{checkHyphens:t,checkBidi:!0,checkJoiners:!0,useSTD3ASCIIRules:t,transitionalProcessing:!1,verifyDNSLength:t,ignoreInvalidPunycode:!1});if(r===null)return qe;if(!t){if(r==="")return qe;if(tee(r))return qe}return r}function lee(e){let t=0,r=e.length;for(;t<r;++t)if(e.charCodeAt(t)>32)break;for(;r>t;--r)if(e.charCodeAt(r-1)>32)break;return e.substring(t,r)}function hee(e){return e.replace(/\u0009|\u000A|\u000D/ug,"")}function aM(e){let{path:t}=e;if(t.length===0)return;if(e.scheme==="file"&&t.length===1&&dee(t[0]))return;t.pop()}function cM(e){return e.username!==""||e.password!==""}function fee(e){return e.host===null||e.host===""||e.scheme==="file"}function If(e){return typeof e.path==="string"}function dee(e){return/^[A-Za-z]:$/u.test(e)}function Ar(e,t,r,n,s){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=r||"utf-8",this.stateOverride=s,this.url=n,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null};let o=lee(this.input);if(o!==this.input)this.parseError=!0;this.input=o}let i=hee(this.input);if(i!==this.input)this.parseError=!0;this.input=i,this.state=s||"scheme start",this.buffer="",this.atSignSeen=!1,this.insideBrackets=!1,this.passwordTokenSeen=!1,this.input=Array.from(this.input,(o)=>o.codePointAt(0));for(;this.pointer<=this.input.length;++this.pointer){let o=this.input[this.pointer],u=isNaN(o)?void 0:String.fromCodePoint(o),a=this[`parse ${this.state}`](o,u);if(!a)break;else if(a===qe){this.failure=!0;break}}}Ar.prototype["parse scheme start"]=function(t,r){if(ft.isASCIIAlpha(t))this.buffer+=r.toLowerCase(),this.state="scheme";else if(!this.stateOverride)this.state="no scheme",--this.pointer;else return this.parseError=!0,qe;return!0};Ar.prototype["parse scheme"]=function(t,r){if(ft.isASCIIAlphanumeric(t)||t===K("+")||t===K("-")||t===K("."))this.buffer+=r.toLowerCase();else if(t===K(":")){if(this.stateOverride){if(Tn(this.url)&&!Mm(this.buffer))return!1;if(!Tn(this.url)&&Mm(this.buffer))return!1;if((cM(this.url)||this.url.port!==null)&&this.buffer==="file")return!1;if(this.url.scheme==="file"&&this.url.host==="")return!1}if(this.url.scheme=this.buffer,this.stateOverride){if(this.url.port===oM(this.url.scheme))this.url.port=null;return!1}if(this.buffer="",this.url.scheme==="file"){if(this.input[this.pointer+1]!==K("/")||this.input[this.pointer+2]!==K("/"))this.parseError=!0;this.state="file"}else if(Tn(this.url)&&this.base!==null&&this.base.scheme===this.url.scheme)this.state="special relative or authority";else if(Tn(this.url))this.state="special authority slashes";else if(this.input[this.pointer+1]===K("/"))this.state="path or authority",++this.pointer;else this.url.path="",this.state="opaque path"}else if(!this.stateOverride)this.buffer="",this.state="no scheme",this.pointer=-1;else return this.parseError=!0,qe;return!0};Ar.prototype["parse no scheme"]=function(t){if(this.base===null||If(this.base)&&t!==K("#"))return qe;else if(If(this.base)&&t===K("#"))this.url.scheme=this.base.scheme,this.url.path=this.base.path,this.url.query=this.base.query,this.url.fragment="",this.state="fragment";else if(this.base.scheme==="file")this.state="file",--this.pointer;else this.state="relative",--this.pointer;return!0};Ar.prototype["parse special relative or authority"]=function(t){if(t===K("/")&&this.input[this.pointer+1]===K("/"))this.state="special authority ignore slashes",++this.pointer;else this.parseError=!0,this.state="relative",--this.pointer;return!0};Ar.prototype["parse path or authority"]=function(t){if(t===K("/"))this.state="authority";else this.state="path",--this.pointer;return!0};Ar.prototype["parse relative"]=function(t){if(this.url.scheme=this.base.scheme,t===K("/"))this.state="relative slash";else if(Tn(this.url)&&t===K("\\"))this.parseError=!0,this.state="relative slash";else if(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,t===K("?"))this.url.query="",this.state="query";else if(t===K("#"))this.url.fragment="",this.state="fragment";else if(!isNaN(t))this.url.query=null,this.url.path.pop(),this.state="path",--this.pointer;return!0};Ar.prototype["parse relative slash"]=function(t){if(Tn(this.url)&&(t===K("/")||t===K("\\"))){if(t===K("\\"))this.parseError=!0;this.state="special authority ignore slashes"}else if(t===K("/"))this.state="authority";else this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer;return!0};Ar.prototype["parse special authority slashes"]=function(t){if(t===K("/")&&this.input[this.pointer+1]===K("/"))this.state="special authority ignore slashes",++this.pointer;else this.parseError=!0,this.state="special authority ignore slashes",--this.pointer;return!0};Ar.prototype["parse special authority ignore slashes"]=function(t){if(t!==K("/")&&t!==K("\\"))this.state="authority",--this.pointer;else this.parseError=!0;return!0};Ar.prototype["parse authority"]=function(t,r){if(t===K("@")){if(this.parseError=!0,this.atSignSeen)this.buffer=`%40${this.buffer}`;this.atSignSeen=!0;let n=XT(this.buffer);for(let s=0;s<n;++s){let i=this.buffer.codePointAt(s);if(i===K(":")&&!this.passwordTokenSeen){this.passwordTokenSeen=!0;continue}let o=Pm(i,p3);if(this.passwordTokenSeen)this.url.password+=o;else this.url.username+=o}this.buffer=""}else if(isNaN(t)||t===K("/")||t===K("?")||t===K("#")||Tn(this.url)&&t===K("\\")){if(this.atSignSeen&&this.buffer==="")return this.parseError=!0,qe;this.pointer-=XT(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=r;return!0};Ar.prototype["parse hostname"]=Ar.prototype["parse host"]=function(t,r){if(this.stateOverride&&this.url.scheme==="file")--this.pointer,this.state="file host";else if(t===K(":")&&!this.insideBrackets){if(this.buffer==="")return this.parseError=!0,qe;if(this.stateOverride==="hostname")return qe;let n=d3(this.buffer,f3(this.url));if(n===qe)return qe;this.url.host=n,this.buffer="",this.state="port"}else if(isNaN(t)||t===K("/")||t===K("?")||t===K("#")||Tn(this.url)&&t===K("\\")){if(--this.pointer,Tn(this.url)&&this.buffer==="")return this.parseError=!0,qe;else if(this.stateOverride&&this.buffer===""&&(cM(this.url)||this.url.port!==null))return this.parseError=!0,qe;let n=d3(this.buffer,f3(this.url));if(n===qe)return qe;if(this.url.host=n,this.buffer="",this.state="path start",this.stateOverride)return!1}else{if(t===K("["))this.insideBrackets=!0;else if(t===K("]"))this.insideBrackets=!1;this.buffer+=r}return!0};Ar.prototype["parse port"]=function(t,r){if(ft.isASCIIDigit(t))this.buffer+=r;else if(isNaN(t)||t===K("/")||t===K("?")||t===K("#")||Tn(this.url)&&t===K("\\")||this.stateOverride){if(this.buffer!==""){let n=parseInt(this.buffer);if(n>65535)return this.parseError=!0,qe;if(this.url.port=n===oM(this.url.scheme)?null:n,this.buffer="",this.stateOverride)return!1}if(this.stateOverride)return qe;this.state="path start",--this.pointer}else return this.parseError=!0,qe;return!0};var pee=new Set([K("/"),K("\\"),K("?"),K("#")]);function lM(e,t){let r=e.length-t;return r>=2&&ZZ(e[t],e[t+1])&&(r===2||pee.has(e[t+2]))}Ar.prototype["parse file"]=function(t){if(this.url.scheme="file",this.url.host="",t===K("/")||t===K("\\")){if(t===K("\\"))this.parseError=!0;this.state="file slash"}else if(this.base!==null&&this.base.scheme==="file"){if(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,t===K("?"))this.url.query="",this.state="query";else if(t===K("#"))this.url.fragment="",this.state="fragment";else if(!isNaN(t)){if(this.url.query=null,!lM(this.input,this.pointer))aM(this.url);else this.parseError=!0,this.url.path=[];this.state="path",--this.pointer}}else this.state="path",--this.pointer;return!0};Ar.prototype["parse file slash"]=function(t){if(t===K("/")||t===K("\\")){if(t===K("\\"))this.parseError=!0;this.state="file host"}else{if(this.base!==null&&this.base.scheme==="file"){if(!lM(this.input,this.pointer)&&eee(this.base.path[0]))this.url.path.push(this.base.path[0]);this.url.host=this.base.host}this.state="path",--this.pointer}return!0};Ar.prototype["parse file host"]=function(t,r){if(isNaN(t)||t===K("/")||t===K("\\")||t===K("?")||t===K("#"))if(--this.pointer,!this.stateOverride&&sM(this.buffer))this.parseError=!0,this.state="path";else if(this.buffer===""){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let n=d3(this.buffer,f3(this.url));if(n===qe)return qe;if(n==="localhost")n="";if(this.url.host=n,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=r;return!0};Ar.prototype["parse path start"]=function(t){if(Tn(this.url)){if(t===K("\\"))this.parseError=!0;if(this.state="path",t!==K("/")&&t!==K("\\"))--this.pointer}else if(!this.stateOverride&&t===K("?"))this.url.query="",this.state="query";else if(!this.stateOverride&&t===K("#"))this.url.fragment="",this.state="fragment";else if(t!==void 0){if(this.state="path",t!==K("/"))--this.pointer}else if(this.stateOverride&&this.url.host===null)this.url.path.push("");return!0};Ar.prototype["parse path"]=function(t){if(isNaN(t)||t===K("/")||Tn(this.url)&&t===K("\\")||!this.stateOverride&&(t===K("?")||t===K("#"))){if(Tn(this.url)&&t===K("\\"))this.parseError=!0;if(XZ(this.buffer)){if(aM(this.url),t!==K("/")&&!(Tn(this.url)&&t===K("\\")))this.url.path.push("")}else if(eM(this.buffer)&&t!==K("/")&&!(Tn(this.url)&&t===K("\\")))this.url.path.push("");else if(!eM(this.buffer)){if(this.url.scheme==="file"&&this.url.path.length===0&&sM(this.buffer))this.buffer=`${this.buffer[0]}:`;this.url.path.push(this.buffer)}if(this.buffer="",t===K("?"))this.url.query="",this.state="query";if(t===K("#"))this.url.fragment="",this.state="fragment"}else{if(t===K("%")&&(!ft.isASCIIHex(this.input[this.pointer+1])||!ft.isASCIIHex(this.input[this.pointer+2])))this.parseError=!0;this.buffer+=Pm(t,QZ)}return!0};Ar.prototype["parse opaque path"]=function(t){if(t===K("?"))this.url.query="",this.state="query";else if(t===K("#"))this.url.fragment="",this.state="fragment";else if(t===K(" ")){let r=this.input[this.pointer+1];if(r===K("?")||r===K("#"))this.url.path+="%20";else this.url.path+=" "}else{if(!isNaN(t)&&t!==K("%"))this.parseError=!0;if(t===K("%")&&(!ft.isASCIIHex(this.input[this.pointer+1])||!ft.isASCIIHex(this.input[this.pointer+2])))this.parseError=!0;if(!isNaN(t))this.url.path+=Pm(t,rM)}return!0};Ar.prototype["parse query"]=function(t,r){if(!Tn(this.url)||this.url.scheme==="ws"||this.url.scheme==="wss")this.encodingOverride="utf-8";if(!this.stateOverride&&t===K("#")||isNaN(t)){let n=Tn(this.url)?JZ:YZ;if(this.url.query+=Bm(this.buffer,n),this.buffer="",t===K("#"))this.url.fragment="",this.state="fragment"}else if(!isNaN(t)){if(t===K("%")&&(!ft.isASCIIHex(this.input[this.pointer+1])||!ft.isASCIIHex(this.input[this.pointer+2])))this.parseError=!0;this.buffer+=r}return!0};Ar.prototype["parse fragment"]=function(t){if(!isNaN(t)){if(t===K("%")&&(!ft.isASCIIHex(this.input[this.pointer+1])||!ft.isASCIIHex(this.input[this.pointer+2])))this.parseError=!0;this.url.fragment+=Pm(t,GZ)}return!0};function mee(e,t){let r=`${e.scheme}:`;if(e.host!==null){if(r+="//",e.username!==""||e.password!==""){if(r+=e.username,e.password!=="")r+=`:${e.password}`;r+="@"}if(r+=m3(e.host),e.port!==null)r+=`:${e.port}`}if(e.host===null&&!If(e)&&e.path.length>1&&e.path[0]==="")r+="/.";if(r+=y3(e),e.query!==null)r+=`?${e.query}`;if(!t&&e.fragment!==null)r+=`#${e.fragment}`;return r}function yee(e){let t=`${e.scheme}://`;if(t+=m3(e.host),e.port!==null)t+=`:${e.port}`;return t}function y3(e){if(If(e))return e.path;let t="";for(let r of e.path)t+=`/${r}`;return t}ps.exports.serializeURL=mee;ps.exports.serializePath=y3;ps.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":{let t=ps.exports.parseURL(y3(e));if(t===null)return"null";if(t.scheme!=="http"&&t.scheme!=="https")return"null";return ps.exports.serializeURLOrigin(t)}case"ftp":case"http":case"https":case"ws":case"wss":return yee({scheme:e.scheme,host:e.host,port:e.port});case"file":return"null";default:return"null"}};ps.exports.basicURLParse=function(e,t){if(t===void 0)t={};let r=new Ar(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);if(r.failure)return null;return r.url};ps.exports.setTheUsername=function(e,t){e.username=Bm(t,p3)};ps.exports.setThePassword=function(e,t){e.password=Bm(t,p3)};ps.exports.serializeHost=m3;ps.exports.cannotHaveAUsernamePasswordPort=fee;ps.exports.hasAnOpaquePath=If;ps.exports.serializeInteger=function(e){return String(e)};ps.exports.parseURL=function(e,t){if(t===void 0)t={};return ps.exports.basicURLParse(e,{baseURL:t.baseURL,encodingOverride:t.encodingOverride})}});var _3=g(function(_me,gM){var{utf8Encode:gee,utf8DecodeWithoutBOM:hM}=Dm(),{percentDecodeBytes:fM,utf8PercentEncodeString:dM,isURLEncodedPercentEncode:pM}=Tm();function mM(e){return e.codePointAt(0)}function _ee(e){let t=Oee(e,mM("&")),r=[];for(let n of t){if(n.length===0)continue;let s,i,o=n.indexOf(mM("="));if(o>=0)s=n.slice(0,o),i=n.slice(o+1);else s=n,i=new Uint8Array(0);s=yM(s,43,32),i=yM(i,43,32);let u=hM(fM(s)),a=hM(fM(i));r.push([u,a])}return r}function Eee(e){return _ee(gee(e))}function Aee(e){let t="";for(let[r,n]of e.entries()){let s=dM(n[0],pM,!0),i=dM(n[1],pM,!0);if(r!==0)t+="&";t+=`${s}=${i}`}return t}function Oee(e,t){let r=[],n=0,s=e.indexOf(t);while(s>=0)r.push(e.slice(n,s)),n=s+1,s=e.indexOf(t,n);if(n!==e.length)r.push(e.slice(n));return r}function yM(e,t,r){let n=e.indexOf(t);while(n>=0)e[n]=r,n=e.indexOf(t,n+1);return e}gM.exports={parseUrlencodedString:Eee,serializeUrlencoded:Aee}});var EM=g(function(_M){var Fm=wm(),ba=bm();_M.convert=(e,t,{context:r="The provided value"}={})=>{if(typeof t!=="function")throw new e.TypeError(r+" is not a function");function n(...s){let i=ba.tryWrapperForImpl(this),o;for(let u=0;u<s.length;u++)s[u]=ba.tryWrapperForImpl(s[u]);return o=Reflect.apply(t,i,s),o=Fm.any(o,{context:r,globals:e}),o}return n.construct=(...s)=>{for(let o=0;o<s.length;o++)s[o]=ba.tryWrapperForImpl(s[o]);let i=Reflect.construct(t,s);return i=Fm.any(i,{context:r,globals:e}),i},n[ba.wrapperSymbol]=t,n.objectReference=t,n}});var OM=g(function(AM){var d1=_3();AM.implementation=class{constructor(t,r,{doNotStripQMark:n=!1}){let s=r[0];if(this._list=[],this._url=null,!n&&typeof s==="string"&&s[0]==="?")s=s.slice(1);if(Array.isArray(s))for(let i of s){if(i.length!==2)throw TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");this._list.push([i[0],i[1]])}else if(typeof s==="object"&&Object.getPrototypeOf(s)===null)for(let i of Object.keys(s)){let o=s[i];this._list.push([i,o])}else this._list=d1.parseUrlencodedString(s)}_updateSteps(){if(this._url!==null){let t=d1.serializeUrlencoded(this._list);if(t==="")t=null;this._url._url.query=t}}get size(){return this._list.length}append(t,r){this._list.push([t,r]),this._updateSteps()}delete(t,r){let n=0;while(n<this._list.length)if(this._list[n][0]===t&&(r===void 0||this._list[n][1]===r))this._list.splice(n,1);else n++;this._updateSteps()}get(t){for(let r of this._list)if(r[0]===t)return r[1];return null}getAll(t){let r=[];for(let n of this._list)if(n[0]===t)r.push(n[1]);return r}has(t,r){for(let n of this._list)if(n[0]===t&&(r===void 0||n[1]===r))return!0;return!1}set(t,r){let n=!1,s=0;while(s<this._list.length)if(this._list[s][0]===t)if(n)this._list.splice(s,1);else n=!0,this._list[s][1]=r,s++;else s++;if(!n)this._list.push([t,r]);this._updateSteps()}sort(){this._list.sort((t,r)=>{if(t[0]<r[0])return-1;if(t[0]>r[0])return 1;return 0}),this._updateSteps()}[Symbol.iterator](){return this._list[Symbol.iterator]()}toString(){return d1.serializeUrlencoded(this._list)}}});var E3=g(function(At){var qt=wm(),Pe=bm(),wM=EM(),SM=Pe.newObjectInRealm,Fr=Pe.implSymbol,CM=Pe.ctorRegistrySymbol;At.is=(e)=>Pe.isObject(e)&&Object.hasOwn(e,Fr)&&e[Fr]instanceof Da.implementation;At.isImpl=(e)=>Pe.isObject(e)&&e instanceof Da.implementation;At.convert=(e,t,{context:r="The provided value"}={})=>{if(At.is(t))return Pe.implForWrapper(t);throw new e.TypeError(`${r} is not of type 'URLSearchParams'.`)};At.createDefaultIterator=(e,t,r)=>{let s=e[CM]["URLSearchParams Iterator"],i=Object.create(s);return Object.defineProperty(i,Pe.iterInternalSymbol,{value:{target:t,kind:r,index:0},configurable:!0}),i};function bM(e,t){let r;if(t!==void 0)r=t.prototype;if(!Pe.isObject(r))r=e[CM].URLSearchParams.prototype;return Object.create(r)}At.create=(e,t,r)=>{let n=bM(e);return At.setup(n,e,t,r)};At.createImpl=(e,t,r)=>{let n=At.create(e,t,r);return Pe.implForWrapper(n)};At._internalSetup=(e,t)=>{};At.setup=(e,t,r=[],n={})=>{if(n.wrapper=e,At._internalSetup(e,t),Object.defineProperty(e,Fr,{value:new Da.implementation(t,r,n),configurable:!0}),e[Fr][Pe.wrapperSymbol]=e,Da.init)Da.init(e[Fr]);return e};At.new=(e,t)=>{let r=bM(e,t);if(At._internalSetup(r,e),Object.defineProperty(r,Fr,{value:Object.create(Da.implementation.prototype),configurable:!0}),r[Fr][Pe.wrapperSymbol]=r,Da.init)Da.init(r[Fr]);return r[Fr]};var See=new Set(["Window","Worker"]);At.install=(e,t)=>{if(!t.some((s)=>See.has(s)))return;let r=Pe.initCtorRegistry(e);class n{constructor(){let s=[];{let i=arguments[0];if(i!==void 0)if(Pe.isObject(i))if(i[Symbol.iterator]!==void 0)if(!Pe.isObject(i))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");else{let o=[],u=i;for(let a of u){if(!Pe.isObject(a))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object.");else{let c=[],l=a;for(let f of l)f=qt.USVString(f,{context:"Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",globals:e}),c.push(f);a=c}o.push(a)}i=o}else if(!Pe.isObject(i))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 record is not an object.");else{let o=Object.create(null);for(let u of Reflect.ownKeys(i)){let a=Object.getOwnPropertyDescriptor(i,u);if(a&&a.enumerable){let c=u;c=qt.USVString(c,{context:"Failed to construct 'URLSearchParams': parameter 1 record's key",globals:e});let l=i[u];l=qt.USVString(l,{context:"Failed to construct 'URLSearchParams': parameter 1 record's value",globals:e}),o[c]=l}}i=o}else i=qt.USVString(i,{context:"Failed to construct 'URLSearchParams': parameter 1",globals:e});else i="";s.push(i)}return At.setup(Object.create(new.target.prototype),e,s)}append(s,i){let o=this!==null&&this!==void 0?this:e;if(!At.is(o))throw new e.TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new e.TypeError(`Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`);let u=[];{let a=arguments[0];a=qt.USVString(a,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 1",globals:e}),u.push(a)}{let a=arguments[1];a=qt.USVString(a,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 2",globals:e}),u.push(a)}return Pe.tryWrapperForImpl(o[Fr].append(...u))}delete(s){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);let o=[];{let u=arguments[0];u=qt.USVString(u,{context:"Failed to execute 'delete' on 'URLSearchParams': parameter 1",globals:e}),o.push(u)}{let u=arguments[1];if(u!==void 0)u=qt.USVString(u,{context:"Failed to execute 'delete' on 'URLSearchParams': parameter 2",globals:e});o.push(u)}return Pe.tryWrapperForImpl(i[Fr].delete(...o))}get(s){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);let o=[];{let u=arguments[0];u=qt.USVString(u,{context:"Failed to execute 'get' on 'URLSearchParams': parameter 1",globals:e}),o.push(u)}return i[Fr].get(...o)}getAll(s){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);let o=[];{let u=arguments[0];u=qt.USVString(u,{context:"Failed to execute 'getAll' on 'URLSearchParams': parameter 1",globals:e}),o.push(u)}return Pe.tryWrapperForImpl(i[Fr].getAll(...o))}has(s){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);let o=[];{let u=arguments[0];u=qt.USVString(u,{context:"Failed to execute 'has' on 'URLSearchParams': parameter 1",globals:e}),o.push(u)}{let u=arguments[1];if(u!==void 0)u=qt.USVString(u,{context:"Failed to execute 'has' on 'URLSearchParams': parameter 2",globals:e});o.push(u)}return i[Fr].has(...o)}set(s,i){let o=this!==null&&this!==void 0?this:e;if(!At.is(o))throw new e.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new e.TypeError(`Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`);let u=[];{let a=arguments[0];a=qt.USVString(a,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 1",globals:e}),u.push(a)}{let a=arguments[1];a=qt.USVString(a,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 2",globals:e}),u.push(a)}return Pe.tryWrapperForImpl(o[Fr].set(...u))}sort(){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))throw new e.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");return Pe.tryWrapperForImpl(s[Fr].sort())}toString(){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))throw new e.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");return s[Fr].toString()}keys(){if(!At.is(this))throw new e.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");return At.createDefaultIterator(e,this,"key")}values(){if(!At.is(this))throw new e.TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");return At.createDefaultIterator(e,this,"value")}entries(){if(!At.is(this))throw new e.TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");return At.createDefaultIterator(e,this,"key+value")}forEach(s){if(!At.is(this))throw new e.TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.");s=wM.convert(e,s,{context:"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"});let i=arguments[1],o=Array.from(this[Fr]),u=0;while(u<o.length){let[a,c]=o[u].map(Pe.tryWrapperForImpl);s.call(i,c,a,this),o=Array.from(this[Fr]),u++}}get size(){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))throw new e.TypeError("'get size' called on an object that is not a valid instance of URLSearchParams.");return s[Fr].size}}Object.defineProperties(n.prototype,{append:{enumerable:!0},delete:{enumerable:!0},get:{enumerable:!0},getAll:{enumerable:!0},has:{enumerable:!0},set:{enumerable:!0},sort:{enumerable:!0},toString:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0},forEach:{enumerable:!0},size:{enumerable:!0},[Symbol.toStringTag]:{value:"URLSearchParams",configurable:!0},[Symbol.iterator]:{value:n.prototype.entries,configurable:!0,writable:!0}}),r.URLSearchParams=n,r["URLSearchParams Iterator"]=Object.create(r["%IteratorPrototype%"],{[Symbol.toStringTag]:{configurable:!0,value:"URLSearchParams Iterator"}}),Pe.define(r["URLSearchParams Iterator"],{next(){let s=this&&this[Pe.iterInternalSymbol];if(!s)throw new e.TypeError("next() called on a value that is not a URLSearchParams iterator object");let{target:i,kind:o,index:u}=s,a=Array.from(i[Fr]),c=a.length;if(u>=c)return SM(e,{value:void 0,done:!0});let l=a[u];return s.index=u+1,SM(e,Pe.iteratorResult(l.map(Pe.tryWrapperForImpl),o))}}),Object.defineProperty(e,"URLSearchParams",{configurable:!0,writable:!0,value:n})};var Da=OM()});var MM=g(function(TM){var Ee=g3(),Nm=_3(),DM=E3();TM.implementation=class e{constructor(t,[r,n]){let s=null;if(n!==void 0){if(s=Ee.basicURLParse(n),s===null)throw TypeError(`Invalid base URL: ${n}`)}let i=Ee.basicURLParse(r,{baseURL:s});if(i===null)throw TypeError(`Invalid URL: ${r}`);let o=i.query!==null?i.query:"";this._url=i,this._query=DM.createImpl(t,[o],{doNotStripQMark:!0}),this._query._url=this}static parse(t,r,n){try{return new e(t,[r,n])}catch{return null}}static canParse(t,r){let n=null;if(r!==void 0){if(n=Ee.basicURLParse(r),n===null)return!1}if(Ee.basicURLParse(t,{baseURL:n})===null)return!1;return!0}get href(){return Ee.serializeURL(this._url)}set href(t){let r=Ee.basicURLParse(t);if(r===null)throw TypeError(`Invalid URL: ${t}`);this._url=r,this._query._list.splice(0);let{query:n}=r;if(n!==null)this._query._list=Nm.parseUrlencodedString(n)}get origin(){return Ee.serializeURLOrigin(this._url)}get protocol(){return`${this._url.scheme}:`}set protocol(t){Ee.basicURLParse(`${t}:`,{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(t){if(Ee.cannotHaveAUsernamePasswordPort(this._url))return;Ee.setTheUsername(this._url,t)}get password(){return this._url.password}set password(t){if(Ee.cannotHaveAUsernamePasswordPort(this._url))return;Ee.setThePassword(this._url,t)}get host(){let t=this._url;if(t.host===null)return"";if(t.port===null)return Ee.serializeHost(t.host);return`${Ee.serializeHost(t.host)}:${Ee.serializeInteger(t.port)}`}set host(t){if(Ee.hasAnOpaquePath(this._url))return;Ee.basicURLParse(t,{url:this._url,stateOverride:"host"})}get hostname(){if(this._url.host===null)return"";return Ee.serializeHost(this._url.host)}set hostname(t){if(Ee.hasAnOpaquePath(this._url))return;Ee.basicURLParse(t,{url:this._url,stateOverride:"hostname"})}get port(){if(this._url.port===null)return"";return Ee.serializeInteger(this._url.port)}set port(t){if(Ee.cannotHaveAUsernamePasswordPort(this._url))return;if(t==="")this._url.port=null;else Ee.basicURLParse(t,{url:this._url,stateOverride:"port"})}get pathname(){return Ee.serializePath(this._url)}set pathname(t){if(Ee.hasAnOpaquePath(this._url))return;this._url.path=[],Ee.basicURLParse(t,{url:this._url,stateOverride:"path start"})}get search(){if(this._url.query===null||this._url.query==="")return"";return`?${this._url.query}`}set search(t){let r=this._url;if(t===""){r.query=null,this._query._list=[];return}let n=t[0]==="?"?t.substring(1):t;r.query="",Ee.basicURLParse(n,{url:r,stateOverride:"query"}),this._query._list=Nm.parseUrlencodedString(n)}get searchParams(){return this._query}get hash(){if(this._url.fragment===null||this._url.fragment==="")return"";return`#${this._url.fragment}`}set hash(t){if(t===""){this._url.fragment=null;return}let r=t[0]==="#"?t.substring(1):t;this._url.fragment="",Ee.basicURLParse(r,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}});var BM=g(function(He){var Tt=wm(),Gt=bm(),Ot=Gt.implSymbol,wee=Gt.ctorRegistrySymbol;He.is=(e)=>Gt.isObject(e)&&Object.hasOwn(e,Ot)&&e[Ot]instanceof zo.implementation;He.isImpl=(e)=>Gt.isObject(e)&&e instanceof zo.implementation;He.convert=(e,t,{context:r="The provided value"}={})=>{if(He.is(t))return Gt.implForWrapper(t);throw new e.TypeError(`${r} is not of type 'URL'.`)};function PM(e,t){let r;if(t!==void 0)r=t.prototype;if(!Gt.isObject(r))r=e[wee].URL.prototype;return Object.create(r)}He.create=(e,t,r)=>{let n=PM(e);return He.setup(n,e,t,r)};He.createImpl=(e,t,r)=>{let n=He.create(e,t,r);return Gt.implForWrapper(n)};He._internalSetup=(e,t)=>{};He.setup=(e,t,r=[],n={})=>{if(n.wrapper=e,He._internalSetup(e,t),Object.defineProperty(e,Ot,{value:new zo.implementation(t,r,n),configurable:!0}),e[Ot][Gt.wrapperSymbol]=e,zo.init)zo.init(e[Ot]);return e};He.new=(e,t)=>{let r=PM(e,t);if(He._internalSetup(r,e),Object.defineProperty(r,Ot,{value:Object.create(zo.implementation.prototype),configurable:!0}),r[Ot][Gt.wrapperSymbol]=r,zo.init)zo.init(r[Ot]);return r[Ot]};var Cee=new Set(["Window","Worker"]);He.install=(e,t)=>{if(!t.some((s)=>Cee.has(s)))return;let r=Gt.initCtorRegistry(e);class n{constructor(s){if(arguments.length<1)throw new e.TypeError(`Failed to construct 'URL': 1 argument required, but only ${arguments.length} present.`);let i=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to construct 'URL': parameter 1",globals:e}),i.push(o)}{let o=arguments[1];if(o!==void 0)o=Tt.USVString(o,{context:"Failed to construct 'URL': parameter 2",globals:e});i.push(o)}return He.setup(Object.create(new.target.prototype),e,i)}toJSON(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'toJSON' called on an object that is not a valid instance of URL.");return s[Ot].toJSON()}get href(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get href' called on an object that is not a valid instance of URL.");return s[Ot].href}set href(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set href' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'href' property on 'URL': The provided value",globals:e}),i[Ot].href=s}toString(){let s=this;if(!He.is(s))throw new e.TypeError("'toString' called on an object that is not a valid instance of URL.");return s[Ot].href}get origin(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get origin' called on an object that is not a valid instance of URL.");return s[Ot].origin}get protocol(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get protocol' called on an object that is not a valid instance of URL.");return s[Ot].protocol}set protocol(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set protocol' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'protocol' property on 'URL': The provided value",globals:e}),i[Ot].protocol=s}get username(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get username' called on an object that is not a valid instance of URL.");return s[Ot].username}set username(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set username' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'username' property on 'URL': The provided value",globals:e}),i[Ot].username=s}get password(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get password' called on an object that is not a valid instance of URL.");return s[Ot].password}set password(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set password' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'password' property on 'URL': The provided value",globals:e}),i[Ot].password=s}get host(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get host' called on an object that is not a valid instance of URL.");return s[Ot].host}set host(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set host' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'host' property on 'URL': The provided value",globals:e}),i[Ot].host=s}get hostname(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get hostname' called on an object that is not a valid instance of URL.");return s[Ot].hostname}set hostname(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set hostname' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'hostname' property on 'URL': The provided value",globals:e}),i[Ot].hostname=s}get port(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get port' called on an object that is not a valid instance of URL.");return s[Ot].port}set port(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set port' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'port' property on 'URL': The provided value",globals:e}),i[Ot].port=s}get pathname(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get pathname' called on an object that is not a valid instance of URL.");return s[Ot].pathname}set pathname(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set pathname' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'pathname' property on 'URL': The provided value",globals:e}),i[Ot].pathname=s}get search(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get search' called on an object that is not a valid instance of URL.");return s[Ot].search}set search(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set search' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'search' property on 'URL': The provided value",globals:e}),i[Ot].search=s}get searchParams(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");return Gt.getSameObject(this,"searchParams",()=>Gt.tryWrapperForImpl(s[Ot].searchParams))}get hash(){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'get hash' called on an object that is not a valid instance of URL.");return s[Ot].hash}set hash(s){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'set hash' called on an object that is not a valid instance of URL.");s=Tt.USVString(s,{context:"Failed to set the 'hash' property on 'URL': The provided value",globals:e}),i[Ot].hash=s}static parse(s){if(arguments.length<1)throw new e.TypeError(`Failed to execute 'parse' on 'URL': 1 argument required, but only ${arguments.length} present.`);let i=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to execute 'parse' on 'URL': parameter 1",globals:e}),i.push(o)}{let o=arguments[1];if(o!==void 0)o=Tt.USVString(o,{context:"Failed to execute 'parse' on 'URL': parameter 2",globals:e});i.push(o)}return Gt.tryWrapperForImpl(zo.implementation.parse(e,...i))}static canParse(s){if(arguments.length<1)throw new e.TypeError(`Failed to execute 'canParse' on 'URL': 1 argument required, but only ${arguments.length} present.`);let i=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to execute 'canParse' on 'URL': parameter 1",globals:e}),i.push(o)}{let o=arguments[1];if(o!==void 0)o=Tt.USVString(o,{context:"Failed to execute 'canParse' on 'URL': parameter 2",globals:e});i.push(o)}return zo.implementation.canParse(...i)}}if(Object.defineProperties(n.prototype,{toJSON:{enumerable:!0},href:{enumerable:!0},toString:{enumerable:!0},origin:{enumerable:!0},protocol:{enumerable:!0},username:{enumerable:!0},password:{enumerable:!0},host:{enumerable:!0},hostname:{enumerable:!0},port:{enumerable:!0},pathname:{enumerable:!0},search:{enumerable:!0},searchParams:{enumerable:!0},hash:{enumerable:!0},[Symbol.toStringTag]:{value:"URL",configurable:!0}}),Object.defineProperties(n,{parse:{enumerable:!0},canParse:{enumerable:!0}}),r.URL=n,Object.defineProperty(e,"URL",{configurable:!0,writable:!0,value:n}),t.includes("Window"))Object.defineProperty(e,"webkitURL",{configurable:!0,writable:!0,value:n})};var zo=MM()});var FM=g(function(A3){var bee=BM(),Dee=E3();A3.URL=bee;A3.URLSearchParams=Dee});var NM=g(function(Un){var{URL:Tee,URLSearchParams:Mee}=FM(),Or=g3(),Im=Tm(),Rm={Array,Object,Promise,String,TypeError};Tee.install(Rm,["Window"]);Mee.install(Rm,["Window"]);Un.URL=Rm.URL;Un.URLSearchParams=Rm.URLSearchParams;Un.parseURL=Or.parseURL;Un.basicURLParse=Or.basicURLParse;Un.serializeURL=Or.serializeURL;Un.serializePath=Or.serializePath;Un.serializeHost=Or.serializeHost;Un.serializeInteger=Or.serializeInteger;Un.serializeURLOrigin=Or.serializeURLOrigin;Un.setTheUsername=Or.setTheUsername;Un.setThePassword=Or.setThePassword;Un.cannotHaveAUsernamePasswordPort=Or.cannotHaveAUsernamePasswordPort;Un.hasAnOpaquePath=Or.hasAnOpaquePath;Un.percentDecodeString=Im.percentDecodeString;Un.percentDecodeBytes=Im.percentDecodeBytes});var RM=g(function(Wo){var Pee=Wo&&Wo.__createBinding||(Object.create?function(e,t,r,n){if(n===void 0)n=r;var s=Object.getOwnPropertyDescriptor(t,r);if(!s||("get"in s?!t.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return t[r]}};Object.defineProperty(e,n,s)}:function(e,t,r,n){if(n===void 0)n=r;e[n]=t[r]}),Bee=Wo&&Wo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Fee=Wo&&Wo.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var s in r)if(Object.prototype.hasOwnProperty.call(r,s))n[n.length]=s;return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null){for(var n=e(t),s=0;s<n.length;s++)if(n[s]!=="default")Pee(r,t,n[s])}return Bee(r,t),r}}();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.redactValidConnectionString=Nee;Wo.redactConnectionString=Iee;var IM=Fee(O3());function Nee(e,t){let r=e.clone(),n=t?.replacementString??"_credentials_",s=t?.redactUsernames??!0;if((r.username||r.password)&&s)r.username=n,r.password="";else if(r.password)r.password=n;if(r.searchParams.has("authMechanismProperties")){let i=new IM.CommaAndColonSeparatedRecord(r.searchParams.get("authMechanismProperties"));if(i.get("AWS_SESSION_TOKEN"))i.set("AWS_SESSION_TOKEN",n),r.searchParams.set("authMechanismProperties",i.toString())}if(r.searchParams.has("tlsCertificateKeyFilePassword"))r.searchParams.set("tlsCertificateKeyFilePassword",n);if(r.searchParams.has("proxyUsername")&&s)r.searchParams.set("proxyUsername",n);if(r.searchParams.has("proxyPassword"))r.searchParams.set("proxyPassword",n);return r}function Iee(e,t){let r=t?.replacementString??"<credentials>",n=t?.redactUsernames??!0,s;try{s=new IM.default(e)}catch{}if(s)return t={...t,replacementString:"___credentials___"},s.redact(t).toString().replace(/___credentials___/g,r);let i=r,o=[(u)=>u.replace(n?/(\/\/)(.*)(@)/g:/(\/\/[^@]*:)(.*)(@)/g,`$1${i}$3`),(u)=>u.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi,`$1${i}`),(u)=>u.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi,`$1${i}`),(u)=>n?u.replace(/(proxyUsername=)([^&]+)/gi,`$1${i}`):u,(u)=>u.replace(/(proxyPassword=)([^&]+)/gi,`$1${i}`)];for(let u of o)e=u(e);return e}});var O3=g(function(Bu){Object.defineProperty(Bu,"__esModule",{value:!0});Bu.CommaAndColonSeparatedRecord=Bu.ConnectionString=Bu.redactConnectionString=void 0;var $M=NM(),$m=RM();Object.defineProperty(Bu,"redactConnectionString",{enumerable:!0,get:function(){return $m.redactConnectionString}});var Rf="__this_is_a_placeholder__";function Ree(e){return e.startsWith("mongodb://")||e.startsWith("mongodb+srv://")}var $ee=/^(?<protocol>[^/]+):\/\/(?:(?<username>[^:@]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;class S3 extends Map{delete(e){return super.delete(this._normalizeKey(e))}get(e){return super.get(this._normalizeKey(e))}has(e){return super.has(this._normalizeKey(e))}set(e,t){return super.set(this._normalizeKey(e),t)}_normalizeKey(e){e=`${e}`;for(let t of this.keys())if(t.toLowerCase()===e.toLowerCase()){e=t;break}return e}}function vee(e){return class extends e{append(r,n){return super.append(this._normalizeKey(r),n)}delete(r){return super.delete(this._normalizeKey(r))}get(r){return super.get(this._normalizeKey(r))}getAll(r){return super.getAll(this._normalizeKey(r))}has(r){return super.has(this._normalizeKey(r))}set(r,n){return super.set(this._normalizeKey(r),n)}keys(){return super.keys()}values(){return super.values()}entries(){return super.entries()}[Symbol.iterator](){return super[Symbol.iterator]()}_normalizeKey(r){return S3.prototype._normalizeKey.call(this,r)}}}class vM extends $M.URL{}class go extends Error{get name(){return"MongoParseError"}}class $f extends vM{_hosts;constructor(e,t={}){let{looseValidation:r}=t;if(!r&&!Ree(e))throw new go('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');let n=e.match($ee);if(!n)throw new go("Invalid connection string");let{protocol:s,username:i,password:o,hosts:u,rest:a}=n.groups??{};if(!r){if(!s||!u)throw new go("Protocol and host list are required in the uri");try{decodeURIComponent(i??""),decodeURIComponent(o??"")}catch(f){throw new go(f.message)}let l=/[:/?#[\]@]/gi;if(i?.match(l))throw new go(`Username contains unescaped characters ${i}`);if(!i||!o){let f=e.replace(`${s}://`,"");if(f.startsWith("@")||f.startsWith(":"))throw new go("URI contained empty userinfo section")}if(o?.match(l))throw new go("Password contains unescaped characters");if(a?.match(/^[^/?]*@/))throw new go("Invalid connection string")}let c="";if(typeof i==="string")c+=i;if(typeof o==="string")c+=`:${o}`;if(c)c+="@";try{super(`${s.toLowerCase()}://${c}${Rf}${a}`)}catch(l){if(r)new $f(e,{...t,looseValidation:!1});if(typeof l.message==="string")l.message=l.message.replace(Rf,()=>u);throw l}if(this._hosts=u.split(","),!r){if(this.isSRV&&this.hosts.length!==1)throw new go("mongodb+srv URI cannot have multiple service names");if(this.isSRV&&this.hosts.some((l)=>l.includes(":")))throw new go("mongodb+srv URI cannot have port number")}if(!this.pathname)this.pathname="/";Object.setPrototypeOf(this.searchParams,vee(this.searchParams.constructor).prototype)}get host(){return Rf}set host(e){throw Error("No single host for connection string")}get hostname(){return Rf}set hostname(e){throw Error("No single host for connection string")}get port(){return""}set port(e){throw Error("No single host for connection string")}get href(){return this.toString()}set href(e){throw Error("Cannot set href for connection strings")}get isSRV(){return this.protocol.includes("srv")}get hosts(){return this._hosts}set hosts(e){this._hosts=e}toString(){return super.toString().replace(Rf,()=>this.hosts.join(","))}clone(){return new $f(this.toString(),{looseValidation:!0})}redact(e){return $m.redactValidConnectionString(this,e)}typedSearchParams(){return this.searchParams}[Symbol.for("nodejs.util.inspect.custom")](){let{href:e,origin:t,protocol:r,username:n,password:s,hosts:i,pathname:o,search:u,searchParams:a,hash:c}=this;return{href:e,origin:t,protocol:r,username:n,password:s,hosts:i,pathname:o,search:u,searchParams:a,hash:c}}}Bu.ConnectionString=$f;class xM extends S3{constructor(e){super();for(let t of(e??"").split(",")){if(!t)continue;let r=t.indexOf(":");if(r===-1)this.set(t,"");else this.set(t.slice(0,r),t.slice(r+1))}}toString(){return[...this].map((e)=>e.join(":")).join(",")}}Bu.CommaAndColonSeparatedRecord=xM;Bu.default=$f});var p1=g(function(Vn){Object.defineProperty(Vn,"__esModule",{value:!0});Vn.MongoCryptKMSRequestNetworkTimeoutError=Vn.MongoCryptAzureKMSRequestError=Vn.MongoCryptCreateEncryptedCollectionError=Vn.MongoCryptCreateDataKeyError=Vn.MongoCryptInvalidArgumentError=Vn.defaultErrorWrapper=Vn.MongoCryptError=void 0;var kM=X();class Ta extends kM.MongoError{constructor(e,t={}){super(e,t)}get name(){return"MongoCryptError"}}Vn.MongoCryptError=Ta;var xee=(e)=>new Ta(e.message,{cause:e});Vn.defaultErrorWrapper=xee;class qM extends Ta{constructor(e){super(e)}get name(){return"MongoCryptInvalidArgumentError"}}Vn.MongoCryptInvalidArgumentError=qM;class jM extends Ta{constructor(e,{cause:t}){super(`Unable to complete creating data keys: ${t.message}`,{cause:t});this.encryptedFields=e}get name(){return"MongoCryptCreateDataKeyError"}}Vn.MongoCryptCreateDataKeyError=jM;class LM extends Ta{constructor(e,{cause:t}){super(`Unable to create collection: ${t.message}`,{cause:t});this.encryptedFields=e}get name(){return"MongoCryptCreateEncryptedCollectionError"}}Vn.MongoCryptCreateEncryptedCollectionError=LM;class UM extends Ta{constructor(e,t){super(e);this.body=t}get name(){return"MongoCryptAzureKMSRequestError"}}Vn.MongoCryptAzureKMSRequestError=UM;class VM extends Ta{get name(){return"MongoCryptKMSRequestNetworkTimeoutError"}}Vn.MongoCryptKMSRequestNetworkTimeoutError=VM});var w3=g(function(vm){Object.defineProperty(vm,"__esModule",{value:!0});vm.AWSSDKCredentialProvider=void 0;var zM=require("process"),WM=Fo(),HM=X();class Ma{constructor(e){if(e)this._provider=e}static get awsSDK(){return Ma._awsSDK??=WM.getAwsCredentialProvider(),Ma._awsSDK}get provider(){if("kModuleError"in Ma.awsSDK)throw Ma.awsSDK.kModuleError;if(this._provider)return this._provider;let{AWS_STS_REGIONAL_ENDPOINTS:e="",AWS_REGION:t=""}=zM.env;e=e.toLowerCase(),t=t.toLowerCase();let r=t.length!==0&&e.length!==0,s=e==="regional"||e==="legacy"&&!new Set(["ap-northeast-1","ap-south-1","ap-southeast-1","ap-southeast-2","aws-global","ca-central-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]).has(t);return this._provider=r&&s?Ma.awsSDK.fromNodeProviderChain({clientConfig:{region:t}}):Ma.awsSDK.fromNodeProviderChain(),this._provider}async getCredentials(){try{let e=await this.provider();return{AccessKeyId:e.accessKeyId,SecretAccessKey:e.secretAccessKey,Token:e.sessionToken,Expiration:e.expiration}}catch(e){throw new HM.MongoAWSError(e.message,{cause:e})}}}vm.AWSSDKCredentialProvider=Ma});var GM=g(function(C3){Object.defineProperty(C3,"__esModule",{value:!0});C3.loadAWSCredentials=kee;var KM=w3();async function kee(e,t){let r=new KM.AWSSDKCredentialProvider(t),{SecretAccessKey:n="",AccessKeyId:s="",Token:i}=await r.getCredentials(),o={secretAccessKey:n,accessKeyId:s};return i!=null&&(o.sessionToken=i),{...e,aws:o}}});var D3=g(function($s){Object.defineProperty($s,"__esModule",{value:!0});$s.tokenCache=$s.AzureCredentialCache=$s.AZURE_BASE_URL=void 0;$s.addAzureParams=QM;$s.prepareRequest=XM;$s.fetchAzureKMSToken=ZM;$s.loadAzureCredentials=Lee;var YM=X(),JM=he(),bi=p1(),qee=6000;$s.AZURE_BASE_URL="http://169.254.169.254/metadata/identity/oauth2/token?";class b3{constructor(){this.cachedToken=null}async getToken(){if(this.cachedToken==null||this.needsRefresh(this.cachedToken))this.cachedToken=await this._getToken();return{accessToken:this.cachedToken.accessToken}}needsRefresh(e){return e.expiresOnTimestamp-Date.now()<=qee}resetCache(){this.cachedToken=null}_getToken(){return ZM()}}$s.AzureCredentialCache=b3;$s.tokenCache=new b3;async function jee(e){let{status:t,body:r}=e,n=(()=>{try{return JSON.parse(r)}catch{throw new bi.MongoCryptAzureKMSRequestError("Malformed JSON body in GET request.")}})();if(t!==200)throw new bi.MongoCryptAzureKMSRequestError("Unable to complete request.",n);if(!n.access_token)throw new bi.MongoCryptAzureKMSRequestError("Malformed response body - missing field `access_token`.");if(!n.expires_in)throw new bi.MongoCryptAzureKMSRequestError("Malformed response body - missing field `expires_in`.");let s=Number(n.expires_in)*1000;if(Number.isNaN(s))throw new bi.MongoCryptAzureKMSRequestError("Malformed response body - unable to parse int from `expires_in` field.");return{accessToken:n.access_token,expiresOnTimestamp:Date.now()+s}}function QM(e,t,r){if(e.searchParams.append("api-version","2018-02-01"),e.searchParams.append("resource",t),r)e.searchParams.append("client_id",r);return e}function XM(e){let t=new URL(e.url?.toString()??$s.AZURE_BASE_URL);return QM(t,"https://vault.azure.net"),{headers:{...e.headers,"Content-Type":"application/json",Metadata:!0},url:t}}async function ZM(e={}){let{headers:t,url:r}=XM(e);try{let n=await JM.get(r,{headers:t});return await jee(n)}catch(n){if(n instanceof YM.MongoNetworkTimeoutError)throw new bi.MongoCryptAzureKMSRequestError(`[Azure KMS] ${n.message}`);throw n}}async function Lee(e){let t=await $s.tokenCache.getToken();return{...e,azure:t}}});var tP=g(function(T3){Object.defineProperty(T3,"__esModule",{value:!0});T3.loadGCPCredentials=Uee;var eP=Fo();async function Uee(e){let t=eP.getGcpMetadata();if("kModuleError"in t)return e;let{access_token:r}=await t.instance({property:"service-accounts/default/token"});return{...e,gcp:{accessToken:r}}}});var M3=g(function(km){Object.defineProperty(km,"__esModule",{value:!0});km.isEmptyCredentials=xm;km.refreshKMSCredentials=Vee;var rP=GM(),nP=D3(),sP=tP();function xm(e,t){let r=t[e];if(r==null)return!1;return typeof r==="object"&&Object.keys(r).length===0}async function Vee(e,t){let r=e;if(xm("aws",e))r=await rP.loadAWSCredentials(r,t?.aws);if(xm("gcp",e))r=await sP.loadGCPCredentials(r);if(xm("azure",e))r=await nP.loadAzureCredentials(r);return r}});var P3=g(function(Um){Object.defineProperty(Um,"__esModule",{value:!0});Um.StateMachine=void 0;var qm=require("fs/promises"),oP=require("net"),uP=require("process"),aP=require("tls"),an=Te(),jm=Ns(),cP=Fo(),Lm=X(),Pa=ds(),Vr=he(),lP=Vm(),zn=p1(),vf=null;function zee(){if(vf==null){let e=cP.getSocks();if("kModuleError"in e)throw e.kModuleError;vf=e}return vf}var Mc=0,hP=1,fP=2,dP=3,pP=7,mP=4,yP=5,gP=6,Wee=443,Hee=new Map([[Mc,"MONGOCRYPT_CTX_ERROR"],[hP,"MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],[fP,"MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],[dP,"MONGOCRYPT_CTX_NEED_MONGO_KEYS"],[pP,"MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS"],[mP,"MONGOCRYPT_CTX_NEED_KMS"],[yP,"MONGOCRYPT_CTX_READY"],[gP,"MONGOCRYPT_CTX_DONE"]]),Kee=["tlsInsecure","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames"];function iP(e){if(uP.env.MONGODB_CRYPT_DEBUG)console.error(e)}var Gee;class _P{constructor(e,t=an.pluckBSONSerializeOptions(e)){this.options=e,this.bsonOptions=t}async execute(e,t,r){let{_keyVaultNamespace:n,_keyVaultClient:s,_metaDataClient:i,_mongocryptdClient:o,_mongocryptdManager:u}=e,a=null,c=()=>t.status,l=()=>t.state;while(l()!==gP&&l()!==Mc)switch(r.signal?.throwIfAborted(),iP(`[context#${t.id}] ${Hee.get(l())||l()}`),l()){case hP:{let f=an.deserialize(t.nextMongoOperation());if(!i)throw new zn.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined");let h=this.fetchCollectionInfo(i,t.ns,f,r);for await(let d of h)if(t.addMongoOperationResponse(an.serialize(d)),l()===Mc)break;if(l()===Mc)break;t.finishMongoOperation();break}case fP:{let f=t.nextMongoOperation();if(l()===Mc)break;if(!o)throw new zn.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined");let h=u?await u.withRespawn(this.markCommand.bind(this,o,t.ns,f,r)):await this.markCommand(o,t.ns,f,r);t.addMongoOperationResponse(h),t.finishMongoOperation();break}case dP:{let f=t.nextMongoOperation(),h=await this.fetchKeys(s,n,f,r);if(h.length===0)a=Gee??=an.serialize({v:[]});for(let d of h)t.addMongoOperationResponse(an.serialize(d));t.finishMongoOperation();break}case pP:{let f=await e.askForKMSCredentials();t.provideKMSProviders(an.serialize(f));break}case mP:{await Promise.all(this.requests(t,r)),t.finishKMSRequests();break}case yP:{let f=t.finalize();if(l()===Mc){let h=c().message||"Finalization error";throw new zn.MongoCryptError(h)}a=f;break}default:throw new zn.MongoCryptError(`Unknown state: ${l()}`)}if(l()===Mc||a==null){let f=c().message;if(!f)iP("unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.");throw new zn.MongoCryptError(f??"unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.")}return a}async kmsRequest(e,t){let r=e.endpoint.split(":"),n=r[1]!=null?Number.parseInt(r[1],10):Wee,s={host:r[0],servername:r[0],port:n,...lP.autoSelectSocketOptions(this.options.socketOptions||{})},i=e.message,o=new Vr.BufferPool,u,a;function c(){for(let m of[a,u])if(m)m.destroy()}function l(m){return new zn.MongoCryptError("KMS request failed",{cause:m})}function f(){return new zn.MongoCryptError("KMS request closed")}let h=this.options.tlsOptions;if(h){let m=e.kmsProvider,_=h[m];if(_){let y=this.validateTlsOptions(m,_);if(y)throw y;try{await this.setTlsOptions(_,s)}catch(E){throw l(E)}}}let d,p;try{if(t?.signal?.throwIfAborted(),this.options.kmsConnectCallback){let D=t?.timeoutContext?.csotEnabled()?t.timeoutContext.getRemainingTimeMSOrThrow(`KMS request timed out after ${t.timeoutContext.timeoutMS}ms`):void 0,A=Number.isFinite(D)?D:void 0,P=new AbortController,S=Vr.addAbortListener(t?.signal,function(){P.abort(this.reason)}),B=this.options.kmsConnectCallback({host:s.host,port:s.port,timeoutMS:A,signal:P.signal});B.then((I)=>{if(P.signal.aborted)I.destroy()},()=>null);let q=A?Pa.Timeout.expires(A):void 0;try{s.socket=q?await Promise.race([B,q]):await B}catch(I){if(Pa.TimeoutError.is(I)){let Oe=new Lm.MongoOperationTimeoutError("KMS request timed out");throw P.abort(Oe),Oe}throw l(I)}finally{q?.clear(),S?.[Vr.kDispose]()}}else if(this.options.proxyOptions&&this.options.proxyOptions.proxyHost){u=new oP.Socket;let{promise:D,reject:A,resolve:P}=Vr.promiseWithResolvers();u.once("error",(B)=>A(l(B))).once("close",()=>A(f())).once("connect",()=>P());let S={...s,host:this.options.proxyOptions.proxyHost,port:this.options.proxyOptions.proxyPort||1080};u.connect(S),await D;try{vf??=zee(),s.socket=(await vf.SocksClient.createConnection({existing_socket:u,command:"connect",destination:{host:s.host,port:s.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:this.options.proxyOptions.proxyUsername,password:this.options.proxyOptions.proxyPassword}})).socket}catch(B){throw l(B)}}a=aP.connect(s,()=>{a.write(i)});let{promise:m,reject:_,resolve:y}=Vr.promiseWithResolvers();d=Vr.addAbortListener(t?.signal,function(){c(),_(this.reason)}),a.once("error",(D)=>_(l(D))).once("close",()=>_(f())).on("data",(D)=>{o.append(D);while(e.bytesNeeded>0&&o.length){let A=Math.min(e.bytesNeeded,o.length);e.addResponse(o.read(A))}if(e.bytesNeeded<=0)y()});let E=t?.timeoutContext?.csotEnabled()?t.timeoutContext.getRemainingTimeMSOrThrow(`KMS request timed out after ${t.timeoutContext.timeoutMS}ms`):void 0,C=Number.isFinite(E)?E:void 0;p=C?Pa.Timeout.expires(C):void 0,await(p?Promise.race([m,p]):m)}catch(m){if(Pa.TimeoutError.is(m))throw new Lm.MongoOperationTimeoutError("KMS request timed out");throw m}finally{c(),d?.[Vr.kDispose](),p?.clear()}}*requests(e,t){for(let r=e.nextKMSRequest();r!=null;r=e.nextKMSRequest())yield this.kmsRequest(r,t)}validateTlsOptions(e,t){let r=Object.keys(t);for(let n of Kee)if(r.includes(n))return new zn.MongoCryptError(`Insecure TLS options prohibited for ${e}: ${n}`)}async setTlsOptions(e,t){if(e.secureContext)t.secureContext=e.secureContext;if(e.tlsCertificateKeyFile){let r=await qm.readFile(e.tlsCertificateKeyFile);t.cert=t.key=r}if(e.tlsCAFile)t.ca=await qm.readFile(e.tlsCAFile);if(e.tlsCertificateKeyFilePassword)t.passphrase=e.tlsCertificateKeyFilePassword}fetchCollectionInfo(e,t,r,n){let{db:s}=Vr.MongoDBCollectionNamespace.fromString(t);return e.db(s).listCollections(r,{promoteLongs:!1,promoteValues:!1,timeoutContext:n?.timeoutContext&&new jm.CursorTimeoutContext(n?.timeoutContext,Symbol()),signal:n?.signal,nameOnly:!1})}async markCommand(e,t,r,n){let{db:s}=Vr.MongoDBCollectionNamespace.fromString(t),i={promoteLongs:!1,promoteValues:!1},o=an.deserialize(r,i),u={timeoutMS:void 0,signal:void 0};if(n?.timeoutContext?.csotEnabled())u.timeoutMS=n.timeoutContext.remainingTimeMS;if(n?.signal)u.signal=n.signal;let a=await e.db(s).command(o,{...i,...u});return an.serialize(a,this.bsonOptions)}fetchKeys(e,t,r,n){let{db:s,collection:i}=Vr.MongoDBCollectionNamespace.fromString(t),o={timeoutContext:void 0,signal:void 0};if(n?.timeoutContext!=null)o.timeoutContext=new jm.CursorTimeoutContext(n.timeoutContext,Symbol());if(n?.signal!=null)o.signal=n.signal;return e.db(s).collection(i,{readConcern:{level:"majority"}}).find(an.deserialize(r),o).toArray()}}Um.StateMachine=_P});var Vm=g(function(kf){Object.defineProperty(kf,"__esModule",{value:!0});kf.ClientEncryption=void 0;kf.autoSelectSocketOptions=xf;var It=Te(),EP=Fo(),Ho=ds(),jt=he(),zr=p1(),zm=M3(),Ba=P3();class Wm{static getMongoCrypt(){let e=EP.getMongoDBClientEncryption();if("kModuleError"in e)throw e.kModuleError;return e.MongoCrypt}constructor(e,t){if(this._client=e,this._proxyOptions=t.proxyOptions??{},this._proxyOptions.proxyHost&&t.kmsConnectCallback)throw new zr.MongoCryptInvalidArgumentError("Cannot set both proxyOptions and kmsConnectCallback");this._tlsOptions=t.tlsOptions??{},this._kmsConnectCallback=t.kmsConnectCallback,this._kmsProviders=t.kmsProviders||{};let{timeoutMS:r}=jt.resolveTimeoutOptions(e,t);if(this._timeoutMS=r,this._credentialProviders=t.credentialProviders,t.credentialProviders?.aws&&!zm.isEmptyCredentials("aws",this._kmsProviders))throw new zr.MongoCryptInvalidArgumentError("Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching");if(t.keyVaultNamespace==null)throw new zr.MongoCryptInvalidArgumentError("Missing required option `keyVaultNamespace`");let n={...t,kmsProviders:It.serialize(this._kmsProviders),errorWrapper:zr.defaultErrorWrapper};this._keyVaultNamespace=t.keyVaultNamespace,this._keyVaultClient=t.keyVaultClient||e;let s=Wm.getMongoCrypt();this._mongoCrypt=new s(n)}async createDataKey(e,t={}){if(t.keyAltNames&&!Array.isArray(t.keyAltNames))throw new zr.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but was of type ${typeof t.keyAltNames}.`);let r=void 0;if(t.keyAltNames&&t.keyAltNames.length>0)r=t.keyAltNames.map((h,d)=>{if(typeof h!=="string")throw new zr.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but item at index ${d} was of type ${typeof h}`);return It.serialize({keyAltName:h})});let n=void 0;if(t.keyMaterial)n=It.serialize({keyMaterial:t.keyMaterial});let s=It.serialize({provider:e,...t.masterKey}),i=this._mongoCrypt.makeDataKeyContext(s,{keyAltNames:r,keyMaterial:n}),o=new Ba.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:xf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),u=t?.timeoutContext??Ho.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})),a=It.deserialize(await o.execute(this,i,{timeoutContext:u})),{db:c,collection:l}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),{insertedId:f}=await this._keyVaultClient.db(c).collection(l).insertOne(a,{writeConcern:{w:"majority"},timeoutMS:u?.csotEnabled()?u?.getRemainingTimeMSOrThrow():void 0});return f}async rewrapManyDataKey(e,t){let r=void 0;if(t){let h=Object.assign({provider:t.provider},t.masterKey);r=It.serialize(h)}let n=It.serialize(e),s=this._mongoCrypt.makeRewrapManyDataKeyContext(n,r),i=new Ba.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:xf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),o=Ho.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})),{v:u}=It.deserialize(await i.execute(this,s,{timeoutContext:o}));if(u.length===0)return{};let{db:a,collection:c}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),l=u.map((h)=>({updateOne:{filter:{_id:h._id},update:{$set:{masterKey:h.masterKey,keyMaterial:h.keyMaterial},$currentDate:{updateDate:!0}}}}));return{bulkWriteResult:await this._keyVaultClient.db(a).collection(c).bulkWrite(l,{writeConcern:{w:"majority"},timeoutMS:o.csotEnabled()?o?.remainingTimeMS:void 0})}}async deleteKey(e){let{db:t,collection:r}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(r).deleteOne({_id:e},{writeConcern:{w:"majority"},timeoutMS:this._timeoutMS})}getKeys(){let{db:e,collection:t}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return this._keyVaultClient.db(e).collection(t).find({},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async getKey(e){let{db:t,collection:r}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(r).findOne({_id:e},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async getKeyByAltName(e){let{db:t,collection:r}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(r).findOne({keyAltNames:e},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async addKeyAltName(e,t){let{db:r,collection:n}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(r).collection(n).findOneAndUpdate({_id:e},{$addToSet:{keyAltNames:t}},{writeConcern:{w:"majority"},returnDocument:"before",timeoutMS:this._timeoutMS})}async removeKeyAltName(e,t){let{db:r,collection:n}=jt.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),s=[{$set:{keyAltNames:{$cond:[{$eq:["$keyAltNames",[t]]},"$$REMOVE",{$filter:{input:"$keyAltNames",cond:{$ne:["$$this",t]}}}]}}}];return await this._keyVaultClient.db(r).collection(n).findOneAndUpdate({_id:e},s,{writeConcern:{w:"majority"},returnDocument:"before",timeoutMS:this._timeoutMS})}async createEncryptedCollection(e,t,r){let{provider:n,masterKey:s,createCollectionOptions:{encryptedFields:{...i},...o}}=r,u=this._timeoutMS!=null?Ho.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0;if(Array.isArray(i.fields)){let a=i.fields.map(async(f)=>f==null||typeof f!=="object"||f.keyId!=null?f:{...f,keyId:await this.createDataKey(n,{masterKey:s,timeoutContext:u?.csotEnabled()?u?.clone():void 0})}),c=await Promise.allSettled(a);i.fields=c.map((f,h)=>f.status==="fulfilled"?f.value:i.fields[h]);let l=c.find((f)=>f.status==="rejected");if(l!=null)throw new zr.MongoCryptCreateDataKeyError(i,{cause:l.reason})}try{return{collection:await e.createCollection(t,{...o,encryptedFields:i,timeoutMS:u?.csotEnabled()?u?.getRemainingTimeMSOrThrow():void 0}),encryptedFields:i}}catch(a){throw new zr.MongoCryptCreateEncryptedCollectionError(i,{cause:a})}}async encrypt(e,t){return await this._encrypt(e,!1,t)}async encryptExpression(e,t){return await this._encrypt(e,!0,t)}async decrypt(e){let t=It.serialize({v:e}),r=this._mongoCrypt.makeExplicitDecryptionContext(t),n=new Ba.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:xf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),s=this._timeoutMS!=null?Ho.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:i}=It.deserialize(await n.execute(this,r,{timeoutContext:s}));return i}async askForKMSCredentials(){return await zm.refreshKMSCredentials(this._kmsProviders,this._credentialProviders)}static get libmongocryptVersion(){return Wm.getMongoCrypt().libmongocryptVersion}async _encrypt(e,t,r){let{algorithm:n,keyId:s,keyAltName:i,contentionFactor:o,queryType:u,rangeOptions:a,stringOptions:c,textOptions:l}=r,f={expressionMode:t,algorithm:n};if(s)f.keyId=s.buffer;if(i){if(s)throw new zr.MongoCryptInvalidArgumentError('"options" cannot contain both "keyId" and "keyAltName"');if(typeof i!=="string")throw new zr.MongoCryptInvalidArgumentError(`"options.keyAltName" must be of type string, but was of type ${typeof i}`);f.keyAltName=It.serialize({keyAltName:i})}if(typeof o==="number"||typeof o==="bigint")f.contentionFactor=o;if(typeof u==="string")f.queryType=u;if(typeof a==="object")f.rangeOptions=It.serialize(a);let h=c??l;if(typeof h==="object")f.textOptions=It.serialize(h);let d=It.serialize({v:e}),p=new Ba.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:xf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),m=this._mongoCrypt.makeExplicitEncryptionContext(d,f),_=this._timeoutMS!=null?Ho.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:y}=It.deserialize(await p.execute(this,m,{timeoutContext:_}));return y}}kf.ClientEncryption=Wm;function xf(e){let t={};if("autoSelectFamily"in e)t.autoSelectFamily=e.autoSelectFamily;if("autoSelectFamilyAttemptTimeout"in e)t.autoSelectFamilyAttemptTimeout=e.autoSelectFamilyAttemptTimeout;return t}});var OP=g(function(Hm){Object.defineProperty(Hm,"__esModule",{value:!0});Hm.MongocryptdManager=void 0;var AP=X();class B3{static{this.DEFAULT_MONGOCRYPTD_URI="mongodb://localhost:27020"}constructor(e={}){if(this.spawnPath="",this.spawnArgs=[],this.uri=typeof e.mongocryptdURI==="string"&&e.mongocryptdURI.length>0?e.mongocryptdURI:B3.DEFAULT_MONGOCRYPTD_URI,this.bypassSpawn=!!e.mongocryptdBypassSpawn,Object.hasOwn(e,"mongocryptdSpawnPath")&&e.mongocryptdSpawnPath)this.spawnPath=e.mongocryptdSpawnPath;if(Object.hasOwn(e,"mongocryptdSpawnArgs")&&Array.isArray(e.mongocryptdSpawnArgs))this.spawnArgs=this.spawnArgs.concat(e.mongocryptdSpawnArgs);if(this.spawnArgs.filter((t)=>typeof t==="string").every((t)=>t.indexOf("--idleShutdownTimeoutSecs")<0))this.spawnArgs.push("--idleShutdownTimeoutSecs","60")}async spawn(){let e=this.spawnPath||"mongocryptd",{spawn:t}=require("child_process");this._child=t(e,this.spawnArgs,{stdio:"ignore",detached:!0}),this._child.on("error",()=>{}),this._child.unref()}async withRespawn(e){try{return await e()}catch(r){if(!(r instanceof AP.MongoNetworkTimeoutError&&!this.bypassSpawn))throw r}return await this.spawn(),await e()}}Hm.MongocryptdManager=B3});var F3=g(function(g1){var SP;Object.defineProperty(g1,"__esModule",{value:!0});g1.AutoEncrypter=g1.AutoEncryptionLoggerLevel=void 0;var Km=require("net"),Wn=Te(),wP=Br(),CP=Fo(),m1=X(),bP=Pc(),DP=he(),y1=Vm(),Fa=p1(),TP=OP(),Gm=M3(),Ym=P3();g1.AutoEncryptionLoggerLevel=Object.freeze({FatalError:0,Error:1,Warning:2,Info:3,Trace:4});class Jm{static{SP=wP.kDecorateResult}static getMongoCrypt(){let e=CP.getMongoDBClientEncryption();if("kModuleError"in e)throw e.kModuleError;return e.MongoCrypt}constructor(e,t){if(this[SP]=!1,this._client=e,this._bypassEncryption=t.bypassAutoEncryption===!0,this._keyVaultNamespace=t.keyVaultNamespace||"admin.datakeys",this._keyVaultClient=t.keyVaultClient||e,this._metaDataClient=t.metadataClient||e,this._proxyOptions=t.proxyOptions||{},this._proxyOptions.proxyHost&&t.kmsConnectCallback)throw new Fa.MongoCryptInvalidArgumentError("Cannot set both proxyOptions and kmsConnectCallback");if(this._tlsOptions=t.tlsOptions||{},this._kmsConnectCallback=t.kmsConnectCallback,this._kmsProviders=t.kmsProviders||{},this._credentialProviders=t.credentialProviders,t.credentialProviders?.aws&&!Gm.isEmptyCredentials("aws",this._kmsProviders))throw new Fa.MongoCryptInvalidArgumentError("Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching");let r={errorWrapper:Fa.defaultErrorWrapper};if(t.schemaMap)if(Wn.ByteUtils.isUint8Array(t.schemaMap))r.schemaMap=t.schemaMap;else r.schemaMap=Wn.serialize(t.schemaMap);if(t.encryptedFieldsMap)if(Wn.ByteUtils.isUint8Array(t.encryptedFieldsMap))r.encryptedFieldsMap=t.encryptedFieldsMap;else r.encryptedFieldsMap=Wn.serialize(t.encryptedFieldsMap);if(Wn.ByteUtils.isUint8Array(this._kmsProviders))r.kmsProviders=this._kmsProviders;else r.kmsProviders=Wn.serialize(this._kmsProviders);if(t.options?.logger)r.logger=t.options.logger;if(t.extraOptions&&t.extraOptions.cryptSharedLibPath)r.cryptSharedLibPath=t.extraOptions.cryptSharedLibPath;if(t.bypassQueryAnalysis)r.bypassQueryAnalysis=t.bypassQueryAnalysis;if(t.keyExpirationMS!=null)r.keyExpirationMS=t.keyExpirationMS;if(this._bypassMongocryptdAndCryptShared=this._bypassEncryption||!!t.bypassQueryAnalysis,t.extraOptions&&t.extraOptions.cryptSharedLibSearchPaths)r.cryptSharedLibSearchPaths=t.extraOptions.cryptSharedLibSearchPaths;else if(!this._bypassMongocryptdAndCryptShared)r.cryptSharedLibSearchPaths=["$SYSTEM"];let n=Jm.getMongoCrypt();if(this._mongocrypt=new n(r),this._contextCounter=0,t.extraOptions&&t.extraOptions.cryptSharedLibRequired&&!this.cryptSharedLibVersionInfo)throw new Fa.MongoCryptInvalidArgumentError("`cryptSharedLibRequired` set but no crypt_shared library loaded");if(!this._bypassMongocryptdAndCryptShared&&!this.cryptSharedLibVersionInfo){this._mongocryptdManager=new TP.MongocryptdManager(t.extraOptions);let s={serverSelectionTimeoutMS:1e4};if((t.extraOptions==null||typeof t.extraOptions.mongocryptdURI!=="string")&&!Km.getDefaultAutoSelectFamily)s.family=4;if(Km.getDefaultAutoSelectFamily)Object.assign(s,y1.autoSelectSocketOptions(this._client.s?.options??{}));this._mongocryptdClient=new bP.MongoClient(this._mongocryptdManager.uri,s)}}async init(){if(this._bypassMongocryptdAndCryptShared||this.cryptSharedLibVersionInfo)return;if(!this._mongocryptdManager)throw new m1.MongoRuntimeError("Reached impossible state: mongocryptdManager is undefined when neither bypassSpawn nor the shared lib are specified.");if(!this._mongocryptdClient)throw new m1.MongoRuntimeError("Reached impossible state: mongocryptdClient is undefined when neither bypassSpawn nor the shared lib are specified.");if(!this._mongocryptdManager.bypassSpawn)await this._mongocryptdManager.spawn();try{return await this._mongocryptdClient.connect()}catch(e){throw new m1.MongoRuntimeError("Unable to connect to `mongocryptd`, please make sure it is running or in your PATH for auto-spawn",{cause:e})}}async close(){await this._mongocryptdClient?.close()}async encrypt(e,t,r={}){if(r.signal?.throwIfAborted(),this._bypassEncryption)return t;let n=Wn.serialize(t,r),s=this._mongocrypt.makeEncryptionContext(DP.MongoDBCollectionNamespace.fromString(e).db,n);s.id=this._contextCounter++,s.ns=e,s.document=t;let i=new Ym.StateMachine({promoteValues:!1,promoteLongs:!1,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:y1.autoSelectSocketOptions(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback});return Wn.deserialize(await i.execute(this,s,r),{promoteValues:!1,promoteLongs:!1})}async decrypt(e,t={}){t.signal?.throwIfAborted();let r=this._mongocrypt.makeDecryptionContext(e);return r.id=this._contextCounter++,await new Ym.StateMachine({...t,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:y1.autoSelectSocketOptions(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}).execute(this,r,t)}async askForKMSCredentials(){return await Gm.refreshKMSCredentials(this._kmsProviders,this._credentialProviders)}get cryptSharedLibVersionInfo(){return this._mongocrypt.cryptSharedLibVersionInfo}static get libmongocryptVersion(){return Jm.getMongoCrypt().libmongocryptVersion}}g1.AutoEncrypter=Jm});var IP=g(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});Xm.Encrypter=void 0;var MP=F3(),PP=Br(),BP=Fo(),Qm=X(),FP=Pc();class NP{constructor(e,t,r){if(typeof r.autoEncryption!=="object")throw new Qm.MongoInvalidArgumentError('Option "autoEncryption" must be specified');if(this.internalClient=null,this.bypassAutoEncryption=!!r.autoEncryption.bypassAutoEncryption,this.needsConnecting=!1,r.maxPoolSize===0&&r.autoEncryption.keyVaultClient==null)r.autoEncryption.keyVaultClient=e;else if(r.autoEncryption.keyVaultClient==null)r.autoEncryption.keyVaultClient=this.getInternalClient(e,t,r);if(this.bypassAutoEncryption)r.autoEncryption.metadataClient=void 0;else if(r.maxPoolSize===0)r.autoEncryption.metadataClient=e;else r.autoEncryption.metadataClient=this.getInternalClient(e,t,r);if(r.proxyHost)r.autoEncryption.proxyOptions={proxyHost:r.proxyHost,proxyPort:r.proxyPort,proxyUsername:r.proxyUsername,proxyPassword:r.proxyPassword};this.autoEncrypter=new MP.AutoEncrypter(e,r.autoEncryption)}getInternalClient(e,t,r){let n=this.internalClient;if(n==null){let s={};for(let i of[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]){if(["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].includes(i))continue;Reflect.set(s,i,Reflect.get(r,i))}s.minPoolSize=0,n=new FP.MongoClient(t,s),this.internalClient=n;for(let i of PP.MONGO_CLIENT_EVENTS)for(let o of e.listeners(i))n.on(i,o);e.on("newListener",(i,o)=>{n?.on(i,o)}),this.needsConnecting=!0}return n}async connectInternalClient(){let e=this.internalClient;if(this.needsConnecting&&e!=null)this.needsConnecting=!1,await e.connect()}async close(e){let t;try{await this.autoEncrypter.close()}catch(n){t=n}let r=this.internalClient;if(r!=null&&e!==r)return await r.close();if(t!=null)throw t}static checkForMongoCrypt(){let e=BP.getMongoDBClientEncryption();if("kModuleError"in e)throw new Qm.MongoMissingDependencyError("Auto-encryption requested, but the module is not installed. Please add `mongodb-client-encryption` as a dependency of your project",{cause:e.kModuleError,dependencyName:"mongodb-client-encryption"})}}Xm.Encrypter=NP});var RP=g(function(qf){Object.defineProperty(qf,"__esModule",{value:!0});qf.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME=void 0;qf.resolveRuntimeAdapters=Yee;qf.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME="allowedDriverRequire";async function Yee(e){return{os:e.runtimeAdapters?.os??await import("os")}}});var v3=g(function(Di){Object.defineProperty(Di,"__esModule",{value:!0});Di.SENSITIVE_COMMANDS=Di.CommandFailedEvent=Di.CommandSucceededEvent=Di.CommandStartedEvent=void 0;var Ko=Br(),ey=he(),Zm=ta();class xP{constructor(e,t,r){this.name=Ko.COMMAND_STARTED;let n=R3(t),s=N3(n),{address:i,connectionId:o,serviceId:u}=$3(e);if(Di.SENSITIVE_COMMANDS.has(s))this.commandObj={},this.commandObj[s]=!0;this.address=i,this.connectionId=o,this.serviceId=u,this.requestId=t.requestId,this.databaseName=t.databaseName,this.commandName=s,this.command=I3(s,n,n),this.serverConnectionId=r}get hasServiceId(){return!!this.serviceId}}Di.CommandStartedEvent=xP;class kP{constructor(e,t,r,n,s){this.name=Ko.COMMAND_SUCCEEDED;let i=R3(t),o=N3(i),{address:u,connectionId:a,serviceId:c}=$3(e);this.address=u,this.connectionId=a,this.serviceId=c,this.requestId=t.requestId,this.commandName=o,this.duration=ey.calculateDurationInMs(n),this.reply=I3(o,i,Xee(r)),this.serverConnectionId=s,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}}Di.CommandSucceededEvent=kP;class qP{constructor(e,t,r,n,s){this.name=Ko.COMMAND_FAILED;let i=R3(t),o=N3(i),{address:u,connectionId:a,serviceId:c}=$3(e);this.address=u,this.connectionId=a,this.serviceId=c,this.requestId=t.requestId,this.commandName=o,this.duration=ey.calculateDurationInMs(n),this.failure=I3(o,i,r),this.serverConnectionId=s,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}}Di.CommandFailedEvent=qP;Di.SENSITIVE_COMMANDS=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]);var Jee=new Set(["hello",Ko.LEGACY_HELLO_COMMAND,Ko.LEGACY_HELLO_COMMAND_CAMEL_CASE]),N3=(e)=>Object.keys(e)[0],Qee=(e)=>e.ns.split(".")[1],I3=(e,t,r)=>Di.SENSITIVE_COMMANDS.has(e)||Jee.has(e)&&t.speculativeAuthenticate?{}:r,$P={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"},vP={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldSelector:"projection"};function R3(e){if(e instanceof Zm.OpMsgRequest){let n={...e.command};for(let s of Object.keys(n))if(n[s]instanceof Zm.DocumentSequence)n[s]=n[s].documents;return n}if(e.query?.$query){let n;if(e.ns==="admin.$cmd")n=Object.assign({},e.query.$query);else n={find:Qee(e)},Object.keys($P).forEach((s)=>{if(e.query[s]!=null)n[$P[s]]={...e.query[s]}});return Object.keys(vP).forEach((s)=>{let i=s;if(e[i]!=null)n[vP[i]]=e[i]}),n}let t={},r={...e};if(e.query)t={...e.query},r.query=t;return e.query?t:r}function Xee(e){if(!e)return e;return e.result?e.result:e}function $3(e){let t;if("id"in e)t=e.id;return{address:e.address,serviceId:e.serviceId,connectionId:t}}});var jf=g(function(_1){Object.defineProperty(_1,"__esModule",{value:!0});_1.ServerDescription=void 0;_1.parseServerType=UP;_1.compareTopologyVersion=VP;var Ti=Te(),jP=X(),Mi=he(),Ke=Ds(),Zee=new Set([Ke.ServerType.RSPrimary,Ke.ServerType.Standalone,Ke.ServerType.Mongos,Ke.ServerType.LoadBalancer]),ete=new Set([Ke.ServerType.RSPrimary,Ke.ServerType.RSSecondary,Ke.ServerType.Mongos,Ke.ServerType.Standalone,Ke.ServerType.LoadBalancer]);class LP{constructor(e,t,r={}){if(e==null||e==="")throw new jP.MongoRuntimeError("ServerDescription must be provided with a non-empty address");this.address=typeof e==="string"?Mi.HostAddress.fromString(e).toString():e.toString(),this.type=UP(t,r),this.hosts=t?.hosts?.map((n)=>n.toLowerCase())??[],this.passives=t?.passives?.map((n)=>n.toLowerCase())??[],this.arbiters=t?.arbiters?.map((n)=>n.toLowerCase())??[],this.tags=t?.tags??{},this.minWireVersion=t?.minWireVersion??0,this.maxWireVersion=t?.maxWireVersion??0,this.roundTripTime=r?.roundTripTime??-1,this.minRoundTripTime=r?.minRoundTripTime??0,this.lastUpdateTime=Mi.processTimeMS(),this.lastWriteDate=t?.lastWrite?.lastWriteDate??0,this.error=r.error??null,this.error?.stack,this.topologyVersion=this.error?.topologyVersion??t?.topologyVersion??null,this.setName=t?.setName??null,this.setVersion=t?.setVersion??null,this.electionId=t?.electionId??null,this.logicalSessionTimeoutMinutes=t?.logicalSessionTimeoutMinutes??null,this.maxMessageSizeBytes=t?.maxMessageSizeBytes??null,this.maxWriteBatchSize=t?.maxWriteBatchSize??null,this.maxBsonObjectSize=t?.maxBsonObjectSize??null,this.primary=t?.primary??null,this.me=t?.me?.toLowerCase()??null,this.$clusterTime=t?.$clusterTime??null,this.iscryptd=Boolean(t?.iscryptd)}get hostAddress(){return Mi.HostAddress.fromString(this.address)}get allHosts(){return this.hosts.concat(this.arbiters).concat(this.passives)}get isReadable(){return this.type===Ke.ServerType.RSSecondary||this.isWritable}get isDataBearing(){return ete.has(this.type)}get isWritable(){return Zee.has(this.type)}get host(){let e=`:${this.port}`.length;return this.address.slice(0,-e)}get port(){let e=this.address.split(":").pop();return e?Number.parseInt(e,10):27017}equals(e){let t=this.topologyVersion===e?.topologyVersion||VP(this.topologyVersion,e?.topologyVersion)===0,r=this.electionId!=null&&e?.electionId!=null?Mi.compareObjectId(this.electionId,e.electionId)===0:this.electionId===e?.electionId;return e!=null&&e.iscryptd===this.iscryptd&&Mi.errorStrictEqual(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&Mi.arrayStrictEqual(this.hosts,e.hosts)&&tte(this.tags,e.tags)&&this.setName===e.setName&&this.setVersion===e.setVersion&&r&&this.primary===e.primary&&this.logicalSessionTimeoutMinutes===e.logicalSessionTimeoutMinutes&&t}}_1.ServerDescription=LP;function UP(e,t){if(t?.loadBalanced)return Ke.ServerType.LoadBalancer;if(!e||!e.ok)return Ke.ServerType.Unknown;if(e.isreplicaset)return Ke.ServerType.RSGhost;if(e.msg&&e.msg==="isdbgrid")return Ke.ServerType.Mongos;if(e.setName)if(e.hidden)return Ke.ServerType.RSOther;else if(e.isWritablePrimary)return Ke.ServerType.RSPrimary;else if(e.secondary)return Ke.ServerType.RSSecondary;else if(e.arbiterOnly)return Ke.ServerType.RSArbiter;else return Ke.ServerType.RSOther;return Ke.ServerType.Standalone}function tte(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((s)=>t[s]===e[s])}function VP(e,t){if(e==null||t==null)return-1;if(!e.processId.equals(t.processId))return-1;let r=typeof e.counter==="bigint"?Ti.Long.fromBigInt(e.counter):Ti.Long.isLong(e.counter)?e.counter:Ti.Long.fromNumber(e.counter),n=typeof t.counter==="bigint"?Ti.Long.fromBigInt(t.counter):Ti.Long.isLong(t.counter)?t.counter:Ti.Long.fromNumber(t.counter);return r.compare(n)}});var GP=g(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.StreamDescription=void 0;var zP=Te(),WP=Ds(),HP=jf(),rte=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","logicalSessionTimeoutMinutes"];class KP{constructor(e,t){this.hello=null,this.address=e,this.type=WP.ServerType.Unknown,this.minWireVersion=void 0,this.maxWireVersion=void 0,this.maxBsonObjectSize=16777216,this.maxMessageSizeBytes=48000000,this.maxWriteBatchSize=1e5,this.logicalSessionTimeoutMinutes=t?.logicalSessionTimeoutMinutes,this.loadBalanced=!!t?.loadBalanced,this.compressors=t&&t.compressors&&Array.isArray(t.compressors)?t.compressors:[],this.serverConnectionId=null}receiveResponse(e){if(e==null)return;if(this.hello=e,this.type=HP.parseServerType(e),"connectionId"in e)this.serverConnectionId=this.parseServerConnectionID(e.connectionId);else this.serverConnectionId=null;for(let t of rte){if(e[t]!=null)this[t]=e[t];if("__nodejs_mock_server__"in e)this.__nodejs_mock_server__=e.__nodejs_mock_server__}if(e.compression)this.compressor=this.compressors.filter((t)=>e.compression?.includes(t))[0]}parseServerConnectionID(e){return zP.Long.isLong(e)?e.toBigInt():BigInt(e)}}ty.StreamDescription=KP});var YP=g(function(x3){Object.defineProperty(x3,"__esModule",{value:!0});x3.onData=nte;var Go=he();function nte(e,{timeoutContext:t,signal:r}){r?.throwIfAborted();let n=new Go.List,s=new Go.List,i=null,o=!1,u={next(){let d=n.shift();if(d!=null)return Promise.resolve({value:d,done:!1});if(i!=null){let y=Promise.reject(i);return i=null,y}if(o)return h();let{promise:p,resolve:m,reject:_}=Go.promiseWithResolvers();return s.push({resolve:m,reject:_}),p},return(){return h()},throw(d){return f(d),Promise.resolve({value:void 0,done:!0})},[Symbol.asyncIterator](){return this},async[Symbol.asyncDispose](){await h()}};e.on("data",l),e.on("error",f);let a=Go.addAbortListener(r,function(){f(this.reason)}),c=t?.timeoutForSocketRead;return c?.throwIfExpired(),c?.then(void 0,f),u;function l(d){let p=s.shift();if(p!=null)p.resolve({value:d,done:!1});else n.push(d)}function f(d){let p=s.shift();if(p!=null)p.reject(d);else i=d;h()}function h(){e.off("data",l),e.off("error",f),a?.[Go.kDispose](),o=!0,c?.clear();let d={value:void 0,done:o};for(let p of s)p.resolve(d);return Promise.resolve(d)}}});var k3=g(function(ry){Object.defineProperty(ry,"__esModule",{value:!0});ry.TopologyDescription=void 0;var tB=Te(),Ia=Cu(),Na=X(),E1=he(),ue=Ds(),Hn=jf(),ste=Ia.MIN_SUPPORTED_SERVER_VERSION,ite=Ia.MAX_SUPPORTED_SERVER_VERSION,JP=Ia.MIN_SUPPORTED_WIRE_VERSION,QP=Ia.MAX_SUPPORTED_WIRE_VERSION,ote=new Set([ue.ServerType.Mongos,ue.ServerType.Unknown]),XP=new Set([ue.ServerType.Mongos,ue.ServerType.Standalone]),ZP=new Set([ue.ServerType.RSSecondary,ue.ServerType.RSArbiter,ue.ServerType.RSOther]);class Lf{constructor(e,t=null,r=null,n=null,s=null,i=null,o=null){o=o??{},this.type=e??ue.TopologyType.Unknown,this.servers=t??new Map,this.stale=!1,this.compatible=!0,this.heartbeatFrequencyMS=o.heartbeatFrequencyMS??0,this.localThresholdMS=o.localThresholdMS??15,this.setName=r??null,this.maxElectionId=s??null,this.maxSetVersion=n??null,this.commonWireVersion=i??0;for(let u of this.servers.values()){if(u.type===ue.ServerType.Unknown||u.type===ue.ServerType.LoadBalancer)continue;if(u.minWireVersion>QP)this.compatible=!1,this.compatibilityError=`Server at ${u.address} requires wire version ${u.minWireVersion}, but this version of the driver only supports up to ${QP} (MongoDB ${ite})`;if(u.maxWireVersion<JP){this.compatible=!1,this.compatibilityError=`Server at ${u.address} reports wire version ${u.maxWireVersion}, but this version of the driver requires at least ${JP} (MongoDB ${ste}).`;break}}this.logicalSessionTimeoutMinutes=null;for(let[,u]of this.servers)if(u.isReadable){if(u.logicalSessionTimeoutMinutes==null){this.logicalSessionTimeoutMinutes=null;break}if(this.logicalSessionTimeoutMinutes==null){this.logicalSessionTimeoutMinutes=u.logicalSessionTimeoutMinutes;continue}this.logicalSessionTimeoutMinutes=Math.min(this.logicalSessionTimeoutMinutes,u.logicalSessionTimeoutMinutes)}}updateFromSrvPollingEvent(e,t=0){let r=e.hostnames(),n=new Set(this.servers.keys()),s=new Set(r),i=new Set;for(let u of n)if(s.delete(u),!r.has(u))i.add(u);if(s.size===0&&i.size===0)return this;let o=new Map(this.servers);for(let u of i)o.delete(u);if(s.size>0){if(t===0)for(let u of s)o.set(u,new Hn.ServerDescription(u));else if(o.size<t){let u=E1.shuffle(s,t-o.size);for(let a of u)o.set(a,new Hn.ServerDescription(a))}}return new Lf(this.type,o,this.setName,this.maxSetVersion,this.maxElectionId,this.commonWireVersion,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}update(e){let t=e.address,{type:r,setName:n,maxSetVersion:s,maxElectionId:i,commonWireVersion:o}=this,u=e.type,a=new Map(this.servers);if(e.maxWireVersion!==0)if(o===0)o=e.maxWireVersion;else o=Math.min(o,e.maxWireVersion);if(typeof e.setName==="string"&&typeof n==="string"&&e.setName!==n)if(r===ue.TopologyType.Single)e=new Hn.ServerDescription(t);else a.delete(t);if(a.set(t,e),r===ue.TopologyType.Single)return new Lf(ue.TopologyType.Single,a,n,s,i,o,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS});if(r===ue.TopologyType.Unknown)if(u===ue.ServerType.Standalone&&this.servers.size!==1)a.delete(t);else r=ute(u);if(r===ue.TopologyType.Sharded){if(!ote.has(u))a.delete(t)}if(r===ue.TopologyType.ReplicaSetNoPrimary){if(XP.has(u))a.delete(t);if(u===ue.ServerType.RSPrimary){let c=eB(a,e,n,s,i);r=c[0],n=c[1],s=c[2],i=c[3]}else if(ZP.has(u)){let c=cte(a,e,n);r=c[0],n=c[1]}}if(r===ue.TopologyType.ReplicaSetWithPrimary)if(XP.has(u))a.delete(t),r=Bc(a);else if(u===ue.ServerType.RSPrimary){let c=eB(a,e,n,s,i);r=c[0],n=c[1],s=c[2],i=c[3]}else if(ZP.has(u))r=ate(a,e,n);else r=Bc(a);return new Lf(r,a,n,s,i,o,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}get error(){let e=Array.from(this.servers.values()).filter((t)=>t.error);if(e.length>0)return e[0].error;return null}get hasKnownServers(){return Array.from(this.servers.values()).some((e)=>e.type!==ue.ServerType.Unknown)}get hasDataBearingServers(){return Array.from(this.servers.values()).some((e)=>e.isDataBearing)}hasServer(e){return this.servers.has(e)}toJSON(){return tB.EJSON.serialize(this)}}ry.TopologyDescription=Lf;function ute(e){switch(e){case ue.ServerType.Standalone:return ue.TopologyType.Single;case ue.ServerType.Mongos:return ue.TopologyType.Sharded;case ue.ServerType.RSPrimary:return ue.TopologyType.ReplicaSetWithPrimary;case ue.ServerType.RSOther:case ue.ServerType.RSSecondary:return ue.TopologyType.ReplicaSetNoPrimary;default:return ue.TopologyType.Unknown}}function eB(e,t,r=null,n=null,s=null){let i=(a,c,l)=>`primary marked stale due to electionId/setVersion mismatch: server setVersion: ${a.setVersion}, server electionId: ${a.electionId}, topology setVersion: ${c}, topology electionId: ${l}`;if(r=r||t.setName,r!==t.setName)return e.delete(t.address),[Bc(e),r,n,s];if(t.maxWireVersion>=17){let a=E1.compareObjectId(s,t.electionId),c=a===0,l=a===-1,f=(n??-1)<=(t.setVersion??-1);if(l||c&&f)s=t.electionId,n=t.setVersion;else return e.set(t.address,new Hn.ServerDescription(t.address,void 0,{error:new Na.MongoStalePrimaryError(i(t,n,s))})),[Bc(e),r,n,s]}else{let a=t.electionId?t.electionId:null;if(t.setVersion&&a){if(n&&s){if(n>t.setVersion||E1.compareObjectId(s,a)>0)return e.set(t.address,new Hn.ServerDescription(t.address,void 0,{error:new Na.MongoStalePrimaryError(i(t,n,s))})),[Bc(e),r,n,s]}s=t.electionId}if(t.setVersion!=null&&(n==null||t.setVersion>n))n=t.setVersion}for(let[a,c]of e)if(c.type===ue.ServerType.RSPrimary&&c.address!==t.address){e.set(a,new Hn.ServerDescription(c.address,void 0,{error:new Na.MongoStalePrimaryError("primary marked stale due to discovery of newer primary")}));break}t.allHosts.forEach((a)=>{if(!e.has(a))e.set(a,new Hn.ServerDescription(a))});let o=Array.from(e.keys()),u=t.allHosts;return o.filter((a)=>u.indexOf(a)===-1).forEach((a)=>{e.delete(a)}),[Bc(e),r,n,s]}function ate(e,t,r=null){if(r==null)throw new Na.MongoRuntimeError('Argument "setName" is required if connected to a replica set');if(r!==t.setName||t.me&&t.address!==t.me)e.delete(t.address);return Bc(e)}function cte(e,t,r=null){let n=ue.TopologyType.ReplicaSetNoPrimary;if(r=r??t.setName,r!==t.setName)return e.delete(t.address),[n,r];if(t.allHosts.forEach((s)=>{if(!e.has(s))e.set(s,new Hn.ServerDescription(s))}),t.me&&t.address!==t.me)e.delete(t.address);return[n,r]}function Bc(e){for(let t of e.values())if(t.type===ue.ServerType.RSPrimary)return ue.TopologyType.ReplicaSetWithPrimary;return ue.TopologyType.ReplicaSetNoPrimary}});var sB=g(function(sy){Object.defineProperty(sy,"__esModule",{value:!0});sy.getReadPreference=lte;sy.isSharded=hte;var rB=X(),A1=Xr(),ny=Ds(),nB=k3();function lte(e){let t=e?.readPreference??A1.ReadPreference.primary;if(typeof t==="string")t=A1.ReadPreference.fromString(t);if(!(t instanceof A1.ReadPreference))throw new rB.MongoInvalidArgumentError('Option "readPreference" must be a ReadPreference instance');return t}function hte(e){if(e==null)return!1;if(e.description&&e.description.type===ny.ServerType.Mongos)return!0;if(e.description&&e.description instanceof nB.TopologyDescription)return Array.from(e.description.servers.values()).some((r)=>r.type===ny.ServerType.Mongos);return!1}});var ay=g(function(Fu){Object.defineProperty(Fu,"__esModule",{value:!0});Fu.CryptoConnection=Fu.SizedMessageTransform=Fu.Connection=void 0;Fu.hasSessionSupport=fte;var iB=require("stream"),uy=require("timers"),C1=Te(),Kn=Br(),Re=X(),iy=fa(),oB=ei(),uB=Xr(),aB=Ds(),O1=wf(),oy=ds(),Yt=he(),S1=v3(),Ra=ta(),cB=GP(),lB=pf(),hB=YP(),Pi=wt(),w1=sB();function fte(e){return e.description.logicalSessionTimeoutMinutes!=null}function dte(e,t){if(t.proxyHost)return t.hostAddress.toString();let{remoteAddress:r,remotePort:n}=e;if(typeof r==="string"&&typeof n==="number")return Yt.HostAddress.fromHostPort(r,n).toString();return C1.ByteUtils.toHex(Yt.uuidV4())}class Yo extends oB.TypedEventEmitter{static{this.COMMAND_STARTED=Kn.COMMAND_STARTED}static{this.COMMAND_SUCCEEDED=Kn.COMMAND_SUCCEEDED}static{this.COMMAND_FAILED=Kn.COMMAND_FAILED}static{this.CLUSTER_TIME_RECEIVED=Kn.CLUSTER_TIME_RECEIVED}static{this.CLOSE=Kn.CLOSE}static{this.PINNED=Kn.PINNED}static{this.UNPINNED=Kn.UNPINNED}constructor(e,t){super();this.lastHelloMS=-1,this.helloOk=!1,this.delayedTimeoutId=null,this.closed=!1,this.clusterTime=null,this.error=null,this.dataEvents=null,this.on("error",Yt.noop),this.socket=e,this.id=t.id,this.address=dte(e,t),this.socketTimeoutMS=t.socketTimeoutMS??0,this.monitorCommands=t.monitorCommands,this.serverApi=t.serverApi,this.mongoLogger=t.mongoLogger,this.established=!1,this.description=new cB.StreamDescription(this.address,t),this.generation=t.generation,this.lastUseTime=Yt.processTimeMS(),this.messageStream=this.socket.on("error",this.onSocketError.bind(this)).pipe(new q3({connection:this})).on("error",this.onTransformError.bind(this)),this.socket.on("close",this.onClose.bind(this)),this.socket.on("timeout",this.onTimeout.bind(this)),this.messageStream.pause()}get hello(){return this.description.hello}set hello(e){this.description.receiveResponse(e),Object.freeze(this.description)}get serviceId(){return this.hello?.serviceId}get loadBalanced(){return this.description.loadBalanced}get idleTime(){return Yt.calculateDurationInMs(this.lastUseTime)}get hasSessionSupport(){return this.description.logicalSessionTimeoutMinutes!=null}get supportsOpMsg(){return this.description!=null&&Yt.maxWireVersion(this)>=6&&!this.description.__nodejs_mock_server__}get shouldEmitAndLogCommand(){return(this.monitorCommands||this.established&&!this.authContext?.reauthenticating&&this.mongoLogger?.willLog(iy.MongoLoggableComponent.COMMAND,iy.SeverityLevel.DEBUG))??!1}markAvailable(){this.lastUseTime=Yt.processTimeMS()}onSocketError(e){this.onError(new Re.MongoNetworkError(e.message,{cause:e}))}onTransformError(e){this.onError(e)}onError(e){this.cleanup(e)}onClose(){let e=`connection ${this.id} to ${this.address} closed`;this.cleanup(new Re.MongoNetworkError(e))}onTimeout(){this.delayedTimeoutId=uy.setTimeout(()=>{let e=`connection ${this.id} to ${this.address} timed out`,t=this.hello==null;this.cleanup(new Re.MongoNetworkTimeoutError(e,{beforeHandshake:t}))},1).unref()}destroy(){if(this.closed)return;this.removeAllListeners(Yo.PINNED),this.removeAllListeners(Yo.UNPINNED);let e=`connection ${this.id} to ${this.address} closed`;this.cleanup(new Re.MongoNetworkError(e))}cleanup(e){if(this.closed)return;this.socket.destroy(),this.error=e,this.dataEvents?.throw(e).then(void 0,Yt.squashError),this.closed=!0,this.emit(Yo.CLOSE)}prepareCommand(e,t,r){let n={...t},s=w1.getReadPreference(r),i=r?.session,o=this.clusterTime;if(this.serverApi){let{version:c,strict:l,deprecationErrors:f}=this.serverApi;if(n.apiVersion=c,l!=null)n.apiStrict=l;if(f!=null)n.apiDeprecationErrors=f}if(this.hasSessionSupport&&i){if(i.clusterTime&&o&&i.clusterTime.clusterTime.greaterThan(o.clusterTime))o=i.clusterTime;let c=O1.applySession(i,n,r);if(c)throw c}else if(i?.explicit)throw new Re.MongoCompatibilityError("Current topology does not support sessions");if(o)n.$clusterTime=o;if(this.description.type!==aB.ServerType.Standalone){if(!w1.isSharded(this)&&!this.description.loadBalanced&&this.supportsOpMsg&&r.directConnection===!0&&s?.mode==="primary")n.$readPreference=uB.ReadPreference.primaryPreferred.toJSON();else if(w1.isSharded(this)&&!this.supportsOpMsg&&s?.mode!=="primary")n={$query:n,$readPreference:s.toJSON()};else if(s?.mode!=="primary")n.$readPreference=s.toJSON()}let u={numberToSkip:0,numberToReturn:-1,checkKeys:!1,secondaryOk:s.secondaryOk(),...r};return r.timeoutContext?.addMaxTimeMSToCommand(n,r),this.supportsOpMsg?new Ra.OpMsgRequest(e,n,u):new Ra.OpQueryRequest(e,n,u)}async*sendWire(e,t,r){this.throwIfAborted();let n=t.socketTimeoutMS??t?.timeoutContext?.getSocketTimeoutMS()??this.socketTimeoutMS;this.socket.setTimeout(n);try{if(await this.writeCommand(e,{agreedCompressor:this.description.compressor??"none",zlibCompressionLevel:this.description.zlibCompressionLevel,timeoutContext:t.timeoutContext,signal:t.signal}),e.moreToCome){yield Pi.MongoDBResponse.empty;return}if(this.throwIfAborted(),t.timeoutContext?.csotEnabled()&&t.timeoutContext.minRoundTripTime!=null&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new Re.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining");for await(let s of this.readMany(t)){this.socket.setTimeout(0);let i=s.parse();yield(r??Pi.MongoDBResponse).make(i),this.throwIfAborted(),this.socket.setTimeout(n)}}finally{this.socket.setTimeout(0)}}async*sendCommand(e,t,r,n){r?.signal?.throwIfAborted();let s=this.prepareCommand(e.db,t,r),i=0;if(this.shouldEmitAndLogCommand)i=Yt.processTimeMS(),this.emitAndLogCommand(this.monitorCommands,Yo.COMMAND_STARTED,s.databaseName,this.established,new S1.CommandStartedEvent(this,s,this.description.serverConnectionId));let o=r.documentsReturnedIn==null||!r.raw?r:{...r,raw:!1,fieldsAsRaw:{[r.documentsReturnedIn]:!0}},u=void 0,a=void 0;try{this.throwIfAborted();for await(u of this.sendWire(s,r,n)){if(a=void 0,r.session!=null)O1.updateSessionFromResponse(r.session,u);if(u.$clusterTime)this.clusterTime=u.$clusterTime,this.emit(Yo.CLUSTER_TIME_RECEIVED,u.$clusterTime);if(u.ok===0){if(r.timeoutContext?.csotEnabled()&&u.isMaxTimeExpiredError)throw new Re.MongoOperationTimeoutError("Server reported a timeout error",{cause:new Re.MongoServerError(a??=u.toObject(o))});throw new Re.MongoServerError(a??=u.toObject(o))}if(this.shouldEmitAndLogCommand)this.emitAndLogCommand(this.monitorCommands,Yo.COMMAND_SUCCEEDED,s.databaseName,this.established,new S1.CommandSucceededEvent(this,s,s.moreToCome?{ok:1}:a??=u.toObject(o),i,this.description.serverConnectionId));if(n==null)yield a??=u.toObject(o);else yield u;this.throwIfAborted()}}catch(c){if(r.session!=null&&!(c instanceof Re.MongoServerError))O1.updateSessionFromResponse(r.session,Pi.MongoDBResponse.empty);if(this.shouldEmitAndLogCommand)this.emitAndLogCommand(this.monitorCommands,Yo.COMMAND_FAILED,s.databaseName,this.established,new S1.CommandFailedEvent(this,s,c,i,this.description.serverConnectionId));throw c}}async command(e,t,r={},n){this.throwIfAborted(),r.signal?.throwIfAborted();for await(let s of this.sendCommand(e,t,r,n)){if(r.timeoutContext?.csotEnabled()){if(Pi.MongoDBResponse.is(s)){if(s.isMaxTimeExpiredError)throw new Re.MongoOperationTimeoutError("Server reported a timeout error",{cause:new Re.MongoServerError(s.toObject())})}else if(Array.isArray(s?.writeErrors)&&s.writeErrors.some((i)=>i?.code===Re.MONGODB_ERROR_CODES.MaxTimeMSExpired)||s?.writeConcernError?.code===Re.MONGODB_ERROR_CODES.MaxTimeMSExpired)throw new Re.MongoOperationTimeoutError("Server reported a timeout error",{cause:new Re.MongoServerError(s)})}return s}throw new Re.MongoUnexpectedServerResponseError("Unable to get response from server")}exhaustCommand(e,t,r,n){(async()=>{this.throwIfAborted();for await(let i of this.sendCommand(e,t,r))n(void 0,i),this.throwIfAborted();throw new Re.MongoUnexpectedServerResponseError("Server ended moreToCome unexpectedly")})().then(void 0,n)}throwIfAborted(){if(this.error)throw this.error}async writeCommand(e,t){let r=t.agreedCompressor==="none"||!Ra.OpCompressedRequest.canCompress(e)?e:new Ra.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0}),n=C1.ByteUtils.concat(await r.toBin());if(t.timeoutContext?.csotEnabled()){if(t.timeoutContext.minRoundTripTime!=null&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new Re.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining")}try{if(this.socket.write(n))return}catch(u){let a=new Re.MongoNetworkError("unexpected error writing to socket",{cause:u});throw this.onError(a),a}let s=Yt.once(this.socket,"drain",t),i=t?.timeoutContext?.timeoutForSocketWrite,o=i?Promise.race([s,i]):s;try{return await o}catch(u){if(oy.TimeoutError.is(u)){let a=new Re.MongoOperationTimeoutError("Timed out at socket write");throw this.onError(a),a}else if(u===t.signal?.reason)this.onError(u);throw u}finally{i?.clear()}}async*readMany(e){try{this.dataEvents=hB.onData(this.messageStream,e),this.messageStream.resume();for await(let t of this.dataEvents){let r=await lB.decompressResponse(t);if(yield r,!r.moreToCome)return}}catch(t){if(oy.TimeoutError.is(t)){let r=new Re.MongoOperationTimeoutError(`Timed out during socket read (${t.duration}ms)`);throw this.dataEvents=null,this.onError(r),r}else if(t===e.signal?.reason)this.onError(t);throw t}finally{this.dataEvents=null,this.messageStream.pause()}}}Fu.Connection=Yo;class q3 extends iB.Transform{constructor({connection:e}){super({writableObjectMode:!1,readableObjectMode:!0});this.bufferPool=new Yt.BufferPool,this.connection=e}_transform(e,t,r){if(this.connection.delayedTimeoutId!=null)uy.clearTimeout(this.connection.delayedTimeoutId),this.connection.delayedTimeoutId=null;this.bufferPool.append(e);while(this.bufferPool.length){let n=this.bufferPool.getInt32();if(n==null)break;if(n<0)return r(new Re.MongoParseError(`Message size cannot be negative: ${n}`));if(n>this.bufferPool.length)break;let s=this.bufferPool.read(n);if(!this.push(s))return r(new Re.MongoRuntimeError("SizedMessageTransform does not support backpressure"))}r()}}Fu.SizedMessageTransform=q3;class fB extends Yo{constructor(e,t){super(e,t);this.autoEncrypter=t.autoEncrypter}async command(e,t,r,n){let{autoEncrypter:s}=this;if(!s)throw new Re.MongoRuntimeError("No AutoEncrypter available for encryption");if(Yt.maxWireVersion(this)===0)return await super.command(e,t,r,n);let o=t.find||t.findAndModify?t.sort:null,u=t.createIndexes?t.indexes.map((h)=>h.key):null,a=await s.encrypt(e.toString(),t,r);if(o!=null&&(t.find||t.findAndModify))a.sort=o;if(u!=null&&t.createIndexes)for(let[h,d]of u.entries())a.indexes[h].key=d;let c=await super.command(e,a,r,n??Pi.MongoDBResponse),l=await s.decrypt(c.toBytes(),r),f=n?.make(l)??C1.deserialize(l,r);if(s[Kn.kDecorateResult]){if(n==null)Yt.decorateDecryptionResult(f,c.toObject(),!0);else if(f instanceof Pi.CursorResponse)f.encryptedResponse=c}return f}}Fu.CryptoConnection=fB});var L3=g(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0});Mn.LEGAL_TCP_SOCKET_OPTIONS=Mn.LEGAL_TLS_SOCKET_OPTIONS=Mn.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS=void 0;Mn.connect=pte;Mn.makeConnection=gB;Mn.performInitialHandshake=_B;Mn.prepareHandshakeDocument=EB;Mn.makeSocket=ly;var hy=require("net"),dB=require("tls"),fy=Br(),pB=Fo(),Be=X(),b1=he(),mB=Sa(),$a=Uo(),cy=ay(),Bi=Cu();function yB(e){e.addErrorLabel(Be.MongoErrorLabel.SystemOverloadedError),e.addErrorLabel(Be.MongoErrorLabel.RetryableError)}async function pte(e){let t=null;try{let r=await ly(e);return t=gB(e,r),await _B(t,e),t}catch(r){throw t?.destroy(),r}}function gB(e,t){let r=e.connectionType??cy.Connection;if(e.autoEncrypter)r=cy.CryptoConnection;return new r(t,e)}function mte(e,t){let r=Number(e.maxWireVersion),n=Number(e.minWireVersion),s=!Number.isNaN(r)&&r>=Bi.MIN_SUPPORTED_WIRE_VERSION,i=!Number.isNaN(n)&&n<=Bi.MAX_SUPPORTED_WIRE_VERSION;if(s){if(i)return null;let u=`Server at ${t.hostAddress} reports minimum wire version ${JSON.stringify(e.minWireVersion)}, but this version of the Node.js Driver requires at most ${Bi.MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${Bi.MAX_SUPPORTED_SERVER_VERSION})`;return new Be.MongoCompatibilityError(u)}let o=`Server at ${t.hostAddress} reports maximum wire version ${JSON.stringify(e.maxWireVersion)??0}, but this version of the Node.js Driver requires at least ${Bi.MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${Bi.MIN_SUPPORTED_SERVER_VERSION})`;return new Be.MongoCompatibilityError(o)}async function _B(e,t){let r=t.credentials;if(r){if(r.mechanism!==$a.AuthMechanism.MONGODB_DEFAULT&&!t.authProviders.getOrCreateProvider(r.mechanism,r.mechanismProperties))throw new Be.MongoInvalidArgumentError(`AuthMechanism '${r.mechanism}' not supported`)}let n=new mB.AuthContext(e,r,t);e.authContext=n;let s=await EB(n),i={...t,raw:!1};if(typeof t.connectTimeoutMS==="number")i.socketTimeoutMS=t.connectTimeoutMS;let o=new Date().getTime(),u=await c(s,i);if(!("isWritablePrimary"in u))u.isWritablePrimary=u[fy.LEGACY_HELLO_COMMAND];if(u.helloOk)e.helloOk=!0;let a=mte(u,t);if(a)throw a;if(t.loadBalanced){if(!u.serviceId)throw new Be.MongoCompatibilityError("Driver attempted to initialize in load balancing mode, but the server does not support this mode.")}if(e.hello=u,e.lastHelloMS=new Date().getTime()-o,!u.arbiterOnly&&r){n.response=u;let l=r.resolveAuthMechanism(u),f=t.authProviders.getOrCreateProvider(l.mechanism,l.mechanismProperties);if(!f)throw new Be.MongoInvalidArgumentError(`No AuthProvider for ${l.mechanism} defined.`);try{await f.auth(n)}catch(h){if(h instanceof Be.MongoError){if(h.addErrorLabel(Be.MongoErrorLabel.HandshakeError),Be.needsRetryableWriteLabel(h))h.addErrorLabel(Be.MongoErrorLabel.RetryableWriteError)}throw h}}e.established=!0;async function c(l,f){try{return await e.command(b1.ns("admin.$cmd"),l,f)}catch(h){if(h instanceof Be.MongoError)h.addErrorLabel(Be.MongoErrorLabel.HandshakeError);if(h instanceof Be.MongoNetworkError)yB(h);throw h}}}async function EB(e){let t=e.options,r=t.compressors?t.compressors:[],{serverApi:n}=e.connection,s=await t.metadata,i={[n?.version||t.loadBalanced===!0?"hello":fy.LEGACY_HELLO_COMMAND]:1,backpressure:"2",helloOk:!0,client:s,compression:r};if(t.loadBalanced===!0)i.loadBalanced=!0;let o=e.credentials;if(o){if(o.mechanism===$a.AuthMechanism.MONGODB_DEFAULT&&o.username){i.saslSupportedMechs=`${o.source}.${o.username}`;let a=e.options.authProviders.getOrCreateProvider($a.AuthMechanism.MONGODB_SCRAM_SHA256,o.mechanismProperties);if(!a)throw new Be.MongoInvalidArgumentError(`No AuthProvider for ${$a.AuthMechanism.MONGODB_SCRAM_SHA256} defined.`);return await a.prepare(i,e)}let u=e.options.authProviders.getOrCreateProvider(o.mechanism,o.mechanismProperties);if(!u)throw new Be.MongoInvalidArgumentError(`No AuthProvider for ${o.mechanism} defined.`);return await u.prepare(i,e)}return i}Mn.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS=120000;Mn.LEGAL_TLS_SOCKET_OPTIONS=["allowPartialTrustChain","ALPNProtocols","ca","cert","checkServerIdentity","ciphers","crl","ecdhCurve","key","minDHSize","passphrase","pfx","rejectUnauthorized","secureContext","secureProtocol","servername","session"];Mn.LEGAL_TCP_SOCKET_OPTIONS=["autoSelectFamily","autoSelectFamilyAttemptTimeout","keepAliveInitialDelay","family","hints","localAddress","localPort","lookup"];function j3(e){let t=e.hostAddress;if(!t)throw new Be.MongoInvalidArgumentError('Option "hostAddress" is required');let r={};for(let n of Mn.LEGAL_TCP_SOCKET_OPTIONS)if(e[n]!=null)r[n]=e[n];if(r.keepAliveInitialDelay??=Mn.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS,r.keepAlive=!0,r.noDelay=e.noDelay??!0,typeof t.socketPath==="string")return r.path=t.socketPath,r;else if(typeof t.host==="string")return r.host=t.host,r.port=t.port,r;else throw new Be.MongoRuntimeError(`Unexpected HostAddress ${JSON.stringify(t)}`)}function yte(e){let t=j3(e);for(let r of Mn.LEGAL_TLS_SOCKET_OPTIONS)if(e[r]!=null)t[r]=e[r];if(e.existingSocket)t.socket=e.existingSocket;if(t.servername==null&&t.host&&!hy.isIP(t.host))t.servername=t.host;return t}async function ly(e){let t=e.tls??!1,r=e.connectTimeoutMS??30000,n=e.existingSocket,s=e.keepAliveInitialDelay??Mn.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS,i=e.noDelay??!0,o;if(e.proxyHost!=null)return await _te({...e,connectTimeoutMS:r});if(t){let f=dB.connect(yte(e));if(typeof f.disableRenegotiation==="function")f.disableRenegotiation();o=f}else if(n)o=n;else o=hy.createConnection(j3(e));o.setKeepAlive(!0,s),o.setNoDelay(i),o.setTimeout(r);let u=null,{promise:a,resolve:c,reject:l}=b1.promiseWithResolvers();if(n)c(o);else{let f=performance.now(),h=t?"secureConnect":"connect";if(o.once(h,()=>c(o)).once("error",(d)=>l(new Be.MongoNetworkError(Be.MongoError.buildErrorMessage(d),{cause:d}))).once("timeout",()=>{l(new Be.MongoNetworkTimeoutError(`Socket '${h}' timed out after ${performance.now()-f|0}ms (connectTimeoutMS: ${r})`))}).once("close",()=>l(new Be.MongoNetworkError(`Socket closed after ${performance.now()-f|0} during connection establishment`))),e.cancellationToken!=null)u=()=>l(new Be.MongoNetworkError(`Socket connection establishment was cancelled after ${performance.now()-f|0}`)),e.cancellationToken.once("cancel",u)}try{return o=await a,o}catch(f){throw yB(f),o.destroy(),f}finally{if(o.setTimeout(0),u!=null)e.cancellationToken?.removeListener("cancel",u)}}var Uf=null;function gte(){if(Uf==null){let e=pB.getSocks();if("kModuleError"in e)throw e.kModuleError;Uf=e}return Uf}async function _te(e){let t=b1.HostAddress.fromHostPort(e.proxyHost??"",e.proxyPort??1080),r=await ly({...e,hostAddress:t,tls:!1,proxyHost:void 0}),n=j3(e);if(typeof n.host!=="string"||typeof n.port!=="number")throw new Be.MongoInvalidArgumentError("Can only make Socks5 connections to TCP hosts");Uf??=gte();let s;try{s=(await Uf.SocksClient.createConnection({existing_socket:r,timeout:e.connectTimeoutMS,command:"connect",destination:{host:n.host,port:n.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:e.proxyUsername||void 0,password:e.proxyPassword||void 0}})).socket}catch(i){throw new Be.MongoNetworkError(Be.MongoError.buildErrorMessage(i),{cause:i})}return await ly({...e,existingSocket:s,proxyHost:void 0})}});var dy=g(function(Wr){Object.defineProperty(Wr,"__esModule",{value:!0});Wr.ServerHeartbeatFailedEvent=Wr.ServerHeartbeatSucceededEvent=Wr.ServerHeartbeatStartedEvent=Wr.TopologyClosedEvent=Wr.TopologyOpeningEvent=Wr.TopologyDescriptionChangedEvent=Wr.ServerClosedEvent=Wr.ServerOpeningEvent=Wr.ServerDescriptionChangedEvent=void 0;var cn=Br();class AB{constructor(e,t,r,n){this.name=cn.SERVER_DESCRIPTION_CHANGED,this.topologyId=e,this.address=t,this.previousDescription=r,this.newDescription=n}}Wr.ServerDescriptionChangedEvent=AB;class OB{constructor(e,t){this.name=cn.SERVER_OPENING,this.topologyId=e,this.address=t}}Wr.ServerOpeningEvent=OB;class SB{constructor(e,t){this.name=cn.SERVER_CLOSED,this.topologyId=e,this.address=t}}Wr.ServerClosedEvent=SB;class wB{constructor(e,t,r){this.name=cn.TOPOLOGY_DESCRIPTION_CHANGED,this.topologyId=e,this.previousDescription=t,this.newDescription=r}}Wr.TopologyDescriptionChangedEvent=wB;class CB{constructor(e){this.name=cn.TOPOLOGY_OPENING,this.topologyId=e}}Wr.TopologyOpeningEvent=CB;class bB{constructor(e){this.name=cn.TOPOLOGY_CLOSED,this.topologyId=e}}Wr.TopologyClosedEvent=bB;class DB{constructor(e,t){this.name=cn.SERVER_HEARTBEAT_STARTED,this.connectionId=e,this.awaited=t}}Wr.ServerHeartbeatStartedEvent=DB;class TB{constructor(e,t,r,n){this.name=cn.SERVER_HEARTBEAT_SUCCEEDED,this.connectionId=e,this.duration=t,this.reply=r??{},this.awaited=n}}Wr.ServerHeartbeatSucceededEvent=TB;class MB{constructor(e,t,r,n){this.name=cn.SERVER_HEARTBEAT_FAILED,this.connectionId=e,this.duration=t,this.failure=r,this.awaited=n}}Wr.ServerHeartbeatFailedEvent=MB});var U3=g(function(Jt){Object.defineProperty(Jt,"__esModule",{value:!0});Jt.ConnectionPoolClearedEvent=Jt.ConnectionCheckedInEvent=Jt.ConnectionCheckedOutEvent=Jt.ConnectionCheckOutFailedEvent=Jt.ConnectionCheckOutStartedEvent=Jt.ConnectionClosedEvent=Jt.ConnectionReadyEvent=Jt.ConnectionCreatedEvent=Jt.ConnectionPoolClosedEvent=Jt.ConnectionPoolReadyEvent=Jt.ConnectionPoolCreatedEvent=Jt.ConnectionPoolMonitoringEvent=void 0;var Sr=Br(),D1=he();class ri{constructor(e){this.time=new Date,this.address=e.address}}Jt.ConnectionPoolMonitoringEvent=ri;class PB extends ri{constructor(e){super(e);this.name=Sr.CONNECTION_POOL_CREATED;let{maxConnecting:t,maxPoolSize:r,minPoolSize:n,maxIdleTimeMS:s,waitQueueTimeoutMS:i}=e.options;this.options={maxConnecting:t,maxPoolSize:r,minPoolSize:n,maxIdleTimeMS:s,waitQueueTimeoutMS:i}}}Jt.ConnectionPoolCreatedEvent=PB;class BB extends ri{constructor(e){super(e);this.name=Sr.CONNECTION_POOL_READY}}Jt.ConnectionPoolReadyEvent=BB;class FB extends ri{constructor(e){super(e);this.name=Sr.CONNECTION_POOL_CLOSED}}Jt.ConnectionPoolClosedEvent=FB;class NB extends ri{constructor(e,t){super(e);this.name=Sr.CONNECTION_CREATED,this.connectionId=t.id}}Jt.ConnectionCreatedEvent=NB;class IB extends ri{constructor(e,t,r){super(e);this.name=Sr.CONNECTION_READY,this.durationMS=D1.processTimeMS()-r,this.connectionId=t.id}}Jt.ConnectionReadyEvent=IB;class RB extends ri{constructor(e,t,r,n){super(e);this.name=Sr.CONNECTION_CLOSED,this.connectionId=t.id,this.reason=r,this.serviceId=t.serviceId,this.error=n??null}}Jt.ConnectionClosedEvent=RB;class $B extends ri{constructor(e){super(e);this.name=Sr.CONNECTION_CHECK_OUT_STARTED}}Jt.ConnectionCheckOutStartedEvent=$B;class vB extends ri{constructor(e,t,r,n){super(e);this.name=Sr.CONNECTION_CHECK_OUT_FAILED,this.durationMS=D1.processTimeMS()-r,this.reason=t,this.error=n}}Jt.ConnectionCheckOutFailedEvent=vB;class xB extends ri{constructor(e,t,r){super(e);this.name=Sr.CONNECTION_CHECKED_OUT,this.durationMS=D1.processTimeMS()-r,this.connectionId=t.id}}Jt.ConnectionCheckedOutEvent=xB;class kB extends ri{constructor(e,t){super(e);this.name=Sr.CONNECTION_CHECKED_IN,this.connectionId=t.id}}Jt.ConnectionCheckedInEvent=kB;class qB extends ri{constructor(e,t={}){super(e);this.name=Sr.CONNECTION_POOL_CLEARED,this.serviceId=t.serviceId,this.interruptInUseConnections=t.interruptInUseConnections}}Jt.ConnectionPoolClearedEvent=qB});var z3=g(function(Jo){Object.defineProperty(Jo,"__esModule",{value:!0});Jo.WaitQueueTimeoutError=Jo.PoolClearedOnNetworkError=Jo.PoolClearedError=Jo.PoolClosedError=void 0;var va=X();class jB extends va.MongoDriverError{constructor(e){super("Attempted to check out a connection from closed connection pool");this.address=e.address}get name(){return"MongoPoolClosedError"}}Jo.PoolClosedError=jB;class V3 extends va.MongoNetworkError{constructor(e,t){let r=t?t:`Connection pool for ${e.address} was cleared because another operation failed with: "${e.serverError?.message}"`;super(r,e.serverError?{cause:e.serverError}:void 0);this.address=e.address,this.addErrorLabel(va.MongoErrorLabel.PoolRequestedRetry)}get name(){return"MongoPoolClearedError"}}Jo.PoolClearedError=V3;class LB extends V3{constructor(e){super(e,`Connection to ${e.address} interrupted due to server monitor timeout`)}get name(){return"PoolClearedOnNetworkError"}}Jo.PoolClearedOnNetworkError=LB;class UB extends va.MongoDriverError{constructor(e,t){super(e);this.address=t}get name(){return"MongoWaitQueueTimeoutError"}}Jo.WaitQueueTimeoutError=UB});var HB=g(function(Pn){Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ConnectionPool=Pn.PoolState=void 0;var Fi=require("timers"),or=Br(),wr=X(),py=ei(),VB=ds(),ln=he(),zB=L3(),xa=ay(),dt=U3(),Ni=z3(),WB=T6();Pn.PoolState=Object.freeze({paused:"paused",ready:"ready",closed:"closed"});class Zr extends py.TypedEventEmitter{static{this.CONNECTION_POOL_CREATED=or.CONNECTION_POOL_CREATED}static{this.CONNECTION_POOL_CLOSED=or.CONNECTION_POOL_CLOSED}static{this.CONNECTION_POOL_CLEARED=or.CONNECTION_POOL_CLEARED}static{this.CONNECTION_POOL_READY=or.CONNECTION_POOL_READY}static{this.CONNECTION_CREATED=or.CONNECTION_CREATED}static{this.CONNECTION_READY=or.CONNECTION_READY}static{this.CONNECTION_CLOSED=or.CONNECTION_CLOSED}static{this.CONNECTION_CHECK_OUT_STARTED=or.CONNECTION_CHECK_OUT_STARTED}static{this.CONNECTION_CHECK_OUT_FAILED=or.CONNECTION_CHECK_OUT_FAILED}static{this.CONNECTION_CHECKED_OUT=or.CONNECTION_CHECKED_OUT}static{this.CONNECTION_CHECKED_IN=or.CONNECTION_CHECKED_IN}constructor(e,t){super();if(this.on("error",ln.noop),this.options=Object.freeze({connectionType:xa.Connection,...t,maxPoolSize:t.maxPoolSize??100,minPoolSize:t.minPoolSize??0,maxConnecting:t.maxConnecting??2,maxIdleTimeMS:t.maxIdleTimeMS??0,waitQueueTimeoutMS:t.waitQueueTimeoutMS??0,minPoolSizeCheckFrequencyMS:t.minPoolSizeCheckFrequencyMS??100,autoEncrypter:t.autoEncrypter}),this.options.minPoolSize>this.options.maxPoolSize)throw new wr.MongoInvalidArgumentError("Connection pool minimum size must not be greater than maximum pool size");this.poolState=Pn.PoolState.paused,this.server=e,this.connections=new ln.List,this.pending=0,this.checkedOut=new Set,this.minPoolSizeTimer=void 0,this.generation=0,this.serviceGenerations=new Map,this.connectionCounter=ln.makeCounter(1),this.cancellationToken=new py.CancellationToken,this.cancellationToken.setMaxListeners(1/0),this.waitQueue=new ln.List,this.metrics=new WB.ConnectionPoolMetrics,this.processingWaitQueue=!1,this.mongoLogger=this.server.topology.client?.mongoLogger,this.component="connection",queueMicrotask(()=>{this.emitAndLog(Zr.CONNECTION_POOL_CREATED,new dt.ConnectionPoolCreatedEvent(this))})}get address(){return this.options.hostAddress.toString()}get closed(){return this.poolState===Pn.PoolState.closed}get totalConnectionCount(){return this.availableConnectionCount+this.pendingConnectionCount+this.currentCheckedOutCount}get availableConnectionCount(){return this.connections.length}get pendingConnectionCount(){return this.pending}get currentCheckedOutCount(){return this.checkedOut.size}get waitQueueSize(){return this.waitQueue.length}get loadBalanced(){return this.options.loadBalanced}get serverError(){return this.server.description.error}get checkedOutConnections(){return this.checkedOut}waitQueueErrorMetrics(){return this.metrics.info(this.options.maxPoolSize)}ready(){if(this.poolState!==Pn.PoolState.paused)return;this.poolState=Pn.PoolState.ready,this.emitAndLog(Zr.CONNECTION_POOL_READY,new dt.ConnectionPoolReadyEvent(this)),Fi.clearTimeout(this.minPoolSizeTimer),this.ensureMinPoolSize()}async checkOut(e){let t=ln.processTimeMS();this.emitAndLog(Zr.CONNECTION_CHECK_OUT_STARTED,new dt.ConnectionCheckOutStartedEvent(this));let{promise:r,resolve:n,reject:s}=ln.promiseWithResolvers(),i=e.timeoutContext.connectionCheckoutTimeout,o={resolve:n,reject:s,cancelled:!1,checkoutTime:t},u=ln.addAbortListener(e.signal,function(){o.cancelled=!0,s(this.reason)});this.waitQueue.push(o),queueMicrotask(()=>this.processWaitQueue());try{return i?.throwIfExpired(),await(i?Promise.race([r,i]):r)}catch(a){if(VB.TimeoutError.is(a)){i?.clear(),o.cancelled=!0,this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,"timeout",o.checkoutTime));let c=new Ni.WaitQueueTimeoutError(this.loadBalanced?this.waitQueueErrorMetrics():"Timed out while checking out a connection from connection pool",this.address);if(e.timeoutContext.csotEnabled())throw new wr.MongoOperationTimeoutError("Timed out during connection checkout",{cause:c});throw c}throw a}finally{u?.[ln.kDispose](),i?.clear()}}checkIn(e){if(!this.checkedOut.has(e))return;let t=this.closed,r=this.connectionIsStale(e),n=!!(t||r||e.closed);if(!n)e.markAvailable(),this.connections.unshift(e);if(this.checkedOut.delete(e),this.emitAndLog(Zr.CONNECTION_CHECKED_IN,new dt.ConnectionCheckedInEvent(this,e)),n){let s=e.closed?"error":t?"poolClosed":"stale";this.destroyConnection(e,s)}queueMicrotask(()=>this.processWaitQueue())}clear(e={}){if(this.closed)return;if(this.loadBalanced){let{serviceId:s}=e;if(!s)throw new wr.MongoRuntimeError("ConnectionPool.clear() called in load balanced mode with no serviceId.");let i=s.toHexString(),o=this.serviceGenerations.get(i);if(o==null)throw new wr.MongoRuntimeError("Service generations are required in load balancer mode.");else this.serviceGenerations.set(i,o+1);this.emitAndLog(Zr.CONNECTION_POOL_CLEARED,new dt.ConnectionPoolClearedEvent(this,{serviceId:s}));return}let t=e.interruptInUseConnections??!1,r=this.generation;this.generation+=1;let n=this.poolState===Pn.PoolState.paused;if(this.poolState=Pn.PoolState.paused,this.clearMinPoolSizeTimer(),!n)this.emitAndLog(Zr.CONNECTION_POOL_CLEARED,new dt.ConnectionPoolClearedEvent(this,{interruptInUseConnections:t}));if(t)queueMicrotask(()=>this.interruptInUseConnections(r));this.processWaitQueue()}interruptInUseConnections(e){for(let t of this.checkedOut)if(t.generation<=e)t.onError(new Ni.PoolClearedOnNetworkError(this))}closeCheckedOutConnections(){for(let e of this.checkedOut)e.onError(new wr.MongoClientClosedError)}close(){if(this.closed)return;if(this.cancellationToken.emit("cancel"),typeof this.connectionCounter.return==="function")this.connectionCounter.return(void 0);this.poolState=Pn.PoolState.closed,this.clearMinPoolSizeTimer(),this.processWaitQueue();for(let e of this.connections)this.emitAndLog(Zr.CONNECTION_CLOSED,new dt.ConnectionClosedEvent(this,e,"poolClosed")),e.destroy();this.connections.clear(),this.emitAndLog(Zr.CONNECTION_POOL_CLOSED,new dt.ConnectionPoolClosedEvent(this))}async reauthenticate(e){let t=e.authContext;if(!t)throw new wr.MongoRuntimeError("No auth context found on connection.");let r=t.credentials;if(!r)throw new wr.MongoMissingCredentialsError("Connection is missing credentials when asked to reauthenticate");let n=r.resolveAuthMechanism(e.hello),s=this.server.topology.client.s.authProviders.getOrCreateProvider(n.mechanism,n.mechanismProperties);if(!s)throw new wr.MongoMissingCredentialsError(`Reauthenticate failed due to no auth provider for ${r.mechanism}`);await s.reauth(t);return}clearMinPoolSizeTimer(){let e=this.minPoolSizeTimer;if(e)Fi.clearTimeout(e)}destroyConnection(e,t){this.emitAndLog(Zr.CONNECTION_CLOSED,new dt.ConnectionClosedEvent(this,e,t)),e.destroy()}connectionIsStale(e){let t=e.serviceId;if(this.loadBalanced&&t){let r=t.toHexString(),n=this.serviceGenerations.get(r);return e.generation!==n}return e.generation!==this.generation}connectionIsIdle(e){return!!(this.options.maxIdleTimeMS&&e.idleTime>this.options.maxIdleTimeMS)}destroyConnectionIfPerished(e){let t=this.connectionIsStale(e),r=this.connectionIsIdle(e);if(!t&&!r&&!e.closed)return!1;let n=e.closed?"error":t?"stale":"idle";return this.destroyConnection(e,n),!0}createConnection(e){let t={...this.options,id:this.connectionCounter.next().value,generation:this.generation,cancellationToken:this.cancellationToken,mongoLogger:this.mongoLogger,authProviders:this.server.topology.client.s.authProviders,metadata:this.server.topology.client.options.metadata};this.pending++;let r=ln.processTimeMS();this.emitAndLog(Zr.CONNECTION_CREATED,new dt.ConnectionCreatedEvent(this,{id:t.id})),zB.connect(t).then((n)=>{if(this.poolState!==Pn.PoolState.ready){this.pending--,n.destroy(),e(this.closed?new Ni.PoolClosedError(this):new Ni.PoolClearedError(this));return}for(let s of[...or.APM_EVENTS,xa.Connection.CLUSTER_TIME_RECEIVED])n.on(s,(i)=>this.emit(s,i));if(this.loadBalanced){n.on(xa.Connection.PINNED,(i)=>this.metrics.markPinned(i)),n.on(xa.Connection.UNPINNED,(i)=>this.metrics.markUnpinned(i));let s=n.serviceId;if(s){let i,o=s.toHexString();if(i=this.serviceGenerations.get(o))n.generation=i;else this.serviceGenerations.set(o,0),n.generation=0}}n.markAvailable(),this.emitAndLog(Zr.CONNECTION_READY,new dt.ConnectionReadyEvent(this,n,r)),this.pending--,e(void 0,n)},(n)=>{if(this.pending--,this.server.handleError(n),this.emitAndLog(Zr.CONNECTION_CLOSED,new dt.ConnectionClosedEvent(this,{id:t.id,serviceId:void 0},"error",n)),n instanceof wr.MongoNetworkError||n instanceof wr.MongoServerError)n.connectionGeneration=t.generation;e(n??new wr.MongoRuntimeError("Connection creation failed without error"))})}ensureMinPoolSize(){let e=this.options.minPoolSize;if(this.poolState!==Pn.PoolState.ready)return;if(this.connections.prune((t)=>this.destroyConnectionIfPerished(t)),this.totalConnectionCount<e&&this.pendingConnectionCount<this.options.maxConnecting)this.createConnection((t,r)=>{if(!t&&r)this.connections.push(r),queueMicrotask(()=>this.processWaitQueue());if(this.poolState===Pn.PoolState.ready)Fi.clearTimeout(this.minPoolSizeTimer),this.minPoolSizeTimer=Fi.setTimeout(()=>this.ensureMinPoolSize(),this.options.minPoolSizeCheckFrequencyMS)});else Fi.clearTimeout(this.minPoolSizeTimer),this.minPoolSizeTimer=Fi.setTimeout(()=>this.ensureMinPoolSize(),this.options.minPoolSizeCheckFrequencyMS)}processWaitQueue(){if(this.processingWaitQueue)return;this.processingWaitQueue=!0;while(this.waitQueueSize){let r=this.waitQueue.first();if(!r){this.waitQueue.shift();continue}if(r.cancelled){this.waitQueue.shift();continue}if(this.poolState!==Pn.PoolState.ready){let s=this.closed?"poolClosed":"connectionError",i=this.closed?new Ni.PoolClosedError(this):new Ni.PoolClearedError(this);this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,s,r.checkoutTime,i)),this.waitQueue.shift(),r.reject(i);continue}if(!this.availableConnectionCount)break;let n=this.connections.shift();if(!n)break;if(!this.destroyConnectionIfPerished(n))this.checkedOut.add(n),this.emitAndLog(Zr.CONNECTION_CHECKED_OUT,new dt.ConnectionCheckedOutEvent(this,n,r.checkoutTime)),this.waitQueue.shift(),r.resolve(n)}let{maxPoolSize:e,maxConnecting:t}=this.options;while(this.waitQueueSize>0&&this.pendingConnectionCount<t&&(e===0||this.totalConnectionCount<e)){let r=this.waitQueue.shift();if(!r||r.cancelled)continue;this.createConnection((n,s)=>{if(r.cancelled){if(!n&&s)this.connections.push(s)}else if(n)this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,"connectionError",r.checkoutTime,n)),r.reject(n);else if(s)this.checkedOut.add(s),this.emitAndLog(Zr.CONNECTION_CHECKED_OUT,new dt.ConnectionCheckedOutEvent(this,s,r.checkoutTime)),r.resolve(s);queueMicrotask(()=>this.processWaitQueue())})}this.processingWaitQueue=!1}}Pn.ConnectionPool=Zr});var K3=g(function(yy){Object.defineProperty(yy,"__esModule",{value:!0});yy.Server=void 0;var GB=ay(),YB=HB(),JB=z3(),Hr=Br(),Fe=X(),QB=ei(),XB=Af(),T1=M6(),Ii=he(),my=fs(),Ce=Ds(),ZB=G3(),M1=jf(),eF=Sl(),Vf=Ii.makeStateMachine({[Ce.STATE_CLOSED]:[Ce.STATE_CLOSED,Ce.STATE_CONNECTING],[Ce.STATE_CONNECTING]:[Ce.STATE_CONNECTING,Ce.STATE_CLOSING,Ce.STATE_CONNECTED,Ce.STATE_CLOSED],[Ce.STATE_CONNECTED]:[Ce.STATE_CONNECTED,Ce.STATE_CLOSING,Ce.STATE_CLOSED],[Ce.STATE_CLOSING]:[Ce.STATE_CLOSING,Ce.STATE_CLOSED]});class Fc extends QB.TypedEventEmitter{static{this.SERVER_HEARTBEAT_STARTED=Hr.SERVER_HEARTBEAT_STARTED}static{this.SERVER_HEARTBEAT_SUCCEEDED=Hr.SERVER_HEARTBEAT_SUCCEEDED}static{this.SERVER_HEARTBEAT_FAILED=Hr.SERVER_HEARTBEAT_FAILED}static{this.CONNECT=Hr.CONNECT}static{this.DESCRIPTION_RECEIVED=Hr.DESCRIPTION_RECEIVED}static{this.CLOSED=Hr.CLOSED}static{this.ENDED=Hr.ENDED}constructor(e,t,r){super();this.on("error",Ii.noop),this.serverApi=r.serverApi;let n={hostAddress:t.hostAddress,...r};this.topology=e,this.pool=new YB.ConnectionPool(this,n),this.s={description:t,options:r,state:Ce.STATE_CLOSED,operationCount:0};for(let s of[...Hr.CMAP_EVENTS,...Hr.APM_EVENTS])this.pool.on(s,(i)=>this.emit(s,i));if(this.pool.on(GB.Connection.CLUSTER_TIME_RECEIVED,(s)=>{this.clusterTime=s}),this.loadBalanced){this.monitor=null;return}this.monitor=new ZB.Monitor(this,this.s.options);for(let s of Hr.HEARTBEAT_EVENTS)this.monitor.on(s,(i)=>this.emit(s,i));this.monitor.on("resetServer",(s)=>W3(this,s)),this.monitor.on(Fc.SERVER_HEARTBEAT_SUCCEEDED,(s)=>{if(this.emit(Fc.DESCRIPTION_RECEIVED,new M1.ServerDescription(this.description.hostAddress,s.reply,{roundTripTime:this.monitor?.roundTripTime,minRoundTripTime:this.monitor?.minRoundTripTime})),this.s.state===Ce.STATE_CONNECTING)Vf(this,Ce.STATE_CONNECTED),this.emit(Fc.CONNECT,this)})}get clusterTime(){return this.topology.clusterTime}set clusterTime(e){this.topology.clusterTime=e}get description(){return this.s.description}get name(){return this.s.description.address}get autoEncrypter(){if(this.s.options&&this.s.options.autoEncrypter)return this.s.options.autoEncrypter;return}get loadBalanced(){return this.topology.description.type===Ce.TopologyType.LoadBalanced}connect(){if(this.s.state!==Ce.STATE_CLOSED)return;if(Vf(this,Ce.STATE_CONNECTING),!this.loadBalanced)this.monitor?.connect();else Vf(this,Ce.STATE_CONNECTED),this.emit(Fc.CONNECT,this)}closeCheckedOutConnections(){return this.pool.closeCheckedOutConnections()}close(){if(this.s.state===Ce.STATE_CLOSED)return;if(Vf(this,Ce.STATE_CLOSING),!this.loadBalanced)this.monitor?.close();this.pool.close(),Vf(this,Ce.STATE_CLOSED),this.emit("closed")}requestCheck(){if(!this.loadBalanced)this.monitor?.requestCheck()}async command(e,t){if(this.s.state===Ce.STATE_CLOSING||this.s.state===Ce.STATE_CLOSED)throw new Fe.MongoServerClosedError;let r=e.session,n=r?.pinnedConnection;if(this.incrementOperationCount(),n==null)try{n=await this.pool.checkOut({timeoutContext:t,signal:e.options.signal})}catch(l){if(this.decrementOperationCount(),!(l instanceof JB.PoolClearedError))this.handleError(l);throw l}let s=null,i=()=>{if(this.decrementOperationCount(),r?.pinnedConnection!==n)if(s!=null){let l=()=>{this.pool.checkIn(n)};s.then(l,l)}else this.pool.checkIn(n)},o;try{o=e.buildCommand(n,r)}catch(l){throw i(),l}let u=e.buildOptions(t),a=e.ns;if(this.loadBalanced&&Ete(o,r)&&!r?.pinnedConnection)r?.pin(n);if(u.directConnection=this.topology.s.options.directConnection,e instanceof XB.AggregateOperation&&e.hasWriteStage&&Ii.maxWireVersion(n)<eF.MIN_SECONDARY_WRITE_WIRE_VERSION)delete u.readPreference;if(this.description.iscryptd)u.omitMaxTimeMS=!0;try{try{let l=await n.command(a,o,u,e.SERVER_COMMAND_RESPONSE_TYPE);return my.throwIfWriteConcernError(l),l}catch(l){throw this.decorateCommandError(n,o,u,l)}}catch(l){if(l instanceof Fe.MongoError&&l.code?.valueOf()===Fe.MONGODB_ERROR_CODES.Reauthenticate){s=this.pool.reauthenticate(n),s.then(void 0,(f)=>{s=null,Ii.squashError(f)}),await Ii.abortable(s,u),s=null;try{let f=await n.command(a,o,u,e.SERVER_COMMAND_RESPONSE_TYPE);return my.throwIfWriteConcernError(f),f}catch(f){throw this.decorateCommandError(n,o,u,f)}}else throw l}finally{i()}}handleError(e,t){if(!(e instanceof Fe.MongoError))return;if(Ote(this,e))return;let r=e instanceof Fe.MongoNetworkError&&!(e instanceof Fe.MongoNetworkTimeoutError),n=e instanceof Fe.MongoNetworkError&&e.beforeHandshake,s=e.hasErrorLabel(Fe.MongoErrorLabel.HandshakeError),i=e.hasErrorLabel(Fe.MongoErrorLabel.SystemOverloadedError);if(Fe.isStateChangeError(e)||e instanceof Fe.MongoParseError){let o=Fe.isNodeShuttingDownError(e);if(!this.loadBalanced){if(o)e.addErrorLabel(Fe.MongoErrorLabel.ResetPool);W3(this,e),queueMicrotask(()=>this.requestCheck());return}if(t&&o)this.pool.clear({serviceId:t.serviceId})}else if(r||n||s){if(i)return;if(!this.loadBalanced)e.addErrorLabel(Fe.MongoErrorLabel.ResetPool),W3(this,e);else if(t)this.pool.clear({serviceId:t.serviceId})}}decorateCommandError(e,t,r,n){if(typeof n!=="object"||n==null||!("name"in n))throw new Fe.MongoRuntimeError("An unexpected error type: "+typeof n);if(n.name==="AbortError"&&"cause"in n&&n.cause instanceof Fe.MongoError)n=n.cause;if(!(n instanceof Fe.MongoError))return n;if(Ate(this.pool,e))return n;let s=r?.session;if(n instanceof Fe.MongoNetworkError){if(s&&!s.hasEnded&&s.serverSession)s.serverSession.isDirty=!0;if(H3(s,t)&&!n.hasErrorLabel(Fe.MongoErrorLabel.TransientTransactionError))n.addErrorLabel(Fe.MongoErrorLabel.TransientTransactionError);if((KB(this.topology)||T1.isTransactionCommand(t))&&Ii.supportsRetryableWrites(this)&&!H3(s,t))n.addErrorLabel(Fe.MongoErrorLabel.RetryableWriteError)}else if((KB(this.topology)||T1.isTransactionCommand(t))&&Fe.needsRetryableWriteLabel(n)&&!H3(s,t))n.addErrorLabel(Fe.MongoErrorLabel.RetryableWriteError);if(s&&s.isPinned&&n.hasErrorLabel(Fe.MongoErrorLabel.TransientTransactionError))s.unpin({force:!0});return this.handleError(n,e),n}decrementOperationCount(){return this.s.operationCount-=1}incrementOperationCount(){return this.s.operationCount+=1}}yy.Server=Fc;function W3(e,t){if(e.loadBalanced)return;if(t instanceof Fe.MongoNetworkError&&!(t instanceof Fe.MongoNetworkTimeoutError))e.monitor?.reset();e.emit(Fc.DESCRIPTION_RECEIVED,new M1.ServerDescription(e.description.hostAddress,void 0,{error:t}))}function Ete(e,t){if(t)return t.inTransaction()||t.transaction.isCommitted&&"commitTransaction"in e||"aggregate"in e||"find"in e||"getMore"in e||"listCollections"in e||"listIndexes"in e||"bulkWrite"in e;return!1}function Ate(e,t){if(t.serviceId)return t.generation!==e.serviceGenerations.get(t.serviceId.toHexString());return t.generation!==e.generation}function H3(e,t){return e&&e.inTransaction()&&!T1.isTransactionCommand(t)}function KB(e){return e.s.options.retryWrites!==!1}function Ote(e,t){let r=e.pool.generation,n=t.connectionGeneration;if(n&&n<r)return!0;let s=e.description.topologyVersion;return M1.compareTopologyVersion(s,t.topologyVersion)>=0}});var G3=g(function(vs){Object.defineProperty(vs,"__esModule",{value:!0});vs.RTTSampler=vs.MonitorInterval=vs.RTTPinger=vs.Monitor=vs.ServerMonitoringMode=void 0;var Gn=require("timers"),gy=Te(),ka=L3(),nF=n3(),F1=Br(),Ri=X(),sF=fa(),_y=ei(),pt=he(),mt=Ds(),Qo=dy(),Xo=K3(),P1="idle",Nc="monitoring",B1=pt.makeStateMachine({[mt.STATE_CLOSING]:[mt.STATE_CLOSING,P1,mt.STATE_CLOSED],[mt.STATE_CLOSED]:[mt.STATE_CLOSED,Nc],[P1]:[P1,Nc,mt.STATE_CLOSING],[Nc]:[Nc,P1,mt.STATE_CLOSING]}),Ste=new Set([mt.STATE_CLOSING,mt.STATE_CLOSED,Nc]);function zf(e){return e.s.state===mt.STATE_CLOSED||e.s.state===mt.STATE_CLOSING}vs.ServerMonitoringMode=Object.freeze({auto:"auto",poll:"poll",stream:"stream"});class iF extends _y.TypedEventEmitter{constructor(e,t){super();this.component=sF.MongoLoggableComponent.TOPOLOGY,this.on("error",pt.noop),this.server=e,this.connection=null,this.cancellationToken=new _y.CancellationToken,this.cancellationToken.setMaxListeners(1/0),this.monitorId=void 0,this.s={state:mt.STATE_CLOSED},this.address=e.description.address,this.options=Object.freeze({connectTimeoutMS:t.connectTimeoutMS??1e4,heartbeatFrequencyMS:t.heartbeatFrequencyMS??1e4,minHeartbeatFrequencyMS:t.minHeartbeatFrequencyMS??500,serverMonitoringMode:t.serverMonitoringMode}),this.isRunningInFaasEnv=nF.getFAASEnv()!=null,this.mongoLogger=this.server.topology.client?.mongoLogger,this.rttSampler=new Q3(10);let r=this.cancellationToken,n={id:"<monitor>",generation:e.pool.generation,cancellationToken:r,hostAddress:e.description.hostAddress,...t,raw:!1,useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!0};if(delete n.credentials,n.autoEncrypter)delete n.autoEncrypter;this.connectOptions=Object.freeze(n)}connect(){if(this.s.state!==mt.STATE_CLOSED)return;let e=this.options.heartbeatFrequencyMS,t=this.options.minHeartbeatFrequencyMS;this.monitorId=new Ey(rF(this),{heartbeatFrequencyMS:e,minHeartbeatFrequencyMS:t,immediate:!0})}requestCheck(){if(Ste.has(this.s.state))return;this.monitorId?.wake()}reset(){let e=this.server.description.topologyVersion;if(zf(this)||e==null)return;B1(this,mt.STATE_CLOSING),tF(this),B1(this,P1);let t=this.options.heartbeatFrequencyMS,r=this.options.minHeartbeatFrequencyMS;this.monitorId=new Ey(rF(this),{heartbeatFrequencyMS:t,minHeartbeatFrequencyMS:r})}close(){if(zf(this))return;B1(this,mt.STATE_CLOSING),tF(this),this.emit("close"),B1(this,mt.STATE_CLOSED)}get roundTripTime(){return this.rttSampler.average()}get minRoundTripTime(){return this.rttSampler.min()}get latestRtt(){return this.rttSampler.last}addRttSample(e){this.rttSampler.addSample(e)}clearRttSamples(){this.rttSampler.clear()}}vs.Monitor=iF;function tF(e){e.monitorId?.stop(),e.monitorId=void 0,e.rttPinger?.close(),e.rttPinger=void 0,e.cancellationToken.emit("cancel"),e.connection?.destroy(),e.connection=null,e.clearRttSamples()}function Y3(e,t){if(t==null)return!1;let r=e.options.serverMonitoringMode;if(r===vs.ServerMonitoringMode.poll)return!1;if(r===vs.ServerMonitoringMode.stream)return!0;if(e.isRunningInFaasEnv)return!1;return!0}function wte(e,t){let r,n,s=e.server.description.topologyVersion,i=Y3(e,s);e.emitAndLogHeartbeat(Xo.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new Qo.ServerHeartbeatStartedEvent(e.address,i));function o(c){e.connection?.destroy(),e.connection=null,e.emitAndLogHeartbeat(Xo.Server.SERVER_HEARTBEAT_FAILED,e.server.topology.s.id,void 0,new Qo.ServerHeartbeatFailedEvent(e.address,pt.calculateDurationInMs(r),c,n));let l=!(c instanceof Ri.MongoError)?new Ri.MongoError(Ri.MongoError.buildErrorMessage(c),{cause:c}):c;if(l.addErrorLabel(Ri.MongoErrorLabel.ResetPool),l instanceof Ri.MongoNetworkTimeoutError)l.addErrorLabel(Ri.MongoErrorLabel.InterruptInUseConnections);e.emit("resetServer",l),t(c)}function u(c){if(!("isWritablePrimary"in c))c.isWritablePrimary=c[F1.LEGACY_HELLO_COMMAND];let l=i&&e.rttPinger?e.rttPinger.latestRtt??pt.calculateDurationInMs(r):pt.calculateDurationInMs(r);if(e.addRttSample(l),e.emitAndLogHeartbeat(Xo.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,c.connectionId,new Qo.ServerHeartbeatSucceededEvent(e.address,l,c,i)),i)e.emitAndLogHeartbeat(Xo.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new Qo.ServerHeartbeatStartedEvent(e.address,!0)),r=pt.processTimeMS();else e.rttPinger?.close(),e.rttPinger=void 0,t(void 0,c)}let{connection:a}=e;if(a&&!a.closed){let{serverApi:c,helloOk:l}=a,f=e.options.connectTimeoutMS,h=e.options.heartbeatFrequencyMS,d={[c?.version||l?"hello":F1.LEGACY_HELLO_COMMAND]:1,...i&&s?{maxAwaitTimeMS:h,topologyVersion:Cte(s)}:{}},p=i?{socketTimeoutMS:f?f+h:0,exhaustAllowed:!0}:{socketTimeoutMS:f};if(i&&e.rttPinger==null)e.rttPinger=new J3(e);if(r=pt.processTimeMS(),i)return n=!0,a.exhaustCommand(pt.ns("admin.$cmd"),d,p,(m,_)=>{if(m)return o(m);return u(_)});n=!1,a.command(pt.ns("admin.$cmd"),d,p).then(u,o);return}(async()=>{let c=await ka.makeSocket(e.connectOptions),l=ka.makeConnection(e.connectOptions,c);r=pt.processTimeMS();try{return await ka.performInitialHandshake(l,e.connectOptions),l}catch(f){throw l.destroy(),f}})().then((c)=>{if(zf(e)){c.destroy();return}let l=pt.calculateDurationInMs(r);e.addRttSample(l),e.connection=c,e.emitAndLogHeartbeat(Xo.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,c.hello?.connectionId,new Qo.ServerHeartbeatSucceededEvent(e.address,l,c.hello,Y3(e,c.hello?.topologyVersion))),t(void 0,c.hello)},(c)=>{e.connection=null,n=!1,o(c)})}function rF(e){return(t)=>{if(e.s.state===Nc){queueMicrotask(t);return}B1(e,Nc);function r(){if(!zf(e))B1(e,P1);t()}wte(e,(n,s)=>{if(n){if(e.server.description.type===mt.ServerType.Unknown)return r()}if(Y3(e,s?.topologyVersion))Gn.setTimeout(()=>{if(!zf(e))e.monitorId?.wake()},0);r()})}}function Cte(e){return{processId:e.processId,counter:gy.Long.isLong(e.counter)?e.counter:gy.Long.fromNumber(e.counter)}}class J3{constructor(e){this.connection=void 0,this.cancellationToken=e.cancellationToken,this.closed=!1,this.monitor=e,this.latestRtt=e.latestRtt??void 0;let t=e.options.heartbeatFrequencyMS;this.monitorId=Gn.setTimeout(()=>this.measureRoundTripTime(),t)}get roundTripTime(){return this.monitor.roundTripTime}get minRoundTripTime(){return this.monitor.minRoundTripTime}close(){this.closed=!0,Gn.clearTimeout(this.monitorId),this.connection?.destroy(),this.connection=void 0}measureAndReschedule(e,t){if(this.closed){t?.destroy();return}if(this.connection==null)this.connection=t;this.latestRtt=pt.calculateDurationInMs(e),this.monitorId=Gn.setTimeout(()=>this.measureRoundTripTime(),this.monitor.options.heartbeatFrequencyMS)}measureRoundTripTime(){let e=pt.processTimeMS();if(this.closed)return;let t=this.connection;if(t==null){ka.connect(this.monitor.connectOptions).then((n)=>{this.measureAndReschedule(e,n)},()=>{this.connection=void 0});return}let r=t.serverApi?.version||t.helloOk?"hello":F1.LEGACY_HELLO_COMMAND;t.command(pt.ns("admin.$cmd"),{[r]:1},void 0).then(()=>this.measureAndReschedule(e),()=>{this.connection?.destroy(),this.connection=void 0;return})}}vs.RTTPinger=J3;class Ey{constructor(e,t={}){if(this.isExpeditedCallToFnScheduled=!1,this.stopped=!1,this.isExecutionInProgress=!1,this.hasExecutedOnce=!1,this._executeAndReschedule=()=>{if(this.stopped)return;if(this.timerId)Gn.clearTimeout(this.timerId);this.isExpeditedCallToFnScheduled=!1,this.isExecutionInProgress=!0,this.fn(()=>{this.lastExecutionEnded=pt.processTimeMS(),this.isExecutionInProgress=!1,this._reschedule(this.heartbeatFrequencyMS)})},this.fn=e,this.lastExecutionEnded=-1/0,this.heartbeatFrequencyMS=t.heartbeatFrequencyMS??1000,this.minHeartbeatFrequencyMS=t.minHeartbeatFrequencyMS??500,t.immediate)this._executeAndReschedule();else this._reschedule(void 0)}wake(){let t=pt.processTimeMS()-this.lastExecutionEnded;if(t<0)return this._executeAndReschedule();if(this.isExecutionInProgress)return;if(this.isExpeditedCallToFnScheduled)return;if(t<this.minHeartbeatFrequencyMS){this.isExpeditedCallToFnScheduled=!0,this._reschedule(this.minHeartbeatFrequencyMS-t);return}this._executeAndReschedule()}stop(){if(this.stopped=!0,this.timerId)Gn.clearTimeout(this.timerId),this.timerId=void 0;this.lastExecutionEnded=-1/0,this.isExpeditedCallToFnScheduled=!1}toString(){return JSON.stringify(this)}toJSON(){let e=pt.processTimeMS(),t=e-this.lastExecutionEnded;return{timerId:this.timerId!=null?"set":"cleared",lastCallTime:this.lastExecutionEnded,isExpeditedCheckScheduled:this.isExpeditedCallToFnScheduled,stopped:this.stopped,heartbeatFrequencyMS:this.heartbeatFrequencyMS,minHeartbeatFrequencyMS:this.minHeartbeatFrequencyMS,currentTime:e,timeSinceLastCall:t}}_reschedule(e){if(this.stopped)return;if(this.timerId)Gn.clearTimeout(this.timerId);this.timerId=Gn.setTimeout(this._executeAndReschedule,e||this.heartbeatFrequencyMS)}}vs.MonitorInterval=Ey;class Q3{constructor(e=10){this.rttSamples=new Float64Array(e),this.length=0,this.writeIndex=0}addSample(e){if(this.rttSamples[this.writeIndex++]=e,this.length<this.rttSamples.length)this.length++;this.writeIndex%=this.rttSamples.length}min(){if(this.length<2)return 0;let e=this.rttSamples[0];for(let t=1;t<this.length;t++)if(this.rttSamples[t]<e)e=this.rttSamples[t];return e}average(){if(this.length===0)return 0;let e=0;for(let t=0;t<this.length;t++)e+=this.rttSamples[t];return e/this.length}get last(){if(this.length===0)return null;return this.rttSamples[this.writeIndex===0?this.length-1:this.writeIndex-1]}clear(){this.length=0,this.writeIndex=0}}vs.RTTSampler=Q3});var tA=g(function(ms){Object.defineProperty(ms,"__esModule",{value:!0});ms.DEFAULT_OPTIONS=ms.OPTIONS=void 0;ms.resolveSRVRecord=Nte;ms.parseOptions=Rte;var N1=require("dns"),bte=O3(),Yn=require("process"),cF=require("url"),$i=Em(),Kr=Uo(),Ay=pf(),Oy=IP(),R=X(),qa=Pc(),R1=fa(),I1=lo(),fn=Xr(),lF=RP(),hF=G3(),Xe=he(),hn=fs(),X3=["authSource","replicaSet","loadBalanced"],Dte=["srvMaxHosts","srvServiceName","srvAllowedHostsSuffix","srvHostValidator"],oF=new Set(["test","localhost","invalid","example","local","internal","corp","home","mail"]),Tte="loadBalanced option only supported with a single host in the URI",Mte="loadBalanced option not supported with a replicaSet option",Pte="loadBalanced option not supported when directConnection is provided";function fF(e){let t=e==="SRV"?(r)=>N1.promises.resolve(r,"SRV"):(r)=>N1.promises.resolve(r,"TXT");return async function(n){try{return await t(n)}catch(s){if(s.code===N1.TIMEOUT)return await t(n);else throw s}}}var Bte=fF("SRV"),Fte=fF("TXT");async function Nte(e){if(typeof e.srvHost!=="string")throw new R.MongoAPIError('Option "srvHost" must not be empty');let t=e.srvHost,r=Fte(t);r.then(void 0,Xe.squashError);let n=`_${e.srvServiceName}._tcp.${t}`,s=await Bte(n);if(s.length===0)throw new R.MongoAPIError("No addresses found at host");let i=s.map(({name:h,port:d})=>{let p=Xe.normalizeDnsName(h);return Xe.verifySrvHost(p,t,e),Xe.HostAddress.fromString(`${p}:${d??27017}`)});Z3(i,e,!0);let o;try{o=await r}catch(h){if(h.code!=="ENODATA"&&h.code!=="ENOTFOUND")throw h;return i}if(o.length>1)throw new R.MongoParseError("Multiple text records not allowed");let u=new cF.URLSearchParams(o[0].join(""));if([...u.keys()].some((h)=>!X3.includes(h)))throw new R.MongoParseError(`Text record may only set any of: ${X3.join(", ")}`);if(X3.some((h)=>u.get(h)===""))throw new R.MongoParseError("Cannot have empty URI params in DNS TXT Record");let c=u.get("authSource")??void 0,l=u.get("replicaSet")??void 0,f=u.get("loadBalanced")??void 0;if(!e.userSpecifiedAuthSource&&c&&e.credentials&&!Kr.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(e.credentials.mechanism))e.credentials=$i.MongoCredentials.merge(e.credentials,{source:c});if(!e.userSpecifiedReplicaSet&&l)e.replicaSet=l;if(f==="true")e.loadBalanced=!0;if(e.replicaSet&&e.srvMaxHosts>0)throw new R.MongoParseError("Cannot combine replicaSet option with srvMaxHosts");return Z3(i,e,!0),i}function Ite(e){if(!e)return;let t=(r,n)=>{if(e.has(r)&&e.has(n))throw new R.MongoAPIError(`The '${r}' option cannot be used with the '${n}' option`)};t("tlsInsecure","tlsAllowInvalidCertificates"),t("tlsInsecure","tlsAllowInvalidHostnames")}function Nu(e,t){if(typeof t==="boolean")return t;switch(t){case"true":return!0;case"false":return!1;default:throw new R.MongoParseError(`${e} must be either "true" or "false"`)}}function eA(e,t){let r=Xe.parseInteger(t);if(r!=null)return r;throw new R.MongoParseError(`Expected ${e} to be stringified int value`)}function Wf(e,t){let r=eA(e,t);if(r<0)throw new R.MongoParseError(`${e} can only be a positive int value, got: ${r}`);return r}function*uF(e){if(e==="")return;let t=e.split(",");for(let r of t){let[n,s]=r.split(/:(.*)/);if(s==null)throw new R.MongoParseError("Cannot have undefined values in key value pairs");yield[n,s]}}class Hf extends Map{constructor(e=[]){super(e.map(([t,r])=>[t.toLowerCase(),r]))}has(e){return super.has(e.toLowerCase())}get(e){return super.get(e.toLowerCase())}set(e,t){return super.set(e.toLowerCase(),t)}delete(e){return super.delete(e.toLowerCase())}}function Rte(e,t=void 0,r={}){if(t!=null&&!(t instanceof qa.MongoClient))r=t,t=void 0;if(r.useBigInt64&&typeof r.promoteLongs==="boolean"&&!r.promoteLongs)throw new R.MongoAPIError("Must request either bigint or Long for int64 deserialization");if(r.useBigInt64&&typeof r.promoteValues==="boolean"&&!r.promoteValues)throw new R.MongoAPIError("Must request either bigint or Long for int64 deserialization");let n;try{n=new bte.default(e)}catch(y){if(y.message?.startsWith("Username contains unescaped characters"))throw new R.MongoParseError("Username contains unescaped characters");throw y}let{hosts:s,isSRV:i}=n,o=Object.create(null);o.hosts=i?[]:s.map(Xe.HostAddress.fromString);let u=new Hf;if(n.pathname!=="/"&&n.pathname!==""){let y=decodeURIComponent(n.pathname[0]==="/"?n.pathname.slice(1):n.pathname);if(y)u.set("dbName",[y])}if(n.username!==""){let y={username:decodeURIComponent(n.username)};if(typeof n.password==="string")y.password=decodeURIComponent(n.password);u.set("auth",[y])}let a=new Set(Object.keys(ms.OPTIONS).map((y)=>y.toLowerCase())),c=Array.from(n.searchParams.keys()).flatMap((y,E)=>a.has(y.toLowerCase())?[]:[E+1]);if(c.length!==0)throw new R.MongoParseError(`connection string contains unsupported options, at position: ${c.join(", ")}`);for(let y of n.searchParams.keys()){let E=n.searchParams.getAll(y),C=Object.keys(ms.OPTIONS).find((A)=>A.toLowerCase()===y.toLowerCase()),D=/readPreferenceTags/i.test(y);if(!D&&E.length>1)throw new R.MongoInvalidArgumentError(`URI option "${C}" cannot appear more than once in the connection string`);if(!D&&E.includes("")&&!xte(y))throw new R.MongoAPIError(`URI option "${C}" cannot be specified with no value`);if(!u.has(y))u.set(y,E)}let l=new Hf(Object.entries(r).filter(([,y])=>y!=null)),[f]=u.get("readPreference")??[];if(typeof f==="string"&&!fn.ReadPreference.isValid(f))throw new R.MongoInvalidArgumentError("readPreference is not a valid read preference mode");if(u.has("serverApi"))throw new R.MongoParseError("URI cannot contain `serverApi`, it can only be passed to the client");if(u.has("srvHostValidator"))throw new R.MongoParseError("URI cannot contain `srvHostValidator`, it can only be passed to the client");let h=u.get("authMechanismProperties");if(h){for(let y of h)if(/(^|,)ALLOWED_HOSTS:/.test(y))throw new R.MongoParseError("Auth mechanism property ALLOWED_HOSTS is not allowed in the connection string.")}if(l.has("loadBalanced"))throw new R.MongoParseError("loadBalanced is only a valid option in the URI");let d=new Hf,p=new Set([...u.keys(),...l.keys()]);for(let y of p){let E=[],C=l.get(y);if(C!=null)E.push(C);let D=u.get(y)??[];E.push(...D),d.set(y,E)}if(d.has("tls")||d.has("ssl")){let y=(d.get("tls")||[]).concat(d.get("ssl")||[]).map(Nu.bind(null,"tls/ssl"));if(new Set(y).size!==1)throw new R.MongoParseError("All values of tls/ssl must be the same.")}Ite(d);let m=Xe.setDifference(p,a);if(m.size!==0){let y=m.size>1?"options":"option",E=m.size>1?"are":"is";throw new R.MongoParseError(`${y} ${Array.from(m).join(", ")} ${E} not supported`)}for(let[y,E]of Object.entries(ms.OPTIONS)){let C=d.get(y);if(!C||C.length===0){if(ms.DEFAULT_OPTIONS.has(y))aF(o,y,E,[ms.DEFAULT_OPTIONS.get(y)])}else{let{deprecated:D,ignored:A}=E;if(D){let P=typeof D==="string"?`: ${D}`:"";Xe.emitWarning(`${y} is a deprecated option${P}`)}if(A)continue;aF(o,y,E,C)}}if(o.credentials){let y=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_GSSAPI,E=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_X509,C=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_AWS,D=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_OIDC;if((y||E)&&d.has("authSource")&&o.credentials.source!=="$external")throw new R.MongoParseError(`authMechanism ${o.credentials.mechanism} requires an authSource of '$external'`);if(!(y||E||C||D)&&o.dbName&&!d.has("authSource"))o.credentials=$i.MongoCredentials.merge(o.credentials,{source:o.dbName});if(C){let{username:A,password:P}=o.credentials;if(A||P)throw new R.MongoAPIError("username and password cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.");if(o.credentials.mechanismProperties.AWS_SESSION_TOKEN)throw new R.MongoAPIError("AWS_SESSION_TOKEN cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.")}if(o.credentials.validate(),o.credentials.password===""&&o.credentials.username===""&&o.credentials.mechanism===Kr.AuthMechanism.MONGODB_DEFAULT&&Object.keys(o.credentials.mechanismProperties).length===0)delete o.credentials}if(!o.dbName)o.dbName="test";if(Z3(s,o,i),t&&o.autoEncryption)Oy.Encrypter.checkForMongoCrypt(),o.encrypter=new Oy.Encrypter(t,e,r),o.autoEncrypter=o.encrypter.autoEncrypter;if(o.userSpecifiedAuthSource=l.has("authSource")||u.has("authSource"),o.userSpecifiedReplicaSet=l.has("replicaSet")||u.has("replicaSet"),i){if(o.srvHost=s[0],o.directConnection)throw new R.MongoAPIError("SRV URI does not support directConnection");if(o.srvMaxHosts>0&&typeof o.replicaSet==="string")throw new R.MongoParseError("Cannot use srvMaxHosts option with replicaSet");if(o.srvAllowedHostsSuffix!=null&&o.srvHostValidator!=null)throw new R.MongoParseError("Cannot use srvAllowedHostsSuffix together with srvHostValidator");let y=!l.has("tls")&&!u.has("tls"),E=!l.has("ssl")&&!u.has("ssl");if(y&&E)o.tls=!0}else{let y=Dte.filter((E)=>u.has(E)||l.has(E));if(y.length>0)throw new R.MongoParseError(`Cannot use ${y.join(", ")} with a non-srv connection string`)}if(o.directConnection&&o.hosts.length!==1)throw new R.MongoParseError("directConnection option requires exactly one host");if(!o.proxyHost&&(o.proxyPort||o.proxyUsername||o.proxyPassword))throw new R.MongoParseError("Must specify proxyHost if other proxy options are passed");if(o.proxyUsername&&!o.proxyPassword||!o.proxyUsername&&o.proxyPassword)throw new R.MongoParseError("Can only specify both of proxy username/password or neither");if(["proxyHost","proxyPort","proxyUsername","proxyPassword"].map((y)=>u.get(y)??[]).some((y)=>y.length>1))throw new R.MongoParseError("Proxy options cannot be specified multiple times in the connection string");return o.mongoLoggerOptions=R1.MongoLogger.resolveOptions({MONGODB_LOG_COMMAND:Yn.env.MONGODB_LOG_COMMAND,MONGODB_LOG_TOPOLOGY:Yn.env.MONGODB_LOG_TOPOLOGY,MONGODB_LOG_SERVER_SELECTION:Yn.env.MONGODB_LOG_SERVER_SELECTION,MONGODB_LOG_CONNECTION:Yn.env.MONGODB_LOG_CONNECTION,MONGODB_LOG_CLIENT:Yn.env.MONGODB_LOG_CLIENT,MONGODB_LOG_ALL:Yn.env.MONGODB_LOG_ALL,MONGODB_LOG_MAX_DOCUMENT_LENGTH:Yn.env.MONGODB_LOG_MAX_DOCUMENT_LENGTH,MONGODB_LOG_PATH:Yn.env.MONGODB_LOG_PATH},{mongodbLogPath:o.mongodbLogPath,mongodbLogComponentSeverities:o.mongodbLogComponentSeverities,mongodbLogMaxDocumentLength:o.mongodbLogMaxDocumentLength}),o.runtime=lF.resolveRuntimeAdapters(r),o.runtime.then(void 0,Xe.squashError),o[dF]=$te,o.toJSON=pF,o}var dF=Symbol.for("nodejs.util.inspect.custom");function pF(){let e={...this};delete e[dF];for(let t of["proxyUsername","proxyPassword","passphrase"])if(e[t]!=null)e[t]="<redacted>";return e}function $te(e,t,r){return r(pF.call(this),t)}function Z3(e,t,r){if(t.loadBalanced){if(e.length>1)throw new R.MongoParseError(Tte);if(t.replicaSet)throw new R.MongoParseError(Mte);if(t.directConnection)throw new R.MongoParseError(Pte);if(r&&t.srvMaxHosts>0)throw new R.MongoParseError("Cannot limit srv hosts with loadBalanced enabled")}return}function vte(e){let t=e.replace(/^\.+|\.+$/g,"");if(t==="")throw new R.MongoParseError("srvAllowedHostsSuffix must contain at least one domain label");let r=Xe.dnsNameToASCII(t);if(r==null)throw new R.MongoParseError("srvAllowedHostsSuffix is not a valid domain name");if(!r.includes(".")&&!oF.has(r))throw new R.MongoParseError(`srvAllowedHostsSuffix must contain at least two domain labels, or be one of: ${[...oF].join(", ")}`);return`.${r}`}function xte(e){return Object.entries(ms.OPTIONS).some(([t,r])=>r.ignored&&t.toLowerCase()===e.toLowerCase())}function aF(e,t,r,n){let{target:s,type:i,transform:o}=r,u=s??t;switch(i){case"boolean":e[u]=Nu(u,n[0]);break;case"int":e[u]=eA(u,n[0]);break;case"uint":e[u]=Wf(u,n[0]);break;case"string":if(n[0]==null)break;e[u]=String(n[0]);break;case"record":if(!Xe.isRecord(n[0]))throw new R.MongoParseError(`${u} must be an object`);e[u]=n[0];break;case"any":e[u]=n[0];break;default:{if(!o)throw new R.MongoParseError("Descriptors missing a type must define a transform");let a=o({name:u,options:e,values:n});e[u]=a;break}}}ms.OPTIONS={enableOverloadRetargeting:{default:!1,type:"boolean"},appName:{type:"string"},auth:{target:"credentials",transform({name:e,options:t,values:[r]}){if(!Xe.isRecord(r,["username","password"]))throw new R.MongoParseError(`${e} must be an object with 'username' and 'password' properties`);return $i.MongoCredentials.merge(t.credentials,{username:r.username,password:r.password})}},authMechanism:{target:"credentials",transform({options:e,values:[t]}){let r=Object.values(Kr.AuthMechanism),n;try{[n]=r.filter((o)=>o.match(RegExp(String.raw`\b${t}\b`,"i")))}catch{}if(!n)throw new R.MongoParseError(`authMechanism must be one of ${r}`);let s=e.credentials?.source;if(n===Kr.AuthMechanism.MONGODB_PLAIN||Kr.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(n))s="$external";let i=e.credentials?.password;if(n===Kr.AuthMechanism.MONGODB_X509&&i==="")i=void 0;return $i.MongoCredentials.merge(e.credentials,{mechanism:n,source:s,password:i})}},authMechanismProperties:{target:"credentials",transform({options:e,values:t}){let r=Object.create(null);for(let n of t)if(typeof n==="string")for(let[s,i]of uF(n))try{r[s]=Nu(s,i)}catch{r[s]=i}else{if(!Xe.isRecord(n))throw new R.MongoParseError("AuthMechanismProperties must be an object");r={...n}}return $i.MongoCredentials.merge(e.credentials,{mechanismProperties:r})}},authSource:{target:"credentials",transform({options:e,values:[t]}){let r=String(t);return $i.MongoCredentials.merge(e.credentials,{source:r})}},autoEncryption:{type:"record"},autoSelectFamily:{type:"boolean"},autoSelectFamilyAttemptTimeout:{type:"uint"},bsonRegExp:{type:"boolean"},serverApi:{target:"serverApi",transform({values:[e]}){let t=typeof e==="string"?{version:e}:e,r=t&&t.version;if(!r)throw new R.MongoParseError(`Invalid \`serverApi\` property; must specify a version from the following enum: ["${Object.values(qa.ServerApiVersion).join('", "')}"]`);if(!Object.values(qa.ServerApiVersion).some((n)=>n===r))throw new R.MongoParseError(`Invalid server API version=${r}; must be in the following enum: ["${Object.values(qa.ServerApiVersion).join('", "')}"]`);return t}},checkKeys:{type:"boolean"},compressors:{default:"none",target:"compressors",transform({values:e}){let t=new Set;for(let r of e){let n=typeof r==="string"?r.split(","):r;if(!Array.isArray(n))throw new R.MongoInvalidArgumentError("compressors must be an array or a comma-delimited list of strings");for(let s of n)if(Object.keys(Ay.Compressor).includes(String(s)))t.add(String(s));else throw new R.MongoInvalidArgumentError(`compressors contains a value that is not a valid compression mechanism. Must be one of: ${Object.keys(Ay.Compressor)}.`)}return[...t]}},connectTimeoutMS:{default:30000,type:"uint"},dbName:{type:"string"},directConnection:{default:!1,type:"boolean"},driverInfo:{default:{},type:"record"},enableUtf8Validation:{type:"boolean",default:!0},family:{transform({name:e,values:[t]}){let r=eA(e,t);if(r===4||r===6)return r;throw new R.MongoParseError(`Option 'family' must be 4 or 6 got ${r}.`)}},fieldsAsRaw:{type:"record"},forceServerObjectId:{default:!1,type:"boolean"},fsync:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[r]}){let n=hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,fsync:Nu(e,r)}});if(!n)throw new R.MongoParseError(`Unable to make a writeConcern from fsync=${r}`);return n}},heartbeatFrequencyMS:{default:1e4,type:"uint"},ignoreUndefined:{type:"boolean"},j:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[r]}){let n=hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:Nu(e,r)}});if(!n)throw new R.MongoParseError(`Unable to make a writeConcern from journal=${r}`);return n}},journal:{target:"writeConcern",transform({name:e,options:t,values:[r]}){let n=hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:Nu(e,r)}});if(!n)throw new R.MongoParseError(`Unable to make a writeConcern from journal=${r}`);return n}},loadBalanced:{default:!1,type:"boolean"},localThresholdMS:{default:15,type:"uint"},maxAdaptiveRetries:{default:2,type:"uint"},maxConnecting:{default:2,transform({name:e,values:[t]}){let r=Wf(e,t);if(r===0)throw new R.MongoInvalidArgumentError("maxConnecting must be > 0 if specified");return r}},maxIdleTimeMS:{default:0,type:"uint"},maxPoolSize:{default:100,type:"uint"},maxStalenessSeconds:{target:"readPreference",transform({name:e,options:t,values:[r]}){let n=Wf(e,r);if(t.readPreference)return fn.ReadPreference.fromOptions({readPreference:{...t.readPreference,maxStalenessSeconds:n}});else return new fn.ReadPreference("secondary",void 0,{maxStalenessSeconds:n})}},minInternalBufferSize:{type:"uint"},minPoolSize:{default:0,type:"uint"},minHeartbeatFrequencyMS:{default:500,type:"uint"},monitorCommands:{default:!1,type:"boolean"},name:{target:"driverInfo",transform({values:[e],options:t}){return{...t.driverInfo,name:String(e)}}},noDelay:{default:!0,type:"boolean"},pkFactory:{default:Xe.DEFAULT_PK_FACTORY,transform({values:[e]}){if(Xe.isRecord(e,["createPk"])&&typeof e.createPk==="function")return e;throw new R.MongoParseError("Option pkFactory must be an object with a createPk function")}},promoteBuffers:{type:"boolean"},promoteLongs:{type:"boolean"},promoteValues:{type:"boolean"},useBigInt64:{type:"boolean"},proxyHost:{type:"string"},proxyPassword:{type:"string"},proxyPort:{type:"uint"},proxyUsername:{type:"string"},raw:{default:!1,type:"boolean"},readConcern:{transform({values:[e],options:t}){if(e instanceof I1.ReadConcern||Xe.isRecord(e,["level"]))return I1.ReadConcern.fromOptions({...t.readConcern,...e});throw new R.MongoParseError("ReadConcern must be an object")}},readConcernLevel:{target:"readConcern",transform({values:[e],options:t}){return I1.ReadConcern.fromOptions({...t.readConcern,level:e})}},readPreference:{default:fn.ReadPreference.primary,transform({values:[e],options:t}){if(e instanceof fn.ReadPreference)return fn.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if(Xe.isRecord(e,["mode"])){let r=fn.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if(r)return r;else throw new R.MongoParseError(`Cannot make read preference from ${JSON.stringify(e)}`)}if(typeof e==="string"){let r={hedge:t.readPreference?.hedge,maxStalenessSeconds:t.readPreference?.maxStalenessSeconds};return new fn.ReadPreference(e,t.readPreference?.tags,r)}throw new R.MongoParseError(`Unknown ReadPreference value: ${e}`)}},readPreferenceTags:{target:"readPreference",transform({values:e,options:t}){let r=Array.isArray(e[0])?e[0]:e,n=[];for(let s of r){let i=Object.create(null);if(typeof s==="string")for(let[o,u]of uF(s))i[o]=u;if(Xe.isRecord(s))for(let[o,u]of Object.entries(s))i[o]=u;n.push(i)}return fn.ReadPreference.fromOptions({readPreference:t.readPreference,readPreferenceTags:n})}},replicaSet:{type:"string"},retryReads:{default:!0,type:"boolean"},retryWrites:{default:!0,type:"boolean"},runtimeAdapters:{type:"record"},serializeFunctions:{type:"boolean"},serverMonitoringMode:{default:"auto",transform({values:[e]}){if(!Object.values(hF.ServerMonitoringMode).includes(e))throw new R.MongoParseError("serverMonitoringMode must be one of `auto`, `poll`, or `stream`");return e}},serverSelectionTimeoutMS:{default:30000,type:"uint"},servername:{type:"string"},socketTimeoutMS:{default:0,type:"uint"},srvAllowedHostsSuffix:{transform({values:[e]}){if(typeof e!=="string")throw new R.MongoParseError("srvAllowedHostsSuffix must be a string");return vte(e)}},srvHostValidator:{transform({values:[e]}){if(typeof e!=="function")throw new R.MongoParseError("srvHostValidator must be a function");return(t)=>{let r;try{r=e(t)}catch(n){throw new R.MongoAPIError("srvHostValidator threw an error",{cause:n})}if(typeof r!=="boolean")throw new R.MongoAPIError(`srvHostValidator must return a boolean, received ${typeof r}`);return r}}},srvMaxHosts:{type:"uint",default:0},srvServiceName:{type:"string",default:"mongodb"},ssl:{target:"tls",type:"boolean"},timeoutMS:{deprecated:"timeoutMS has no effect and will be removed in a future release",ignored:!0},tls:{type:"boolean"},tlsAllowInvalidCertificates:{target:"rejectUnauthorized",transform({name:e,values:[t]}){return!Nu(e,t)}},tlsAllowInvalidHostnames:{target:"checkServerIdentity",transform({name:e,values:[t]}){return Nu(e,t)?()=>{return}:void 0}},tlsCAFile:{type:"string"},tlsCRLFile:{type:"string"},tlsCertificateKeyFile:{type:"string"},tlsCertificateKeyFilePassword:{target:"passphrase",type:"any"},tlsInsecure:{transform({name:e,options:t,values:[r]}){let n=Nu(e,r);if(n)t.checkServerIdentity=()=>{return},t.rejectUnauthorized=!1;else t.checkServerIdentity=t.tlsAllowInvalidHostnames?()=>{return}:void 0,t.rejectUnauthorized=t.tlsAllowInvalidCertificates?!1:!0;return n}},w:{target:"writeConcern",transform({values:[e],options:t}){return hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}})}},waitQueueTimeoutMS:{default:0,type:"uint"},writeConcern:{target:"writeConcern",transform({values:[e],options:t}){if(Xe.isRecord(e)||e instanceof hn.WriteConcern)return hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,...e}});else if(e==="majority"||typeof e==="number")return hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}});throw new R.MongoParseError("Invalid WriteConcern cannot parse")}},wtimeout:{deprecated:"Please use wtimeoutMS instead",target:"writeConcern",transform({values:[e],options:t}){let r=hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeout:Wf("wtimeout",e)}});if(r)return r;throw new R.MongoParseError("Cannot make WriteConcern from wtimeout")}},wtimeoutMS:{target:"writeConcern",transform({values:[e],options:t}){let r=hn.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeoutMS:Wf("wtimeoutMS",e)}});if(r)return r;throw new R.MongoParseError("Cannot make WriteConcern from wtimeout")}},zlibCompressionLevel:{default:0,type:"int"},mongodbLogPath:{transform({values:[e]}){if(!(typeof e==="string"&&["stderr","stdout"].includes(e)||e&&typeof e==="object"&&("write"in e)&&typeof e.write==="function"))throw new R.MongoAPIError("Option 'mongodbLogPath' must be of type 'stderr' | 'stdout' | MongoDBLogWritable");return e}},mongodbLogComponentSeverities:{transform({values:[e]}){if(typeof e!=="object"||!e)throw new R.MongoAPIError("Option 'mongodbLogComponentSeverities' must be a non-null object");for(let[t,r]of Object.entries(e)){if(typeof r!=="string"||typeof t!=="string")throw new R.MongoAPIError("User input for option 'mongodbLogComponentSeverities' object cannot include a non-string key or value");if(!Object.values(R1.MongoLoggableComponent).some((n)=>n===t)&&t!=="default")throw new R.MongoAPIError(`User input for option 'mongodbLogComponentSeverities' contains invalid key: ${t}`);if(!Object.values(R1.SeverityLevel).some((n)=>n===r))throw new R.MongoAPIError(`Option 'mongodbLogComponentSeverities' does not support ${r} as a value for ${t}`)}return e}},mongodbLogMaxDocumentLength:{type:"uint"},connectionType:{type:"any"},srvPoller:{type:"any"},allowPartialTrustChain:{type:"any"},minDHSize:{type:"any"},pskCallback:{type:"any"},secureContext:{type:"any"},enableTrace:{type:"any"},requestCert:{type:"any"},rejectUnauthorized:{type:"any"},checkServerIdentity:{type:"any"},keepAliveInitialDelay:{type:"any"},ALPNProtocols:{type:"any"},SNICallback:{type:"any"},session:{type:"any"},requestOCSP:{type:"any"},localAddress:{type:"any"},localPort:{type:"any"},hints:{type:"any"},lookup:{type:"any"},ca:{type:"any"},cert:{type:"any"},ciphers:{type:"any"},crl:{type:"any"},ecdhCurve:{type:"any"},key:{type:"any"},passphrase:{type:"any"},pfx:{type:"any"},secureProtocol:{type:"any"},index:{type:"any"},__skipPingOnConnect:{type:"boolean"}};ms.DEFAULT_OPTIONS=new Hf(Object.entries(ms.OPTIONS).filter(([,e])=>e.default!=null).map(([e,t])=>[e,t.default]))});var yF=g(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});nA.aws4Sign=kte;var ja=Te(),mF=async(e)=>{let t=rA(e),r=await crypto.subtle.digest("SHA-256",t);return ja.ByteUtils.toHex(new Uint8Array(r))},Kf=async(e,t)=>{let r;if(typeof e==="string")r=rA(e);else r=e;let n=await crypto.subtle.importKey("raw",r,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),s=rA(t),i=await crypto.subtle.sign("HMAC",n,s);return new Uint8Array(i)},Ic=(e)=>e.toString().trim().replace(/\s+/g," ");function rA(e){let t=new Uint8Array(ja.ByteUtils.utf8ByteLength(e));return ja.ByteUtils.encodeUTF8Into(t,e,0),t}async function kte(e,t){let n=e.date.toISOString().replace(/[:-]|\.\d{3}/g,""),s=n.substring(0,8),{method:i,path:o}=e,u="",a=new Headers({"content-length":Ic(e.headers["Content-Length"]),"content-type":Ic(e.headers["Content-Type"]),host:Ic(e.host),"x-amz-date":Ic(n),"x-mongodb-gs2-cb-flag":Ic(e.headers["X-MongoDB-GS2-CB-Flag"]),"x-mongodb-server-nonce":Ic(e.headers["X-MongoDB-Server-Nonce"])});if("sessionToken"in t&&t.sessionToken)a.append("x-amz-security-token",Ic(t.sessionToken));let c=Array.from(a.entries()).map(([q,I])=>`${q.toLowerCase()}:${I}`).sort().join(`
24
+ `),f=Array.from(a.keys()).map((q)=>q.toLowerCase()).sort().join(";"),h=await mF(e.body),d=[i,o,"",c+`
25
+ `,f,h].join(`
26
+ `),p=await mF(d),m="AWS4-HMAC-SHA256",_=`${s}/${e.region}/${e.service}/aws4_request`,y=[m,n,_,p].join(`
27
+ `),E=await Kf("AWS4"+t.secretAccessKey,s),C=await Kf(E,e.region),D=await Kf(C,e.service),A=await Kf(D,"aws4_request"),P=await Kf(A,y),S=ja.ByteUtils.toHex(P);return{Authorization:["AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+_,"SignedHeaders="+f,"Signature="+S].join(", "),"X-Amz-Date":n}}});var wF=g(function(wy){Object.defineProperty(wy,"__esModule",{value:!0});wy.MongoDBAWS=void 0;var Sy=Te(),$1=Te(),Zo=X(),v1=he(),gF=Sa(),_F=w3(),EF=yF(),AF=Em(),OF=Uo(),qte=110,sA={useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1};class SF extends gF.AuthProvider{constructor(e){super();this.credentialFetcher=new _F.AWSSDKCredentialProvider(e)}async auth(e){let{connection:t}=e;if(!e.credentials)throw new Zo.MongoMissingCredentialsError("AuthContext must provide credentials.");e.credentials=await jte(e.credentials,this.credentialFetcher);let{credentials:r}=e,{username:n,password:s}=r,i=r.mechanismProperties.AWS_SESSION_TOKEN,o=i?{accessKeyId:n,secretAccessKey:s,sessionToken:i}:{accessKeyId:n,secretAccessKey:s},u=r.source,a=await v1.randomBytes(32),c={saslStart:1,mechanism:"MONGODB-AWS",payload:$1.serialize({r:a,p:qte},sA)},l=await t.command(v1.ns(`${u}.$cmd`),c,void 0),f=$1.deserialize(l.payload.buffer,sA),h=f.h,d=f.s.buffer;if(d.length!==64)throw new Zo.MongoRuntimeError(`Invalid server nonce length ${d.length}, expected 64`);if(!Sy.ByteUtils.equals(d.subarray(0,a.byteLength),a))throw new Zo.MongoRuntimeError("Server nonce does not begin with client nonce");if(h.length<1||h.length>255||h.indexOf("..")!==-1)throw new Zo.MongoRuntimeError(`Server returned an invalid host: "${h}"`);let p="Action=GetCallerIdentity&Version=2011-06-15",m=await EF.aws4Sign({method:"POST",host:h,region:Lte(f.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":p.length,"X-MongoDB-Server-Nonce":Sy.ByteUtils.toBase64(d),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:p,date:new Date},o),_={a:m.Authorization,d:m["X-Amz-Date"]};if(i)_.t=i;let y={saslContinue:1,conversationId:l.conversationId,payload:$1.serialize(_,sA)};await t.command(v1.ns(`${u}.$cmd`),y,void 0)}}wy.MongoDBAWS=SF;async function jte(e,t){function r(s){if(!s.AccessKeyId||!s.SecretAccessKey)throw new Zo.MongoMissingCredentialsError("Could not obtain temporary MONGODB-AWS credentials");return new AF.MongoCredentials({username:s.AccessKeyId,password:s.SecretAccessKey,source:e.source,mechanism:OF.AuthMechanism.MONGODB_AWS,mechanismProperties:{AWS_SESSION_TOKEN:s.Token}})}let n=await t.getCredentials();return r(n)}function Lte(e){let t=e.split(".");if(t.length===1||t[1]==="amazonaws")return"us-east-1";return t[1]}});var CF=g(function(by){Object.defineProperty(by,"__esModule",{value:!0});by.finishCommandDocument=Ute;by.startCommandDocument=Vte;var vi=Te(),Cy=Uo();function Ute(e,t){if(t!=null)return{saslContinue:1,conversationId:t,payload:new vi.Binary(vi.BSON.serialize({jwt:e}))};return{saslStart:1,mechanism:Cy.AuthMechanism.MONGODB_OIDC,payload:new vi.Binary(vi.BSON.serialize({jwt:e}))}}function Vte(e){let t={};if(e.username)t.n=e.username;return{saslStart:1,autoAuthorize:1,mechanism:Cy.AuthMechanism.MONGODB_OIDC,payload:new vi.Binary(vi.BSON.serialize(t))}}});var oA=g(function(La){Object.defineProperty(La,"__esModule",{value:!0});La.CallbackWorkflow=La.AUTOMATED_TIMEOUT_MS=La.HUMAN_TIMEOUT_MS=void 0;var bF=require("timers/promises"),DF=X(),Dy=he(),x1=CF();La.HUMAN_TIMEOUT_MS=300000;La.AUTOMATED_TIMEOUT_MS=60000;var zte=["accessToken","expiresInSeconds","refreshToken"],Wte="User provided OIDC callbacks must return a valid object with an accessToken.",iA=100;class TF{constructor(e,t){this.cache=e,this.callback=this.withLock(t),this.lastExecutionTime=Date.now()-iA}async speculativeAuth(e,t){if(this.cache.hasAccessToken){let r=this.cache.getAccessToken();e.accessToken=r;let n=x1.finishCommandDocument(r);return n.db=t.source,{speculativeAuthenticate:n}}return{}}async reauthenticate(e,t){if(this.cache.hasAccessToken)if(e.accessToken===this.cache.getAccessToken())this.cache.removeAccessToken(),delete e.accessToken;else e.accessToken=this.cache.getAccessToken();await this.execute(e,t)}async startAuthentication(e,t,r){let n;if(r?.speculativeAuthenticate)n=r.speculativeAuthenticate;else n=await e.command(Dy.ns(t.source),x1.startCommandDocument(t),void 0);return n}async finishAuthentication(e,t,r,n){await e.command(Dy.ns(t.source),x1.finishCommandDocument(r,n),void 0)}async executeAndValidateCallback(e){let t=await this.callback(e);if(Hte(t))throw new DF.MongoMissingCredentialsError(Wte);return t}withLock(e){let t=Promise.resolve();return async(r)=>{let n=t.then(async()=>{let s=Date.now()-this.lastExecutionTime;if(s<=iA)await bF.setTimeout(iA-s,{signal:r.timeoutContext});return this.lastExecutionTime=Date.now(),await e(r)});return t=n.then(()=>{return},()=>{return}),await n}}}La.CallbackWorkflow=TF;function Hte(e){if(e==null||typeof e!=="object")return!0;if(!("accessToken"in e))return!0;return!Object.getOwnPropertyNames(e).every((t)=>zte.includes(t))}});var uA=g(function(My){Object.defineProperty(My,"__esModule",{value:!0});My.AutomatedCallbackWorkflow=void 0;var k1=X(),Ty=ds(),MF=Py(),q1=oA();class PF extends q1.CallbackWorkflow{constructor(e,t){super(e,t)}async execute(e,t){if(this.cache.hasAccessToken){let n=this.cache.getAccessToken();if(!e.accessToken)e.accessToken=n;try{return await this.finishAuthentication(e,t,n)}catch(s){if(s instanceof k1.MongoError&&s.code===k1.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeAccessToken(),await this.execute(e,t);else throw s}}let r=await this.fetchAccessToken(t);this.cache.put(r),e.accessToken=r.accessToken,await this.finishAuthentication(e,t,r.accessToken)}async fetchAccessToken(e){let t=new AbortController,r={timeoutContext:t.signal,version:MF.OIDC_VERSION};if(e.username)r.username=e.username;if(e.mechanismProperties.TOKEN_RESOURCE)r.tokenAudience=e.mechanismProperties.TOKEN_RESOURCE;let n=Ty.Timeout.expires(q1.AUTOMATED_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(r),n])}catch(s){if(Ty.TimeoutError.is(s))throw t.abort(),new k1.MongoOIDCError(`OIDC callback timed out after ${q1.AUTOMATED_TIMEOUT_MS}ms.`);throw s}finally{n.clear()}}}My.AutomatedCallbackWorkflow=PF});var FF=g(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});Fy.azureCallback=void 0;var By=D3(),j1=X(),BF=he(),Kte=Object.freeze({Metadata:"true",Accept:"application/json"}),Gte="Azure endpoint did not return a value with only access_token and expires_in properties",Yte="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure.",Jte=async(e)=>{let{tokenAudience:t,username:r}=e;if(!t)throw new j1.MongoAzureError(Yte);let n=await Qte(t,r);if(!Xte(n))throw new j1.MongoAzureError(Gte);return n};Fy.azureCallback=Jte;async function Qte(e,t){let r=new URL(By.AZURE_BASE_URL);By.addAzureParams(r,e,t);let n=await BF.get(r,{headers:Kte});if(n.status!==200)throw new j1.MongoAzureError(`Status code ${n.status} returned from the Azure endpoint. Response body: ${n.body}`);let s=JSON.parse(n.body);return{accessToken:s.access_token,expiresInSeconds:Number(s.expires_in)}}function Xte(e){if(e==null||typeof e!=="object")return!1;return"accessToken"in e&&typeof e.accessToken==="string"&&"expiresInSeconds"in e&&typeof e.expiresInSeconds==="number"}});var IF=g(function(Iy){Object.defineProperty(Iy,"__esModule",{value:!0});Iy.gcpCallback=void 0;var Ny=X(),NF=he(),Zte="http://metadata/computeMetadata/v1/instance/service-accounts/default/identity",ere=Object.freeze({"Metadata-Flavor":"Google"}),tre="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is gcp.",rre=async(e)=>{let t=e.tokenAudience;if(!t)throw new Ny.MongoGCPError(tre);return await nre(t)};Iy.gcpCallback=rre;async function nre(e){let t=new URL(Zte);t.searchParams.append("audience",e);let r=await NF.get(t,{headers:ere});if(r.status!==200)throw new Ny.MongoGCPError(`Status code ${r.status} returned from the GCP endpoint. Response body: ${r.body}`);return{accessToken:r.body}}});var xF=g(function(Ry){Object.defineProperty(Ry,"__esModule",{value:!0});Ry.k8sCallback=void 0;var vF=require("fs/promises"),Ua=require("process"),sre="/var/run/secrets/kubernetes.io/serviceaccount/token",RF="AZURE_FEDERATED_TOKEN_FILE",$F="AWS_WEB_IDENTITY_TOKEN_FILE",ire=async()=>{let e;if(Ua.env[RF])e=Ua.env[RF];else if(Ua.env[$F])e=Ua.env[$F];else e=sre;return{accessToken:await vF.readFile(e,"utf8")}};Ry.k8sCallback=ire});var aA=g(function(vy){Object.defineProperty(vy,"__esModule",{value:!0});vy.TokenCache=void 0;var kF=X();class $y extends kF.MongoDriverError{}class qF{get hasAccessToken(){return!!this.accessToken}get hasRefreshToken(){return!!this.refreshToken}get hasIdpInfo(){return!!this.idpInfo}getAccessToken(){if(!this.accessToken)throw new $y("Attempted to get an access token when none exists.");return this.accessToken}getRefreshToken(){if(!this.refreshToken)throw new $y("Attempted to get a refresh token when none exists.");return this.refreshToken}getIdpInfo(){if(!this.idpInfo)throw new $y("Attempted to get IDP information when none exists.");return this.idpInfo}put(e,t){if(this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expiresInSeconds=e.expiresInSeconds,t)this.idpInfo=t}removeAccessToken(){this.accessToken=void 0}removeRefreshToken(){this.refreshToken=void 0}}vy.TokenCache=qF});var VF=g(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});xy.tokenMachineCallback=void 0;var jF=require("fs"),LF=require("process"),UF=X(),ore="OIDC_TOKEN_FILE must be set in the environment.",ure=async()=>{let e=LF.env.OIDC_TOKEN_FILE;if(!e)throw new UF.MongoAWSError(ore);return{accessToken:await jF.promises.readFile(e,"utf8")}};xy.tokenMachineCallback=ure});var Py=g(function(xi){Object.defineProperty(xi,"__esModule",{value:!0});xi.MongoDBOIDC=xi.OIDC_WORKFLOWS=xi.OIDC_VERSION=void 0;var ky=X(),WF=Sa(),Va=uA(),HF=FF(),KF=IF(),GF=xF(),za=aA(),YF=VF(),are="AuthContext must provide credentials.";xi.OIDC_VERSION=1;xi.OIDC_WORKFLOWS=new Map;xi.OIDC_WORKFLOWS.set("test",()=>new Va.AutomatedCallbackWorkflow(new za.TokenCache,YF.tokenMachineCallback));xi.OIDC_WORKFLOWS.set("azure",()=>new Va.AutomatedCallbackWorkflow(new za.TokenCache,HF.azureCallback));xi.OIDC_WORKFLOWS.set("gcp",()=>new Va.AutomatedCallbackWorkflow(new za.TokenCache,KF.gcpCallback));xi.OIDC_WORKFLOWS.set("k8s",()=>new Va.AutomatedCallbackWorkflow(new za.TokenCache,GF.k8sCallback));class JF extends WF.AuthProvider{constructor(e){super();if(!e)throw new ky.MongoInvalidArgumentError("No workflow provided to the OIDC auth provider.");this.workflow=e}async auth(e){let{connection:t,reauthenticating:r,response:n}=e;if(n?.speculativeAuthenticate?.done&&!r)return;let s=zF(e);if(r)await this.workflow.reauthenticate(t,s);else await this.workflow.execute(t,s,n)}async prepare(e,t){let{connection:r}=t,n=zF(t),s=await this.workflow.speculativeAuth(r,n);return{...e,...s}}}xi.MongoDBOIDC=JF;function zF(e){let{credentials:t}=e;if(!t)throw new ky.MongoMissingCredentialsError(are);return t}});var eN=g(function(jy){Object.defineProperty(jy,"__esModule",{value:!0});jy.HumanCallbackWorkflow=void 0;var QF=Te(),eu=X(),qy=ds(),XF=Py(),L1=oA();class ZF extends L1.CallbackWorkflow{constructor(e,t){super(e,t)}async execute(e,t){if(this.cache.hasAccessToken){let o=this.cache.getAccessToken();e.accessToken=o;try{return await this.finishAuthentication(e,t,o)}catch(u){if(u instanceof eu.MongoError&&u.code===eu.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeAccessToken(),delete e.accessToken,await this.execute(e,t);else throw u}}if(this.cache.hasRefreshToken){let o=this.cache.getRefreshToken(),u=await this.fetchAccessToken(this.cache.getIdpInfo(),t,o);this.cache.put(u),e.accessToken=u.accessToken;try{return await this.finishAuthentication(e,t,u.accessToken)}catch(a){if(a instanceof eu.MongoError&&a.code===eu.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeRefreshToken(),delete e.accessToken,await this.execute(e,t);else throw a}}let r=await this.startAuthentication(e,t),n=r.conversationId,s=QF.BSON.deserialize(r.payload.buffer),i=await this.fetchAccessToken(s,t);return this.cache.put(i,s),e.accessToken=i.accessToken,await this.finishAuthentication(e,t,i.accessToken,n)}async fetchAccessToken(e,t,r){let n=new AbortController,s={timeoutContext:n.signal,version:XF.OIDC_VERSION,idpInfo:e};if(t.username)s.username=t.username;if(r)s.refreshToken=r;let i=qy.Timeout.expires(L1.HUMAN_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(s),i])}catch(o){if(qy.TimeoutError.is(o))throw n.abort(),new eu.MongoOIDCError(`OIDC callback timed out after ${L1.HUMAN_TIMEOUT_MS}ms.`);throw o}finally{i.clear()}}}jy.HumanCallbackWorkflow=ZF});var iN=g(function(Uy){Object.defineProperty(Uy,"__esModule",{value:!0});Uy.Plain=void 0;var Ly=Te(),tN=X(),rN=he(),nN=Sa();class sN extends nN.AuthProvider{async auth(e){let{connection:t,credentials:r}=e;if(!r)throw new tN.MongoMissingCredentialsError("AuthContext must provide credentials.");let{username:n,password:s}=r,o={saslStart:1,mechanism:"PLAIN",payload:new Ly.Binary(Ly.ByteUtils.fromUTF8(`\x00${n}\x00${s}`)),autoAuthorize:1};await t.command(rN.ns("$external.$cmd"),o,void 0)}}Uy.Plain=sN});var cN=g(function(pye,aN){var oN=(e)=>e.codePointAt(0),cre=(e)=>e[0],lre=(e)=>e[e.length-1];function uN(e){let t=[],r=e.length;for(let n=0;n<r;n+=1){let s=e.charCodeAt(n);if(s>=55296&&s<=56319&&r>n+1){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343){t.push((s-55296)*1024+i-56320+65536),n+=1;continue}}t.push(s)}return t}function Gf({unassigned_code_points:e,commonly_mapped_to_nothing:t,non_ASCII_space_characters:r,prohibited_characters:n,bidirectional_r_al:s,bidirectional_l:i},o,u={}){let a=r,c=t;if(typeof o!=="string")throw TypeError("Expected string.");if(o.length===0)return"";let l=uN(o).map((E)=>a.get(E)?32:E).filter((E)=>!c.get(E)),f=String.fromCodePoint.apply(null,l).normalize("NFKC"),h=uN(f);if(h.some((E)=>n.get(E)))throw Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(u.allowUnassigned!==!0){if(h.some((C)=>e.get(C)))throw Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}let p=h.some((E)=>s.get(E)),m=h.some((E)=>i.get(E));if(p&&m)throw Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");let _=s.get(oN(cre(f))),y=s.get(oN(lre(f)));if(p&&!(_&&y))throw Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return f}Gf.saslprep=Gf;Gf.default=Gf;aN.exports=Gf});var fN=g(function(mye,hN){hN.exports=Iu;function Iu(e,t){if(!(this instanceof Iu))return new Iu(e,t);this.length=0,this.updates=[],this.path=new Uint16Array(4),this.pages=Array(32768),this.maxPages=this.pages.length,this.level=0,this.pageSize=e||1024,this.deduplicate=t?t.deduplicate:null,this.zeros=this.deduplicate?Vy(this.deduplicate.length):null}Iu.prototype.updated=function(e){while(this.deduplicate&&e.buffer[e.deduplicate]===this.deduplicate[e.deduplicate])if(e.deduplicate++,e.deduplicate===this.deduplicate.length){if(e.deduplicate=0,e.buffer.equals&&e.buffer.equals(this.deduplicate))e.buffer=this.deduplicate;break}if(e.updated||!this.updates)return;e.updated=!0,this.updates.push(e)};Iu.prototype.lastUpdate=function(){if(!this.updates||!this.updates.length)return null;var e=this.updates.pop();return e.updated=!1,e};Iu.prototype._array=function(e,t){if(e>=this.maxPages){if(t)return;hre(this,e)}pre(e,this.path);var r=this.pages;for(var n=this.level;n>0;n--){var s=this.path[n],i=r[s];if(!i){if(t)return;i=r[s]=Array(32768)}r=i}return r};Iu.prototype.get=function(e,t){var r=this._array(e,t),n=this.path[0],s=r&&r[n];if(!s&&!t){if(s=r[n]=new lN(e,Vy(this.pageSize)),e>=this.length)this.length=e+1}if(s&&s.buffer===this.deduplicate&&this.deduplicate&&!t)s.buffer=dre(s.buffer),s.deduplicate=0;return s};Iu.prototype.set=function(e,t){var r=this._array(e,!1),n=this.path[0];if(e>=this.length)this.length=e+1;if(!t||this.zeros&&t.equals&&t.equals(this.zeros)){r[n]=void 0;return}if(this.deduplicate&&t.equals&&t.equals(this.deduplicate))t=this.deduplicate;var s=r[n],i=fre(t,this.pageSize);if(s)s.buffer=i;else r[n]=new lN(e,i)};Iu.prototype.toBuffer=function(){var e=Array(this.length),t=Vy(this.pageSize),r=0;while(r<e.length){var n=this._array(r,!0);for(var s=0;s<32768&&r<e.length;s++)e[r++]=n&&n[s]?n[s].buffer:t}return Buffer.concat(e)};function hre(e,t){while(e.maxPages<t){var r=e.pages;e.pages=Array(32768),e.pages[0]=r,e.level++,e.maxPages*=32768}}function fre(e,t){if(e.length===t)return e;if(e.length>t)return e.slice(0,t);var r=Vy(t);return e.copy(r),r}function Vy(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function dre(e){var t=Buffer.allocUnsafe?Buffer.allocUnsafe(e.length):new Buffer(e.length);return e.copy(t),t}function lN(e,t){this.offset=e*t.length,this.buffer=t,this.updated=!1,this.deduplicate=0}function pre(e,t){e=(e-(t[0]=e&32767))/32768,e=(e-(t[1]=e&32767))/32768,t[3]=(e-(t[2]=e&32767))/32768&32767}});var pN=g(function(yye,dN){var mre=fN();dN.exports=Wa;function Wa(e){if(!(this instanceof Wa))return new Wa(e);if(!e)e={};if(Buffer.isBuffer(e))e={buffer:e};if(this.pageOffset=e.pageOffset||0,this.pageSize=e.pageSize||1024,this.pages=e.pages||mre(this.pageSize),this.byteLength=this.pages.length*this.pageSize,this.length=8*this.byteLength,!gre(this.pageSize))throw Error("The page size should be a power of two");if(this._trackUpdates=!!e.trackUpdates,this._pageMask=this.pageSize-1,e.buffer){for(var t=0;t<e.buffer.length;t+=this.pageSize)this.pages.set(t/this.pageSize,e.buffer.slice(t,t+this.pageSize));this.byteLength=e.buffer.length,this.length=8*this.byteLength}}Wa.prototype.get=function(e){var t=e&7,r=(e-t)/8;return!!(this.getByte(r)&128>>t)};Wa.prototype.getByte=function(e){var t=e&this._pageMask,r=(e-t)/this.pageSize,n=this.pages.get(r,!0);return n?n.buffer[t+this.pageOffset]:0};Wa.prototype.set=function(e,t){var r=e&7,n=(e-r)/8,s=this.getByte(n);return this.setByte(n,t?s|128>>r:s&(255^128>>r))};Wa.prototype.toBuffer=function(){var e=yre(this.pages.length*this.pageSize);for(var t=0;t<this.pages.length;t++){var r=this.pages.get(t,!0),n=t*this.pageSize;if(r)r.buffer.copy(e,n,this.pageOffset,this.pageOffset+this.pageSize)}return e};Wa.prototype.setByte=function(e,t){var r=e&this._pageMask,n=(e-r)/this.pageSize,s=this.pages.get(n,!1);if(r+=this.pageOffset,s.buffer[r]===t)return!1;if(s.buffer[r]=t,e>=this.byteLength)this.byteLength=e+1,this.length=this.byteLength*8;if(this._trackUpdates)this.pages.updated(s);return!0};function yre(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function gre(e){return!(e&e-1)}});var mN=g(function(Yf){var _re=Yf&&Yf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yf,"__esModule",{value:!0});Yf.createMemoryCodePoints=Are;var Ere=_re(pN());function Are(e){let t=0;function r(){let c=e.readUInt32BE(t);t+=4;let l=e.slice(t,t+c);return t+=c,(0,Ere.default)({buffer:l})}let n=r(),s=r(),i=r(),o=r(),u=r(),a=r();return{unassigned_code_points:n,commonly_mapped_to_nothing:s,non_ASCII_space_characters:i,prohibited_characters:o,bidirectional_r_al:u,bidirectional_l:a}}});var gN=g(function(cA){Object.defineProperty(cA,"__esModule",{value:!0});var yN=require("zlib");cA.default=yN.gunzipSync(Buffer.from("H4sIAAAAAAACA+3dTYgcaRkA4LemO9Mhxm0FITnE9Cwr4jHgwgZ22B6YywqCJ0HQg5CL4sGTuOjCtGSF4CkHEW856MlTQHD3EJnWkU0Owh5VxE3LHlYQdNxd2U6mU59UV/d09fw4M2EySSXPAzNdP1/9fX/99bzVNZEN4jisRDulVFnQmLxm1aXF9Id/2/xMxNJ4XZlg576yuYlGt9gupV6xoFf8jhu9YvulVrFlp5XSx+lfvYhORGPXvqIRWSxERKtIm8bKFd10WNfKDS5Fo9jJWrq2+M2IlW+8uHgl/+BsROfPF4v5L7148Ur68Sha6dqZpYiVVy8tvLCWXo80Sf/lS89dGX2wHGvpzoXVn75/YWH5wmqe8uika82ViJXTy83Ve2k5Urozm38wm4/ls6t5uT6yfsTSJ7J3T0VKt8c5ExEXI8aFkH729c3eT+7EC6ca8cVULZUiYacX0R5PNWNxlh9L1y90q5kyzrpyy+9WcvOV6URntqw7La9sNVstXyczWVaWYbaaTYqzOHpr7pyiNT3/YzKuT63Z/FqKZlFTiuXtFM2vVOtIq7jiyKJbWZaOWD0euz0yoV2Z7kY0xq2x0YhfzVpmM5px9nTEH7JZ0ot5u39p0ma75Z472/s/H+2yr2inYyuq7fMvJivH2rM72N/Z3lyL31F2b1ya1P0zn816k2KP6JU9UzseucdQH5YqVeH/lFajSN2udg+TLJ9rksNxlvV2lki19rXKI43TPLejFu4ov7k3nMbhyhfY3Xb37f8BAGCf0eMTOH5szf154KmnNgKcnLb+Fzi2AfXktbN7fJelwTAiO/W5uQ2KINXRYu+znqo/WTAdLadURHmy3qciazd3bra4T3w16/f7t7Ms9U5gfJu10955sx1r3vmhBAAAAAAAgId20J1iZbDowNvIjuH427Gr5l/eiC+8OplZON8sVjx/qr9y+Pj+YRItT+NqAM+kkZs3AAAAAID6yfx1FwCAI97/dCh1/ub6SA0AAAAAAAAAgNoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hutp5SiQpYAAAAAAAAAQO2MIpZiT804flnAE2fhwjOeAZXr76kOAAAAAAAA8FjNf4N/l0NE3U/vuVQskLpSd4/Yh2xu9xTu0tFeeNYsLI2f/VMdNxTzj6Je9E/+6pp6Nn3awW3A54goe4Bss6v+PGsjQGMAAAAAAOBp5XEgwH6e7J7rwEQHRb/XvAMAAAAAAAA8yzoDeQDwVGjIAgAAAAAAAACoPfF/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqL/GSkSkClkCAAAAAAAAALXTSAAAAAAAAABA3Y1kAQAAAAAAAADUX8RSXZ9dsHC9+M8Fg2Ex/em1lAZpEBGttcrVjZqLEa+k0XpKw9mG4zWx4ukPUMhkAQAAAAAAABzBqbSe3//rXOS9HxGdo4TqR2XkutCdBu+LaPZw/lBbO7cbHnh2C7N7AIo4evEznllqLqWUp/LnYOtpM2bnOH66wI1+9GO4sOuISwv/TOlumu56FDv3NZhc4mR9v7zYIrafr40j/Cccvj9Xns3t3mu99E7qxUv3bqS0/ouNH/08++RGemfQ+nsx/5uNXsQPGulynPvv3ZTW37zd+1ovrqaYpP/122X6Xpx779Z3zr/3YOPKW1lkaRDf31pPaf3j/msRsVGkL+d/f+/m4sJsPm1cfSsr16e8m9Ldj/KsnyIuR3nXw83Is3EhxLd/2V773ks3m/cj/THKUummdP9qKhIOImuOU0Xjwb3y+oqt735rpTetVbF9n8R4x9crRfO77TKqVOZpDclv5bfK18lMnk+q0K18UpxF/RrGXE0Zxtqx3tWSj+vxbL4XaasfKb0dRbtLW73JsfPGg177H+OmGKlfvS1msllt7JEJm9XOJqXR+Fkfo1H66uy5H1v3Xx5+uJmGLw9jro2u7Loj4PnuR6+f+e3d261+eazNhzrL7X83MohoHpS4PddV8ki1it61//pw1g7z6p1U/26Nm2llST57B5rUvuG0XqSU/rPd7jYrqWcbd+beJQ77BgPMDwn37/8BAGCf0eMTOH4cPlufv9VGgJOzqf8Fjm1APXkd7B7f5dF57GPMaWy/MTvjvNvtXj6h8W2+GXvnzXaseeeHEgAAAAAAAB7aQXeKlcGiadBoEOeLb2dtpGOL2MyOtf391a3P/zD96c3JzIP3t4oV797vrh8+vn+YRL5bBuj/AQAAAABqJvfHXQAAHkX82zfXAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACeAgkAAAAAAAAAqLuRLAAAAAAAAACA2hv9D1iu/VAYaAYA","base64"))});var ON=g(function(lA,AN){var _N=lA&&lA.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Ore=_N(cN()),EN=mN(),Sre=_N(gN()),wre=EN.createMemoryCodePoints(Sre.default);function Jf(e,t){return(0,Ore.default)(wre,e,t)}Jf.saslprep=Jf;Jf.default=Jf;AN.exports=Jf});var FN=g(function(U1){Object.defineProperty(U1,"__esModule",{value:!0});U1.ScramSHA256=U1.ScramSHA1=void 0;var wN=ON(),ve=Te(),ur=X(),Ha=he(),CN=Sa(),Hy=Uo();class fA extends CN.AuthProvider{constructor(e){super();this.cryptoMethod=e||"sha1"}async prepare(e,t){let r=this.cryptoMethod,n=t.credentials;if(!n)throw new ur.MongoMissingCredentialsError("AuthContext must provide credentials.");let s=await Ha.randomBytes(24);return t.nonce=s,{...e,speculativeAuthenticate:{...TN(r,n,s),db:n.source}}}async auth(e){let{reauthenticating:t,response:r}=e;if(r?.speculativeAuthenticate&&!t)return await MN(this.cryptoMethod,r.speculativeAuthenticate,e);return await Cre(this.cryptoMethod,e)}}function bN(e){return e.replace("=","=3D").replace(",","=2C")}function DN(e,t){return ve.ByteUtils.concat([ve.ByteUtils.fromUTF8("n="),ve.ByteUtils.fromUTF8(e),ve.ByteUtils.fromUTF8(",r="),ve.ByteUtils.fromUTF8(ve.ByteUtils.toBase64(t))])}function TN(e,t,r){let n=bN(t.username);return{saslStart:1,mechanism:e==="sha1"?Hy.AuthMechanism.MONGODB_SCRAM_SHA1:Hy.AuthMechanism.MONGODB_SCRAM_SHA256,payload:new ve.Binary(ve.ByteUtils.concat([ve.ByteUtils.fromUTF8("n,,"),DN(n,r)])),autoAuthorize:1,options:{skipEmptyExchange:!0}}}async function Cre(e,t){let{connection:r,credentials:n}=t;if(!n)throw new ur.MongoMissingCredentialsError("AuthContext must provide credentials.");if(!t.nonce)throw new ur.MongoInvalidArgumentError("AuthContext must contain a valid nonce property");let s=t.nonce,i=n.source,o=TN(e,n,s),u=await r.command(Ha.ns(`${i}.$cmd`),o,void 0);await MN(e,u,t)}async function MN(e,t,r){let{connection:n,credentials:s}=r;if(!s)throw new ur.MongoMissingCredentialsError("AuthContext must provide credentials.");if(!r.nonce)throw new ur.MongoInvalidArgumentError("Unable to continue SCRAM without valid nonce");let i=r.nonce,o=s.source,u=bN(s.username),a=s.password,c=e==="sha256"?wN.saslprep(a):bre(u,a),l=ve.ByteUtils.isUint8Array(t.payload)?new ve.Binary(t.payload):t.payload,f=SN(l),h=parseInt(f.i,10);if(h&&h<4096)throw new ur.MongoRuntimeError(`Server returned an invalid iteration count ${h}`);let{s:d,r:p}=f;if(p.startsWith("nonce"))throw new ur.MongoRuntimeError(`Server returned an invalid nonce: ${p}`);let m=`c=biws,r=${p}`,_=await Bre(c,ve.ByteUtils.fromBase64(d),h,e),y=await zy(e,_,"Client Key"),E=await zy(e,_,"Server Key"),C=await Tre(e,y),D=DN(u,i),A=ve.ByteUtils.toUTF8(D,0,D.length,!1),P=ve.ByteUtils.toUTF8(l.buffer,0,l.position,!1),S=[A,P,m].join(","),B=await zy(e,C,S),q=`p=${Dre(y,B)}`,I=[m,q].join(","),Oe=await zy(e,E,S),Ne={saslContinue:1,conversationId:t.conversationId,payload:new ve.Binary(ve.ByteUtils.fromUTF8(I))},ae=await n.command(Ha.ns(`${o}.$cmd`),Ne,void 0),sr=SN(ae.payload);if(!Fre(ve.ByteUtils.fromBase64(sr.v),Oe))throw new ur.MongoRuntimeError("Server returned an invalid signature");if(ae.done!==!1)return;let G={saslContinue:1,conversationId:ae.conversationId,payload:ve.ByteUtils.allocate(0)};await n.command(Ha.ns(`${o}.$cmd`),G,void 0)}function SN(e){let t=ve.ByteUtils.toUTF8(e.buffer,0,e.position,!1),r={},n=t.split(",");for(let s=0;s<n.length;s++){let i=(n[s].match(/^([^=]*)=(.*)$/)??[]).slice(1);r[i[0]]=i[1]}return r}function bre(e,t){if(typeof e!=="string")throw new ur.MongoInvalidArgumentError("Username must be a string");if(typeof t!=="string")throw new ur.MongoInvalidArgumentError("Password must be a string");if(t.length===0)throw new ur.MongoInvalidArgumentError("Password cannot be empty");let r;try{r=require("crypto")}catch(n){throw new ur.MongoRuntimeError("Node.js crypto module is required for SCRAM-SHA-1 authentication",{cause:n})}try{let n=r.createHash("md5");return n.update(`${e}:mongo:${t}`,"utf8"),n.digest("hex")}catch(n){if(r.getFips())throw Error("Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode");throw n}}function Dre(e,t){let r=Math.max(e.length,t.length),n=[];for(let s=0;s<r;s+=1)n.push(e[s]^t[s]);return ve.ByteUtils.toBase64(ve.ByteUtils.fromNumberArray(n))}async function Tre(e,t){let r=await crypto.subtle.digest(e==="sha256"?"SHA-256":"SHA-1",t);return new Uint8Array(r)}async function zy(e,t,r){let n=ve.ByteUtils.toLocalBufferType(t),s=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:{name:e==="sha256"?"SHA-256":"SHA-1"}},!1,["sign","verify"]),i=typeof r==="string"?new TextEncoder().encode(r):r,o=ve.ByteUtils.toLocalBufferType(i),u=await crypto.subtle.sign("HMAC",s,o);return new Uint8Array(u)}var Wy={},hA=0;function Mre(){Wy={},hA=0}var Pre={sha256:32,sha1:20};async function Bre(e,t,r,n){let s=[e,ve.ByteUtils.toBase64(t),r].join("_");if(Wy[s]!=null)return Wy[s];let i=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),{name:"PBKDF2"},!1,["deriveBits"]),o={name:"PBKDF2",salt:t,iterations:r,hash:{name:n==="sha256"?"SHA-256":"SHA-1"}},u=await crypto.subtle.deriveBits(o,i,Pre[n]*8),a=new Uint8Array(u);if(hA>=200)Mre();return Wy[s]=a,hA+=1,a}function Fre(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}class PN extends fA{constructor(){super("sha1")}}U1.ScramSHA1=PN;class BN extends fA{constructor(){super("sha256")}}U1.ScramSHA256=BN});var vN=g(function(Gy){Object.defineProperty(Gy,"__esModule",{value:!0});Gy.X509=void 0;var Ky=X(),IN=he(),RN=Sa();class $N extends RN.AuthProvider{async prepare(e,t){let{credentials:r}=t;if(!r)throw new Ky.MongoMissingCredentialsError("AuthContext must provide credentials.");return{...e,speculativeAuthenticate:NN(r)}}async auth(e){let{connection:t,credentials:r}=e;if(!r)throw new Ky.MongoMissingCredentialsError("AuthContext must provide credentials.");if(e.response?.speculativeAuthenticate)return;await t.command(IN.ns("$external.$cmd"),NN(r),void 0)}}Gy.X509=$N;function NN(e){let t={authenticate:1,mechanism:"MONGODB-X509"};if(e.username)t.user=e.username;return t}});var dA=g(function(Zy){Object.defineProperty(Zy,"__esModule",{value:!0});Zy.MongoClientAuthProviders=void 0;var xN=gm(),kN=wF(),Qy=Py(),qN=uA(),jN=eN(),Yy=aA(),LN=iN(),xs=Uo(),Jy=FN(),UN=vN(),Xy=X(),Nre=new Map([[xs.AuthMechanism.MONGODB_AWS,({AWS_CREDENTIAL_PROVIDER:e})=>new kN.MongoDBAWS(e)],[xs.AuthMechanism.MONGODB_GSSAPI,()=>new xN.GSSAPI],[xs.AuthMechanism.MONGODB_OIDC,(e)=>new Qy.MongoDBOIDC(Ire(e))],[xs.AuthMechanism.MONGODB_PLAIN,()=>new LN.Plain],[xs.AuthMechanism.MONGODB_SCRAM_SHA1,()=>new Jy.ScramSHA1],[xs.AuthMechanism.MONGODB_SCRAM_SHA256,()=>new Jy.ScramSHA256],[xs.AuthMechanism.MONGODB_X509,()=>new UN.X509]]);class VN{constructor(){this.existingProviders=new Map}getOrCreateProvider(e,t){let r=this.existingProviders.get(e);if(r)return r;let n=Nre.get(e);if(!n)throw new Xy.MongoInvalidArgumentError(`authMechanism ${e} not supported`);let s=n(t);return this.existingProviders.set(e,s),s}}Zy.MongoClientAuthProviders=VN;function Ire(e){if(e.OIDC_HUMAN_CALLBACK)return new jN.HumanCallbackWorkflow(new Yy.TokenCache,e.OIDC_HUMAN_CALLBACK);else if(e.OIDC_CALLBACK)return new qN.AutomatedCallbackWorkflow(new Yy.TokenCache,e.OIDC_CALLBACK);else{let t=e.ENVIRONMENT,r=Qy.OIDC_WORKFLOWS.get(t)?.();if(!r)throw new Xy.MongoInvalidArgumentError(`Could not load workflow for environment ${e.ENVIRONMENT}`);return r}}});var mA=g(function(e2){Object.defineProperty(e2,"__esModule",{value:!0});e2.ClientBulkWriteOperation=void 0;var zN=wt(),WN=he(),HN=fr(),ks=xt();class pA extends HN.CommandOperation{get commandName(){return"bulkWrite"}constructor(e,t){super(void 0,t);this.SERVER_COMMAND_RESPONSE_TYPE=zN.ClientBulkWriteCursorResponse,this.commandBuilder=e,this.options=t,this.ns=new WN.MongoDBNamespace("admin","$cmd")}resetBatch(){return this.commandBuilder.resetBatch()}get canRetryWrite(){return this.commandBuilder.isBatchRetryable}handleOk(e){return e}buildCommandDocument(e,t){let r=this.commandBuilder.buildBatch(e.description.maxMessageSizeBytes,e.description.maxWriteBatchSize,e.description.maxBsonObjectSize);if(!this.canRetryWrite)this.options.willRetryWrite=!1;return r}}e2.ClientBulkWriteOperation=pA;ks.defineAspects(pA,[ks.Aspect.WRITE_OPERATION,ks.Aspect.SKIP_COLLATION,ks.Aspect.CURSOR_CREATING,ks.Aspect.RETRYABLE,ks.Aspect.COMMAND_BATCHING,ks.Aspect.SUPPORTS_RAW_DATA])});var JN=g(function(r2){Object.defineProperty(r2,"__esModule",{value:!0});r2.ClientBulkWriteCursor=void 0;var KN=mA(),GN=sn(),t2=he(),YN=Ns();class yA extends YN.AbstractCursor{constructor(e,t,r={}){super(e,new t2.MongoDBNamespace("admin","$cmd"),r);this.commandBuilder=t,this.clientBulkWriteOptions=r}get response(){if(this.cursorResponse)return this.cursorResponse;return null}get operations(){return this.commandBuilder.lastOperations}clone(){let e=t2.mergeOptions({},this.clientBulkWriteOptions);return delete e.session,new yA(this.client,this.commandBuilder,{...e})}async _initialize(e){let t=new KN.ClientBulkWriteOperation(this.commandBuilder,{...this.clientBulkWriteOptions,...this.cursorOptions,session:e}),r=await GN.executeOperation(this.client,t,this.timeoutContext);return this.cursorResponse=r,{server:t.server,session:e,response:r}}}r2.ClientBulkWriteCursor=yA});var tI=g(function(dr){Object.defineProperty(dr,"__esModule",{value:!0});dr.buildReplaceOneOperation=dr.buildUpdateManyOperation=dr.buildUpdateOneOperation=dr.buildDeleteManyOperation=dr.buildDeleteOneOperation=dr.buildInsertOneOperation=dr.ClientBulkWriteCommandBuilder=void 0;dr.buildOperation=_A;var V1=Te(),n2=ta(),tu=X(),s2=Pl(),z1=he(),QN=1000;class XN{constructor(e,t,r){this.models=e,this.options=t,this.pkFactory=r??z1.DEFAULT_PK_FACTORY,this.currentModelIndex=0,this.previousModelIndex=0,this.lastOperations=[],this.isBatchRetryable=!0}get errorsOnly(){if("verboseResults"in this.options)return!this.options.verboseResults;return!0}hasNextBatch(){return this.currentModelIndex<this.models.length}resetBatch(){return this.currentModelIndex=this.previousModelIndex,!0}buildBatch(e,t,r){this.isBatchRetryable=!0;let n=0,s=0,i=this.baseCommand(),o=new Map;this.previousModelIndex=this.currentModelIndex;while(this.currentModelIndex<this.models.length){let u=this.models[this.currentModelIndex],a=u.namespace,c=o.get(a);if(u.name==="deleteMany"||u.name==="updateMany")this.isBatchRetryable=!1;if(c!=null){let l=_A(u,c,this.pkFactory,this.options),f;try{f=V1.BSON.serialize(l)}catch(h){throw new tu.MongoInvalidArgumentError("Could not serialize operation to BSON",{cause:h})}if(gA("ops",f,r),n+f.length<e&&i.ops.documents.length<t)n=QN+i.ops.push(l,f),this.currentModelIndex++;else break}else{o.set(a,s);let l={ns:a},f=_A(u,s,this.pkFactory,this.options),h,d;try{h=V1.BSON.serialize(l),d=V1.BSON.serialize(f)}catch(p){throw new tu.MongoInvalidArgumentError("Could not serialize ns info to BSON",{cause:p})}if(gA("nsInfo",h,r),gA("ops",d,r),n+h.length+d.length<e&&i.ops.documents.length<t)n=QN+i.nsInfo.push(l,h)+i.ops.push(f,d),s++,this.currentModelIndex++;else break}}return this.lastOperations=i.ops.documents,i}baseCommand(){let e={bulkWrite:1,errorsOnly:this.errorsOnly,ordered:this.options.ordered??!0,ops:new n2.DocumentSequence("ops"),nsInfo:new n2.DocumentSequence("nsInfo")};if(this.options.bypassDocumentValidation!=null)e.bypassDocumentValidation=this.options.bypassDocumentValidation;if(this.options.let)e.let=this.options.let;if(this.options.comment!==void 0)e.comment=this.options.comment;return e}}dr.ClientBulkWriteCommandBuilder=XN;function gA(e,t,r){if(t.length>r)throw new tu.MongoInvalidArgumentError(`Client bulk write operation ${e} of length ${t.length} exceeds the max bson object size of ${r}`)}var Rre=(e,t,r)=>{let n={insert:t,document:e.document};return n.document._id=e.document._id??r.createPk(),n};dr.buildInsertOneOperation=Rre;var $re=(e,t)=>ZN(e,t,!1);dr.buildDeleteOneOperation=$re;var vre=(e,t)=>ZN(e,t,!0);dr.buildDeleteManyOperation=vre;function ZN(e,t,r){let n={delete:t,multi:r,filter:e.filter};if(e.hint)n.hint=e.hint;if(e.collation)n.collation=e.collation;return n}var xre=(e,t,r)=>eI(e,t,!1,r);dr.buildUpdateOneOperation=xre;var kre=(e,t,r)=>eI(e,t,!0,r);dr.buildUpdateManyOperation=kre;function qre(e,t){if(!z1.hasAtomicOperators(e,t))throw new tu.MongoAPIError("Client bulk write update models must only contain atomic modifiers (start with $) and must not be empty.")}function eI(e,t,r,n){qre(e.update,n);let s={update:t,multi:r,filter:e.filter,updateMods:e.update};if(e.hint)s.hint=e.hint;if(e.upsert)s.upsert=e.upsert;if(e.arrayFilters)s.arrayFilters=e.arrayFilters;if(e.collation)s.collation=e.collation;if(!r&&"sort"in e&&e.sort!=null)s.sort=s2.formatSort(e.sort);return s}var jre=(e,t)=>{if(z1.hasAtomicOperators(e.replacement))throw new tu.MongoAPIError("Client bulk write replace models must not contain atomic modifiers (start with $) and must not be empty.");let r={update:t,multi:!1,filter:e.filter,updateMods:e.replacement};if(e.hint)r.hint=e.hint;if(e.upsert)r.upsert=e.upsert;if(e.collation)r.collation=e.collation;if(e.sort!=null)r.sort=s2.formatSort(e.sort);return r};dr.buildReplaceOneOperation=jre;function _A(e,t,r,n){switch(e.name){case"insertOne":return(0,dr.buildInsertOneOperation)(e,t,r);case"deleteOne":return(0,dr.buildDeleteOneOperation)(e,t);case"deleteMany":return(0,dr.buildDeleteManyOperation)(e,t);case"updateOne":return(0,dr.buildUpdateOneOperation)(e,t,n);case"updateMany":return(0,dr.buildUpdateManyOperation)(e,t,n);case"replaceOne":return(0,dr.buildReplaceOneOperation)(e,t)}}});var iI=g(function(i2){Object.defineProperty(i2,"__esModule",{value:!0});i2.ClientBulkWriteResultsMerger=void 0;var rI=Oa(),nI=X(),Lre={acknowledged:!1,insertedCount:0,upsertedCount:0,matchedCount:0,modifiedCount:0,deletedCount:0,insertResults:void 0,updateResults:void 0,deleteResults:void 0};class sI{static unacknowledged(){return Lre}constructor(e){if(this.options=e,this.currentBatchOffset=0,this.writeConcernErrors=[],this.writeErrors=new Map,this.result={acknowledged:!0,insertedCount:0,upsertedCount:0,matchedCount:0,modifiedCount:0,deletedCount:0,insertResults:void 0,updateResults:void 0,deleteResults:void 0},e.verboseResults)this.result.insertResults=new Map,this.result.updateResults=new Map,this.result.deleteResults=new Map}get bulkWriteResult(){return{acknowledged:this.result.acknowledged,insertedCount:this.result.insertedCount,upsertedCount:this.result.upsertedCount,matchedCount:this.result.matchedCount,modifiedCount:this.result.modifiedCount,deletedCount:this.result.deletedCount,insertResults:this.result.insertResults,updateResults:this.result.updateResults,deleteResults:this.result.deleteResults}}async merge(e){let t;try{for await(let r of e)if(r.ok===1){if(this.options.verboseResults)this.processDocument(e,r)}else if(this.options.ordered){let n=new nI.MongoClientBulkWriteError({message:"Mongo client ordered bulk write encountered a write error."});throw n.writeErrors.set(r.idx+this.currentBatchOffset,{code:r.code,message:r.errmsg}),n.partialResult=this.result,n}else this.writeErrors.set(r.idx+this.currentBatchOffset,{code:r.code,message:r.errmsg})}catch(r){if(r instanceof rI.MongoWriteConcernError){let n=r.result;if(t={insertedCount:n.nInserted,upsertedCount:n.nUpserted,matchedCount:n.nMatched,modifiedCount:n.nModified,deletedCount:n.nDeleted,writeConcernError:n.writeConcernError},this.options.verboseResults&&n.cursor.firstBatch){for(let s of n.cursor.firstBatch)if(s.ok===1)this.processDocument(e,s)}}else throw r}finally{if(e.response){let r=e.response;this.incrementCounts(r)}this.currentBatchOffset+=e.operations.length}if(t){let r=t.writeConcernError;this.incrementCounts(t),this.writeConcernErrors.push({code:r.code,message:r.errmsg})}return this.result}processDocument(e,t){let r=e.operations[t.idx];if("insert"in r)this.result.insertResults?.set(t.idx+this.currentBatchOffset,{insertedId:r.document._id});if("update"in r){let n={matchedCount:t.n,modifiedCount:t.nModified??0,didUpsert:t.upserted!=null};if(t.upserted)n.upsertedId=t.upserted._id;this.result.updateResults?.set(t.idx+this.currentBatchOffset,n)}if("delete"in r)this.result.deleteResults?.set(t.idx+this.currentBatchOffset,{deletedCount:t.n})}incrementCounts(e){this.result.insertedCount+=e.insertedCount,this.result.upsertedCount+=e.upsertedCount,this.result.matchedCount+=e.matchedCount,this.result.modifiedCount+=e.modifiedCount,this.result.deletedCount+=e.deletedCount}}i2.ClientBulkWriteResultsMerger=sI});var pI=g(function(a2){Object.defineProperty(a2,"__esModule",{value:!0});a2.ClientBulkWriteExecutor=void 0;var o2=Ns(),oI=JN(),qs=X(),uI=ds(),aI=he(),cI=fs(),lI=sn(),hI=mA(),fI=tI(),u2=iI();class dI{constructor(e,t,r){if(t.length===0)throw new qs.MongoClientBulkWriteExecutionError("No client bulk write models were provided.");if(this.client=e,this.operations=t,this.options={ordered:!0,bypassDocumentValidation:!1,verboseResults:!1,...r},!this.options.writeConcern)this.options.writeConcern=cI.WriteConcern.fromOptions(this.client.s.options);if(this.options.writeConcern?.w===0){if(this.options.verboseResults)throw new qs.MongoInvalidArgumentError("Cannot request unacknowledged write concern and verbose results");if(this.options.ordered)throw new qs.MongoInvalidArgumentError("Cannot request unacknowledged write concern and ordered writes")}}async execute(){let e=this.client.s.options.pkFactory,t=new fI.ClientBulkWriteCommandBuilder(this.operations,this.options,e),r=aI.resolveTimeoutOptions(this.client,this.options),n=uI.TimeoutContext.create(r);if(this.options.writeConcern?.w===0){while(t.hasNextBatch()){let s=new hI.ClientBulkWriteOperation(t,this.options);await lI.executeOperation(this.client,s,n)}return u2.ClientBulkWriteResultsMerger.unacknowledged()}else{let s=new u2.ClientBulkWriteResultsMerger(this.options);while(t.hasNextBatch()){let i=new o2.CursorTimeoutContext(n,Symbol()),o={...this.options,timeoutContext:i,...r.timeoutMS!=null&&{timeoutMode:o2.CursorTimeoutMode.LIFETIME}},u=new oI.ClientBulkWriteCursor(this.client,t,o);try{await s.merge(u)}catch(a){if(a instanceof qs.MongoServerError&&!(a instanceof qs.MongoClientBulkWriteError)){let c=new qs.MongoClientBulkWriteError({message:"Mongo client bulk write encountered an error during execution"});throw c.cause=a,c.partialResult=s.bulkWriteResult,c}else throw a}}if(s.writeConcernErrors.length>0||s.writeErrors.size>0){let i=new qs.MongoClientBulkWriteError({message:"Mongo client bulk write encountered errors during execution."});throw i.writeConcernErrors=s.writeConcernErrors,i.writeErrors=s.writeErrors,i.partialResult=s.bulkWriteResult,i}return s.bulkWriteResult}}}a2.ClientBulkWriteExecutor=dI});var EI=g(function(l2){Object.defineProperty(l2,"__esModule",{value:!0});l2.EndSessionsOperation=void 0;var mI=wt(),yI=fr(),gI=Xr(),_I=he(),c2=xt();class EA extends yI.CommandOperation{constructor(e){super();this.writeConcern={w:0},this.ns=_I.MongoDBNamespace.fromString("admin.$cmd"),this.SERVER_COMMAND_RESPONSE_TYPE=mI.MongoDBResponse,this.sessions=e}buildCommandDocument(e,t){return{endSessions:this.sessions}}buildOptions(e){return{timeoutContext:e,readPreference:gI.ReadPreference.primaryPreferred}}get commandName(){return"endSessions"}}l2.EndSessionsOperation=EA;c2.defineAspects(EA,c2.Aspect.WRITE_OPERATION)});var AA=g(function(ki){Object.defineProperty(ki,"__esModule",{value:!0});ki.WaitingForSuitableServerEvent=ki.ServerSelectionSucceededEvent=ki.ServerSelectionFailedEvent=ki.ServerSelectionStartedEvent=ki.ServerSelectionEvent=void 0;var AI=he(),Ka=Br();class W1{constructor(e,t,r){this.selector=e,this.operation=r,this.topologyDescription=t}}ki.ServerSelectionEvent=W1;class OI extends W1{constructor(e,t,r){super(e,t,r);this.name=Ka.SERVER_SELECTION_STARTED,this.message="Server selection started"}}ki.ServerSelectionStartedEvent=OI;class SI extends W1{constructor(e,t,r,n){super(e,t,n);this.name=Ka.SERVER_SELECTION_FAILED,this.message="Server selection failed",this.failure=r}}ki.ServerSelectionFailedEvent=SI;class wI extends W1{constructor(e,t,r,n){super(e,t,n);this.name=Ka.SERVER_SELECTION_SUCCEEDED,this.message="Server selection succeeded";let{host:s,port:i}=AI.HostAddress.fromString(r).toHostPort();this.serverHost=s,this.serverPort=i}}ki.ServerSelectionSucceededEvent=wI;class CI extends W1{constructor(e,t,r,n){super(e,t,n);this.name=Ka.WAITING_FOR_SUITABLE_SERVER,this.message="Waiting for suitable server to become available",this.remainingTimeMS=r}}ki.WaitingForSuitableServerEvent=CI});var wA=g(function(K1){Object.defineProperty(K1,"__esModule",{value:!0});K1.SrvPoller=K1.SrvPollingEvent=void 0;var bI=require("dns"),H1=require("timers"),DI=X(),TI=ei(),qi=he();class OA{constructor(e){this.srvRecords=e}hostnames(){return new Set(this.srvRecords.map((e)=>qi.HostAddress.fromSrvRecord(e).toString()))}}K1.SrvPollingEvent=OA;class SA extends TI.TypedEventEmitter{static{this.SRV_RECORD_DISCOVERY="srvRecordDiscovery"}constructor(e){super();if(this.on("error",qi.noop),!e||!e.srvHost)throw new DI.MongoRuntimeError("Options for SrvPoller must exist and include srvHost");this.srvHost=e.srvHost,this.srvMaxHosts=e.srvMaxHosts??0,this.srvServiceName=e.srvServiceName??"mongodb",this.srvAllowedHostsSuffix=e.srvAllowedHostsSuffix,this.srvHostValidator=e.srvHostValidator,this.rescanSrvIntervalMS=60000,this.heartbeatFrequencyMS=e.heartbeatFrequencyMS??1e4,this.haMode=!1,this.generation=0,this._timeout=void 0}get srvAddress(){return`_${this.srvServiceName}._tcp.${this.srvHost}`}get intervalMS(){return this.haMode?this.heartbeatFrequencyMS:this.rescanSrvIntervalMS}start(){if(!this._timeout)this.schedule()}stop(){if(this._timeout)H1.clearTimeout(this._timeout),this.generation+=1,this._timeout=void 0}schedule(){if(this._timeout)H1.clearTimeout(this._timeout);this._timeout=H1.setTimeout(()=>{this._poll().then(void 0,qi.squashError)},this.intervalMS)}success(e){this.haMode=!1,this.schedule(),this.emit(SA.SRV_RECORD_DISCOVERY,new OA(e))}failure(){this.haMode=!0,this.schedule()}async _poll(){let e=this.generation,t;try{t=await bI.promises.resolve(this.srvAddress,"SRV")}catch{this.failure();return}if(e!==this.generation)return;let r=[];for(let n of t)try{let s=qi.normalizeDnsName(n.name);qi.verifySrvHost(s,this.srvHost,this),r.push({...n,name:s})}catch(s){qi.squashError(s)}if(!r.length){this.failure();return}this.success(r)}}K1.SrvPoller=SA});var $I=g(function(d2){Object.defineProperty(d2,"__esModule",{value:!0});d2.Topology=void 0;var BI=tA(),Lt=Br(),Gr=X(),xe=fa(),FI=ei(),ru=Xr(),G1=ds(),Ut=he(),te=Ds(),Jn=dy(),h2=K3(),Y1=jf(),Ga=Sl(),Qn=AA(),Ya=wA(),f2=k3(),Ure=0,Qf=Ut.makeStateMachine({[te.STATE_CLOSED]:[te.STATE_CLOSED,te.STATE_CONNECTING],[te.STATE_CONNECTING]:[te.STATE_CONNECTING,te.STATE_CLOSING,te.STATE_CONNECTED,te.STATE_CLOSED],[te.STATE_CONNECTED]:[te.STATE_CONNECTED,te.STATE_CLOSING,te.STATE_CLOSED],[te.STATE_CLOSING]:[te.STATE_CLOSING,te.STATE_CLOSED]});class Bn extends FI.TypedEventEmitter{static{this.SERVER_OPENING=Lt.SERVER_OPENING}static{this.SERVER_CLOSED=Lt.SERVER_CLOSED}static{this.SERVER_DESCRIPTION_CHANGED=Lt.SERVER_DESCRIPTION_CHANGED}static{this.TOPOLOGY_OPENING=Lt.TOPOLOGY_OPENING}static{this.TOPOLOGY_CLOSED=Lt.TOPOLOGY_CLOSED}static{this.TOPOLOGY_DESCRIPTION_CHANGED=Lt.TOPOLOGY_DESCRIPTION_CHANGED}static{this.ERROR=Lt.ERROR}static{this.OPEN=Lt.OPEN}static{this.CONNECT=Lt.CONNECT}static{this.CLOSE=Lt.CLOSE}static{this.TIMEOUT=Lt.TIMEOUT}constructor(e,t,r){super();if(this.on("error",Ut.noop),this.client=e,r=r??{hosts:[Ut.HostAddress.fromString("localhost:27017")],...Object.fromEntries(BI.DEFAULT_OPTIONS.entries())},typeof t==="string")t=[Ut.HostAddress.fromString(t)];else if(!Array.isArray(t))t=[t];let n=[];for(let a of t)if(typeof a==="string")n.push(Ut.HostAddress.fromString(a));else if(a instanceof Ut.HostAddress)n.push(a);else throw new Gr.MongoRuntimeError(`Topology cannot be constructed from ${JSON.stringify(a)}`);let s=Vre(r),i=Ure++,o=r.srvMaxHosts==null||r.srvMaxHosts===0||r.srvMaxHosts>=n.length?n:Ut.shuffle(n,r.srvMaxHosts),u=new Map;for(let a of o)u.set(a.toString(),new Y1.ServerDescription(a));if(this.waitQueue=new Ut.List,this.s={id:i,options:r,seedlist:n,state:te.STATE_CLOSED,description:new f2.TopologyDescription(s,u,r.replicaSet,void 0,void 0,void 0,r),serverSelectionTimeoutMS:r.serverSelectionTimeoutMS,heartbeatFrequencyMS:r.heartbeatFrequencyMS,minHeartbeatFrequencyMS:r.minHeartbeatFrequencyMS,servers:new Map,credentials:r?.credentials,clusterTime:void 0,detectShardedTopology:(a)=>this.detectShardedTopology(a),detectSrvRecords:(a)=>this.detectSrvRecords(a)},this.mongoLogger=e.mongoLogger,this.component="topology",r.srvHost&&!r.loadBalanced)this.s.srvPoller=r.srvPoller??new Ya.SrvPoller({heartbeatFrequencyMS:this.s.heartbeatFrequencyMS,srvHost:r.srvHost,srvMaxHosts:r.srvMaxHosts,srvServiceName:r.srvServiceName,srvAllowedHostsSuffix:r.srvAllowedHostsSuffix,srvHostValidator:r.srvHostValidator}),this.on(Bn.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology);this.connectionLock=void 0}detectShardedTopology(e){let t=e.previousDescription.type,r=e.newDescription.type,n=t!==te.TopologyType.Sharded&&r===te.TopologyType.Sharded,i=!!this.s.srvPoller?.listeners(Ya.SrvPoller.SRV_RECORD_DISCOVERY)?.includes(this.s.detectSrvRecords);if(n&&!i)this.s.srvPoller?.on(Ya.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords),this.s.srvPoller?.start()}detectSrvRecords(e){let t=this.s.description;if(this.s.description=this.s.description.updateFromSrvPollingEvent(e,this.s.options.srvMaxHosts),this.s.description===t)return;MI(this),this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Jn.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description))}get description(){return this.s.description}get loadBalanced(){return this.s.options.loadBalanced}get serverApi(){return this.s.options.serverApi}async connect(e){this.connectionLock??=this._connect(e);try{return await this.connectionLock,this}finally{this.connectionLock=void 0}}async _connect(e){if(e=e??{},this.s.state===te.STATE_CONNECTED)return this;Qf(this,te.STATE_CONNECTING),this.emitAndLog(Bn.TOPOLOGY_OPENING,new Jn.TopologyOpeningEvent(this.s.id)),this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Jn.TopologyDescriptionChangedEvent(this.s.id,new f2.TopologyDescription(te.TopologyType.Unknown),this.s.description));let t=Array.from(this.s.description.servers.values());if(this.s.servers=new Map(t.map((o)=>[o.address,II(this,o)])),this.s.options.loadBalanced)for(let o of t){let u=new Y1.ServerDescription(o.hostAddress,void 0,{loadBalanced:this.s.options.loadBalanced});this.serverUpdateHandler(u)}let r=this.client.s.options.serverSelectionTimeoutMS,n=e.readPreference??ru.ReadPreference.primary,s=G1.TimeoutContext.create({timeoutMS:void 0,serverSelectionTimeoutMS:r,waitQueueTimeoutMS:this.client.s.options.waitQueueTimeoutMS}),i={operationName:"handshake",...e,timeoutContext:s,deprioritizedServers:new Ga.DeprioritizedServers};try{let o=await this.selectServer(Ga.readPreferenceServerSelector(n),i);if(this.s.options.__skipPingOnConnect!==!0){let a=await o.pool.checkOut({timeoutContext:s});return o.pool.checkIn(a),Qf(this,te.STATE_CONNECTED),this.emit(Bn.OPEN,this),this.emit(Bn.CONNECT,this),this}return Qf(this,te.STATE_CONNECTED),this.emit(Bn.OPEN,this),this.emit(Bn.CONNECT,this),this}catch(o){throw this.close(),o}}closeCheckedOutConnections(){for(let e of this.s.servers.values())e.closeCheckedOutConnections()}close(){if(this.s.state===te.STATE_CLOSED||this.s.state===te.STATE_CLOSING)return;for(let e of this.s.servers.values())NI(e,this);if(this.s.servers.clear(),Qf(this,te.STATE_CLOSING),RI(this.waitQueue,new Gr.MongoTopologyClosedError),this.s.srvPoller)this.s.srvPoller.stop(),this.s.srvPoller.removeListener(Ya.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords);this.removeListener(Bn.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology),Qf(this,te.STATE_CLOSED),this.emitAndLog(Bn.TOPOLOGY_CLOSED,new Jn.TopologyClosedEvent(this.s.id))}async selectServer(e,t){let r;if(typeof e!=="function")if(typeof e==="string")r=Ga.readPreferenceServerSelector(ru.ReadPreference.fromString(e));else{let h;if(e instanceof ru.ReadPreference)h=e;else ru.ReadPreference.translate(t),h=t.readPreference||ru.ReadPreference.primary;r=Ga.readPreferenceServerSelector(h)}else r=e;if(t={serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS,...t},this.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionStartedEvent(e,this.description,t.operationName));let n;if(t.timeoutContext)n=t.timeoutContext.serverSelectionTimeout;else n=G1.Timeout.expires(t.serverSelectionTimeoutMS??0);let s=this.description.type===te.TopologyType.Sharded,i=t.session,o=i&&i.transaction;if(s&&o&&o.server){if(this.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionSucceededEvent(e,this.description,o.server.pool.address,t.operationName));if(!t.timeoutContext||t.timeoutContext.clearServerSelectionTimeout)n?.clear();return o.server}let{promise:u,resolve:a,reject:c}=Ut.promiseWithResolvers(),l={serverSelector:r,topologyDescription:this.description,mongoLogger:this.client.mongoLogger,transaction:o,resolve:a,reject:c,cancelled:!1,startTime:Ut.processTimeMS(),operationName:t.operationName,waitingLogged:!1,deprioritizedServers:t.deprioritizedServers},f=Ut.addAbortListener(t.signal,function(){l.cancelled=!0,c(this.reason)});this.waitQueue.push(l),PI(this);try{n?.throwIfExpired();let h=await(n?Promise.race([u,n]):u);if(t.timeoutContext?.csotEnabled()&&h.description.minRoundTripTime!==0)t.timeoutContext.minRoundTripTime=h.description.minRoundTripTime;return h}catch(h){if(G1.TimeoutError.is(h)){l.cancelled=!0;let d=new Gr.MongoServerSelectionError(`Server selection timed out after ${n?.duration} ms`,this.description);if(this.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionFailedEvent(e,this.description,d,t.operationName));if(t.timeoutContext?.csotEnabled())throw new Gr.MongoOperationTimeoutError("Timed out during server selection",{cause:d});throw d}throw h}finally{if(f?.[Ut.kDispose](),!t.timeoutContext||t.timeoutContext.clearServerSelectionTimeout)n?.clear()}}serverUpdateHandler(e){if(!this.s.description.hasServer(e.address))return;if(zre(this.s.description,e))return;let t=this.s.description,r=this.s.description.servers.get(e.address);if(!r)return;let n=e.$clusterTime;if(n)te._advanceClusterTime(this,n);let s=r&&r.equals(e);if(this.s.description=this.s.description.update(e),this.s.description.compatibilityError){this.emit(Bn.ERROR,new Gr.MongoCompatibilityError(this.s.description.compatibilityError));return}if(!s){let i=this.s.description.servers.get(e.address);if(i)this.emit(Bn.SERVER_DESCRIPTION_CHANGED,new Jn.ServerDescriptionChangedEvent(this.s.id,e.address,r,i))}if(MI(this,e),this.waitQueue.length>0)PI(this);if(!s)this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Jn.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description))}auth(e,t){if(typeof e==="function")t=e,e=void 0;if(typeof t==="function")t(void 0,!0)}isConnected(){return this.s.state===te.STATE_CONNECTED}isDestroyed(){return this.s.state===te.STATE_CLOSED}lastHello(){let e=Array.from(this.description.servers.values());if(e.length===0)return{};return e.filter((n)=>n.type!==te.ServerType.Unknown)[0]||{maxWireVersion:this.description.commonWireVersion}}get commonWireVersion(){return this.description.commonWireVersion}get logicalSessionTimeoutMinutes(){return this.description.logicalSessionTimeoutMinutes}get clusterTime(){return this.s.clusterTime}set clusterTime(e){this.s.clusterTime=e}}d2.Topology=Bn;function NI(e,t){for(let r of Lt.LOCAL_SERVER_EVENTS)e.removeAllListeners(r);e.close(),t.emitAndLog(Bn.SERVER_CLOSED,new Jn.ServerClosedEvent(t.s.id,e.description.address));for(let r of Lt.SERVER_RELAY_EVENTS)e.removeAllListeners(r)}function Vre(e){if(e?.directConnection)return te.TopologyType.Single;if(e?.replicaSet)return te.TopologyType.ReplicaSetNoPrimary;if(e?.loadBalanced)return te.TopologyType.LoadBalanced;return te.TopologyType.Unknown}function II(e,t){e.emitAndLog(Bn.SERVER_OPENING,new Jn.ServerOpeningEvent(e.s.id,t.address));let r=new h2.Server(e,t,e.s.options);for(let n of Lt.SERVER_RELAY_EVENTS)r.on(n,(s)=>e.emit(n,s));return r.on(h2.Server.DESCRIPTION_RECEIVED,(n)=>e.serverUpdateHandler(n)),r.connect(),r}function MI(e,t){if(t&&e.s.servers.has(t.address)){let r=e.s.servers.get(t.address);if(r){if(r.s.description=t,t.error instanceof Gr.MongoError&&t.error.hasErrorLabel(Gr.MongoErrorLabel.ResetPool)){let n=t.error.hasErrorLabel(Gr.MongoErrorLabel.InterruptInUseConnections);r.pool.clear({interruptInUseConnections:n})}else if(t.error==null){let n=e.s.description.type;if(t.isDataBearing||t.type!==te.ServerType.Unknown&&n===te.TopologyType.Single)r.pool.ready()}}}for(let r of e.description.servers.values())if(!e.s.servers.has(r.address)){let n=II(e,r);e.s.servers.set(r.address,n)}for(let r of e.s.servers){let n=r[0];if(e.description.hasServer(n))continue;if(!e.s.servers.has(n))continue;let s=e.s.servers.get(n);if(e.s.servers.delete(n),s)NI(s,e)}}function RI(e,t){while(e.length){let r=e.shift();if(!r)continue;if(!r.cancelled){if(r.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))r.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionFailedEvent(r.serverSelector,r.topologyDescription,t,r.operationName));r.reject(t)}}}function PI(e){if(e.s.state===te.STATE_CLOSED){RI(e.waitQueue,new Gr.MongoTopologyClosedError);return}let t=e.description.type===te.TopologyType.Sharded,r=Array.from(e.description.servers.values()),n=e.waitQueue.length;for(let s=0;s<n;++s){let i=e.waitQueue.shift();if(!i)continue;if(i.cancelled)continue;let o;try{let{serverSelector:c,deprioritizedServers:l}=i;o=c?c(e.description,r,l):r}catch(c){if(e.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionFailedEvent(i.serverSelector,e.description,c,i.operationName));i.reject(c);continue}let u;if(o.length===0){if(!i.waitingLogged){if(e.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.INFORMATIONAL))e.client.mongoLogger?.info(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.WaitingForSuitableServerEvent(i.serverSelector,e.description,e.s.serverSelectionTimeoutMS!==0?e.s.serverSelectionTimeoutMS-(Ut.processTimeMS()-i.startTime):-1,i.operationName));i.waitingLogged=!0}e.waitQueue.push(i);continue}else if(o.length===1)u=e.s.servers.get(o[0].address);else{let c=Ut.shuffle(o,2),l=e.s.servers.get(c[0].address),f=e.s.servers.get(c[1].address);u=l&&f&&l.s.operationCount<f.s.operationCount?l:f}if(!u){let c=new Gr.MongoServerSelectionError("server selection returned a server description but the server was not found in the topology",e.description);if(e.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionFailedEvent(i.serverSelector,e.description,c,i.operationName));i.reject(c);return}let a=i.transaction;if(t&&a&&a.isActive&&u)a.pinServer(u);if(e.client.mongoLogger?.willLog(xe.MongoLoggableComponent.SERVER_SELECTION,xe.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(xe.MongoLoggableComponent.SERVER_SELECTION,new Qn.ServerSelectionSucceededEvent(i.serverSelector,i.topologyDescription,u.pool.address,i.operationName));i.resolve(u)}if(e.waitQueue.length>0)for(let[,s]of e.s.servers)queueMicrotask(function(){return s.requestCheck()})}function zre(e,t){let n=e.servers.get(t.address)?.topologyVersion;return Y1.compareTopologyVersion(n,t.topologyVersion)>0}});var Pc=g(function(X1){Object.defineProperty(X1,"__esModule",{value:!0});X1.MongoClient=X1.ServerApiVersion=void 0;var J1=require("fs"),vI=Oa(),xI=Te(),kI=r1(),qI=Em(),jI=Uo(),p2=n3(),m2=tA(),LI=Br(),UI=mm(),Q1=X(),VI=dA(),y2=fa(),zI=ei(),WI=pI(),HI=EI(),KI=sn(),GI=Xr(),g2=Sl(),_2=$I(),E2=wf(),nt=he();X1.ServerApiVersion=Object.freeze({v1:"1"});class YI extends zI.TypedEventEmitter{constructor(e,t){super();this.driverInfoList=[],this.on("error",nt.noop),this.options=m2.parseOptions(e,this,t),this.appendMetadata(this.options.driverInfo);let r=Object.values(this.options.mongoLoggerOptions.componentSeverities).some((s)=>s!==y2.SeverityLevel.OFF);this.mongoLogger=r?new y2.MongoLogger(this.options.mongoLoggerOptions):void 0;let n=this;this.s={url:e,bsonOptions:xI.resolveBSONOptions(this.options),namespace:nt.ns("admin"),hasBeenClosed:!1,sessionPool:new E2.ServerSessionPool(this),activeSessions:new Set,activeCursors:new Set,authProviders:new VI.MongoClientAuthProviders,get options(){return n.options},get readConcern(){return n.options.readConcern},get writeConcern(){return n.options.writeConcern},get readPreference(){return n.options.readPreference},get isMongoClient(){return!0}},Object.defineProperty(this.s,"url",{enumerable:!1}),this.checkForNonGenuineHosts()}async[Symbol.asyncDispose](){await this.close()}appendMetadata(e){if(this.driverInfoList.some((r)=>p2.isDriverInfoEqual(r,e)))return;this.driverInfoList.push(e),this.options.metadata=p2.makeClientMetadata(this.driverInfoList,this.options).then(void 0,nt.squashError).then((r)=>r??{})}checkForNonGenuineHosts(){let e=this.options.hosts.filter((s)=>nt.isHostMatch(nt.DOCUMENT_DB_CHECK,s.host)),t=nt.isHostMatch(nt.DOCUMENT_DB_CHECK,this.options.srvHost),r=this.options.hosts.filter((s)=>nt.isHostMatch(nt.COSMOS_DB_CHECK,s.host)),n=nt.isHostMatch(nt.COSMOS_DB_CHECK,this.options.srvHost);if(e.length!==0||t)this.mongoLogger?.info("client",nt.DOCUMENT_DB_MSG);else if(r.length!==0||n)this.mongoLogger?.info("client",nt.COSMOS_DB_MSG)}get serverApi(){return this.options.serverApi&&Object.freeze({...this.options.serverApi})}get monitorCommands(){return this.options.monitorCommands}set monitorCommands(e){this.options.monitorCommands=e}get autoEncrypter(){return this.options.autoEncrypter}get readConcern(){return this.s.readConcern}get writeConcern(){return this.s.writeConcern}get readPreference(){return this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get timeoutMS(){return}async bulkWrite(e,t){if(this.autoEncrypter)throw new Q1.MongoInvalidArgumentError("MongoClient bulkWrite does not currently support automatic encryption.");return await new WI.ClientBulkWriteExecutor(this,e,nt.resolveOptions(this,t)).execute()}async connect(){if(this.connectionLock)return await this.connectionLock;try{this.connectionLock=this._connect(),await this.connectionLock}finally{this.connectionLock=void 0}return this}async _connect(){if(this.topology&&this.topology.isConnected())return this;let e=this.options;if(e.tls){if(typeof e.tlsCAFile==="string")e.ca??=await J1.promises.readFile(e.tlsCAFile);if(typeof e.tlsCRLFile==="string")e.crl??=await J1.promises.readFile(e.tlsCRLFile);if(typeof e.tlsCertificateKeyFile==="string"){if(!e.key||!e.cert){let r=await J1.promises.readFile(e.tlsCertificateKeyFile);e.key??=r,e.cert??=r}}}if(typeof e.srvHost==="string"){let r=await m2.resolveSRVRecord(e);for(let[n,s]of r.entries())e.hosts[n]=s}if(e.credentials?.mechanism===jI.AuthMechanism.MONGODB_OIDC){let r=e.credentials?.mechanismProperties?.ALLOWED_HOSTS||qI.DEFAULT_ALLOWED_HOSTS;if(!e.credentials?.mechanismProperties?.ENVIRONMENT){for(let s of e.hosts)if(!nt.hostMatchesWildcards(s.toHostPort().host,r))throw new Q1.MongoInvalidArgumentError(`Host '${s}' is not valid for OIDC authentication with ALLOWED_HOSTS of '${r.join(",")}'`)}}this.topology=new _2.Topology(this,e.hosts,e),this.topology.once(_2.Topology.OPEN,()=>this.emit("open",this));for(let r of LI.MONGO_CLIENT_EVENTS)this.topology.on(r,(...n)=>this.emit(r,...n));let t=async()=>{try{await this.topology?.connect(e)}catch(r){throw this.topology?.close(),r}};if(this.autoEncrypter)await this.autoEncrypter?.init(),await t(),await e.encrypter.connectInternalClient();else await t();return this}async close(e=!1){if(this.closeLock)return await this.closeLock;try{this.closeLock=this._close(),await this.closeLock}finally{this.closeLock=void 0}}async _close(){Object.defineProperty(this.s,"hasBeenClosed",{value:!0,enumerable:!0,configurable:!1,writable:!1}),this.topology?.closeCheckedOutConnections();let e=Array.from(this.s.activeCursors,(o)=>o.close());this.s.activeCursors.clear(),await Promise.all(e);let t=Array.from(this.s.activeSessions,(o)=>o.endSession());if(this.s.activeSessions.clear(),await Promise.all(t),this.topology==null)return;if(this.topology.description.type===vI.TopologyType.LoadBalanced||this.topology.description.logicalSessionTimeoutMinutes!=null)await i(this,this.topology);let n=this.topology;this.topology=void 0,n.close();let{encrypter:s}=this.options;if(s)await s.close(this);async function i(o,{description:u}){let a=g2.readPreferenceServerSelector(GI.ReadPreference.primaryPreferred),c=Array.from(u.servers.values());if(a(u,c,new g2.DeprioritizedServers).length!==0){let f=Array.from(o.s.sessionPool.sessions,({id:h})=>h);if(f.length!==0)try{await KI.executeOperation(o,new HI.EndSessionsOperation(f))}catch(h){nt.squashError(h)}}}}db(e,t){if(t=t??{},!e)e=this.s.options.dbName;let r=Object.assign({},this.options,t);return new UI.Db(this,e,r)}static async connect(e,t){return await new this(e,t).connect()}startSession(e){let t=new E2.ClientSession(this,this.s.sessionPool,{explicit:!0,...e},this.options);return this.s.activeSessions.add(t),t.once("ended",()=>{this.s.activeSessions.delete(t)}),t}async withSession(e,t){let r={owner:Symbol(),...typeof e==="object"?e:{}},n=typeof e==="function"?e:t;if(n==null)throw new Q1.MongoInvalidArgumentError("Missing required callback parameter");let s=this.startSession(r);try{return await n(s)}finally{try{await s.endSession()}catch(i){nt.squashError(i)}}}watch(e=[],t={}){if(!Array.isArray(e))t=e,e=[];return new kI.ChangeStream(this,e,nt.resolveOptions(this,t))}}X1.MongoClient=YI});var r1=g(function(Xf){Object.defineProperty(Xf,"__esModule",{value:!0});Xf.ChangeStream=void 0;Xf.filterOutOptions=nR;var JI=Xl(),Cr=Br(),QI=Ns(),XI=G6(),ZI=mm(),st=X(),eR=Pc(),tR=ei(),rR=Sl(),dn=he(),Rc={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")},Wre=[Cr.RESUME_TOKEN_CHANGED,Cr.END,Cr.CLOSE],Hre="A change stream document has been received that lacks a resume token (_id).",A2="ChangeStream is closed",Kre=Gre();function nR(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>!Kre.has(t)))}class $c extends tR.TypedEventEmitter{async[Symbol.asyncDispose](){await this.close()}static{this.RESPONSE=Cr.RESPONSE}static{this.MORE=Cr.MORE}static{this.INIT=Cr.INIT}static{this.CLOSE=Cr.CLOSE}static{this.CHANGE=Cr.CHANGE}static{this.END=Cr.END}static{this.ERROR=Cr.ERROR}static{this.RESUME_TOKEN_CHANGED=Cr.RESUME_TOKEN_CHANGED}constructor(e,t=[],r={}){super();if(this.pipeline=t,this.options={...r},this.options.timeoutMS=void 0,this.options.timeoutMode=void 0,delete this.options.writeConcern,e instanceof JI.Collection)this.type=Rc.COLLECTION;else if(e instanceof ZI.Db)this.type=Rc.DATABASE;else if(e instanceof eR.MongoClient)this.type=Rc.CLUSTER;else throw new st.MongoChangeStreamError("Parent provided to ChangeStream constructor must be an instance of Collection, Db, or MongoClient");if(this.contextOwner=Symbol(),this.parent=e,this.namespace=e.s.namespace,!this.options.readPreference&&e.readPreference)this.options.readPreference=e.readPreference;this.cursor=this._createChangeStreamCursor(r),this.isClosed=!1,this.mode=!1,this.on("newListener",(n)=>{if(n==="change"&&this.cursor&&this.listenerCount("change")===0)this._streamEvents(this.cursor)}),this.on("removeListener",(n)=>{if(n==="change"&&this.listenerCount("change")===0&&this.cursor)this.cursorStream?.removeAllListeners("data")})}get resumeToken(){return this.cursor?.resumeToken}bufferedCount(){return this.cursor?.bufferedCount()??0}async hasNext(){this._setIsIterator(),this.timeoutContext?.refresh();try{while(!0)try{return await this.cursor.hasNext()}catch(e){try{await this._processErrorIteratorMode(e,this.cursor.id!=null)}catch(t){if(t instanceof st.MongoOperationTimeoutError&&this.cursor.id==null)throw t;try{await this.close()}catch(r){dn.squashError(r)}throw t}}}finally{this.timeoutContext?.clear()}}async next(){this._setIsIterator(),this.timeoutContext?.refresh();try{while(!0)try{let e=await this.cursor.next();return this._processChange(e??null)}catch(e){try{await this._processErrorIteratorMode(e,this.cursor.id!=null)}catch(t){if(t instanceof st.MongoOperationTimeoutError&&this.cursor.id==null)throw t;try{await this.close()}catch(r){dn.squashError(r)}throw t}}}finally{this.timeoutContext?.clear()}}async tryNext(){this._setIsIterator(),this.timeoutContext?.refresh();try{while(!0)try{let e=await this.cursor.tryNext();if(!e)return null;return this._processChange(e)}catch(e){try{await this._processErrorIteratorMode(e,this.cursor.id!=null)}catch(t){if(t instanceof st.MongoOperationTimeoutError&&this.cursor.id==null)throw t;try{await this.close()}catch(r){dn.squashError(r)}throw t}}}finally{this.timeoutContext?.clear()}}async*[Symbol.asyncIterator](){if(this.closed)return;try{while(!0)yield await this.next()}finally{try{await this.close()}catch(e){dn.squashError(e)}}}get closed(){return this.isClosed||this.cursor.closed}async close(){this.timeoutContext?.clear(),this.timeoutContext=void 0,this.isClosed=!0;let e=this.cursor;try{await e.close()}finally{this._endStream()}}stream(){if(this.closed)throw new st.MongoChangeStreamError(A2);return this.cursor.stream()}_setIsEmitter(){if(this.mode==="iterator")throw new st.MongoAPIError("ChangeStream cannot be used as an EventEmitter after being used as an iterator");this.mode="emitter"}_setIsIterator(){if(this.mode==="emitter")throw new st.MongoAPIError("ChangeStream cannot be used as an iterator after being used as an EventEmitter");this.mode="iterator"}_createChangeStreamCursor(e){let t=nR(e);if(this.type===Rc.CLUSTER)t.allChangesForCluster=!0;let r=[{$changeStream:t},...this.pipeline],n=this.type===Rc.CLUSTER?this.parent:this.type===Rc.DATABASE?this.parent.client:this.type===Rc.COLLECTION?this.parent.client:null;if(n==null)throw new st.MongoRuntimeError(`Changestream type should only be one of cluster, database, collection. Found ${this.type.toString()}`);let s=new XI.ChangeStreamCursor(n,this.namespace,r,{...e,timeoutContext:this.timeoutContext?new QI.CursorTimeoutContext(this.timeoutContext,this.contextOwner):void 0});for(let i of Wre)s.on(i,(o)=>this.emit(i,o));if(this.listenerCount($c.CHANGE)>0)this._streamEvents(s);return s}_closeEmitterModeWithError(e){this.emit($c.ERROR,e),this.close().then(void 0,dn.squashError)}_streamEvents(e){this._setIsEmitter();let t=this.cursorStream??e.stream();this.cursorStream=t,t.on("data",(r)=>{try{let n=this._processChange(r);this.emit($c.CHANGE,n)}catch(n){this.emit($c.ERROR,n)}this.timeoutContext?.refresh()}),t.on("error",(r)=>this._processErrorStreamMode(r,this.cursor.id!=null))}_endStream(){this.cursorStream?.removeAllListeners("data"),this.cursorStream?.removeAllListeners("close"),this.cursorStream?.removeAllListeners("end"),this.cursorStream?.destroy(),this.cursorStream=void 0}_processChange(e){if(this.isClosed)throw new st.MongoAPIError(A2);if(e==null)throw new st.MongoRuntimeError(A2);if(e&&!e._id)throw new st.MongoChangeStreamError(Hre);return this.cursor.cacheResumeToken(e._id),this.options.startAtOperationTime=void 0,e}_processErrorStreamMode(e,t){if(this.isClosed)return;if(t&&(st.isResumableError(e,this.cursor.maxWireVersion)||e instanceof st.MongoOperationTimeoutError))this._endStream(),this.cursor.close().then(()=>this._resume(e),(r)=>(dn.squashError(r),this._resume(e))).then(()=>{if(e instanceof st.MongoOperationTimeoutError)this.emit($c.ERROR,e)},()=>this._closeEmitterModeWithError(e));else this._closeEmitterModeWithError(e)}async _processErrorIteratorMode(e,t){if(this.isClosed)throw new st.MongoAPIError(A2);if(t&&(st.isResumableError(e,this.cursor.maxWireVersion)||e instanceof st.MongoOperationTimeoutError)){try{await this.cursor.close()}catch(r){dn.squashError(r)}if(await this._resume(e),e instanceof st.MongoOperationTimeoutError)throw e}else{try{await this.close()}catch(r){dn.squashError(r)}throw e}}async _resume(e){this.timeoutContext?.refresh();let t=dn.getTopology(this.parent);try{await t.selectServer(this.cursor.readPreference,{operationName:"reconnect topology in change stream",timeoutContext:this.timeoutContext,deprioritizedServers:new rR.DeprioritizedServers}),this.cursor=this._createChangeStreamCursor(this.cursor.resumeOptions)}catch{throw await this.close(),e}}}Xf.ChangeStream=$c;function Gre(){return new Set(Object.keys({allowDiskUse:"",authdb:"",batchSize:"",bsonRegExp:"",bypassDocumentValidation:"",bypassPinningCheck:"",checkKeys:"",collation:"",comment:"",cursor:"",dbName:"",enableUtf8Validation:"",explain:"",fieldsAsRaw:"",hint:"",ignoreUndefined:"",let:"",maxAwaitTimeMS:"",maxTimeMS:"",omitMaxTimeMS:"",out:"",promoteBuffers:"",promoteLongs:"",promoteValues:"",raw:"",rawData:"",readConcern:"",readPreference:"",serializeFunctions:"",session:"",timeoutContext:"",timeoutMS:"",timeoutMode:"",useBigInt64:"",willRetryWrite:"",writeConcern:""}))}});var bA=g(function(O2){Object.defineProperty(O2,"__esModule",{value:!0});O2.GridFSBucketReadStream=void 0;var iR=require("stream"),oR=Te(),Qt=X();class CA extends iR.Readable{static{this.FILE="file"}constructor(e,t,r,n,s){super({emitClose:!0});this.s={bytesToTrim:0,bytesToSkip:0,bytesRead:0,chunks:e,expected:0,files:t,filter:n,init:!1,expectedEnd:0,options:{start:0,end:0,...s},readPreference:r}}_read(){if(this.destroyed)return;Qre(this,()=>Yre(this))}start(e=0){return sR(this),this.s.options.start=e,this}end(e=0){return sR(this),this.s.options.end=e,this}async abort(){this.push(null),this.destroy();let e=this.s.timeoutContext?.getRemainingTimeMSOrThrow();await this.s.cursor?.close({timeoutMS:e})}}O2.GridFSBucketReadStream=CA;function sR(e){if(e.s.init)throw new Qt.MongoGridFSStreamError("Options cannot be changed after the stream is initialized")}function Yre(e){if(e.destroyed)return;if(!e.s.cursor)return;if(!e.s.file)return;let t=(r)=>{if(e.destroyed)return;if(!r){e.push(null),e.s.cursor?.close().then(void 0,(f)=>e.destroy(f));return}if(!e.s.file)return;let n=e.s.file.length-e.s.bytesRead,s=e.s.expected++,i=Math.min(e.s.file.chunkSize,n);if(r.n>s)return e.destroy(new Qt.MongoGridFSChunkError(`ChunkIsMissing: Got unexpected n: ${r.n}, expected: ${s}`));if(r.n<s)return e.destroy(new Qt.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${r.n}, expected: ${s}`));let o=oR.ByteUtils.isUint8Array(r.data)?r.data:r.data.buffer;if(o.byteLength!==i){if(n<=0)return e.destroy(new Qt.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${r.n}, expected file length ${e.s.file.length} bytes but already read ${e.s.bytesRead} bytes`));return e.destroy(new Qt.MongoGridFSChunkError(`ChunkIsWrongSize: Got unexpected length: ${o.byteLength}, expected: ${i}`))}if(e.s.bytesRead+=o.byteLength,o.byteLength===0)return e.push(null);let u=null,a=null;if(e.s.bytesToSkip!=null)u=e.s.bytesToSkip,e.s.bytesToSkip=0;let c=s===e.s.expectedEnd-1,l=e.s.options.end-e.s.bytesToSkip;if(c&&e.s.bytesToTrim!=null)a=e.s.file.chunkSize-e.s.bytesToTrim;else if(e.s.options.end&&l<r.data.byteLength)a=l;if(u!=null||a!=null)o=o.slice(u||0,a||o.byteLength);e.push(o);return};e.s.cursor.next().then(t,(r)=>{if(e.destroyed)return;e.destroy(r)})}function Jre(e){let t={};if(e.s.readPreference)t.readPreference=e.s.readPreference;if(e.s.options&&e.s.options.sort)t.sort=e.s.options.sort;if(e.s.options&&e.s.options.skip)t.skip=e.s.options.skip;let r=(s)=>{if(e.destroyed)return;if(!s){let a=`FileNotFound: file ${e.s.filter._id!=null?e.s.filter._id.$eq:e.s.filter.filename} was not found`,c=new Qt.MongoRuntimeError(a);return c.code="ENOENT",e.destroy(c)}if(s.length<=0){e.push(null);return}if(e.destroyed){e.destroy();return}try{e.s.bytesToSkip=Xre(e,s,e.s.options)}catch(u){return e.destroy(u)}let i={files_id:{$eq:s._id}};if(e.s.options&&e.s.options.start!=null){let u=Math.floor(e.s.options.start/s.chunkSize);if(u>0)i.n={$gte:u}}let o;try{o=e.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${e.s.timeoutContext?.timeoutMS}ms`)}catch(u){return e.destroy(u)}if(e.s.cursor=e.s.chunks.find(i,{timeoutMS:o}).sort({n:1}),e.s.readPreference)e.s.cursor.withReadPreference(e.s.readPreference);e.s.expectedEnd=Math.ceil(s.length/s.chunkSize),e.s.file=s;try{e.s.bytesToTrim=Zre(e,s,e.s.cursor,e.s.options)}catch(u){return e.destroy(u)}e.emit(CA.FILE,s);return},n;try{n=e.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${e.s.timeoutContext?.timeoutMS}ms`)}catch(s){if(!e.destroyed)e.destroy(s);return}t.timeoutMS=n,e.s.files.findOne(e.s.filter,t).then(r,(s)=>{if(e.destroyed)return;e.destroy(s)})}function Qre(e,t){if(e.s.file)return t();if(!e.s.init)Jre(e),e.s.init=!0;e.once("file",()=>{t()})}function Xre(e,t,r){if(r&&r.start!=null){if(r.start>t.length)throw new Qt.MongoInvalidArgumentError(`Stream start (${r.start}) must not be more than the length of the file (${t.length})`);if(r.start<0)throw new Qt.MongoInvalidArgumentError(`Stream start (${r.start}) must not be negative`);if(r.end!=null&&r.end<r.start)throw new Qt.MongoInvalidArgumentError(`Stream start (${r.start}) must not be greater than stream end (${r.end})`);return e.s.bytesRead=Math.floor(r.start/t.chunkSize)*t.chunkSize,e.s.expected=Math.floor(r.start/t.chunkSize),r.start-e.s.bytesRead}throw new Qt.MongoInvalidArgumentError("Start option must be defined")}function Zre(e,t,r,n){if(n&&n.end!=null){if(n.end>t.length)throw new Qt.MongoInvalidArgumentError(`Stream end (${n.end}) must not be more than the length of the file (${t.length})`);if(n.start==null||n.start<0)throw new Qt.MongoInvalidArgumentError(`Stream end (${n.end}) must not be negative`);let s=n.start!=null?Math.floor(n.start/t.chunkSize):0;return r.limit(Math.ceil(n.end/t.chunkSize)-s),e.s.expectedEnd=Math.ceil(n.end/t.chunkSize),Math.ceil(n.end/t.chunkSize)*t.chunkSize-n.end}throw new Qt.MongoInvalidArgumentError("End option must be defined")}});var TA=g(function(Z1){Object.defineProperty(Z1,"__esModule",{value:!0});Z1.GridFSBucketWriteStream=void 0;Z1.checkChunksIndex=fR;Z1.checkIndexes=dR;var uR=require("stream"),pn=Te(),br=X(),aR=he(),cR=fs();class lR extends uR.Writable{constructor(e,t,r){super();this.gridFSFile=null,r=r??{},this.bucket=e,this.chunks=e.s._chunksCollection,this.filename=t,this.files=e.s._filesCollection,this.options=r,this.writeConcern=cR.WriteConcern.fromOptions(r)||e.s.options.writeConcern,this.done=!1,this.id=r.id?r.id:new pn.ObjectId,this.chunkSizeBytes=r.chunkSizeBytes||this.bucket.s.options.chunkSizeBytes,this.bufToStore=pn.ByteUtils.allocate(this.chunkSizeBytes),this.length=0,this.n=0,this.pos=0,this.state={streamEnd:!1,outstandingRequests:0,errored:!1,aborted:!1}}_construct(e){if(!this.bucket.s.calledOpenUploadStream)this.bucket.s.calledOpenUploadStream=!0,dR(this).then(()=>{this.bucket.s.checkedIndexes=!0,this.bucket.emit("index"),e()},(t)=>{if(t instanceof br.MongoOperationTimeoutError)return vc(this,t,e);aR.squashError(t),e()});else return queueMicrotask(e)}_write(e,t,r){tne(this,e,t,r)}_final(e){if(this.state.streamEnd)return queueMicrotask(e);this.state.streamEnd=!0,rne(this,e)}async abort(){if(this.state.streamEnd)throw new br.MongoAPIError("Cannot abort a stream that has already completed");if(this.state.aborted)throw new br.MongoAPIError("Cannot call abort() on a stream twice");this.state.aborted=!0;let e=this.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${this.timeoutContext?.timeoutMS}ms`);await this.chunks.deleteMany({files_id:{$eq:this.id}},{timeoutMS:e})}}Z1.GridFSBucketWriteStream=lR;function vc(e,t,r){if(e.state.errored){queueMicrotask(r);return}e.state.errored=!0,queueMicrotask(()=>r(t))}function hR(e,t,r){return{_id:new pn.ObjectId,files_id:e,n:t,data:r}}async function fR(e){let t={files_id:1,n:1},r;r=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);let n;try{n=await e.chunks.listIndexes({timeoutMS:r}).toArray()}catch(i){if(i instanceof br.MongoError&&br.isNamespaceNotFoundError(i))n=[];else throw i}if(!n.find((i)=>{if(Object.keys(i.key).length===2&&i.key.files_id===1&&i.key.n===1)return!0;return!1}))r=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),await e.chunks.createIndex(t,{unique:!0},{timeoutMS:r})}function DA(e,t){if(e.done)return queueMicrotask(t);if(e.state.streamEnd&&e.state.outstandingRequests===0&&!e.state.errored){e.done=!0;let r=ene(e.id,e.length,e.chunkSizeBytes,e.filename,e.options.metadata);if(S2(e,t))return;let n=e.timeoutContext?.remainingTimeMS;if(n!=null&&n<=0)return vc(e,new br.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),t);e.files.insertOne(r,{writeConcern:e.writeConcern,timeoutMS:n}).then(()=>{e.gridFSFile=r,t()},(s)=>vc(e,s,t));return}queueMicrotask(t)}async function dR(e){let t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);if(await e.files.findOne({},{projection:{_id:1},timeoutMS:t})!=null)return;let n={filename:1,uploadDate:1},s;t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);let i={timeoutMS:t};try{s=await e.files.listIndexes(i).toArray()}catch(u){if(u instanceof br.MongoError&&br.isNamespaceNotFoundError(u))s=[];else throw u}if(!s.find((u)=>{if(Object.keys(u.key).length===2&&u.key.filename===1&&u.key.uploadDate===1)return!0;return!1}))t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),await e.files.createIndex(n,{},{timeoutMS:t});await fR(e)}function ene(e,t,r,n,s){let i={_id:e,length:t,chunkSize:r,uploadDate:new Date,filename:n};if(s)i.metadata=s;return i}function tne(e,t,r,n){if(S2(e,n))return;let s=typeof t==="string"?pn.ByteUtils.fromUTF8(t):pn.ByteUtils.toLocalBufferType(t);if(e.length+=s.length,e.pos+s.length<e.chunkSizeBytes){pn.ByteUtils.copy(s,e.bufToStore,e.pos),e.pos+=s.length,queueMicrotask(n);return}let i=s.length,o=e.chunkSizeBytes-e.pos,u=Math.min(o,s.length),a=0;while(i>0){let c=s.length-i;pn.ByteUtils.copy(s,e.bufToStore,e.pos,c,c+u),e.pos+=u,o-=u;let l;if(o===0){l=hR(e.id,e.n,new Uint8Array(e.bufToStore));let f=e.timeoutContext?.remainingTimeMS;if(f!=null&&f<=0)return vc(e,new br.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),n);if(++e.state.outstandingRequests,++a,S2(e,n))return;e.chunks.insertOne(l,{writeConcern:e.writeConcern,timeoutMS:f}).then(()=>{if(--e.state.outstandingRequests,--a,!a)DA(e,n)},(h)=>vc(e,h,n)),o=e.chunkSizeBytes,e.pos=0,++e.n}i-=u,u=Math.min(o,i)}}function rne(e,t){if(e.pos===0)return DA(e,t);let r=pn.ByteUtils.allocate(e.pos);pn.ByteUtils.copy(e.bufToStore,r,0,0,e.pos);let n=hR(e.id,e.n,r);if(S2(e,t))return;let s=e.timeoutContext?.remainingTimeMS;if(s!=null&&s<=0)return vc(e,new br.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),t);++e.state.outstandingRequests,e.chunks.insertOne(n,{writeConcern:e.writeConcern,timeoutMS:s}).then(()=>{--e.state.outstandingRequests,DA(e,t)},(i)=>vc(e,i,t))}function S2(e,t){if(e.state.aborted)return queueMicrotask(()=>t(new br.MongoAPIError("Stream has been aborted"))),!0;return!1}});var gR=g(function(D2){Object.defineProperty(D2,"__esModule",{value:!0});D2.GridFSBucket=void 0;var eh=X(),pR=ei(),w2=ds(),Ja=he(),mR=fs(),C2=bA(),b2=TA(),nne={bucketName:"fs",chunkSizeBytes:261120};class yR extends pR.TypedEventEmitter{static{this.INDEX="index"}constructor(e,t){super();this.on("error",Ja.noop),this.setMaxListeners(0);let r=Ja.resolveOptions(e,{...nne,...t,writeConcern:mR.WriteConcern.fromOptions(t)});this.s={db:e,options:r,_chunksCollection:e.collection(r.bucketName+".chunks"),_filesCollection:e.collection(r.bucketName+".files"),checkedIndexes:!1,calledOpenUploadStream:!1}}openUploadStream(e,t){return new b2.GridFSBucketWriteStream(this,e,{timeoutMS:this.s.options.timeoutMS,...t})}openUploadStreamWithId(e,t,r){return new b2.GridFSBucketWriteStream(this,t,{timeoutMS:this.s.options.timeoutMS,...r,id:e})}openDownloadStream(e,t){return new C2.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{_id:{$eq:e}},{timeoutMS:this.s.options.timeoutMS,...t})}async delete(e,t){let{timeoutMS:r}=Ja.resolveOptions(this.s.db,t),n=void 0;if(r)n=new w2.CSOTTimeoutContext({timeoutMS:r,serverSelectionTimeoutMS:this.s.db.client.s.options.serverSelectionTimeoutMS});let{deletedCount:s}=await this.s._filesCollection.deleteOne({_id:{$eq:e}},{timeoutMS:n?.remainingTimeMS}),i=n?.remainingTimeMS;if(i!=null&&i<=0)throw new eh.MongoOperationTimeoutError(`Timed out after ${r}ms`);if(await this.s._chunksCollection.deleteMany({files_id:{$eq:e}},{timeoutMS:i}),s===0)throw new eh.MongoRuntimeError(`File not found for id ${e}`)}find(e={},t={}){return this.s._filesCollection.find(e,t)}openDownloadStreamByName(e,t){let r={uploadDate:-1},n=void 0;if(t&&t.revision!=null)if(t.revision>=0)r={uploadDate:1},n=t.revision;else n=-t.revision-1;return new C2.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{filename:e},{timeoutMS:this.s.options.timeoutMS,...t,sort:r,skip:n})}async rename(e,t,r){let n={_id:{$eq:e}},s={$set:{filename:t}},{matchedCount:i}=await this.s._filesCollection.updateOne(n,s,r);if(i===0)throw new eh.MongoRuntimeError(`File with id ${e} not found`)}async drop(e){let{timeoutMS:t}=Ja.resolveOptions(this.s.db,e),r=void 0;if(t)r=new w2.CSOTTimeoutContext({timeoutMS:t,serverSelectionTimeoutMS:this.s.db.client.s.options.serverSelectionTimeoutMS});if(r){await this.s._filesCollection.drop({timeoutMS:r.remainingTimeMS});let n=r.getRemainingTimeMSOrThrow(`Timed out after ${t}ms`);await this.s._chunksCollection.drop({timeoutMS:n})}else await this.s._filesCollection.drop(),await this.s._chunksCollection.drop()}}D2.GridFSBucket=yR});var Oa=g(function(O){Object.defineProperty(O,"__esModule",{value:!0});O.MongoRuntimeError=O.MongoParseError=O.MongoOperationTimeoutError=O.MongoOIDCError=O.MongoNotConnectedError=O.MongoNetworkTimeoutError=O.MongoNetworkError=O.MongoMissingDependencyError=O.MongoMissingCredentialsError=O.MongoKerberosError=O.MongoInvalidArgumentError=O.MongoGridFSStreamError=O.MongoGridFSChunkError=O.MongoGCPError=O.MongoExpiredSessionError=O.MongoError=O.MongoDriverError=O.MongoDecompressionError=O.MongoCursorInUseError=O.MongoCursorExhaustedError=O.MongoCompatibilityError=O.MongoClientClosedError=O.MongoClientBulkWriteExecutionError=O.MongoClientBulkWriteError=O.MongoClientBulkWriteCursorError=O.MongoChangeStreamError=O.MongoBatchReExecutionError=O.MongoAzureError=O.MongoAWSError=O.MongoAPIError=O.ExplainableCursor=O.ChangeStreamCursor=O.ClientEncryption=O.MongoBulkWriteError=O.UUID=O.Timestamp=O.ObjectId=O.MinKey=O.MaxKey=O.Long=O.Int32=O.Double=O.Decimal128=O.DBRef=O.Code=O.BSONType=O.BSONSymbol=O.BSONRegExp=O.Binary=O.BSON=void 0;O.CommandStartedEvent=O.CommandFailedEvent=O.WriteConcern=O.ReadPreference=O.ReadConcern=O.TopologyType=O.ServerType=O.ReadPreferenceMode=O.ReadConcernLevel=O.ProfilingLevel=O.ReturnDocument=O.SeverityLevel=O.MongoLoggableComponent=O.ServerApiVersion=O.ExplainVerbosity=O.MongoErrorLabel=O.CursorTimeoutMode=O.CURSOR_FLAGS=O.Compressor=O.AuthMechanism=O.GSSAPICanonicalizationValue=O.AutoEncryptionLoggerLevel=O.BatchType=O.UnorderedBulkOperation=O.OrderedBulkOperation=O.MongoClient=O.ListIndexesCursor=O.ListCollectionsCursor=O.GridFSBucketWriteStream=O.GridFSBucketReadStream=O.GridFSBucket=O.FindCursor=O.Db=O.Collection=O.ClientSession=O.ChangeStream=O.CancellationToken=O.AggregationCursor=O.Admin=O.AbstractCursor=O.MongoWriteConcernError=O.MongoUnexpectedServerResponseError=O.MongoTransactionError=O.MongoTopologyClosedError=O.MongoTailableCursorError=O.MongoSystemError=O.MongoStalePrimaryError=O.MongoServerSelectionError=O.MongoServerError=O.MongoServerClosedError=void 0;O.MongoClientAuthProviders=O.MongoCryptKMSRequestNetworkTimeoutError=O.MongoCryptInvalidArgumentError=O.MongoCryptError=O.MongoCryptCreateEncryptedCollectionError=O.MongoCryptCreateDataKeyError=O.MongoCryptAzureKMSRequestError=O.SrvPollingEvent=O.WaitingForSuitableServerEvent=O.ServerSelectionSucceededEvent=O.ServerSelectionStartedEvent=O.ServerSelectionFailedEvent=O.ServerSelectionEvent=O.TopologyOpeningEvent=O.TopologyDescriptionChangedEvent=O.TopologyClosedEvent=O.ServerOpeningEvent=O.ServerHeartbeatSucceededEvent=O.ServerHeartbeatStartedEvent=O.ServerHeartbeatFailedEvent=O.ServerDescriptionChangedEvent=O.ServerClosedEvent=O.ConnectionReadyEvent=O.ConnectionPoolReadyEvent=O.ConnectionPoolMonitoringEvent=O.ConnectionPoolCreatedEvent=O.ConnectionPoolClosedEvent=O.ConnectionPoolClearedEvent=O.ConnectionCreatedEvent=O.ConnectionClosedEvent=O.ConnectionCheckOutStartedEvent=O.ConnectionCheckOutFailedEvent=O.ConnectionCheckedOutEvent=O.ConnectionCheckedInEvent=O.CommandSucceededEvent=void 0;var _R=g6();Object.defineProperty(O,"Admin",{enumerable:!0,get:function(){return _R.Admin}});var ER=_6();Object.defineProperty(O,"OrderedBulkOperation",{enumerable:!0,get:function(){return ER.OrderedBulkOperation}});var AR=E6();Object.defineProperty(O,"UnorderedBulkOperation",{enumerable:!0,get:function(){return AR.UnorderedBulkOperation}});var OR=r1();Object.defineProperty(O,"ChangeStream",{enumerable:!0,get:function(){return OR.ChangeStream}});var SR=Xl();Object.defineProperty(O,"Collection",{enumerable:!0,get:function(){return SR.Collection}});var wR=Ns();Object.defineProperty(O,"AbstractCursor",{enumerable:!0,get:function(){return wR.AbstractCursor}});var CR=bf();Object.defineProperty(O,"AggregationCursor",{enumerable:!0,get:function(){return CR.AggregationCursor}});var bR=x6();Object.defineProperty(O,"FindCursor",{enumerable:!0,get:function(){return bR.FindCursor}});var DR=Q6();Object.defineProperty(O,"ListCollectionsCursor",{enumerable:!0,get:function(){return DR.ListCollectionsCursor}});var TR=L6();Object.defineProperty(O,"ListIndexesCursor",{enumerable:!0,get:function(){return TR.ListIndexesCursor}});var MR=mm();Object.defineProperty(O,"Db",{enumerable:!0,get:function(){return MR.Db}});var PR=gR();Object.defineProperty(O,"GridFSBucket",{enumerable:!0,get:function(){return PR.GridFSBucket}});var BR=bA();Object.defineProperty(O,"GridFSBucketReadStream",{enumerable:!0,get:function(){return BR.GridFSBucketReadStream}});var FR=TA();Object.defineProperty(O,"GridFSBucketWriteStream",{enumerable:!0,get:function(){return FR.GridFSBucketWriteStream}});var NR=Pc();Object.defineProperty(O,"MongoClient",{enumerable:!0,get:function(){return NR.MongoClient}});var IR=ei();Object.defineProperty(O,"CancellationToken",{enumerable:!0,get:function(){return IR.CancellationToken}});var RR=wf();Object.defineProperty(O,"ClientSession",{enumerable:!0,get:function(){return RR.ClientSession}});var sne=Te();Object.defineProperty(O,"BSON",{enumerable:!0,get:function(){return sne.BSON}});var ys=Te();Object.defineProperty(O,"Binary",{enumerable:!0,get:function(){return ys.Binary}});Object.defineProperty(O,"BSONRegExp",{enumerable:!0,get:function(){return ys.BSONRegExp}});Object.defineProperty(O,"BSONSymbol",{enumerable:!0,get:function(){return ys.BSONSymbol}});Object.defineProperty(O,"BSONType",{enumerable:!0,get:function(){return ys.BSONType}});Object.defineProperty(O,"Code",{enumerable:!0,get:function(){return ys.Code}});Object.defineProperty(O,"DBRef",{enumerable:!0,get:function(){return ys.DBRef}});Object.defineProperty(O,"Decimal128",{enumerable:!0,get:function(){return ys.Decimal128}});Object.defineProperty(O,"Double",{enumerable:!0,get:function(){return ys.Double}});Object.defineProperty(O,"Int32",{enumerable:!0,get:function(){return ys.Int32}});Object.defineProperty(O,"Long",{enumerable:!0,get:function(){return ys.Long}});Object.defineProperty(O,"MaxKey",{enumerable:!0,get:function(){return ys.MaxKey}});Object.defineProperty(O,"MinKey",{enumerable:!0,get:function(){return ys.MinKey}});Object.defineProperty(O,"ObjectId",{enumerable:!0,get:function(){return ys.ObjectId}});Object.defineProperty(O,"Timestamp",{enumerable:!0,get:function(){return ys.Timestamp}});Object.defineProperty(O,"UUID",{enumerable:!0,get:function(){return ys.UUID}});var ine=Il();Object.defineProperty(O,"MongoBulkWriteError",{enumerable:!0,get:function(){return ine.MongoBulkWriteError}});var one=Vm();Object.defineProperty(O,"ClientEncryption",{enumerable:!0,get:function(){return one.ClientEncryption}});var une=G6();Object.defineProperty(O,"ChangeStreamCursor",{enumerable:!0,get:function(){return une.ChangeStreamCursor}});var ane=b0();Object.defineProperty(O,"ExplainableCursor",{enumerable:!0,get:function(){return ane.ExplainableCursor}});var Ge=X();Object.defineProperty(O,"MongoAPIError",{enumerable:!0,get:function(){return Ge.MongoAPIError}});Object.defineProperty(O,"MongoAWSError",{enumerable:!0,get:function(){return Ge.MongoAWSError}});Object.defineProperty(O,"MongoAzureError",{enumerable:!0,get:function(){return Ge.MongoAzureError}});Object.defineProperty(O,"MongoBatchReExecutionError",{enumerable:!0,get:function(){return Ge.MongoBatchReExecutionError}});Object.defineProperty(O,"MongoChangeStreamError",{enumerable:!0,get:function(){return Ge.MongoChangeStreamError}});Object.defineProperty(O,"MongoClientBulkWriteCursorError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteCursorError}});Object.defineProperty(O,"MongoClientBulkWriteError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteError}});Object.defineProperty(O,"MongoClientBulkWriteExecutionError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteExecutionError}});Object.defineProperty(O,"MongoClientClosedError",{enumerable:!0,get:function(){return Ge.MongoClientClosedError}});Object.defineProperty(O,"MongoCompatibilityError",{enumerable:!0,get:function(){return Ge.MongoCompatibilityError}});Object.defineProperty(O,"MongoCursorExhaustedError",{enumerable:!0,get:function(){return Ge.MongoCursorExhaustedError}});Object.defineProperty(O,"MongoCursorInUseError",{enumerable:!0,get:function(){return Ge.MongoCursorInUseError}});Object.defineProperty(O,"MongoDecompressionError",{enumerable:!0,get:function(){return Ge.MongoDecompressionError}});Object.defineProperty(O,"MongoDriverError",{enumerable:!0,get:function(){return Ge.MongoDriverError}});Object.defineProperty(O,"MongoError",{enumerable:!0,get:function(){return Ge.MongoError}});Object.defineProperty(O,"MongoExpiredSessionError",{enumerable:!0,get:function(){return Ge.MongoExpiredSessionError}});Object.defineProperty(O,"MongoGCPError",{enumerable:!0,get:function(){return Ge.MongoGCPError}});Object.defineProperty(O,"MongoGridFSChunkError",{enumerable:!0,get:function(){return Ge.MongoGridFSChunkError}});Object.defineProperty(O,"MongoGridFSStreamError",{enumerable:!0,get:function(){return Ge.MongoGridFSStreamError}});Object.defineProperty(O,"MongoInvalidArgumentError",{enumerable:!0,get:function(){return Ge.MongoInvalidArgumentError}});Object.defineProperty(O,"MongoKerberosError",{enumerable:!0,get:function(){return Ge.MongoKerberosError}});Object.defineProperty(O,"MongoMissingCredentialsError",{enumerable:!0,get:function(){return Ge.MongoMissingCredentialsError}});Object.defineProperty(O,"MongoMissingDependencyError",{enumerable:!0,get:function(){return Ge.MongoMissingDependencyError}});Object.defineProperty(O,"MongoNetworkError",{enumerable:!0,get:function(){return Ge.MongoNetworkError}});Object.defineProperty(O,"MongoNetworkTimeoutError",{enumerable:!0,get:function(){return Ge.MongoNetworkTimeoutError}});Object.defineProperty(O,"MongoNotConnectedError",{enumerable:!0,get:function(){return Ge.MongoNotConnectedError}});Object.defineProperty(O,"MongoOIDCError",{enumerable:!0,get:function(){return Ge.MongoOIDCError}});Object.defineProperty(O,"MongoOperationTimeoutError",{enumerable:!0,get:function(){return Ge.MongoOperationTimeoutError}});Object.defineProperty(O,"MongoParseError",{enumerable:!0,get:function(){return Ge.MongoParseError}});Object.defineProperty(O,"MongoRuntimeError",{enumerable:!0,get:function(){return Ge.MongoRuntimeError}});Object.defineProperty(O,"MongoServerClosedError",{enumerable:!0,get:function(){return Ge.MongoServerClosedError}});Object.defineProperty(O,"MongoServerError",{enumerable:!0,get:function(){return Ge.MongoServerError}});Object.defineProperty(O,"MongoServerSelectionError",{enumerable:!0,get:function(){return Ge.MongoServerSelectionError}});Object.defineProperty(O,"MongoStalePrimaryError",{enumerable:!0,get:function(){return Ge.MongoStalePrimaryError}});Object.defineProperty(O,"MongoSystemError",{enumerable:!0,get:function(){return Ge.MongoSystemError}});Object.defineProperty(O,"MongoTailableCursorError",{enumerable:!0,get:function(){return Ge.MongoTailableCursorError}});Object.defineProperty(O,"MongoTopologyClosedError",{enumerable:!0,get:function(){return Ge.MongoTopologyClosedError}});Object.defineProperty(O,"MongoTransactionError",{enumerable:!0,get:function(){return Ge.MongoTransactionError}});Object.defineProperty(O,"MongoUnexpectedServerResponseError",{enumerable:!0,get:function(){return Ge.MongoUnexpectedServerResponseError}});Object.defineProperty(O,"MongoWriteConcernError",{enumerable:!0,get:function(){return Ge.MongoWriteConcernError}});var cne=Il();Object.defineProperty(O,"BatchType",{enumerable:!0,get:function(){return cne.BatchType}});var lne=F3();Object.defineProperty(O,"AutoEncryptionLoggerLevel",{enumerable:!0,get:function(){return lne.AutoEncryptionLoggerLevel}});var hne=gm();Object.defineProperty(O,"GSSAPICanonicalizationValue",{enumerable:!0,get:function(){return hne.GSSAPICanonicalizationValue}});var fne=Uo();Object.defineProperty(O,"AuthMechanism",{enumerable:!0,get:function(){return fne.AuthMechanism}});var dne=pf();Object.defineProperty(O,"Compressor",{enumerable:!0,get:function(){return dne.Compressor}});var $R=Ns();Object.defineProperty(O,"CURSOR_FLAGS",{enumerable:!0,get:function(){return $R.CURSOR_FLAGS}});Object.defineProperty(O,"CursorTimeoutMode",{enumerable:!0,get:function(){return $R.CursorTimeoutMode}});var pne=X();Object.defineProperty(O,"MongoErrorLabel",{enumerable:!0,get:function(){return pne.MongoErrorLabel}});var mne=zE();Object.defineProperty(O,"ExplainVerbosity",{enumerable:!0,get:function(){return mne.ExplainVerbosity}});var yne=Pc();Object.defineProperty(O,"ServerApiVersion",{enumerable:!0,get:function(){return yne.ServerApiVersion}});var vR=fa();Object.defineProperty(O,"MongoLoggableComponent",{enumerable:!0,get:function(){return vR.MongoLoggableComponent}});Object.defineProperty(O,"SeverityLevel",{enumerable:!0,get:function(){return vR.SeverityLevel}});var gne=z6();Object.defineProperty(O,"ReturnDocument",{enumerable:!0,get:function(){return gne.ReturnDocument}});var _ne=Z6();Object.defineProperty(O,"ProfilingLevel",{enumerable:!0,get:function(){return _ne.ProfilingLevel}});var Ene=lo();Object.defineProperty(O,"ReadConcernLevel",{enumerable:!0,get:function(){return Ene.ReadConcernLevel}});var Ane=Xr();Object.defineProperty(O,"ReadPreferenceMode",{enumerable:!0,get:function(){return Ane.ReadPreferenceMode}});var xR=Ds();Object.defineProperty(O,"ServerType",{enumerable:!0,get:function(){return xR.ServerType}});Object.defineProperty(O,"TopologyType",{enumerable:!0,get:function(){return xR.TopologyType}});var One=lo();Object.defineProperty(O,"ReadConcern",{enumerable:!0,get:function(){return One.ReadConcern}});var Sne=Xr();Object.defineProperty(O,"ReadPreference",{enumerable:!0,get:function(){return Sne.ReadPreference}});var wne=fs();Object.defineProperty(O,"WriteConcern",{enumerable:!0,get:function(){return wne.WriteConcern}});var MA=v3();Object.defineProperty(O,"CommandFailedEvent",{enumerable:!0,get:function(){return MA.CommandFailedEvent}});Object.defineProperty(O,"CommandStartedEvent",{enumerable:!0,get:function(){return MA.CommandStartedEvent}});Object.defineProperty(O,"CommandSucceededEvent",{enumerable:!0,get:function(){return MA.CommandSucceededEvent}});var ji=U3();Object.defineProperty(O,"ConnectionCheckedInEvent",{enumerable:!0,get:function(){return ji.ConnectionCheckedInEvent}});Object.defineProperty(O,"ConnectionCheckedOutEvent",{enumerable:!0,get:function(){return ji.ConnectionCheckedOutEvent}});Object.defineProperty(O,"ConnectionCheckOutFailedEvent",{enumerable:!0,get:function(){return ji.ConnectionCheckOutFailedEvent}});Object.defineProperty(O,"ConnectionCheckOutStartedEvent",{enumerable:!0,get:function(){return ji.ConnectionCheckOutStartedEvent}});Object.defineProperty(O,"ConnectionClosedEvent",{enumerable:!0,get:function(){return ji.ConnectionClosedEvent}});Object.defineProperty(O,"ConnectionCreatedEvent",{enumerable:!0,get:function(){return ji.ConnectionCreatedEvent}});Object.defineProperty(O,"ConnectionPoolClearedEvent",{enumerable:!0,get:function(){return ji.ConnectionPoolClearedEvent}});Object.defineProperty(O,"ConnectionPoolClosedEvent",{enumerable:!0,get:function(){return ji.ConnectionPoolClosedEvent}});Object.defineProperty(O,"ConnectionPoolCreatedEvent",{enumerable:!0,get:function(){return ji.ConnectionPoolCreatedEvent}});Object.defineProperty(O,"ConnectionPoolMonitoringEvent",{enumerable:!0,get:function(){return ji.ConnectionPoolMonitoringEvent}});Object.defineProperty(O,"ConnectionPoolReadyEvent",{enumerable:!0,get:function(){return ji.ConnectionPoolReadyEvent}});Object.defineProperty(O,"ConnectionReadyEvent",{enumerable:!0,get:function(){return ji.ConnectionReadyEvent}});var Ru=dy();Object.defineProperty(O,"ServerClosedEvent",{enumerable:!0,get:function(){return Ru.ServerClosedEvent}});Object.defineProperty(O,"ServerDescriptionChangedEvent",{enumerable:!0,get:function(){return Ru.ServerDescriptionChangedEvent}});Object.defineProperty(O,"ServerHeartbeatFailedEvent",{enumerable:!0,get:function(){return Ru.ServerHeartbeatFailedEvent}});Object.defineProperty(O,"ServerHeartbeatStartedEvent",{enumerable:!0,get:function(){return Ru.ServerHeartbeatStartedEvent}});Object.defineProperty(O,"ServerHeartbeatSucceededEvent",{enumerable:!0,get:function(){return Ru.ServerHeartbeatSucceededEvent}});Object.defineProperty(O,"ServerOpeningEvent",{enumerable:!0,get:function(){return Ru.ServerOpeningEvent}});Object.defineProperty(O,"TopologyClosedEvent",{enumerable:!0,get:function(){return Ru.TopologyClosedEvent}});Object.defineProperty(O,"TopologyDescriptionChangedEvent",{enumerable:!0,get:function(){return Ru.TopologyDescriptionChangedEvent}});Object.defineProperty(O,"TopologyOpeningEvent",{enumerable:!0,get:function(){return Ru.TopologyOpeningEvent}});var Zf=AA();Object.defineProperty(O,"ServerSelectionEvent",{enumerable:!0,get:function(){return Zf.ServerSelectionEvent}});Object.defineProperty(O,"ServerSelectionFailedEvent",{enumerable:!0,get:function(){return Zf.ServerSelectionFailedEvent}});Object.defineProperty(O,"ServerSelectionStartedEvent",{enumerable:!0,get:function(){return Zf.ServerSelectionStartedEvent}});Object.defineProperty(O,"ServerSelectionSucceededEvent",{enumerable:!0,get:function(){return Zf.ServerSelectionSucceededEvent}});Object.defineProperty(O,"WaitingForSuitableServerEvent",{enumerable:!0,get:function(){return Zf.WaitingForSuitableServerEvent}});var Cne=wA();Object.defineProperty(O,"SrvPollingEvent",{enumerable:!0,get:function(){return Cne.SrvPollingEvent}});var th=p1();Object.defineProperty(O,"MongoCryptAzureKMSRequestError",{enumerable:!0,get:function(){return th.MongoCryptAzureKMSRequestError}});Object.defineProperty(O,"MongoCryptCreateDataKeyError",{enumerable:!0,get:function(){return th.MongoCryptCreateDataKeyError}});Object.defineProperty(O,"MongoCryptCreateEncryptedCollectionError",{enumerable:!0,get:function(){return th.MongoCryptCreateEncryptedCollectionError}});Object.defineProperty(O,"MongoCryptError",{enumerable:!0,get:function(){return th.MongoCryptError}});Object.defineProperty(O,"MongoCryptInvalidArgumentError",{enumerable:!0,get:function(){return th.MongoCryptInvalidArgumentError}});Object.defineProperty(O,"MongoCryptKMSRequestNetworkTimeoutError",{enumerable:!0,get:function(){return th.MongoCryptKMSRequestNetworkTimeoutError}});var bne=dA();Object.defineProperty(O,"MongoClientAuthProviders",{enumerable:!0,get:function(){return bne.MongoClientAuthProviders}})});var de=g(function(en){en.arrayAtomicsBackupSymbol=Symbol("mongoose#Array#atomicsBackup");en.arrayAtomicsSymbol=Symbol("mongoose#Array#_atomics");en.arrayParentSymbol=Symbol("mongoose#Array#_parent");en.arrayPathSymbol=Symbol("mongoose#Array#_path");en.arraySchemaSymbol=Symbol("mongoose#Array#_schema");en.documentArrayParent=Symbol("mongoose#documentArrayParent");en.documentIsSelected=Symbol("mongoose#Document#isSelected");en.documentIsModified=Symbol("mongoose#Document#isModified");en.documentModifiedPaths=Symbol("mongoose#Document#modifiedPaths");en.documentSchemaSymbol=Symbol("mongoose#Document#schema");en.getSymbol=Symbol("mongoose#Document#get");en.modelSymbol=Symbol("mongoose#Model");en.objectIdSymbol=Symbol("mongoose#ObjectId");en.populateModelSymbol=Symbol("mongoose#PopulateOptions#Model");en.schemaTypeSymbol=Symbol("mongoose#schemaType");en.sessionNewDocuments=Symbol("mongoose#ClientSession#newDocuments");en.scopeSymbol=Symbol("mongoose#Document#scope");en.validatorErrorSymbol=Symbol("mongoose#validatorError")});var Qa=g(function(kye,kR){var ed=Te().ObjectId,Dne=de().objectIdSymbol;Object.defineProperty(ed.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}});/*!
28
+ * Convenience `valueOf()` to allow comparing ObjectIds using double equals re: gh-7299
29
+ */if(!Object.hasOwn(ed.prototype,"valueOf"))ed.prototype.valueOf=function(){return this.toString()};ed.prototype[Dne]=!0;kR.exports=ed});var Xn=g(function(qye,qR){qR.exports=function(t){if(t==null)return;if(typeof t.constructor!=="function")return;return t.constructor.name}});var _o=g(function(jR){/*!
30
+ * ignore
31
+ */jR.internalToObjectOptions={transform:!1,virtuals:!1,getters:!1,_skipDepopulateTopLevel:!0,depopulate:!0,flattenDecimals:!1,useProjection:!1,versionKey:!0,flattenObjectIds:!1,flattenUUIDs:!1}});var T2=g(function(Lye,LR){LR.exports=Te().Decimal128});var Xa=g(function(Uye,UR){UR.exports=new Set(["__proto__","constructor","prototype"])});var rh=g(function(Vye,VR){VR.exports=function(t,r){if(t==null)return;let n=Object.getPrototypeOf(t);return n==null?void 0:n[r]}});var M2=g(function(zR){zR.isMongooseArray=function(e){return Array.isArray(e)&&e.isMongooseArray}});var Fn=g(function(Wye,WR){var Tne=rh();WR.exports=function(t){return t!=null&&t.$isMongooseDocumentPrototype===!0&&Tne(t,"$isMongooseDocumentPrototype")===!0}});var td=g(function(Hye,HR){var Mne=rh(),Pne=M2().isMongooseArray,Bne=Fn();HR.exports=function(e){return e!=null&&(Pne(e)||Bne(e)||e.isMongooseBuffer&&Buffer.isBuffer(e)||e.$isMongooseMap&&Mne(e,"$isMongooseMap"))}});var PA=g(function(Kye,KR){var Fne=/^function\s*([^\s(]+)/;KR.exports=function(e){return e.name||(e.toString().trim().match(Fne)||[])[1]}});var Zn=g(function(Gye,GR){function Nne(e,t){return e!=null&&e._bsontype===t}GR.exports=Nne});var xc=g(function(Yye,YR){YR.exports=function(e){return Buffer.isBuffer(e)||Object.prototype.toString.call(e)==="[object Object]"}});var nh=g(function(BA){var JR=Symbol("mongoose#trustedSymbol");BA.trustedSymbol=JR;BA.trusted=function(t){if(t==null||typeof t!=="object"&&typeof t!=="function")return t;return t[JR]=!0,t}});var ar=g(function(Qye,r$){var ZR=T2(),Ine=Qa(),e$=Xa(),Rne=td(),$ne=PA(),QR=rh(),FA=Zn(),vne=M2().isMongooseArray,xne=Fn(),kne=xc(),t$=de(),NA=nh().trustedSymbol,ih=Te(),XR=ih.UUID,IA=ih.Binary;function rd(e,t,r){if(e==null)return e;if(FA(e,"Double"))return new ih.Double(e.value);if(typeof e==="number"||typeof e==="string"||typeof e==="boolean"||typeof e==="bigint")return e;if(Array.isArray(e))return qne(e,t);if(Rne(e)){if(t){if(t.flattenUUIDs){if(e instanceof IA&&e._subtype===IA.SUBTYPE_UUID)return e.toString();if(Buffer.isBuffer(e)&&e.isMongooseBuffer&&e._subtype===IA.SUBTYPE_UUID)return e.toUUID().toString()}if(t.retainDocuments&&xne(e)){let i=e.$clone();if(e.__index!=null)i.__index=e.__index;if(e.__parentArray!=null)i.__parentArray=t.parentArray??e.__parentArray;return i.$__setParent(t.parentDoc??e.$__parent),i}if(t.retainDocuments&&QR(e,"$isMongooseMap")){let i=t.parentDoc??e.$__parent,u=new e.constructor({},e.$__path,i,e.$__schemaType);for(let[a,c]of e)u.$__set(a,rd(c,{...t,parentDoc:i}));return u}}let s;if(t?.json&&typeof e.toJSON==="function")s=e.toJSON(t);else s=e.toObject(t);return s}let n=e.constructor;if(n)switch($ne(n)){case"Object":if(QR(e.$__,"strictMode")!=null&&e._doc!=null)return e._doc;return RA(e,t,r);case"Date":return new n(+e);case"RegExp":return jne(e);default:break}if(FA(e,"ObjectId")){if(t?.flattenObjectIds)return e.toJSON();return new Ine(e.id)}if(FA(e,"Decimal128")){if(t?.flattenDecimals)return e.toJSON();return ZR.fromString(e.toString())}if(e instanceof XR){if(t?.flattenUUIDs)return e.toJSON();return new XR(e.buffer)}if(!n&&kne(e))return RA(e,t,r);if(typeof e==="object"&&e[t$.schemaTypeSymbol])return e.clone();if(t?.bson&&typeof e.toBSON==="function")return e;if(typeof e.valueOf==="function")return e.valueOf();return RA(e,t,r)}r$.exports=rd;/*!
32
+ * ignore
33
+ */function RA(e,t,r){let n=t?.minimize,s=t?.omitUndefined,i=t?._seen,o={},u;if(i&&i.has(e))return i.get(e);else if(i)i.set(e,o);if(NA in e&&t?.copyTrustedSymbol!==!1)o[NA]=e[NA];let a=Object.keys(e),c=a.length;for(let l=0;l<c;++l){let f=a[l];if(e$.has(f))continue;let h=rd(e[f],t,!1);if((n===!1||s)&&typeof h>"u")delete o[f];else if(n!==!0||typeof h<"u")u||(u=!0),o[f]=h}return n&&!r?u&&o:o}function qne(e,t){let r=t?._seen;if(r&&r.has(e))return r.get(e);let n=0,s=e.length,i=null;if(t?.retainDocuments){let o=t.parentDoc??(e.isMongooseArray?e.$parent():void 0);if(e.isMongooseDocumentArray)i=new(e.$schemaType()).schema.base.Types.DocumentArray([],e.$path(),o,e.$schemaType());else if(e.isMongooseArray)i=new(e.$parent()).schema.base.Types.Array([],e.$path(),o,e.$schemaType());else i=Array(s)}else i=Array(s);if(r)r.set(e,i);if(e=vne(e)?e.__array:e,i.isMongooseDocumentArray){t={...t,parentArray:i};for(n=0;n<s;++n){let o=rd(e[n],t,!0);if(typeof o?.$setIndex==="function")o.$setIndex(n);i.set(n,o,!0)}}else for(n=0;n<s;++n)i[n]=rd(e[n],t,!0);return i}function jne(e){let t=new RegExp(e.source,e.flags);if(t.lastIndex!==e.lastIndex)t.lastIndex=e.lastIndex;return t}});var u$=g(function(Xye,o$){/*!
34
+ * Module dependencies.
35
+ */var Za=f6(),$A=ze(),vA=Oa().Collection,n$=Qa(),s$=Xn(),Lne=_o().internalToObjectOptions,i$=require("stream"),uh=require("util"),Une=Object.freeze({...Lne,copyTrustedSymbol:!1});function Eo(e,t,r){this.collection=null,this.Promise=r.Promise||Promise,this.modelName=r.modelName,delete r.modelName,this._closed=!1,Za.apply(this,arguments)}/*!
36
+ * Inherit from abstract Collection.
37
+ */Object.setPrototypeOf(Eo.prototype,Za.prototype);Eo.prototype.onOpen=function(){return this.collection=this.conn.db.collection(this.name),Za.prototype.onOpen.call(this),this.collection};Eo.prototype.onClose=function(e){Za.prototype.onClose.call(this,e)};Eo.prototype._getCollection=function(){if(this.collection)return this.collection;if(this.conn.db!=null)return this.collection=this.conn.db.collection(this.name),this.collection;return null};function Vne(e){Eo.prototype[e]=function(){let t=this._getCollection(),r=arguments,n=this,s=n?.conn?.base?.options?.debug,i=n?.conn?.options?.debug,o=i==null?s:i;if(this.conn.$wasForceClosed){let h=new $A("Connection was force closed");if(r.length>0&&typeof r[r.length-1]==="function"){r[r.length-1](h);return}else throw h}let u=null,a=null,c=this.conn.listenerCount("operation-start")>0||this.conn.listenerCount("operation-end")>0;if(c||o)u=new n$;let l=null,f=null;if(this._shouldBufferCommands()&&this.buffer){if(u==null)u=new n$;this.conn.emit("buffer",{_id:u,modelName:n.modelName,collectionName:n.name,method:e,args:r});let h=this._getBufferTimeoutMS();return f=new Promise((d,p)=>{this.addQueue(d),l=setTimeout(()=>{if(this.removeQueue(d)){let _="Operation `"+this.name+"."+e+"()` buffering timed out after "+h+"ms",y=new $A(_);this.conn.emit("buffer-end",{_id:u,modelName:n.modelName,collectionName:n.name,method:e,error:y}),p(y)}},h)}),f.then(()=>{if(l)clearTimeout(l);return this[e].apply(this,r)})}if(o)if(typeof o==="function"){if(a==null)a=Array.from(r);let h=null;if(typeof a[a.length-1]=="function")h=a.slice(0,a.length-1);else h=a;o.apply(n,[n.name,e].concat(h))}else if(o instanceof i$.Writable)this.$printToStream(n.name,e,r,o);else{let h=o.color==null?!0:o.color,d=o.shell==null?!1:o.shell,p=o.timestamp==null?!1:o.timestamp;this.$print(n.name,e,r,h,d,p)}if(c){if(a==null)a=Array.from(r);this.conn.emit("operation-start",{_id:u,modelName:n.modelName,collectionName:this.name,method:e,params:a})}try{if(t==null){let d="Cannot call `"+this.name+"."+e+"()` before initial connection is complete if `bufferCommands = false`. Make sure you `await mongoose.connect()` if you have `bufferCommands = false`.";throw new $A(d)}let h=t[e].apply(t,r);if(typeof h?.then==="function")return h.then((d)=>{if(l!=null)clearTimeout(l);if(c)this.conn.emit("operation-end",{_id:u,modelName:n.modelName,collectionName:this.name,method:e,result:d});return d},(d)=>{if(l!=null)clearTimeout(l);if(c)this.conn.emit("operation-end",{_id:u,modelName:n.modelName,collectionName:this.name,method:e,error:d});throw d});if(c)this.conn.emit("operation-end",{_id:u,modelName:n.modelName,collectionName:this.name,method:e,result:h});if(l!=null)clearTimeout(l);return h}catch(h){if(l!=null)clearTimeout(l);if(c)this.conn.emit("operation-end",{_id:u,modelName:n.modelName,collectionName:this.name,method:e,error:h});throw h}}}for(let e of Object.getOwnPropertyNames(vA.prototype)){if(Object.getOwnPropertyDescriptor(vA.prototype,e).get!==void 0)continue;if(typeof vA.prototype[e]!=="function")continue;Vne(e)}Eo.prototype.$print=function(e,t,r,n,s,i){let o="";if(i){let f=new Date().toISOString();o=n?`\x1B[0;90m[${f}]\x1B[0m `:`[${f}] `}let u=n?"\x1B[0;36mMongoose:\x1B[0m ":"Mongoose: ",a=[e,t].join("."),c=[];for(let f=r.length-1;f>=0;--f)if(this.$format(r[f])||c.length)c.unshift(this.$format(r[f],n,s));let l="("+c.join(", ")+")";console.info(o+u+a+l)};Eo.prototype.$printToStream=function(e,t,r,n){let s=[e,t].join("."),i=[];for(let u=r.length-1;u>=0;--u)if(this.$format(r[u])||i.length)i.unshift(this.$format(r[u]));let o="("+i.join(", ")+")";n.write(s+o,"utf8")};Eo.prototype.$format=function(e,t,r){let n=typeof e;if(n==="function"||n==="undefined")return"";return xA(e,!1,t,r)};function oh(e){let t={inspect:function(){return e}};if(uh.inspect.custom)t[uh.inspect.custom]=t.inspect;return t}function zne(e){return xA(e,!0)}function Wne(e,t){e[t]=oh('ObjectId("'+e[t].toHexString()+'")')}function Hne(e,t,r){if(r)e[t]=oh('ISODate("'+e[t].toUTCString()+'")');else e[t]=oh('new Date("'+e[t].toUTCString()+'")')}function xA(e,t,r,n){if(typeof e?.toBSON==="function")e=e.toBSON();if(e==null)return e;let s=ar(),i=t?e:s(e,Une),o=s$(i);if(o==="Binary")i="BinData("+i.sub_type+', "'+i.toString("base64")+'")';else if(o==="ObjectId")i=oh('ObjectId("'+i.toHexString()+'")');else if(o==="Date")i=oh('new Date("'+i.toUTCString()+'")');else if(o==="Object"){let u=Object.keys(i),a=u.length,c;for(let l=0;l<a;++l)if(c=u[l],i[c]){let f;if(typeof i[c].toBSON==="function")try{i[c]=i[c].toBSON()}catch(d){f=d}let h=s$(i[c]);if(h==="Binary")i[c]="BinData("+i[c].sub_type+', "'+i[c].buffer.toString("base64")+'")';else if(h==="Object")i[c]=xA(i[c],!0);else if(h==="ObjectId")Wne(i,c);else if(h==="Date")Hne(i,c,n);else if(h==="ClientSession")i[c]=oh('ClientSession("'+(i[c]?.id?.id?.buffer||"").toString("hex")+'")');else if(Array.isArray(i[c]))i[c]=i[c].map(zne);else if(f!=null)throw f}}if(t)return i;return uh.inspect(i,!1,10,r).replace(/\n/g,"").replace(/\s{2,}/g," ")}Eo.prototype.getIndexes=Eo.prototype.indexInformation;/*!
38
+ * Module exports.
39
+ */o$.exports=Eo});var kA=g(function(Zye,l$){/*!
40
+ * Module dependencies.
41
+ */var Kne=require("events").EventEmitter,nd=ze();/*!
42
+ * ignore
43
+ */var a$=["close","change","end","error","resumeTokenChanged"];/*!
44
+ * ignore
45
+ */class c$ extends Kne{constructor(e,t,r){super();if(this.driverChangeStream=null,this.closed=!1,this.bindedEvents=!1,this.pipeline=t,this.options=r,this.errored=!1,r?.hydrate&&!r.model)throw Error("Cannot create change stream with `hydrate: true` unless calling `Model.watch()`");this.$driverChangeStreamPromise=e.then((n)=>(this.driverChangeStream=n,setImmediate(()=>this.emit("ready")),this),(n)=>{throw this.errored=!0,this.emit("error",n),n})}_bindEvents(){if(this.bindedEvents)return;if(this.bindedEvents=!0,this.driverChangeStream==null){this.$driverChangeStreamPromise.then(()=>{this.driverChangeStream.on("close",()=>{this.closed=!0}),a$.forEach((e)=>{this.driverChangeStream.on(e,(t)=>{if(t?.fullDocument!=null&&this.options?.hydrate)t.fullDocument=this.options.model.hydrate(t.fullDocument);this.emit(e,t)})})},()=>{});return}this.driverChangeStream.on("close",()=>{this.closed=!0}),a$.forEach((e)=>{this.driverChangeStream.on(e,(t)=>{if(t?.fullDocument!=null&&this.options?.hydrate)t.fullDocument=this.options.model.hydrate(t.fullDocument);this.emit(e,t)})})}hasNext(e){if(this.errored)throw new nd("Cannot call hasNext() on errored ChangeStream");if(this.driverChangeStream!=null)return this.driverChangeStream.hasNext(e);return this.$driverChangeStreamPromise.then(()=>this.driverChangeStream.hasNext(e),(t)=>{if(e!=null)return e(t);throw t})}next(e){if(this.errored)throw new nd("Cannot call next() on errored ChangeStream");if(this.options?.hydrate){if(e!=null){let r=e;e=(n,s)=>{if(n!=null)return r(n);if(s.fullDocument!=null)s.fullDocument=this.options.model.hydrate(s.fullDocument);return r(null,s)}}let t;if(this.driverChangeStream!=null)t=this.driverChangeStream.next(e);else t=this.$driverChangeStreamPromise.then(()=>this.driverChangeStream.next(e),(r)=>{if(e!=null)return e(r);throw r});if(typeof t?.then==="function")t=t.then((r)=>{if(r.fullDocument!=null)r.fullDocument=this.options.model.hydrate(r.fullDocument);return r});return t}if(this.driverChangeStream!=null)return this.driverChangeStream.next(e);return this.$driverChangeStreamPromise.then(()=>this.driverChangeStream.next(e),(t)=>{if(e!=null)return e(t);throw t})}addListener(e,t){if(this.errored)throw new nd("Cannot call addListener() on errored ChangeStream");return this._bindEvents(),super.addListener(e,t)}on(e,t){if(this.errored)throw new nd("Cannot call on() on errored ChangeStream");return this._bindEvents(),super.on(e,t)}once(e,t){if(this.errored)throw new nd("Cannot call once() on errored ChangeStream");return this._bindEvents(),super.once(e,t)}close(){if(this.closed=!0,this.driverChangeStream)return this.driverChangeStream.close();else return this.$driverChangeStreamPromise.then(()=>this.driverChangeStream.close(),()=>{})}}/*!
46
+ * ignore
47
+ */l$.exports=c$});var kc=g(function(e2e,f$){function ct(){this._pres=new Map,this._posts=new Map}ct.skipWrappedFunction=function(){if(!(this instanceof ct.skipWrappedFunction))return new ct.skipWrappedFunction(...arguments);this.args=[...arguments]};ct.overwriteResult=function(){if(!(this instanceof ct.overwriteResult))return new ct.overwriteResult(...arguments);this.args=[...arguments]};ct.overwriteArguments=function(){if(!(this instanceof ct.overwriteArguments))return new ct.overwriteArguments(...arguments);this.args=[...arguments]};ct.prototype.execPre=async function(t,r,n,s){let i=this._pres.get(t)||[];if(s?.filter)i=i.filter(s.filter);let o=i.length,u=n,a=null;if(!o)return u;for(let c of i)try{let l=c.fn.apply(r,u);if(qA(l)){let f=await l;if(f instanceof ct.overwriteArguments)u=f.args}else if(l instanceof ct.overwriteArguments)u=l.args}catch(l){if(l instanceof ct.skipWrappedFunction){a=l;continue}if(l instanceof ct.overwriteArguments){u=l.args;continue}throw l}if(a)throw a;return u};ct.prototype.execPreSync=function(e,t,r,n){let s=this._pres.get(e)||[];if(n?.filter)s=s.filter(n.filter);let i=s.length,o=r||[];for(let u=0;u<i;++u){let a=s[u].fn.apply(t,o);if(a instanceof ct.overwriteArguments)o=a.args}return o};ct.prototype.execPost=async function(t,r,n,s){let i=this._posts.get(t)||[];if(s?.filter)i=i.filter(s.filter);let o=i.length,u=null;if(s&&s.error)u=s.error;if(!o){if(u!=null)throw u;return n}let a=null,c,l,f=function(_){if(_)l(_);else c()},h=n.slice();P2(h,s?.numCallbackParams);let d=h.length;h.push(f);let p=s?.error?[u,...h]:null;for(let m of i){let _=m.fn;if(a=new Promise((y,E)=>{c=y,l=E}),u)if(h$(m,d))try{let y=_.apply(r,p);if(qA(y))await y;else if(_.length===d+2)await a}catch(y){if(y instanceof ct.overwriteResult){n=y.args,h=n.slice(),P2(h,s?.numCallbackParams),d=h.length,h.push(f);continue}u=y,p=[u,...h]}else continue;else if(h$(m,d))continue;else{let y=null;try{if(y=_.apply(r,h),qA(y))y=await y;else if(_.length===d+1)y=await a}catch(E){if(E instanceof ct.overwriteResult){n=E.args,h=n.slice(),P2(h,s?.numCallbackParams),d=h.length,h.push(f),p=[u,...h];continue}u=E,p=[u,...h];continue}if(y instanceof ct.overwriteResult){n=y.args,h=n.slice(),P2(h,s?.numCallbackParams),d=h.length,h.push(f);continue}}}if(u!=null)throw u;return n};/*!
48
+ * Handle the `numCallbackParams` option for `execPostSync`: fill `newArgs` with `null` until
49
+ * length is `numCallbackParams` if `numCallbackParams` is a number.
50
+ *
51
+ * @param {Array} newArgs The arguments to fill
52
+ * @param {number|null|undefined} numCallbackParams The number of callback parameters
53
+ */function P2(e,t){if(typeof t==="number"&&t>e.length)for(let r=e.length;r<t;++r)e.push(null)}ct.prototype.execPostSync=function(e,t,r,n){let s=this._posts.get(e)||[];if(n?.filter)s=s.filter(n.filter);let i=s.length;for(let o=0;o<i;++o){let u=s[o].fn.apply(t,r||[]);if(u instanceof ct.overwriteResult)r=u.args}return r};ct.prototype.createWrapperSync=function(e,t,r,n){let s=this,i=n?.getOptions;return function(...u){let a=r??this,c=typeof i==="function"?i(u):{},l=c.pre??c,f=c.post??c,h=s.execPreSync(e,a,u,l),d=t.apply(a,h);return s.execPostSync(e,a,[d],f)[0]}};ct.prototype.wrap=async function(t,r,n,s,i){let o=i?.getOptions,u=typeof o==="function"?o(s):{},a=u.pre??u,c=u.post??u,l,f=!1,h=s;try{h=await this.execPre(t,n,s,a)}catch(d){if(d instanceof ct.skipWrappedFunction)l=d.args,f=!0;else await this.execPost(t,n,s,{...i,...c,error:d})}if(!f)l=await r.apply(n,h);return l=await this.execPost(t,n,[l],{...i,...c}),l[0]};ct.prototype.filter=function(e){let t=this.clone(),r=Array.from(t._pres.keys());for(let s of r){let i=this._pres.get(s).map((o)=>Object.assign({},o,{name:s})).filter(e);if(i.length===0){t._pres.delete(s);continue}t._pres.set(s,i)}let n=Array.from(t._posts.keys());for(let s of n){let i=this._posts.get(s).map((o)=>Object.assign({},o,{name:s})).filter(e);if(i.length===0){t._posts.delete(s);continue}t._posts.set(s,i)}return t};ct.prototype.hasHooks=function(e){return this._pres.has(e)||this._posts.has(e)};ct.prototype.createWrapper=function(e,t,r,n){let s=this;if(!this.hasHooks(e))return t;return function(...o){let u=r??this;return s.wrap(e,t,u,o,n)}};ct.prototype.pre=function(e,t,r,n,s){if(typeof t==="function")r=t,t={};else if(t==null)t={};let i=this._pres.get(e)||[];if(this._pres.set(e,i),typeof r!=="function")throw Error('pre() requires a function, got "'+typeof r+'"');if(s)i.unshift(Object.assign({},t,{fn:r}));else i.push(Object.assign({},t,{fn:r}));return this};ct.prototype.post=function(e,t,r,n){let s=this._posts.get(e)||[];if(typeof t==="function")n=!!r,r=t,t={};if(typeof r!=="function")throw Error('post() requires a function, got "'+typeof r+'"');if(n)s.unshift(Object.assign({},t,{fn:r}));else s.push(Object.assign({},t,{fn:r}));return this._posts.set(e,s),this};ct.prototype.postError=function(t,r,n,s){if(typeof r==="function")s=!!n,n=r,r={};return this.post(t,{...r,errorHandler:!0},n,s)};ct.prototype.clone=function(){let e=new ct;for(let t of this._pres.keys()){let r=this._pres.get(t).slice();e._pres.set(t,r)}for(let t of this._posts.keys())e._posts.set(t,this._posts.get(t).slice());return e};ct.prototype.merge=function(e,t){t=arguments.length===1?!0:t;let r=t?this.clone():this;for(let n of e._pres.keys()){let s=r._pres.get(n)||[],i=e._pres.get(n).filter((u)=>s.map((a)=>a.fn).indexOf(u.fn)===-1),o=s.concat(i);r._pres.set(n,o)}for(let n of e._posts.keys()){let s=r._posts.get(n)||[],i=e._posts.get(n).filter((o)=>s.indexOf(o)===-1);r._posts.set(n,s.concat(i))}return r};function qA(e){return typeof e==="object"&&e!==null&&typeof e.then==="function"}function h$(e,t){if(e.errorHandler)return!0;return e.fn.length===t+2}f$.exports=ct});var LA=g(function(t2e,p$){var Gne=/^\d+$/;class jA{constructor(){this.children=new Map,this.terminal=!1,this.hasWildcard=!1}}class d${constructor(e){if(this.root=new jA,e!=null)for(let t of e)this.add(t)}add(e){if(e.indexOf(".")===-1){this._addSegment(this.root,e).terminal=!0;return}let t=this.root;for(let r of e.split("."))t=this._addSegment(t,r);t.terminal=!0}_addSegment(e,t){let r=e.children.get(t);if(r==null){if(r=new jA,e.children.set(t,r),t==="$*")e.hasWildcard=!0}return r}matchesPathOrAncestor(e){return this._walk(e)===!0}overlapsPath(e){return this._walk(e)!==!1}_walk(e){if(typeof e==="string"){let r=[],n=this.root.children.get(e);if(n!=null){if(n.terminal)return!0;r.push(n)}if(this.root.hasWildcard){let s=this.root.children.get("$*");if(s.terminal)return!0;r.push(s)}return r.length===0?!1:r}let t=[this.root];for(let r of e){let n=[],s=Gne.test(r);for(let i of t){if(s)n.push(i);let o=i.children.get(r);if(o!=null){if(o.terminal)return!0;n.push(o)}if(i.hasWildcard){let u=i.children.get("$*");if(u.terminal)return!0;n.push(u)}}if(n.length===0)return!1;t=n}return t}}p$.exports=d$});var g$=g(function(r2e,y$){class m${constructor(e){this.paths=[],this.schemaTypes=[],this.defaultsByNestedPath=new Map;for(let t of Object.keys(e.paths)){let r=e.paths[t];if(r.defaultValue===void 0)continue;let n=r.splitPath();if(n[n.length-1]==="$*")continue;this.paths.push(t),this.schemaTypes.push(r);let s="";for(let i=0;i<n.length-1;++i){if(s=i===0?n[0]:s+"."+n[i],e.nested[s]!==!0)continue;let o=this.defaultsByNestedPath.get(s);if(o==null)o={paths:[],schemaTypes:[],depth:i+1},this.defaultsByNestedPath.set(s,o);o.paths.push(t),o.schemaTypes.push(r)}}}}y$.exports=m$});var A$=g(function(_$,E$){var Nn=E$.exports=_$={};Nn.DocumentNotFoundError=null;Nn.general={};Nn.general.default="Validator failed for path `{PATH}` with value `{VALUE}`";Nn.general.required="Path `{PATH}` is required.";Nn.general.allowNull="Path `{PATH}` does not allow null values.";Nn.Number={};Nn.Number.min="Path `{PATH}` ({VALUE}) is less than minimum allowed value ({MIN}).";Nn.Number.max="Path `{PATH}` ({VALUE}) is more than maximum allowed value ({MAX}).";Nn.Number.enum="`{VALUE}` is not a valid enum value for path `{PATH}`.";Nn.Date={};Nn.Date.min="Path `{PATH}` ({VALUE}) is before minimum allowed value ({MIN}).";Nn.Date.max="Path `{PATH}` ({VALUE}) is after maximum allowed value ({MAX}).";Nn.String={};Nn.String.enum="`{VALUE}` is not a valid enum value for path `{PATH}`.";Nn.String.match="Path `{PATH}` is invalid ({VALUE}).";Nn.String.minlength="Path `{PATH}` (`{VALUE}`, length {LENGTH}) is shorter than the minimum allowed length ({MINLENGTH}).";Nn.String.maxlength="Path `{PATH}` (`{VALUE}`, length {LENGTH}) is longer than the maximum allowed length ({MAXLENGTH})."});var es=g(function(n2e,C$){/*!
54
+ * Module dependencies.
55
+ */var Yne=ze(),w$=require("util");class zA extends Yne{constructor(e,t,r,n,s){if(arguments.length>0){let i=O$(t),o=S$(s),u=UA(null,e,t,r,o,i,n);super(u);this.init(e,t,r,n,s)}else super(UA())}toJSON(){return{stringValue:this.stringValue,valueType:this.valueType,kind:this.kind,value:this.value,path:this.path,reason:this.reason,name:this.name,message:this.message}}init(e,t,r,n,s){/*!
56
+ * ignore
57
+ */this.stringValue=VA(t),this.messageFormat=S$(s),this.kind=e,this.value=t,this.path=r,this.reason=n,this.valueType=O$(t)}copy(e){this.messageFormat=e.messageFormat,this.stringValue=e.stringValue,this.kind=e.kind,this.value=e.value,this.path=e.path,this.reason=e.reason,this.message=e.message,this.valueType=e.valueType}setModel(e){/*!
58
+ * ignore
59
+ */this.message=UA(e,this.kind,this.value,this.path,this.messageFormat,this.valueType,this.reason)}}Object.defineProperty(zA.prototype,"name",{value:"CastError"});function VA(e){let t=w$.inspect(e);if(t=t.replace(/^'|'$/g,'"'),!t.startsWith('"'))t='"'+t+'"';return t}function O$(e){if(e==null)return""+e;let t=typeof e;if(t!=="object")return t;if(typeof e.constructor!=="function")return t;return e.constructor.name}function S$(e){let t=e?._castErrorMessage||null;if(typeof t==="string"||typeof t==="function")return t}/*!
60
+ * ignore
61
+ */function UA(e,t,r,n,s,i,o){if(typeof s==="string"){let u=VA(r),a=s.replace("{KIND}",t).replace("{VALUE}",u).replace("{PATH}",n);if(e!=null)a=a.replace("{MODEL}",e.modelName);return a}else if(typeof s==="function")return s(r,n,e,t);else{let u=VA(r),a=i?" (type "+i+")":"",c="Cast to "+t+" failed for value "+u+a+' at path "'+n+'"';if(e!=null)c+=' for model "'+e.modelName+'"';if(o!=null&&typeof o.constructor==="function"&&o.constructor.name!=="AssertionError"&&o.constructor.name!=="Error"&&o.constructor.name!=="BSONError")c+=' because of "'+o.constructor.name+'"';return c}}/*!
62
+ * exports
63
+ */C$.exports=zA});var B2=g(function(s2e,D$){/*!
64
+ * Module dependencies.
65
+ */var WA=ze(),b$=require("util");class HA extends WA{constructor(e,t,r,n){let s,i=WA.messages;if(i.DocumentNotFoundError!=null)s=typeof i.DocumentNotFoundError==="function"?i.DocumentNotFoundError(e,t):i.DocumentNotFoundError;else s='No document found for query "'+b$.inspect(e)+'" on model "'+t+'"';super(s);this.result=n,this.numAffected=r,this.filter=e,this.query=e}}Object.defineProperty(HA.prototype,"name",{value:"DocumentNotFoundError"});/*!
66
+ * exports
67
+ */D$.exports=HA});var KA=g(function(i2e,T$){/*!
68
+ * ignore
69
+ */T$.exports=function(t){let r=Object.keys(t.errors||{}),n=r.length,s=[],i;for(let o=0;o<n;++o){if(i=r[o],t===t.errors[i])continue;s.push(i+": "+t.errors[i].message)}return s.join(", ")}});var jc=g(function(o2e,P$){/*!
70
+ * Module requirements
71
+ */var Jne=ze(),Qne=Xn(),F2=require("util"),M$=KA();class qc extends Jne{constructor(e){let t;if(Qne(e)==="model")t=e.constructor.modelName+" validation failed";else t="Validation failed";super(t);if(this.errors={},this._message=t,e)e.$errors=this.errors}toString(){return this.name+": "+M$(this)}addError(e,t){if(t instanceof qc){let{errors:r}=t;for(let n of Object.keys(r))this.addError(`${e}.${n}`,r[n]);return}this.errors[e]=t,this.message=this._message+": "+M$(this)}}if(F2.inspect.custom)qc.prototype[F2.inspect.custom]=qc.prototype.inspect;Object.defineProperty(qc.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}});Object.defineProperty(qc.prototype,"name",{value:"ValidationError"});/*!
72
+ * Module exports
73
+ */P$.exports=qc});var YA=g(function(u2e,N$){/*!
74
+ * Module dependencies.
75
+ */var GA=ze(),B$=require("util");class sd extends GA{constructor(e,t){let r=e.message;if(!r)r=GA.messages.general.default;let n=F$(r,e,t);super(n);e=Object.assign({},e,{message:n}),this.properties=e,this.kind=e.type,this.path=e.path,this.value=e.value,this.reason=e.reason}toString(){return this.message}toJSON(){return Object.assign({name:this.name,message:this.message},this)}}Object.defineProperty(sd.prototype,"name",{value:"ValidatorError"});Object.defineProperty(sd.prototype,"properties",{enumerable:!1,writable:!0,value:null});sd.prototype.formatMessage=F$;function F$(e,t,r){if(typeof e==="function")return e(t,r);let n=Object.keys(t);for(let s of n){if(s==="message")continue;let i="{"+s.toUpperCase()+"}";if(!e.includes(i))continue;let o;try{o=String(t[s])}catch{o=B$.inspect(t[s])}e=e.replace(i,o)}return e}/*!
76
+ * exports
77
+ */N$.exports=sd});var QA=g(function(a2e,I$){/*!
78
+ * Module dependencies.
79
+ */var Xne=ze();class JA extends Xne{constructor(e,t,r){let n=r.join(", ");super('No matching document found for id "'+e._doc._id+'" version '+t+' modifiedPaths "'+n+'"');this.version=t,this.modifiedPaths=r}}Object.defineProperty(JA.prototype,"name",{value:"VersionError"});/*!
80
+ * exports
81
+ */I$.exports=JA});var ZA=g(function(c2e,R$){/*!
82
+ * Module dependencies.
83
+ */var Zne=ze();class XA extends Zne{constructor(e){super("Can't save() the same doc multiple times in parallel. Document: "+e._doc._id)}}Object.defineProperty(XA.prototype,"name",{value:"ParallelSaveError"});/*!
84
+ * exports
85
+ */R$.exports=XA});var t4=g(function(l2e,$$){/*!
86
+ * Module dependencies.
87
+ */var ese=ze();class e4 extends ese{constructor(e){super("Cannot overwrite `"+e+"` model once compiled.")}}Object.defineProperty(e4.prototype,"name",{value:"OverwriteModelError"});/*!
88
+ * exports
89
+ */$$.exports=e4});var x$=g(function(h2e,v$){/*!
90
+ * Module dependencies.
91
+ */var tse=ze();class r4 extends tse{constructor(e){let t=`Schema hasn't been registered for model "`+e+`".
92
+ Use mongoose.model(name, schema)`;super(t)}}Object.defineProperty(r4.prototype,"name",{value:"MissingSchemaError"});/*!
93
+ * exports
94
+ */v$.exports=r4});var s4=g(function(f2e,k$){/*!
95
+ * Module dependencies.
96
+ */var rse=ze();class n4 extends rse{constructor(e,t,r){let n=r?.matchedCount??0,s=r?.insertedCount??0,i=t.map((u)=>u._id).join(", ");if(i.length>100)i=i.slice(0,100)+"...";let o=t.length-n-s;super(`${e}.bulkSave() was not able to update ${o} of the given documents due to incorrect version or optimistic concurrency, document ids: ${i}`);this.modelName=e,this.documents=t,this.bulkWriteResult=r,this.numDocumentsNotUpdated=o}}Object.defineProperty(n4.prototype,"name",{value:"MongooseBulkSaveIncompleteError"});/*!
97
+ * exports
98
+ */k$.exports=n4});var j$=g(function(d2e,q$){var nse=Xn();q$.exports=function(t){if(nse(t)!=="TopologyDescription")return!1;let r=Array.from(t.servers.values());return r.length>0&&r.every((n)=>n.type==="Unknown")}});var U$=g(function(p2e,L$){var sse=Xn();L$.exports=function(t){if(sse(t)!=="TopologyDescription")return!1;if(t.servers.size===0)return!1;for(let r of t.servers.values())if(r.host.endsWith(".mongodb.net")===!1||r.port!==27017)return!1;return!0}});var z$=g(function(m2e,V$){var ise=Xn(),ose="Client network socket disconnected before secure TLS connection was established";V$.exports=function(t){if(ise(t)!=="TopologyDescription")return!1;let r=Array.from(t.servers.values());return r.length>0&&r.every((n)=>n.error&&n.error.message.indexOf(ose)!==-1)}});var o4=g(function(y2e,W$){/*!
99
+ * Module dependencies.
100
+ */var use=ze(),ase=j$(),cse=U$(),lse=z$();/*!
101
+ * ignore
102
+ */var hse="Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/",fse="Mongoose is connecting with SSL enabled, but the server is not accepting SSL connections. Please ensure that the MongoDB server you are connecting to is configured to accept SSL connections. Learn more: https://mongoosejs.com/docs/tutorials/ssl.html";class i4 extends use{assimilateError(e){let t=e.reason;if(cse(t)&&ase(t)&&e.message.indexOf("bad auth")===-1&&e.message.indexOf("Authentication failed")===-1)this.message=hse;else if(lse(t))this.message=fse;else this.message=e.message;for(let n in e)if(n!=="name")this[n]=e[n];return this.cause=t,this}}Object.defineProperty(i4.prototype,"name",{value:"MongooseServerSelectionError"});W$.exports=i4});var a4=g(function(g2e,H$){/*!
103
+ * Module dependencies.
104
+ */var dse=ze();class u4 extends dse{constructor(e){let t="For your own good, using `document.save()` to update an array which was selected using an $elemMatch or $slice projection OR populated using skip, limit, query conditions, or exclusion of the _id field when the operation results in a $pop or $set of the entire array is not supported. The following path(s) would have been modified unsafely:\n "+e.join(`
105
+ `)+`
106
+ Use Model.updateOne() to update these arrays instead. See https://mongoosejs.com/docs/faq.html#divergent-array-error for more information.`;super(t)}}Object.defineProperty(u4.prototype,"name",{value:"DivergentArrayError"});/*!
107
+ * exports
108
+ */H$.exports=u4});var ec=g(function(_2e,K$){/*!
109
+ * Module dependencies.
110
+ */var pse=ze();class c4 extends pse{constructor(e,t,r){t=t||"Field `"+e+"` is not in schema and strict mode is set to throw.";super(t);this.isImmutableError=!!r,this.path=e}}Object.defineProperty(c4.prototype,"name",{value:"StrictModeError"});K$.exports=c4});var h4=g(function(E2e,G$){/*!
111
+ * Module dependencies.
112
+ */var mse=ze();class l4 extends mse{constructor(e,t){t=t||"Cannot populate path `"+e+"` because it is not in your schema. Set the `strictPopulate` option to false to override.";super(t);this.path=e}}Object.defineProperty(l4.prototype,"name",{value:"StrictPopulateError"});G$.exports=l4});var ni=g(function(Y$,J$){var mn=ze();/*!
113
+ * Module exports.
114
+ */J$.exports=Y$=mn;mn.messages=A$();mn.Messages=mn.messages;mn.CastError=es();mn.DocumentNotFoundError=B2();mn.ValidationError=jc();mn.ValidatorError=YA();mn.VersionError=QA();mn.ParallelSaveError=ZA();mn.OverwriteModelError=t4();mn.MissingSchemaError=x$();mn.MongooseBulkSaveIncompleteError=s4();mn.MongooseServerSelectionError=o4();mn.DivergentArrayError=a4();mn.StrictModeError=ec();mn.StrictPopulateError=h4()});var si=g(function(A2e,Q$){Q$.exports=Object.freeze({enumerable:!0,configurable:!0,writable:!0,value:void 0})});var js=g(function(O2e,X$){var yse=ar();class In{constructor(e){if(e==null)return this;Object.assign(this,yse(e))}}var gs=si();Object.defineProperty(In.prototype,"type",gs);Object.defineProperty(In.prototype,"validate",gs);Object.defineProperty(In.prototype,"cast",gs);Object.defineProperty(In.prototype,"required",gs);Object.defineProperty(In.prototype,"allowNull",gs);Object.defineProperty(In.prototype,"default",gs);Object.defineProperty(In.prototype,"ref",gs);Object.defineProperty(In.prototype,"refPath",gs);Object.defineProperty(In.prototype,"select",gs);Object.defineProperty(In.prototype,"index",gs);Object.defineProperty(In.prototype,"unique",gs);Object.defineProperty(In.prototype,"immutable",gs);Object.defineProperty(In.prototype,"sparse",gs);Object.defineProperty(In.prototype,"text",gs);Object.defineProperty(In.prototype,"transform",gs);X$.exports=In});var N2=g(function(S2e,ah){var gse=es();ah.exports=function(t,r){if(ah.exports.convertToTrue.has(t))return!0;if(ah.exports.convertToFalse.has(t))return!1;if(t==null)return t;throw new gse("boolean",t,r)};ah.exports.convertToTrue=new Set([!0,"true",1,"1","yes"]);ah.exports.convertToFalse=new Set([!1,"false",0,"0","no"])});var I2=g(function(w2e,Z$){var _se=N2();/*!
115
+ * ignore
116
+ */Z$.exports=function(e){let t=this?.path??null;return _se(e,t)}});var f4=g(function(C2e,ev){/*!
117
+ * ignore
118
+ */ev.exports=function(e){if(Array.isArray(e)){if(!e.every((t)=>typeof t==="number"||typeof t==="string"))throw Error("$type array values must be strings or numbers");return e}if(typeof e!=="number"&&typeof e!=="string")throw Error("$type parameter must be number, string, or array of numbers and strings");return e}});var Li=g(function(b2e,tv){tv.exports=function(t,r){for(let n=t;n!=null&&n!==Object.prototype;n=Object.getPrototypeOf(n))if(Object.hasOwn(n,r))return n[r];return}});var nv=g(function(D2e,rv){var Ese=ec();/*!
119
+ * ignore
120
+ */rv.exports=function(e){if(e.$immutable)e.$immutableSetter=Ase(e.path,e.options.immutable),e.set(e.$immutableSetter);else if(e.$immutableSetter)e.setters=e.setters.filter((t)=>t!==e.$immutableSetter),delete e.$immutableSetter};function Ase(e,t){return function(n,s,i,o){if(this==null||this.$__==null)return n;if(this.isNew)return n;if(o?.overwriteImmutable)return n;if(!(typeof t==="function"?t.call(this,this):t))return n;let a=this.$__.priorDoc!=null?this.$__.priorDoc.$__getValue(e):this.$__getValue(e);if(this.$__.strictMode==="throw"&&n!==a)throw new Ese(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return a}}});var iv=g(function(T2e,sv){sv.exports=function(t){return typeof t==="function"&&t.constructor&&t.constructor.name==="AsyncFunction"}});var uv=g(function(M2e,ov){ov.exports=function(t){let r=Object.keys(t),n=!0;for(let s=0,i=r.length;s<i;++s)if(typeof t[r[s]]==="object"&&t[r[s]]!==null){n=!1;break}return n}});var cv=g(function(P2e,av){var ch=1000,lh=ch*60,hh=lh*60,Lc=hh*24,Ose=Lc*7,Sse=Lc*365.25;av.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return wse(e);else if(r==="number"&&isFinite(e))return t.long?bse(e):Cse(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function wse(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Sse;case"weeks":case"week":case"w":return r*Ose;case"days":case"day":case"d":return r*Lc;case"hours":case"hour":case"hrs":case"hr":case"h":return r*hh;case"minutes":case"minute":case"mins":case"min":case"m":return r*lh;case"seconds":case"second":case"secs":case"sec":case"s":return r*ch;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function Cse(e){var t=Math.abs(e);if(t>=Lc)return Math.round(e/Lc)+"d";if(t>=hh)return Math.round(e/hh)+"h";if(t>=lh)return Math.round(e/lh)+"m";if(t>=ch)return Math.round(e/ch)+"s";return e+"ms"}function bse(e){var t=Math.abs(e);if(t>=Lc)return R2(e,t,Lc,"day");if(t>=hh)return R2(e,t,hh,"hour");if(t>=lh)return R2(e,t,lh,"minute");if(t>=ch)return R2(e,t,ch,"second");return e+" ms"}function R2(e,t,r,n){var s=t>=r*1.5;return Math.round(e/r)+" "+n+(s?"s":"")}});var hv=g(function(B2e,lv){lv.exports=function(t){let r=[],n="",s="DEFAULT";for(let i=0;i<t.length;++i){if(s==="IN_SQUARE_BRACKETS"&&!/\d/.test(t[i])&&t[i]!=="]")s="DEFAULT",n=r[r.length-1]+"["+n,r.splice(r.length-1,1);if(t[i]==="["){if(s!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n),n="";s="IN_SQUARE_BRACKETS"}else if(t[i]==="]")if(s==="IN_SQUARE_BRACKETS")s="IMMEDIATELY_AFTER_SQUARE_BRACKETS",r.push(n),n="";else s="DEFAULT",n+=t[i];else if(t[i]==="."){if(s!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n),n="";s="DEFAULT"}else n+=t[i]}if(s!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n);return r}});var mv=g(function($u){var id=hv(),fv=["__proto__","constructor","prototype"];$u.get=function(e,t,r,n){var s;if(typeof r=="function")if(r.length<2)n=r,r=void 0;else s=r,r=void 0;n||(n=pv);var i=typeof e=="string"?id(e):e;if(!Array.isArray(i))throw TypeError("Invalid `path`. Must be either string or array");var o=t,u;for(var a=0;a<i.length;++a){if(u=i[a],typeof i[a]!=="string"&&typeof i[a]!=="number")throw TypeError("Each segment of path to `get()` must be a string or number, got "+typeof i[a]);if(Array.isArray(o)&&!/^\d+$/.test(u)){var c=i.slice(a);return[].concat(o).map(function(f){return f?$u.get(c,f,r||s,n):n(void 0)})}if(s)o=s(o,u);else{var l=r&&o[r]?o[r]:o;o=l instanceof Map?l.get(u):l[u]}if(!o)return n(o)}return n(o)};$u.has=function(e,t){var r=typeof e==="string"?id(e):e;if(!Array.isArray(r))throw TypeError("Invalid `path`. Must be either string or array");var n=r.length,s=t;for(var i=0;i<n;++i){if(typeof r[i]!=="string"&&typeof r[i]!=="number")throw TypeError("Each segment of path to `has()` must be a string or number, got "+typeof r[i]);if(s==null||typeof s!=="object"||!(r[i]in s))return!1;s=s[r[i]]}return!0};$u.unset=function(e,t){var r=typeof e==="string"?id(e):e;if(!Array.isArray(r))throw TypeError("Invalid `path`. Must be either string or array");var n=r.length,s=t;for(var i=0;i<n;++i){if(s==null||typeof s!=="object"||!(r[i]in s))return!1;if(typeof r[i]!=="string"&&typeof r[i]!=="number")throw TypeError("Each segment of path to `unset()` must be a string or number, got "+typeof r[i]);if(fv.indexOf(r[i])!==-1)return!1;if(i===n-1)return delete s[r[i]],!0;s=s instanceof Map?s.get(r[i]):s[r[i]]}return!0};$u.set=function(e,t,r,n,s,i){var o;if(typeof n=="function")if(n.length<2)s=n,n=void 0;else o=n,n=void 0;s||(s=pv);var u=typeof e=="string"?id(e):e;if(!Array.isArray(u))throw TypeError("Invalid `path`. Must be either string or array");if(r==null)return;for(var a=0;a<u.length;++a){if(typeof u[a]!=="string"&&typeof u[a]!=="number")throw TypeError("Each segment of path to `set()` must be a string or number, got "+typeof u[a]);if(fv.indexOf(u[a])!==-1)return}var c=i||/\$/.test(e)&&i!==!1,l=r,f;for(var a=0,h=u.length-1;a<h;++a){if(f=u[a],f=="$")if(a==h-1)break;else continue;if(Array.isArray(l)&&!/^\d+$/.test(f)){var d=u.slice(a);if(!c&&Array.isArray(t))for(var p=0;p<l.length&&p<t.length;++p)$u.set(d,t[p],l[p],n||o,s,c);else for(var p=0;p<l.length;++p)$u.set(d,t,l[p],n||o,s,c);return}if(o)l=o(l,f);else{var m=n&&l[n]?l[n]:l;l=m instanceof Map?m.get(f):m[f]}if(!l)return}if(f=u[h],n&&l[n])l=l[n];if(Array.isArray(l)&&!/^\d+$/.test(f))if(!c&&Array.isArray(t))dv(l,t,f,o,n,s);else for(var p=0;p<l.length;++p){var _=l[p];if(_)if(o)o(_,f,s(t));else{if(_[n])_=_[n];_[f]=s(t)}}else if(o)o(l,f,s(t));else if(l instanceof Map)l.set(f,s(t));else l[f]=s(t)};/*!
121
+ * Split a string path into components delimited by '.' or
122
+ * '[\d+]'
123
+ *
124
+ * #### Example:
125
+ * stringToParts('foo[0].bar.1'); // ['foo', '0', 'bar', '1']
126
+ */$u.stringToParts=id;/*!
127
+ * Recursively set nested arrays
128
+ */function dv(e,t,r,n,s,i){for(var o,u=0;u<e.length&&u<t.length;++u)if(o=e[u],Array.isArray(o)&&Array.isArray(t[u]))dv(o,t[u],r,n,s,i);else if(o)if(n)n(o,r,i(t[u]));else{if(o[s])o=o[s];o[r]=i(t[u])}}/*!
129
+ * Returns the value passed to it.
130
+ */function pv(e){return e}});var ii=g(function(yv,gv){gv.exports=yv=mv()});var $2=g(function(N2e,Ev){var Dse=ar();class _v{constructor(e){if(this._docs={},this._childDocs=[],e==null)return;if(e=Dse(e),Object.assign(this,e),typeof e.subPopulate==="object")this.populate=e.subPopulate;if(e.perDocumentLimit!=null&&e.limit!=null)throw Error("Can not use `limit` and `perDocumentLimit` at the same time. Path: `"+e.path+"`.")}}Ev.exports=_v});var Ov=g(function(Av){Av.isMongooseDocumentArray=function(e){return Array.isArray(e)&&e.isMongooseDocumentArray}});var nu=g(function(R2e,Sv){Sv.exports=function(t){if(t==null||typeof t!=="object")return!1;let r=Object.getPrototypeOf(t);return!r||r.constructor.name==="Object"}});var v2=g(function($2e,wv){wv.exports=function(t,r,n){let s=Object.keys(r.tree),i={};for(let o of s){if(n&&(t.paths[o]||t.nested[o]||t.singleNestedPaths[o]))continue;i[o]=r.tree[o]}t.options._isMerging=!0,t.add(i,null),delete t.options._isMerging,t.callQueue=t.callQueue.concat(r.callQueue),t.method(r.methods),t.static(r.statics);for(let[o,u]of Object.entries(r._userProvidedOptions))if(!(o in t._userProvidedOptions))t.set(o,u);for(let o in r.query)t.query[o]=r.query[o];for(let o in r.virtuals)t.virtuals[o]=r.virtuals[o].clone();t._indexes=t._indexes.concat(r._indexes||[]),t.s.hooks.merge(r.s.hooks,!1)}});var Dv=g(function(Cv,bv){/*!
131
+ * Module dependencies.
132
+ */var v2e=be(),Ui=bv.exports=Cv=function(){};Ui.ctor=function(){let e=[...arguments],t=function(){this.paths={},this.states={}};return t.prototype=new Ui,t.prototype.constructor=t,t.prototype.stateNames=e,e.forEach(function(r){t.prototype[r]=function(n){this._changeState(n,r)}}),t};Ui.prototype._changeState=function(t,r){let n=this.paths[t];if(n===r)return;if(n!==void 0){let i=this.states[n];if(i)delete i[t]}this.paths[t]=r;let s=this.states[r];if(s==null)s=this.states[r]={};s[t]=!0};/*!
133
+ * ignore
134
+ */Ui.prototype.clearAllExcept=function(t){let r=this.states[t],n=r==null?[]:Object.keys(r);if(n.length===0){this.paths={},this.states={};return}this.paths={};for(let s of n)this.paths[s]=t;this.states={[t]:this.states[t]}};/*!
135
+ * ignore
136
+ */Ui.prototype.clear=function(t){if(this.states[t]==null)return;let r=Object.keys(this.states[t]);if(r.length===0)return;this.states[t]={};let n=r.length;while(n--)delete this.paths[r[n]]};/*!
137
+ * ignore
138
+ */Ui.prototype.clearPath=function(t){let r=this.paths[t];if(!r)return;delete this.paths[t],delete this.states[r][t]};Ui.prototype.getStatePaths=function(t){if(this.states[t]!=null)return this.states[t];return{}};Ui.prototype.some=function(){let t=this,r=arguments.length?arguments:this.stateNames;return Array.prototype.some.call(r,function(n){if(t.states[n]==null)return!1;return Object.keys(t.states[n]).length})};Ui.prototype._iter=function(t){return function(){let r=[...arguments],n=r.pop();if(!r.length)r=this.stateNames;let s=this;return r.reduce(function(o,u){if(s.states[u]==null)return o;return o.concat(Object.keys(s.states[u]))},[])[t](function(o,u,a){return n(o,u,a)})}};Ui.prototype.forEach=function(){return this.forEach=this._iter("forEach"),this.forEach.apply(this,arguments)};Ui.prototype.map=function(){return this.map=this._iter("map"),this.map.apply(this,arguments)};Ui.prototype.clone=function(){let t=new this.constructor;t.paths={...this.paths};for(let r of this.stateNames){if(!(r in this.states))continue;t.states[r]=this.states[r]==null?this.states[r]:{...this.states[r]}}return t}});var Bv=g(function(Mv,Pv){/*!
139
+ * Dependencies
140
+ */var Tv=Dv(),Tse=Tv.ctor("require","modify","init","default","ignore");Pv.exports=Mv=pr;function pr(){this.activePaths=new Tse}pr.prototype.strictMode=!0;pr.prototype.fullPath=void 0;pr.prototype.selected=void 0;pr.prototype.selectedIndex=void 0;pr.prototype.shardval=void 0;pr.prototype.saveError=void 0;pr.prototype.validationError=void 0;pr.prototype.adhocPaths=void 0;pr.prototype.removing=void 0;pr.prototype.inserting=void 0;pr.prototype.saving=void 0;pr.prototype.version=void 0;pr.prototype._id=void 0;pr.prototype.ownerDocument=void 0;pr.prototype.populate=void 0;pr.prototype.populated=void 0;pr.prototype.primitiveAtomics=void 0;pr.prototype.wasPopulated=!1;pr.prototype.scope=void 0;pr.prototype.session=null;pr.prototype.pathsToScopes=null;pr.prototype.cachedRequired=null});var k2=g(function(x2e,Nv){/*!
141
+ * Module dependencies.
142
+ */var d4=Te().Binary,Mse=Te().UUID,x2=be();function _s(e,t,r){let n=e;if(e==null)n=0;let s,i,o;if(Array.isArray(t))i=t[0],o=t[1];else s=t;let u;if(typeof n==="number"||n instanceof Number)u=Buffer.alloc(n);else u=Buffer.from(n,s,r);return x2.decorate(u,_s.mixin),u.isMongooseBuffer=!0,u[_s.pathSymbol]=i,u[Fv]=o,u._subtype=0,u}var Pse=Symbol.for("mongoose#Buffer#_path"),Fv=Symbol.for("mongoose#Buffer#_parent");_s.pathSymbol=Pse;/*!
143
+ * Inherit from Buffer.
144
+ */_s.mixin={_subtype:void 0,_markModified:function(){let e=this[Fv];if(e)e.markModified(this[_s.pathSymbol]);return this},write:function(){let e=Buffer.prototype.write.apply(this,arguments);if(e>0)this._markModified();return e},copy:function(e){let t=Buffer.prototype.copy.apply(this,arguments);if(e?.isMongooseBuffer)e._markModified();return t}};/*!
145
+ * Compile other Buffer methods marking this buffer as modified.
146
+ */x2.each(["writeUInt8","writeUInt16","writeUInt32","writeInt8","writeInt16","writeInt32","writeFloat","writeDouble","fill","utf8Write","binaryWrite","asciiWrite","set","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE"],function(e){if(!Buffer.prototype[e])return;_s.mixin[e]=function(){let t=Buffer.prototype[e].apply(this,arguments);return this._markModified(),t}});_s.mixin.toObject=function(e){let t=typeof e==="number"?e:this._subtype||0;return new d4(Buffer.from(this),t)};_s.mixin.$toObject=_s.mixin.toObject;_s.mixin.toBSON=function(){return new d4(this,this._subtype||0)};_s.mixin.toUUID=function(){if(this._subtype!==4)throw Error("Cannot convert a Buffer with subtype "+this._subtype+" to a UUID");return new Mse(this)};_s.mixin.equals=function(e){if(!Buffer.isBuffer(e))return!1;if(this.length!==e.length)return!1;for(let t=0;t<this.length;++t)if(this[t]!==e[t])return!1;return!0};_s.mixin.subtype=function(e){if(typeof e!=="number")throw TypeError("Invalid subtype. Expected a number");if(this._subtype!==e)this._markModified();this._subtype=e};/*!
147
+ * Module exports.
148
+ */_s.Binary=d4;Nv.exports=_s});var Rv=g(function(k2e,Iv){Iv.exports=class{constructor(t,r,n){this.subdocSnapshot=t,this.activePaths=r,this.version=n}}});var q2=g(function(q2e,$v){/*!
149
+ * Module dependencies.
150
+ */var Bse=ze();class p4 extends Bse{constructor(e,t){let r=Array.isArray(t)?"array":"primitive value";super("Tried to set nested object field `"+e+`\` to ${r} \``+t+"`");this.path=e}}Object.defineProperty(p4.prototype,"name",{value:"ObjectExpectedError"});$v.exports=p4});var j2=g(function(j2e,vv){/*!
151
+ * Module dependencies.
152
+ */var Fse=ze();class m4 extends Fse{constructor(e,t,r){super('Parameter "'+t+'" to '+r+'() must be an object, got "'+(e==null?e:e.toString())+'" (type '+typeof e+")")}}Object.defineProperty(m4.prototype,"name",{value:"ObjectParameterError"});vv.exports=m4});var kv=g(function(L2e,xv){/*!
153
+ * Module dependencies.
154
+ */var Nse=ze();class y4 extends Nse{constructor(e){super("Can't validate() the same doc multiple times in parallel. Document: "+e._doc._id)}}Object.defineProperty(y4.prototype,"name",{value:"ParallelValidateError"});/*!
155
+ * exports
156
+ */xv.exports=y4});var g4=g(function(U2e,qv){qv.exports=function(t){let r={},n=Object.keys(t);for(let s of n){if(s.indexOf(".")===-1){r[s]=1;continue}let i=s.split("."),o=i[0];for(let u=0;u<i.length;++u)if(r[o]=1,u+1<i.length)o=o+"."+i[u+1]}return r}});var Lv=g(function(V2e,jv){jv.exports=function(t){if(t==null||typeof t!=="object")return!1;return t.$slice==null&&t.$elemMatch==null&&t.$meta==null&&t.$==null}});var U2=g(function(z2e,Vv){var Uv=Lv();Vv.exports=function(t,r,n,s,i,o,u){let{paths:a,schemaTypes:c}=t.$__schema._getDefaultsCache(),l=a.length,f=u?.skipParentChangeTracking,h=t.$__.skipId,d=!1;for(let p=0;p<l;++p){let m=a[p],_,y="";if(m==="_id"&&h)continue;let E=c[p];if(typeof E.defaultValue==="function"&&!E.defaultValue.$runBeforeSetters)d=!0;let C=E.splitPath(),D=C.length,A=!1,P=t._doc;if(D===1){if(n===!0){if(m in r)continue}else if(n===!1&&r){let S=E.$isSingleNested||E.$isMongooseDocumentArray;if(m in r&&!Uv(r[m])||S&&s!=null&&s[m])A=!0;else if(s!=null&&!s[m])continue}if(P[m]!==void 0)continue;if(i!=null){if(typeof E.defaultValue==="function"){if(!E.defaultValue.$runBeforeSetters&&i)continue;if(E.defaultValue.$runBeforeSetters&&!i)continue}else if(!i)continue}if(o&&o[m])continue;if(r&&n!==null&&!(n===!0||A))continue;try{_=E.getDefault(t,!1)}catch(S){t.invalidate(m,S);continue}if(typeof _<"u")P[m]=_,L2(t,m,f);continue}for(let S=0;S<D;++S){if(P==null)break;let B=C[S];if(y=y.length?y+"."+B:B,n===!0){if(y in r)break}else if(n===!1&&r&&!A){let q=E.$isSingleNested||E.$isMongooseDocumentArray;if(y in r&&!Uv(r[y])||S===D-1&&q&&s!=null&&s[y])A=!0;else if(s!=null&&!s[y])break}if(S===D-1){if(P[B]!==void 0)break;if(i!=null){if(typeof E.defaultValue==="function"){if(!E.defaultValue.$runBeforeSetters&&i)break;if(E.defaultValue.$runBeforeSetters&&!i)break}else if(!i)continue}if(o&&o[y])break;if(r&&n!==null){if(n===!0){if(m in r)continue;try{_=E.getDefault(t,!1)}catch(q){t.invalidate(m,q);break}if(typeof _<"u")P[B]=_,L2(t,m,f)}else if(A){try{_=E.getDefault(t,!1)}catch(q){t.invalidate(m,q);break}if(typeof _<"u")P[B]=_,L2(t,m,f)}}else{try{_=E.getDefault(t,!1)}catch(q){t.invalidate(m,q);break}if(typeof _<"u")P[B]=_,L2(t,m,f)}}else P=P[B]}}return d};/*!
157
+ * ignore
158
+ */function L2(e,t,r){if(e.$__.activePaths.default(t),!r&&e.$isSubdocument&&e.$isSingleNested&&e.$parent()!=null)e.$parent().$__.activePaths.default(e.$__pathRelativeToParent(t))}});var V2=g(function(W2e,Wv){/*!
159
+ * ignore
160
+ */Wv.exports=function(t,r,n){n=n||{};let s=n.skipDocArrays,i=0;if(!t)return i;for(let o of Object.keys(t.$__.activePaths.getStatePaths("modify"))){if(s){if(t.$__schema.path(o)?.$isMongooseDocumentArray)continue}if(o.startsWith(r+".")){if(t.$__.activePaths.clearPath(o),++i,t.$isSubdocument)zv(t,o)}}return i};function zv(e,t,r=new Set){if(r.has(e))throw Error("Infinite subdocument loop: subdoc with _id "+e._id+" is a parent of itself");let n=e.$parent(),s=e.$__pathRelativeToParent(void 0,!1)+"."+t;if(n.$__.activePaths.clearPath(s),n.$isSubdocument)zv(n,s,r)}});var _4=g(function(H2e,Hv){Hv.exports=function(t,r,n){if(r.has(t))return!0;for(let s of n)if(t.slice(0,s.length)===s&&t.charAt(s.length)===".")return!0;return!1}});var H2=g(function(E4){var Ise=ar(),Rse=de().documentSchemaSymbol,$se=_o().internalToObjectOptions,vse=Fn(),W2=be(),fh,xse=de().getSymbol,z2=de().scopeSymbol,Kv=W2.isPOJO;/*!
161
+ * exports
162
+ */E4.compile=Gv;E4.defineKey=Yv;var kse=Object.freeze({minimize:!0,virtuals:!1,getters:!1,transform:!1}),qse=Object.freeze({noDottedPath:!0});function Gv(e,t,r,n){fh=fh||su();let s=n.typeKey;for(let i of Object.keys(e)){let o=e[i],a=Kv(o)&&W2.hasOwnKeys(o)&&(!o[s]||s==="type"&&Kv(o.type)&&o.type.type)?o:null;Yv({prop:i,subprops:a,prototype:t,prefix:r,options:n})}}function Yv({prop:e,subprops:t,prototype:r,prefix:n,options:s}){fh=fh||su();let i=(n?n+".":"")+e;n=n||"";let o=n?Object.freeze({}):qse;if(t)Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:function(){if(!this.$__)return;let u=this;if(!this.$__.getters)this.$__.getters={};if(!this.$__.getters[i]){let a=Object.create(fh.prototype,jse(this));if(!n)a.$__[z2]=this;a.$__.nestedPath=i,Object.defineProperty(a,"schema",{enumerable:!1,configurable:!0,writable:!1,value:r.schema}),Object.defineProperty(a,"$__schema",{enumerable:!1,configurable:!0,writable:!1,value:r.schema}),Object.defineProperty(a,Rse,{enumerable:!1,configurable:!0,writable:!1,value:r.schema}),Object.defineProperty(a,"toObject",{enumerable:!1,configurable:!0,writable:!1,value:function(){return Ise(u.get(i,null,{virtuals:this&&this.schema&&this.schema.options&&this.schema.options.toObject&&this.schema.options.toObject.virtuals||null}))}}),Object.defineProperty(a,"$__get",{enumerable:!1,configurable:!0,writable:!1,value:function(){return u.get(i,null,{virtuals:this?.schema?.options?.toObject?.virtuals||null})}}),Object.defineProperty(a,"toJSON",{enumerable:!1,configurable:!0,writable:!1,value:function(){return u.get(i,null,{virtuals:this?.schema?.options?.toJSON?.virtuals||null})}}),Object.defineProperty(a,"$__isNested",{enumerable:!1,configurable:!0,writable:!1,value:!0}),Object.defineProperty(a,"$isEmpty",{enumerable:!1,configurable:!0,writable:!1,value:function(){return Object.keys(this.get(i,null,kse)||{}).length===0}}),Object.defineProperty(a,"$__parent",{enumerable:!1,configurable:!0,writable:!1,value:this}),Gv(t,a,i,s),this.$__.getters[i]=a}return this.$__.getters[i]},set:function(u){if(vse(u)&&u.$__isNested)u=u.$__get();else if(u instanceof fh&&!u.$__isNested)u=u.$toObject($se);(this.$__[z2]||this).$set(i,u)}});else Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:function(){return this[xse].call(this.$__[z2]||this,i,null,o)},set:function(u){this.$set.call(this.$__[z2]||this,i,u)}})}function jse(e){let t={};return Object.getOwnPropertyNames(e).forEach(function(r){if(["isNew","$__","$errors","errors","_doc","$locals","$op","__parentArray","__index","$isDocumentArrayElement"].indexOf(r)===-1)return;t[r]=Object.getOwnPropertyDescriptor(e,r),t[r].enumerable=!1}),t}});var Qv=g(function(G2e,Jv){Jv.exports=function(t){if(t==null)return null;return Object.keys(t)[0]}});var oi=g(function(Y2e,Xv){Xv.exports=function(t,r){if(t==null||r==null)return null;return Object.hasOwn(t,r)?t[r]:null}});var Dr=g(function(J2e,Zv){Zv.exports=function(t,r,n){let s,i=!1;if(typeof r==="string"){if(r.indexOf(".")===-1){let a=A4(t,r);if(a==null)return n;return a}s=r.split(".")}else if(i=!0,s=r,s.length===1){let a=A4(t,s[0]);if(a==null)return n;return a}let o=r,u=t;for(let a of s){if(u==null)return n;if(!i&&u[o]!=null)return u[o];if(u=A4(u,a),!i)o=o.substring(a.length+1)}return u==null?n:u};function A4(e,t){if(e==null)return e;if(e instanceof Map)return e.get(t);return e[t]}});var O4=g(function(Q2e,tx){var ex=Zn();tx.exports=function(t,r){if(typeof t==="string"&&typeof r==="string")return t===r;if(typeof t==="number"&&typeof r==="number")return t===r;if(ex(t,"ObjectId")&&ex(r,"ObjectId"))return t.toString()===r.toString();return!1}});var K2=g(function(X2e,rx){var Lse=O4();rx.exports=function(t,r){if(t?.discriminators==null)return null;for(let n of Object.keys(t.discriminators)){let s=t.discriminators[n];if(s.discriminatorMapping==null)continue;if(Lse(s.discriminatorMapping.value,r))return s}return null}});var sx=g(function(Z2e,nx){var Use=oi(),Vse=Dr(),zse=K2();nx.exports=function e(t,r,n){n=n||{};let s=n.typeOnly,i=Array.isArray(r)?r:r.indexOf(".")===-1?[r]:r.split("."),o=null,u="adhocOrUndefined",a=zse(t.schema,t.get(t.schema.options.discriminatorKey))||t.schema;for(let c=0;c<i.length;++c){let l=i.slice(0,c+1).join(".");if(o=a.path(l),o==null){u="adhocOrUndefined";continue}if(o.instance==="Mixed")return s?"real":o;if(u=a.pathType(l),(o.$isSingleNested||o.$isMongooseDocumentArrayElement)&&o.schema.discriminators!=null){let f=o.schema.discriminators,h=t.get(l+"."+Vse(o,"schema.options.discriminatorKey"));if(h==null||Use(f,h)==null)continue;let d=i.slice(c+1).join(".");return e(t.get(l),d,n)}}return s?u:o}});var ox=g(function(ege,ix){var Wse=Dr();ix.exports=function(t,r,n){let s=Object.keys(r);if(s.length<=1)return s;let i=n!=null?Object.keys(Wse(t.tree,n,{})):Object.keys(t.tree),o=new Set(s),u=[];for(let a of i)if(o.delete(a))u.push(a);for(let a of o)u.push(a);return u}});var iu=g(function(tge,ux){ux.exports=function(t,r){return t!=null&&Object.hasOwn(t,r)?t[r]:void 0}});var cx=g(function(rge,ax){ax.exports=function(t,r){if(r.length===1)return;let n=r[0],s=void 0;for(let i=0;i<r.length-1;++i){let o=t.path(n);if(o?.schema)s=o.schema.options.strict,t=o.schema,n=o.$isMongooseDocumentArray&&!isNaN(r[i+1])?"":r[i+1];else n+=n.length?"."+r[i+1]:r[i+1]}return s}});var G2=g(function(nge,hx){var Hse=rh(),lx=be(),Kse=new Set(["__index","__parentArray","_doc"]);hx.exports=function(t,r){if(lx.isPOJO(t)&&Hse(t.$__,"strictMode")!=null&&t._doc!=null){if(r){let n={};for(let s of Object.keys(t)){if(typeof s==="symbol")continue;if(s[0]==="$")continue;if(Kse.has(s))continue;n[s]=t[s]}return{...t._doc,...n}}return t._doc}return t}});var dh=g(function(sge,fx){/*!
163
+ * ignore
164
+ */fx.exports=function(t){if(t==null)return!0;if(typeof t==="object")return!("$meta"in t)&&!("$slice"in t);return!0}});var Uc=g(function(ige,dx){var Gse=dh(),Yse=nu();/*!
165
+ * ignore
166
+ */dx.exports=function e(t){if(t==null)return null;let r=Object.keys(t),n=null;if(r.length===1&&r[0]==="_id")n=!t._id;else for(let s=0;s<r.length;++s){let i=r[s];if(i!=="_id"&&Gse(t[i])){if(n=Yse(t[i])?e(t[i])??n:!t[i],n!=null)break}}return n}});var S4=g(function(oge,px){var Jse=dh();px.exports=function(t,r){if(t==null)return!1;if(r==="_id")return t._id===0;let n=Object.keys(t),s=null;for(let i of n)if(Jse(t[i])){s=t[r]===1?"inclusive":"exclusive";break}if(s==="inclusive")return t[r]!==1;if(s==="exclusive")return t[r]===0;return!1}});var w4=g(function(uge,yx){var mx=be();yx.exports=function(t,r){if(t._doc._id==null||r==null||r.length===0)return;let n=String(t._doc._id);for(let s of r){if(s.isVirtual)continue;let o=s.path.split(".");for(let u=0;u<o.length-1;++u){let a=o.slice(0,u+1).join("."),c=o.slice(u+1).join("."),l=t.get(a);if(l==null)continue;if(mx.isMongooseDocumentArray(l)){for(let f=0;f<l.length;++f)if(l[f])l[f].populated(c,s._docs[n]==null?void 0:s._docs[n][f],s);break}}}}});var C4=g(function(age,_x){var{isPOJO:Qse}=be();_x.exports=gx;function gx(e){let t=Object.keys(e),r=t.length,n,s,i;while(r--){if(s=t[r],i=e[s],Qse(i))e[s]=gx(i);if(e[s]===void 0){delete e[s];continue}n=!0}return n?e:void 0}});var b4=g(function(cge,Ex){var Xse=/\./g;Ex.exports=function(t){if(t.indexOf(".")===-1)return[t];let r=t.split(Xse),n=r.length,s=Array(n),i="";for(let o=0;o<n;++o)i+=i.length!==0?"."+r[o]:r[o],s[o]=i;return s}});var Ox=g(function(lge,Ax){Ax.exports=function(t,r,n,s,i){let o=Object.keys(t).reduce((a,c)=>a||c.startsWith(r+"."),!1),u=r+"."+n.options.discriminatorKey;if(!o&&i.length===1&&i[0]===u)s.splice(s.indexOf(u),1)}});var Vi=g(function(hge,Sx){var Zse=O4();Sx.exports=function(t,r){if(t==null)return null;for(let n of Object.keys(t)){let s=t[n];if(s.schema&&s.schema.discriminatorMapping&&Zse(s.schema.discriminatorMapping.value,r))return s}return null}});var Y2=g(function(fge,wx){/*!
167
+ * ignore
168
+ */wx.exports=function(t,r){let n=r.split("."),s="";for(let i=0;i<n.length;++i)if(s+=s.length?"."+n[i]:n[i],t[s])return!0;return!1}});var D4=g(function(dge,Cx){/*!
169
+ * Store the read preference and read concern that the populate options `pops` inherit from
170
+ * `query`'s explicit settings. Schema-level `read` and `readConcern` defaults are not inherited:
171
+ * each populate query applies its own model's schema defaults. `_execPopulateQuery()` applies
172
+ * these unless the populate options set their own.
173
+ *
174
+ * Store them separately from `pop.options` because a query's clones share its populate options:
175
+ * inherited values written to `pop.options` would look like explicit settings to later executions.
176
+ */Cx.exports=function(t,r){let n=t.options,s="readPreference"in n?n.readPreference:void 0;for(let i of r)i._inheritedReadPreference=s,i._inheritedReadConcern=n.readConcern}});var od=g(function(Vc){/*!
177
+ * Module dependencies
178
+ */var eie=oi(),bx=$2(),tie=Ox(),Dx=Dr(),rie=Vi(),T4=dh(),nie=Uc(),sie=nu(),iie=ar(),oie=Y2(),uie=D4();Vc.preparePopulationOptionsMQ=function(t,r){let n=t._mongooseOptions.populate,s=Object.keys(n).reduce((u,a)=>u.concat([n[a]]),[]);if(r.lean!=null)s.filter((u)=>u?.options?.lean==null).forEach(aie(r.lean));let i=t?.options?.session||null;if(i!=null)s.forEach((u)=>{if(u.options==null){u.options={session:i};return}if(!("session"in u.options))u.options.session=i});let o=t._fieldsForExec();for(let u=0;u<s.length;++u)if(s[u]instanceof bx)s[u]=new bx({...s[u],_queryProjection:o,_localModel:t.model});else s[u]._queryProjection=o,s[u]._localModel=t.model;return uie(t,s),s};Vc.createModel=function(t,r,n,s,i){t.hooks.execPreSync("createModel",r);let o=t.schema?t.schema.discriminatorMapping:null,u=o?.isRoot?o.key:null,a={skipId:!0,isNew:!1,willInit:!0};if(i?.defaults!=null)a.defaults=i.defaults;if(i?.strict!=null)a.strict=i.strict;let c=r[u];if(u&&c&&t.discriminators){let l=eie(t.discriminators,c)||rie(t.discriminators,c);if(l){let f=iie(s);return Vc.applyPaths(f,l.schema),new l(void 0,f,a)}}return new t(void 0,n,a)};/*!
179
+ * ignore
180
+ */Vc.createModelAndInit=function(t,r,n,s,i,o,u){let a={};if(o)a.populated=o;if(i?.middleware!=null)a.middleware=i.middleware;let c=Vc.createModel(t,r,n,s,i);try{c.$init(r,a,u)}catch(l){u(l,c)}};/*!
181
+ * ignore
182
+ */Vc.applyPaths=function(t,r,n){let s,i,o=new Set;if(t){if(n){for(let _ of Object.keys(t))if(_[0]==="+"||_.startsWith("-+"))delete t[_]}i=Object.keys(t);let p=[];for(let _=0;_<i.length;++_){let y=i[_];if(i[_][0]!=="-")continue;if(delete t[y],y==="-_id")t._id=0;else p.push(y.slice(1))}i=Object.keys(t);let m=!1;for(let _=0;_<i.length;++_){if(i[_][0]==="+")continue;let y=t[i[_]];if(!T4(y))continue;if(y?.$elemMatch!=null){m=!0;continue}if(i[_]==="_id"&&i.length>1)continue;if(i[_]===r.options.discriminatorKey&&i.length>1&&y!=null&&!y)continue;if(sie(y)&&!Object.keys(y).some((E)=>E.startsWith("$"))){if(s=nie(y)??void 0,s===void 0)continue;break}s=!y;break}if(s===void 0&&m)s=!1;for(let _ of p){let y=r.path(_);if(!y?.selected||s!==!1)t[_]=0,s=!0;else if(y?.selected&&s===!1)o.add(_)}}let u=[],a=[],c=[];if(r._hasSelectedPaths!==!1)l(r);if(n&&s===!1){let p=Object.keys(t);if(!p.some((m)=>(m!=="_id"||p.length===1)&&T4(t[m])&&t[m]))s=!0}switch(s){case!0:for(let p of a){if(d(t,p))continue;t[p]=0}break;case!1:if(r?.paths._id?.options?.select===!1)t._id=0;for(let p of u){if(o.has(p))continue;if(oie(t,p))continue;t[p]=t[p]||1}break;case void 0:if(t==null)break;for(let p of Object.keys(t||{}))if(p.startsWith("+"))delete t[p];for(let p of a){if(t[p]!=null)continue;t[p]=0}break}function l(p,m){if(m||(m=""),c.indexOf(p)!==-1)return[];c.push(p);let _=[];return p.eachPath(function(y,E){if(m)y=m+"."+y;if(E.$isSchemaMap||y.endsWith(".$*")){let D="+"+y,A=t&&D in t;if(E.options?.select===!1&&n)h(y),a.push(y);else if(E.options?.select===!1&&!A)a.push(y);return}let C=f(y,E);if(C==null&&!Array.isArray(E)&&E.$isMongooseArray&&!E.$isMongooseDocumentArray)C=f(y,E.embeddedSchemaType);if(C!=null)_.push(C);if(E.schema){let D=l(E.schema,y);if(s===!1)tie(t,y,E.schema,u,D)}}),c.pop(),_}function f(p,m){if(t==null)return;if(typeof m.selected!=="boolean")return;if(m.selected===!1&&n)h(p);else if(m.selected===!1&&t[p])return;if(!s&&m.selected&&p===r.options.discriminatorKey&&t[p]!=null&&!t[p]){delete t[p];return}if(s===!1&&m.selected&&t[p]!=null&&!t[p]){delete t[p];return}let _="+"+p;if(t&&_ in t){if(delete t[_],s===!1&&i.length>1&&!~i.indexOf(p))t[p]=1;return}let E=p.split("."),C="";for(let D=0;D<E.length;++D)if(C+=C.length?"."+E[D]:E[D],a.indexOf(C)!==-1)return;if(!s&&(m?.options?.$skipDiscriminatorCheck||!1)){let D="";for(let A=0;A<E.length;++A){D+=(D.length===0?"":".")+E[A];let P=Dx(t,D,!1)||Dx(t,D+".$",!1);if(P&&typeof P!=="object")return}}return(m.selected?u:a).push(p),p}function h(p){for(let m of Object.keys(t)){if(T4(t[m])&&!t[m])continue;let _=m.endsWith(".$")?m.slice(0,-2):m;if(_===p||_.startsWith(p+".")||p.startsWith(_+"."))delete t[m]}}function d(p,m){let _=-1;while((_=m.indexOf(".",_+1))!==-1){let y=p[m.slice(0,_)];if(y!=null&&!y)return!0}return!1}};function aie(e){return function(t){if(t.options||(t.options={}),Array.isArray(e?.virtuals))e=Object.assign({},e),e.virtuals=e.virtuals.filter((r)=>typeof r==="string"&&r.startsWith(t.path+".")).map((r)=>r.slice(t.path.length+1));t.options.lean=e}}});var Ao=g(function(ud){ud.schemaMixedSymbol=Symbol.for("mongoose:schema_mixed");ud.builtInMiddleware=Symbol.for("mongoose:built-in-middleware");ud.skipOnSubdocuments=Symbol("mongoose:skip-on-subdocuments");ud.requiresShardKey=Symbol.for("mongoose:requires-shard-key")});var vu=g(function(yge,Mx){var cie=nu(),Tx=Ao(),lie=(e)=>e.fn[Tx.builtInMiddleware];function M4(e,t){return e?.middleware===!1||e?.middleware?.[t]===!1?lie:null}function hie(e){let t=e[e.length-1],r=cie(t)?t:null;return{pre:{filter:M4(r,"pre")},post:{filter:M4(r,"post")}}}Mx.exports={buildMiddlewareFilter:M4,middlewareFiltersFromLastArg:hie}});var P4=g(function(gge,Px){function fie(e){return!!e&&(typeof e==="object"||typeof e==="function")&&typeof e.then==="function"}Px.exports=fie});var Fx=g(function(_ge,Bx){Bx.exports=function(t,r,n){let s=r[0],i=n,o=t;for(let u=0;u<r.length-1;++u){let a=i.path(s);if(a?.schema){let c=o.get(s);if(i=a.schema,s=r[u+1],Array.isArray(c)&&!isNaN(s))c=c[s],s="";if(c==null)break;o=c}else s+=s.length?"."+r[u+1]:r[u+1]}return o}});var Rx=g(function(Ege,Ix){var die=nu();Ix.exports=function(t,r){return Nx(t,r,!0,new Set)};function Nx(e,t,r,n){if(e==null)return e;if(e.$__!=null&&typeof e.toObject==="function")return r||e.$__isNested?e.toObject(t):e;if(!Array.isArray(e)&&!die(e))return e;if(n.has(e))return e;n.add(e);let s=e;for(let i of Object.keys(e)){let o=Nx(e[i],t,!1,n);if(o===e[i])continue;if(s===e)s=Array.isArray(e)?Object.assign([],e):{...e};s[i]=o}return n.delete(e),s}});var X2=g(function(Age,$x){var yn=su(),pie=_o().internalToObjectOptions,J2=require("util"),Q2=be();$x.exports=Vt;function Vt(e,t,r,n){if(r!=null){let s={isNew:r.isNew};if("defaults"in r.$__)s.defaults=r.$__.defaults;n=Object.assign(s,n)}if(n?.path!=null)this.$basePath=n.path;if(yn.call(this,e,t,n),this.$__.priorDoc!==void 0)this.$__.priorDoc=void 0}Vt.prototype=Object.create(yn.prototype);Object.defineProperty(Vt.prototype,"$isSubdocument",{configurable:!1,writable:!1,value:!0});Object.defineProperty(Vt.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!0});/*!
183
+ * ignore
184
+ */Vt.prototype.toBSON=function(){return this.toObject(pie)};Vt.prototype.save=async function(t){if(t=t||{},!t.suppressWarning)Q2.warn("mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app.");return await this.$__save(t)};Vt.prototype.$__fullPath=function(e){if(!this.$__.fullPath)this.ownerDocument();return e?this.$__.fullPath+"."+e:this.$__.fullPath};Vt.prototype.$__pathRelativeToParent=function(e){if(e==null)return this.$basePath;if(!this.$basePath)return e;return[this.$basePath,e].join(".")};Vt.prototype.$__save=async function(t){try{await this._execDocumentPreHooks("save",t,[t])}catch(r){await this._execDocumentPostHooks("save",t,r);return}await this._execDocumentPostHooks("save",t)};/*!
185
+ * ignore
186
+ */Vt.prototype.$isValid=function(e){let t=this.$parent(),r=this.$__pathRelativeToParent(e);if(t!=null&&r!=null)return t.$isValid(r);return yn.prototype.$isValid.call(this,e)};/*!
187
+ * ignore
188
+ */Vt.prototype.markModified=function(e){yn.prototype.markModified.call(this,e);let t=this.$parent(),r=this.$__pathRelativeToParent(e);if(t==null||r==null)return;if(this.isNew)return;let n=this.$__pathRelativeToParent().replace(/\.$/,"");if(t.isDirectModified(n))return;this.$__parent.markModified(r,this)};/*!
189
+ * ignore
190
+ */Vt.prototype.isModified=function(e,t,r){let n=this.$parent();if(n!=null){if(Array.isArray(e)||typeof e==="string")e=Array.isArray(e)?e:e.split(" "),e=e.map((s)=>this.$__pathRelativeToParent(s)).filter((s)=>s!=null);else if(!e)e=this.$__pathRelativeToParent();return n.$isModified(e,t,r)}return yn.prototype.isModified.call(this,e,t,r)};Vt.prototype.$markValid=function(e){yn.prototype.$markValid.call(this,e);let t=this.$parent(),r=this.$__pathRelativeToParent(e);if(t!=null&&r!=null)t.$markValid(r)};/*!
191
+ * ignore
192
+ */Vt.prototype.invalidate=function(e,t,r){yn.prototype.invalidate.call(this,e,t,r);let n=this.$parent(),s=this.$__pathRelativeToParent(e);if(n!=null&&s!=null)n.invalidate(s,t,r);else if(t.kind==="cast"||t.name==="CastError"||s==null)throw t;return this.ownerDocument().$__.validationError};/*!
193
+ * ignore
194
+ */Vt.prototype.$ignore=function(e){yn.prototype.$ignore.call(this,e);let t=this.$parent(),r=this.$__pathRelativeToParent(e);if(t!=null&&r!=null)t.$ignore(r)};Vt.prototype.ownerDocument=function(){if(this.$__.ownerDocument)return this.$__.ownerDocument;let e=this,t=[],r=new Set([e]);while(!0){if(typeof e.$__pathRelativeToParent!=="function")break;t.unshift(e.$__pathRelativeToParent(void 0,!0));let n=e.$parent();if(n==null)break;if(e=n,r.has(e))throw Error("Infinite subdocument loop: subdoc with _id "+e._id+" is a parent of itself");r.add(e)}return this.$__.fullPath=t.join("."),this.$__.ownerDocument=e,this.$__.ownerDocument};/*!
195
+ * ignore
196
+ */Vt.prototype.$__fullPathWithIndexes=function(){let e=this,t=[],r=new Set([e]);while(!0){if(typeof e.$__pathRelativeToParent!=="function")break;t.unshift(e.$__pathRelativeToParent(void 0,!1));let n=e.$parent();if(n==null)break;if(e=n,r.has(e))throw Error("Infinite subdocument loop: subdoc with _id "+e._id+" is a parent of itself");r.add(e)}return t.join(".")};Vt.prototype.parent=function(){return this.$__parent};Vt.prototype.$parent=Vt.prototype.parent;/*!
197
+ * Sets this sub-documents parent document.
198
+ *
199
+ * @api private
200
+ */Vt.prototype.$__setParent=function(t){this.$__parent=t};Vt.prototype.$__removeFromParent=function(){this.$__parent.set(this.$basePath,null)};Vt.prototype.deleteOne=function(t){if(mie(this),!t?.noop){this.$__removeFromParent();let r=this.ownerDocument();r.$__.removedSubdocs=r.$__.removedSubdocs||[],r.$__.removedSubdocs.push(this)}};/*!
201
+ * ignore
202
+ */Vt.prototype.populate=function(){throw Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.nested.populate("path")`, use `doc.populate("nested.path")`')};Vt.prototype.inspect=function(){return this.toObject()};if(J2.inspect.custom)Vt.prototype[J2.inspect.custom]=Vt.prototype.inspect;Vt.prototype.$toObject=function(t,r){let n=yn.prototype.$toObject.call(this,t,r);if(Q2.hasOwnKeys(n)===!1&&t?._calledWithOptions!=null){if((t._calledWithOptions?.minimize??this?.$__schemaTypeOptions?.minimize??t.minimize)&&!this.constructor.$__required&&!this.$isDocumentArrayElement)return}return n};function mie(e){let t=e.ownerDocument();function r(){t.$removeListener("save",r),t.$removeListener("deleteOne",r),e.emit("deleteOne",e),e.constructor.emit("deleteOne",e)}t.$on("save",r),t.$on("deleteOne",r)}});var ph=g(function(Oge,kx){/*!
203
+ * Module dependencies.
204
+ */var vx=require("events").EventEmitter,Z2=X2(),xx=be(),yie=de().arrayParentSymbol,B4=de().documentArrayParent;function Es(e,t,r,n,s){let i;if(xx.isMongooseDocumentArray(t))this.__parentArray=t,i=t[yie];else this.__parentArray=void 0;this[B4]=i,this.$setIndex(s),this.$__parent=i;let o={isNew:!0};if(i!=null&&"defaults"in i.$__)o.defaults=i.$__.defaults;if(typeof r==="object"&&r!=null)Object.assign(o,r);Z2.call(this,e,n,null,o)}/*!
205
+ * Inherit from Subdocument
206
+ */Es.prototype=Object.create(Z2.prototype);Es.prototype.constructor=Es;Object.defineProperty(Es.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!1});Object.defineProperty(Es.prototype,"$isDocumentArrayElement",{configurable:!1,writable:!1,value:!0});for(let e in vx.prototype)Es[e]=vx.prototype[e];/*!
207
+ * ignore
208
+ */Es.prototype.$setIndex=function(e){if(this.__index=e,this.$__?.validationError!=null){let t=Object.keys(this.$__.validationError.errors);for(let r of t)this.invalidate(r,this.$__.validationError.errors[r])}};/*!
209
+ * ignore
210
+ */Es.prototype.populate=function(){throw Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.arr[0].populate("path")`, use `doc.populate("arr.0.path")`')};/*!
211
+ * ignore
212
+ */Es.prototype.$__removeFromParent=function(){let e=this._doc._id;if(!e)throw Error("For your own good, Mongoose does not know how to remove an ArraySubdocument that has no _id");this.__parentArray.pull({_id:e})};Es.prototype.$__fullPath=function(e,t){if(this.__index==null)return null;if(!this.$__.fullPath)this.ownerDocument();if(t)return e?this.$__.fullPath+"."+e:this.$__.fullPath;return e?this.$__.fullPath+"."+this.__index+"."+e:this.$__.fullPath+"."+this.__index};Es.prototype.$__pathRelativeToParent=function(e,t){if(this.__index==null||!this.__parentArray?.$path)return null;if(t)return e==null?this.__parentArray.$path():this.__parentArray.$path()+"."+e;if(e==null)return this.__parentArray.$path()+"."+this.__index;return this.__parentArray.$path()+"."+this.__index+"."+e};Es.prototype.$parent=function(){return this[B4]};/*!
213
+ * Sets this sub-documents parent document.
214
+ *
215
+ * @api private
216
+ */Es.prototype.$__setParent=function(t){this[B4]=t,this.$__parent=t};Es.prototype.parentArray=function(){return this.__parentArray};/*!
217
+ * Module exports.
218
+ */kx.exports=Es});var ng=g(function(Sge,Hx){var N4=su(),F4=ph(),gie=ze(),qx=V2(),_ie=ar(),jx=_o().internalToObjectOptions,rg=ii(),it=be(),zc=Zn(),Eie=Te().UUID,Aie=de().arrayAtomicsBackupSymbol,Oo=de().arrayAtomicsSymbol,tc=de().arrayParentSymbol,rc=de().arrayPathSymbol,xu=de().arraySchemaSymbol,zx=de().populateModelSymbol,Oie=Symbol("mongoose#Array#sliced"),Lx=Array.prototype.push;/*!
219
+ * ignore
220
+ */var tg={$__getAtomics(){let e=[],t=Object.keys(this[Oo]||{}),r=t.length,n=Object.assign({},jx,{_isNested:!0});if(r===0)return e[0]=["$set",this.toObject(n)],e;while(r--){let s=t[r],i=this[Oo][s];if(it.isMongooseObject(i))i=i.toObject(n);else if(Array.isArray(i))i=this.toObject.call(i,n);else if(Array.isArray(i?.$each))i.$each=this.toObject.call(i.$each,n);else if(typeof i?.valueOf==="function")i=i.valueOf();if(s==="$addToSet")i={$each:i};e.push([s,i])}return e},getAtomics(){return this.$__getAtomics()},clearAtomics(){this[Aie]=this[Oo],this[Oo]={}},$atomics(){/*!
221
+ * ignore
222
+ */return this[Oo]},$parent(){/*!
223
+ * ignore
224
+ */return this[tc]},$path(){/*!
225
+ * ignore
226
+ */return this[rc]},$schemaType(){/*!
227
+ * ignore
228
+ */return this[xu]},$shift(){this._registerAtomic("$pop",-1),this._markModified();let e=this.__array;if(e._shifted)return;return e._shifted=!0,[].shift.call(e)},$pop(){if(this._registerAtomic("$pop",1),this._markModified(),this._popped)return;return this._popped=!0,[].pop.call(this)},$schema(){/*!
229
+ * ignore
230
+ */return this[xu]},_cast(e){let t=!1,r,n=this[tc];if(n)t=n.$populated(this[rc],!0);if(t&&e!=null){if(r=t.options[zx],r==null)throw new gie("No populated model found for path `"+this[rc]+"`. This is likely a bug in Mongoose, please report an issue on github.com/Automattic/mongoose.");if(Buffer.isBuffer(e)||zc(e,"ObjectId")||!it.isObject(e))e={_id:e};if(e.schema?.discriminatorMapping?.key===void 0)e=new r(e);return this[xu].embeddedSchemaType.applySetters(e,n,!0)}return this[xu].embeddedSchemaType.applySetters(e,n,!1)},_mapCast(e,t){return this._cast(e,this.length+t)},_markModified(e){let t=this[tc],r;if(t){if(r=this[rc],arguments.length)r=r+"."+e;if(r!=null&&r.endsWith(".$"))return this;t.markModified(r,arguments.length!==0?e:t)}return this},_registerAtomic(e,t){if(this[Oie])return;if(e==="$set")return this[Oo]={$set:t},qx(this[tc],this[rc]),this._markModified(),this;let r=this[Oo];if(e==="$pop"&&!("$pop"in r)){let s=this;this[tc].once("save",function(){s._popped=s._shifted=null})}if(r.$set||it.hasOwnKeys(r)&&!(e in r))return this[Oo]={$set:this},this;let n;if(e==="$pullAll"||e==="$addToSet")r[e]||(r[e]=[]),r[e]=r[e].concat(t);else if(e==="$pullDocs"){let s=r.$pull||(r.$pull={});if(t[0]instanceof F4)n=s.$or||(s.$or=[]),Array.prototype.push.apply(n,t.map((i)=>i.toObject({transform:(o,u)=>{if(i==null||i.$__==null)return u;return Object.keys(i.$__.activePaths.getStatePaths("default")).forEach((a)=>{rg.unset(a,u),Wx(u,a)}),u},virtuals:!1})));else n=s._id||(s._id={$in:[]}),n.$in=n.$in.concat(t)}else if(e==="$push")if(r.$push=r.$push||{$each:[]},t!=null&&it.hasUserDefinedProperty(t,"$each"))r.$push=t;else if(t.length===1)r.$push.$each.push(t[0]);else if(t.length<1e4)r.$push.$each.push(...t);else for(let s of t)r.$push.$each.push(s);else r[e]=t;return this},addToSet(){eg(this,arguments),Vx(this,arguments);let e=[].map.call(arguments,this._mapCast,this),t=[],r="";if(e[0]instanceof F4)r="doc";else if(e[0]instanceof Date)r="date";else if(zc(e[0],"ObjectId"))r="ObjectId";let n=it.isMongooseArray(e)?e.__array:e,s=it.isMongooseArray(this)?this.__array:this;return n.forEach(function(i){let o;switch(r){case"doc":o=this.some(function(u){return u.equals(i)});break;case"date":{let u=+i;o=this.some(function(a){return+a===u});break}case"ObjectId":o=this.find((u)=>u.toString()===i.toString());break;default:o=~this.indexOf(i);break}if(!o)this._markModified(),s.push(i),this._registerAtomic("$addToSet",i),[].push.call(t,i)},this),t},hasAtomics(){if(!it.isPOJO(this[Oo]))return 0;return Object.keys(this[Oo]).length},includes(e,t){return this.indexOf(e,t)!==-1},indexOf(e,t){if(zc(e,"ObjectId")||e instanceof Eie)e=e.toString();let r=null;if(e instanceof Date)r=Sie;else if(Buffer.isBuffer(e))r=wie;else if(zc(e,"Double"))r=Cie;else if(zc(e,"Decimal128"))r=bie;t=t==null?0:t;let n=this.length;for(let s=t;s<n;++s)if(r===null?e==this[s]:r(e,this[s]))return s;return-1},inspect(){return JSON.stringify(this)},nonAtomicPush(){let e=[].map.call(arguments,this._mapCast,this);this._markModified();let t=[].push.apply(this,e);return this._registerAtomic("$set",this),t},pop(){this._markModified();let e=[].pop.call(this);return this._registerAtomic("$set",this),e},pull(){let e=[].map.call(arguments,(s,i)=>this._cast(s,i,{defaults:!1}),this),t=this;if(it.isMongooseArray(t))t=t.__array;let r=t.length,n;this._markModified();while(r--)if(n=t[r],n instanceof N4){if(e.some(function(i){return n.equals(i)}))t.splice(r,1)}else if(~this.indexOf.call(e,n))t.splice(r,1);if(e[0]instanceof F4)this._registerAtomic("$pullDocs",e.map(function(s){let i=s.$__getValue("_id");if(i===void 0||s.$isDefault("_id"))return s;return i}));else this._registerAtomic("$pullAll",e);if(qx(this[tc],this[rc])>0)this._registerAtomic("$set",this);return this},push(){let e=arguments,t=e,r=e[0]!=null&&it.hasUserDefinedProperty(e[0],"$each"),n=it.isMongooseArray(this)?this.__array:this;if(r)t=e[0],e=e[0].$each;if(this[xu]==null)return Lx.apply(this,e);eg(this,e),Vx(this,e),e=[].map.call(e,this._mapCast,this);let s,i=this[Oo];if(this._markModified(),r)if(t.$each=e,Tie(i.$push,t)){if(t.$position!=null)[].splice.apply(n,[t.$position,0].concat(e)),s=n.length;else s=[].push.apply(n,e);this._registerAtomic("$set",this)}else if(t.$position!=null)[].splice.apply(n,[t.$position,0].concat(e)),s=this.length;else s=[].push.apply(n,e);else if(t=e,s=Lx.apply(n,e),i.$push?.$position!=null)this._registerAtomic("$set",this);return this._registerAtomic("$push",i.$push?.$each?.length?e:t),s},remove(){return this.pull.apply(this,arguments)},set(e,t,r){let n=this.__array;if(r)return n[e]=t,this;let s=tg._cast.call(this,t,e);return tg._markModified.call(this,e),n[e]=s,this},shift(){let e=it.isMongooseArray(this)?this.__array:this;this._markModified();let t=[].shift.call(e);return this._registerAtomic("$set",this),t},sort(){let e=it.isMongooseArray(this)?this.__array:this,t=[].sort.apply(e,arguments);return this._registerAtomic("$set",this),t},splice(){let e,t=it.isMongooseArray(this)?this.__array:this;if(this._markModified(),eg(this,Array.prototype.slice.call(arguments,2)),arguments.length){let r;if(this[xu]==null)r=arguments;else{r=[];for(let n=0;n<arguments.length;++n)r[n]=n<2?arguments[n]:this._cast(arguments[n],arguments[0]+(n-2))}e=[].splice.apply(t,r),this._registerAtomic("$set",this)}return e},toBSON(){/*!
231
+ * ignore
232
+ */return this.toObject(jx)},toObject(e){let t=it.isMongooseArray(this)?this.__array:this;if(e?.depopulate)return e=_ie(e),e._isNested=!0,[].concat(t).map(function(r){return r instanceof N4?r.toObject(e):r});return[].concat(t)},$toObject(){return this.constructor.prototype.toObject.apply(this,arguments)},unshift(){eg(this,arguments);let e;if(this[xu]==null)e=arguments;else e=[].map.call(arguments,this._cast,this);let t=it.isMongooseArray(this)?this.__array:this;return this._markModified(),[].unshift.apply(t,e),this._registerAtomic("$set",this),this.length}};/*!
233
+ * ignore
234
+ */function Sie(e,t){return t instanceof Date&&+e===+t}function wie(e,t){return Buffer.isBuffer(t)&&(e._subtype||0)===(t._subtype||0)&&e.equals(t)}function Cie(e,t){if(!zc(t,"Double"))return!1;let r=e.valueOf(),n=t.valueOf();return r===n||Number.isNaN(r)&&Number.isNaN(n)}var Ux=/^(-?)(\d+)(?:\.(\d*))?(?:E([+-]\d+))?$/;function bie(e,t){if(!zc(t,"Decimal128"))return!1;let r=e.toString(),n=t.toString();if(r===n)return!0;let s=Ux.exec(r),i=Ux.exec(n);if(s===null||i===null)return!1;let o=s[3]||"",u=i[3]||"",a=BigInt(s[1]+s[2]+o),c=BigInt(i[1]+i[2]+u),l=(+s[4]||0)-o.length,f=(+i[4]||0)-u.length;return l>f?a*10n**BigInt(l-f)===c:c*10n**BigInt(f-l)===a}function Die(e,t){if(!t)return!1;for(let r of e){if(r==null)return!1;let n=r.constructor;if(!(r instanceof N4)||n.modelName!==t&&n.baseModelName!==t)return!1}return!0}/*!
235
+ * Minimize _just_ empty objects along the path chain specified
236
+ * by `parts`, ignoring all other paths. Useful in cases where
237
+ * you want to minimize after unsetting a path.
238
+ *
239
+ * #### Example:
240
+ *
241
+ * const obj = { foo: { bar: { baz: {} } }, a: {} };
242
+ * _minimizePath(obj, 'foo.bar.baz');
243
+ * obj; // { a: {} }
244
+ */function Wx(e,t,r){if(typeof t==="string"){if(t.indexOf(".")===-1)return;t=rg.stringToParts(t)}if(r=r||0,r>=t.length)return;if(e==null||typeof e!=="object")return;if(Wx(e[t[0]],t,r+1),e[t[0]]!=null&&typeof e[t[0]]==="object"&&it.hasOwnKeys(e[t[0]])===!1)delete e[t[0]]}/*!
245
+ * ignore
246
+ */function eg(e,t){let r=e==null?null:e[xu]?.embeddedSchemaType?.options?.ref||null;if(e.length===0&&t.length!==0){if(Die(t,r))e[tc].$populated(e[rc],[],{[zx]:t[0].constructor})}}/*!
247
+ * If `docs` isn't all instances of the right model, depopulate `arr`
248
+ */function Vx(e,t){let r=e==null?null:e[xu]?.embeddedSchemaType?.options?.ref||null,n=e[tc],s=e[rc];if(!r||!n.populated(s))return;for(let i of t){if(i==null)continue;if(typeof i!=="object"||i instanceof String||i instanceof Number||i instanceof Buffer||it.isMongooseType(i)){n.depopulate(s);break}}}/*!
249
+ * A `{ $each }` push can only join a pending `$push` when neither has
250
+ * `$position`, `$slice` or `$sort` (gh-14244, gh-16618)
251
+ */function Tie(e,t){if(!e?.$each?.length)return!1;return[e,t].some((r)=>r.$position!=null||r.$slice!=null||r.$sort!=null)}var Mie=["filter","flat","flatMap","map","slice"];for(let e of Mie){if(Array.prototype[e]==null)continue;tg[e]=function(){let t=it.isMongooseArray(this)?this.__array:this,r=[].concat(t);return r[e].apply(r,arguments)}}Hx.exports=tg});var Qx=g(function(wge,Jx){var Yr=ng(),Pie=su(),Kx=oi(),Gx=Vi(),Bie=_o().internalToObjectOptions,gn=be(),Fie=Zn(),sg=de().arrayParentSymbol,I4=de().arrayPathSymbol,ad=de().arraySchemaSymbol,Yx=de().documentArrayParent,Nie=Array.prototype.reverse,Iie=Array.prototype.toString,R4={toBSON(){/*!
252
+ * ignore
253
+ */return this.toObject(Bie)},toString(){return Iie.call(this.__array.map((e)=>{if(e?.$__!=null)return e.toString();return e}))},getArrayParent(){/*!
254
+ * ignore
255
+ */return this[sg]},$schemaType(){/*!
256
+ * ignore
257
+ */return this[ad]},_cast(e,t,r){if(this[ad]==null)return e;let n=this[ad].Constructor;if((n.$isMongooseDocumentArray?gn.isMongooseDocumentArray(e):e instanceof n)||e?.constructor?.baseCasterConstructor===n){if(!(e[Yx]&&e.__parentArray))e[Yx]=this[sg],e.__parentArray=this;return e.$setIndex(t),e}if(e==null)return null;if(Buffer.isBuffer(e)||Fie(e,"ObjectId")||!gn.isObject(e))e={_id:e};if(e&&n.discriminators&&n.schema&&n.schema.options&&n.schema.options.discriminatorKey){let o=typeof e[n.schema.options.discriminatorKey]==="string"?Kx(n.discriminators,e[n.schema.options.discriminatorKey]):null;if(o)n=o;else{let u=Gx(n.discriminators,e[n.schema.options.discriminatorKey]);if(u)n=u}}if(n.$isMongooseDocumentArray)return n.cast(e,this,void 0,void 0,t);let i=new n(e,this,r,void 0,t);return i.isNew=!0,i},id(e){if(e==null)return null;let t=this[ad],r=null;if(t?.schema)r=t.schema.path("_id");else if(t?.casterConstructor?.schema)r=t.casterConstructor.schema.path("_id");let n=null;if(r)try{n=r.cast(e)}catch{}let s;for(let i of this){if(!i)continue;if(s=i.get("_id"),s==null)continue;else if(s instanceof Pie){if(s=s.get("_id"),n!=null&&gn.deepEqual(n,s))return i;else if(n==null&&(e==s||gn.deepEqual(e,s)))return i}else if(n!=null&&gn.deepEqual(n,s))return i;else if(n==null&&(s==e||gn.deepEqual(e,s)))return i}return null},toObject(e){return[].concat(this.map(function(t){if(t==null)return null;if(typeof t.toObject!=="function")return t;return t.toObject(e)}))},$toObject(){return this.constructor.prototype.toObject.apply(this,arguments)},addToSet(){let e=Yr.addToSet.apply(this,arguments);return ku(this),e},push(){let e=Rie(arguments),t=Yr.push.apply(this,arguments);if(e)ku(this);return ou(this),t},pop(){let e=Yr.pop.apply(this,arguments);return ou(this),e},$pop(){/*!
258
+ * ignore
259
+ */let e=Yr.$pop.apply(this,arguments);return ou(this),e},pull(){let e=Yr.pull.apply(this,arguments);return ku(this),ou(this),e},shift(){let e=Yr.shift.apply(this,arguments);return ku(this),ou(this),e},$shift(){/*!
260
+ * ignore
261
+ */let e=Yr.$shift.apply(this,arguments);return ku(this),ou(this),e},splice(){let e=Yr.splice.apply(this,arguments);return ku(this),ou(this),e},reverse(){return Nie.call(this.__array),this._registerAtomic("$set",this),ku(this),ou(this),this},sort(){let e=Yr.sort.apply(this,arguments);return ku(this),ou(this),e},unshift(){let e=Yr.unshift.apply(this,arguments);return ku(this),ou(this),e},inspect(){return this.toObject()},create(e){let t=this[ad].Constructor;if(e&&t.discriminators&&t.schema&&t.schema.options&&t.schema.options.discriminatorKey){let r=typeof e[t.schema.options.discriminatorKey]==="string"?Kx(t.discriminators,e[t.schema.options.discriminatorKey]):null;if(r)t=r;else{let n=Gx(t.discriminators,e[t.schema.options.discriminatorKey]);if(n)t=n}}return new t(e,this)},notify(e){/*!
262
+ * ignore
263
+ */let t=this;return function r(n,s){s=s||t;let i=s.length;while(i--){if(s[i]==null)continue;switch(e){case"save":n=t[i];break;default:break}if(gn.isMongooseArray(s[i]))r(n,s[i]);else if(s[i])s[i].emit(e,n)}}},set(e,t,r){let n=this.__array;if(r)return n[e]=t,this;let s=R4._cast.call(this,t,e);return R4._markModified.call(this,e),n[e]=s,this},_markModified(e,t){let r=this[sg],n;if(r){if(n=this[I4],arguments.length)if(t!=null){let s=e.__index;n=n+"."+s+"."+t}else n=n+"."+e;if(n!=null&&n.endsWith(".$"))return this;r.markModified(n,arguments.length!==0?e:r)}return this}};Jx.exports=R4;/*!
264
+ * ignore
265
+ */function ku(e){let t=gn.isMongooseArray(e)?e.__array:e;for(let r=0;r<t.length;++r)if(typeof t[r]?.$setIndex==="function")t[r].$setIndex(r)}function Rie(e){return e[0]!=null&&gn.hasUserDefinedProperty(e[0],"$each")&&e[0].$position!=null}function ou(e){let t=e[sg];if(!t||t.$__.populated==null)return;let r=Object.keys(t.$__.populated).filter((n)=>n.startsWith(e[I4]+"."));for(let n of r){let s=n.slice((e[I4]+".").length);if(!Array.isArray(t.$__.populated[n].value))continue;t.$__.populated[n].value=e.map((i)=>i.$populated(s))}}});var Hc=g(function(Cge,Zx){/*!
266
+ * Module dependencies.
267
+ */var Xx=ng(),ig=Qx(),$4=de().arrayAtomicsSymbol,$ie=de().arrayAtomicsBackupSymbol,v4=de().arrayParentSymbol,x4=de().arrayPathSymbol,Wc=de().arraySchemaSymbol,vie=Array.prototype.push,xie=/^\d+$/;function kie(e,t,r,n){let s=[],i={[$4]:{},[$ie]:void 0,[x4]:t,[Wc]:void 0,[v4]:void 0};if(Array.isArray(e)){if(e[x4]===t&&e[v4]===r)i[$4]=Object.assign({},e[$4]);e.forEach((u)=>{vie.call(s,u)})}if(i[x4]=t,i.__array=s,r?.$__){i[v4]=r,i[Wc]=r.$__schema.path(t);while(i[Wc]!=null&&i[Wc].$isMongooseArray&&!i[Wc].$isMongooseDocumentArray)i[Wc]=i[Wc].embeddedSchemaType}let o=new Proxy(s,{get:function(u,a){if(a==="isMongooseArray"||a==="isMongooseArrayProxy"||a==="isMongooseDocumentArray"||a==="isMongooseDocumentArrayProxy")return!0;if(Object.hasOwn(i,a))return i[a];if(Object.hasOwn(ig,a))return ig[a];if(n?.virtuals&&Object.hasOwn(n.virtuals,a))return n.virtuals[a].applyGetters(void 0,u);if(Object.hasOwn(Xx,a))return Xx[a];return s[a]},set:function(u,a,c){if(typeof a==="string"&&xie.test(a))ig.set.call(o,a,c,!1);else if(Object.hasOwn(i,a))i[a]=c;else if(n?.virtuals&&Object.hasOwn(n.virtuals,a))n.virtuals[a].applySetters(c,u);else s[a]=c;return!0}});return o}/*!
268
+ * Module exports.
269
+ */Zx.exports=kie});var su=g(function(Dk,Tk){/*!
270
+ * Module dependencies.
271
+ */var qie=a4(),L4=require("events").EventEmitter,jie=Bv(),lk=k2(),Nr=ni(),Lie=Rv(),hk=q2(),z4=j2(),Uie=kv(),ek=LA(),Vie=Kc(),mh=ec(),ld=jc(),fk=YA(),dk=g4(),U4=U2(),k4=V2(),So=ar(),q4=_4(),zie=H2().compile,Wie=H2().defineKey,Hie=Qv(),Kie=Xn(),j4=sx(),tk=ox(),pk=iu(),Gie=cx(),Yie=G2(),Jie=dh(),Qie=Uc(),ts=Fn(),rk=S4(),ug=require("util").inspect,mk=_o().internalToObjectOptions,Xie=w4(),Zie=C4(),yk=ii(),W4=b4(),gk=od(),{buildMiddlewareFilter:_k}=vu(),z=be(),eoe=P4(),og=z.deepEqual,toe=Object.freeze({skipParentChangeTracking:!0}),hd=de().arrayAtomicsBackupSymbol,As=de().arrayAtomicsSymbol,roe=de().documentArrayParent,noe=de().documentIsModified,Ek=de().documentModifiedPaths,soe=de().documentSchemaSymbol,ioe=de().getSymbol,nk=de().modelSymbol,sk=de().populateModelSymbol,ooe=de().scopeSymbol,Ak=Ao().schemaMixedSymbol,uoe=Fx(),aoe=de().sessionNewDocuments,coe=Rx(),ag,cd,H4=z.specialProperties;/*!
272
+ * Document internals that don't start with `$`. `isNew` is a getter/setter
273
+ * for `$isNew`.
274
+ */var loe=new Set(["_doc","__parentArray","__index","isNew"]);function j(e,t,r){if(typeof r==="boolean")throw Error("The skipId parameter has been removed. Use { skipId: true } in the options parameter instead.");if(r==null)r={};let n=r.skipId;if(this.$__=new jie,this.$__schema==null){let l=z.isObject(t)&&!t.instanceOfSchema?new Vie(t):t;this.$__setSchema(l),r=Object.assign({},r),t=r,n=r.skipId}if(r.isNew!=null&&r.isNew!==!0)this.$isNew=r.isNew;if(r.priorDoc!=null)this.$__.priorDoc=r.priorDoc;if(n)this.$__.skipId=n;if(e!=null&&typeof e!=="object")throw new z4(e,"obj","Document");let s=!0;if(r.defaults!==void 0)this.$__.defaults=r.defaults,s=r.defaults;let i=this.$__schema;if(typeof t==="boolean"||t==="throw"){if(t!==!0)this.$__.strictMode=t;t=void 0}else if(r.strict!==void 0)this.$__.strictMode=r.strict;else if(i.options.strict!==!0)this.$__.strictMode=i.options.strict;let o=i.requiredPaths();for(let l of o)this.$__.activePaths.require(l);let u=null;if(z.isPOJO(t)&&z.hasOwnKeys(t))u=Qie(t),this.$__.selected=t,this.$__.exclude=u;let a=u===!1&&t?dk(t):null,c=!0;if(this._doc==null){if(this.$__buildDoc(e,t,n,u,a,!1),s)c=U4(this,t,u,a,!0,null,toe)}if(e){let l=Object.assign({},r);if(this.$__original_set)this.$__original_set(e,void 0,!0,l);else this.$set(e,void 0,!0,l);if(e.$__!=null&&e instanceof j)this.$isNew=e.$isNew}if(r.willInit&&s){if(r.skipDefaults)this.$__.skipDefaults=r.skipDefaults}else if(s&&c)U4(this,t,u,a,!1,r.skipDefaults);if(!this.$__.strictMode&&e){let l=this;Object.keys(this._doc).forEach(function(h){if(!(h in i.tree)&&!(h in i.methods)&&!(h in i.virtuals)&&V4(h))Wie({prop:h,subprops:null,prototype:l})})}Eoe(this)}j.prototype.$isMongooseDocumentPrototype=!0;Object.defineProperty(j.prototype,"isNew",{get:function(){return this.$isNew},set:function(e){this.$isNew=e}});Object.defineProperty(j.prototype,"errors",{get:function(){return this.$errors},set:function(e){this.$errors=e}});/*!
275
+ * ignore
276
+ */j.prototype.$isNew=!0;/*!
277
+ * Document exposes the NodeJS event emitter API, so you can use
278
+ * `on`, `once`, etc.
279
+ */z.each(["on","once","emit","listeners","removeListener","setMaxListeners","removeAllListeners","addListener"],function(e){j.prototype[e]=function(){if(!this.$__.emitter){if(e==="emit")return;this.$__.emitter=new L4,this.$__.emitter.setMaxListeners(0)}return this.$__.emitter[e].apply(this.$__.emitter,arguments)},j.prototype[`$${e}`]=j.prototype[e]});j.prototype.constructor=j;for(let e in L4.prototype)j[e]=L4.prototype[e];j.prototype.$__schema;j.prototype.schema;Object.defineProperty(j.prototype,"$locals",{configurable:!1,enumerable:!1,get:function(){if(this.$__.locals==null)this.$__.locals={};return this.$__.locals},set:function(e){this.$__.locals=e}});j.prototype.isNew;Object.defineProperty(j.prototype,"$where",{configurable:!1,enumerable:!1,writable:!0});j.prototype.id;j.prototype.$errors;Object.defineProperty(j.prototype,"$op",{get:function(){return this.$__.op||null},set:function(e){this.$__.op=e}});/*!
280
+ * ignore
281
+ */function hoe(e,t,r){if(e==null)return;let n=r.$__schema._getDefaultsCache().defaultsByNestedPath.get(t);if(n==null)return;let{paths:s,schemaTypes:i,depth:o}=n,u=s.length;for(let a=0;a<u;++a){let c=s[a],l=i[a],f=l.splitPath(),h=f.length,d=e;for(let p=o;p<h;++p){let m=f[p];if(p===h-1){if(d[m]!==void 0)break;try{let _=l.getDefault(r,!1);if(_!==void 0)d[m]=_,r.$__.activePaths.default(c)}catch(_){r.invalidate(c,_)}break}if(d[m]==null)d[m]={};else if(typeof d[m]!=="object")break;d=d[m]}}}j.prototype.$__buildDoc=function(e,t,r,n,s){if(!z.hasOwnKeys(this.$__schema.nested)){this._doc={};return}let i={},o=Object.keys(this.$__schema.paths),u=o.length,a=0;for(;a<u;++a){let c=o[a];if(c.includes("$*"))continue;let l=this.$__schema.paths[c].splitPath(),f=l.length;if(f===1)continue;let h=f-1,d="",p=i,m=!1;for(let _=0;_<f;++_){let y=l[_];if(!d.length)d=y;else d+="."+y;if(n===!0){if(d in t)break}else if(n===!1&&t&&!m){if(d in t)m=!0;else if(!s[d])break}if(_<h)p=p[y]||(p[y]={})}}this._doc=i};/*!
282
+ * Converts to POJO when you use the document for querying
283
+ */j.prototype.toBSON=function(){return this.toObject(mk)};j.prototype.init=function(e,t,r){if(typeof t==="function")r=t,t=null;if(e==null)throw new z4(e,"doc","init");if(this.$__init(e,t),r)r(null,this);return this};j.prototype.$init=function(){return this.constructor.prototype.init.apply(this,arguments)};j.prototype.$__init=function(e,t){if(e==null)throw new z4(e,"doc","init");if(this.$isNew=!1,t=t||{},e._id!=null&&t.populated&&t.populated.length){let n=String(e._id);for(let s of t.populated){if(s.isVirtual)this.$populated(s.path,z.getValue(s.path,e),s);else this.$populated(s.path,s._docs[n],s);if(s._childDocs==null)continue;for(let i of s._childDocs){if(i?.$__==null)continue;i.$__.parent=this}s._childDocs=[]}}Ok(this,e,this._doc,t),Xie(this,t.populated),this.$emit("init",this),this.constructor.emit("init",this);let r=this.$__.exclude===!1&&this.$__.selected?dk(this.$__.selected):null;return U4(this,this.$__.selected,this.$__.exclude,r,!1,this.$__.skipDefaults),this};function Ok(e,t,r,n,s){if(s=s||"",typeof t!=="object"||Array.isArray(t))throw new hk(e.$basePath,t);if(ts(t))t=t._doc;let i=Object.keys(t),o=i.length,u,a,c,l=e.$__.strictMode,f=e.$__schema,h=f.options.strictRead;for(let d=0;d<o;++d){if(c=i[d],H4.has(c))continue;if(a=s?s+c:c,u=f.path(a),f.$isRootDiscriminator&&!e.$__isSelected(a))continue;let p=t[c];if(!u&&h&&f.pathType(a)==="adhocOrUndefined"){if(h==="throw")throw new mh(a,"Field `"+a+"` is not in schema and strictRead is set to throw.");else if(h===!0)continue}if(!u&&z.isPOJO(p)){if(!Object.hasOwn(r,c)&&c in r)continue;if(!r[c]){if(r[c]={},!l&&!s&&!(c in f.tree)&&!(c in f.methods)&&!(c in f.virtuals)&&V4(c))e[c]=r[c];else if(n?.virtuals&&Object.hasOwn(f.virtuals,c))e[c]=r[c]}Ok(e,p,r[c],n,a+".")}else if(!u){if(h==="throw")throw new mh(a,"Field `"+a+"` is not in schema and strictRead is set to throw.");else if(h===!0)continue;if(r[c]=p,!l&&!s){if(V4(c))e[c]=p}else if(n?.virtuals&&Object.hasOwn(f.virtuals,c))e[c]=p;else if(n?.strict==="throw")throw new mh(c)}else{if(Object.hasOwn(r,c)&&p!==void 0&&!n.hydratedPopulatedDocs)delete r[c];if(p===null)r[c]=u._castNullish(null);else if(p!==void 0){let _=ts(p)?p.$__.wasPopulated:null;if(u&&!_&&!n.hydratedPopulatedDocs)try{if(n?.setters)r[c]=u.applySetters(p,e,!1,null,n);else r[c]=u.cast(p,e,!0,void 0,n)}catch(y){e.invalidate(y.path,new fk({path:y.path,message:y.message,type:"cast",value:y.value,reason:y}))}else if(u&&n.hydratedPopulatedDocs){if(r[c]=u.cast(p,e,!0,void 0,{hydratedPopulatedDocs:!0}),ts(r[c])&&r[c].$__.wasPopulated)e.$populated(a,r[c].$__.wasPopulated.value,r[c].$__.wasPopulated.options);else if(Array.isArray(r[c])&&r[c].length&&ts(r[c][0])&&r[c][0].$__.wasPopulated)e.$populated(a,r[c].map((y)=>ts(y)?y.$__.wasPopulated?.value:null).filter((y)=>y!=null),r[c][0].$__.wasPopulated.options)}else r[c]=p}let m=e.$__.activePaths;if(m.states.modify==null||!e.$isModified(a))m.init(a)}}}function V4(e){return!e.startsWith("$")&&!loe.has(e)}j.prototype.updateOne=function(t,r){let n=this.constructor.updateOne(),s=this;return n.pre(async function(){let o=await s._execDocumentPreHooks("updateOne",r,[s,t,r]);if(o[0]!==s||o[1]!==t||o[2]!==r)throw Error("Document updateOne pre hooks cannot overwrite arguments");if(n.updateOne({_id:s._doc._id},t,r),s.$where!=null)this.where(s.$where);if(s.$session()!=null){if(!("session"in n.options))n.options.session=s.$session()}return o}),n.post(function(){return s._execDocumentPostHooks("updateOne",r)}),n};j.prototype.replaceOne=function(){let t=[...arguments];return t.unshift({_id:this._doc._id}),this.constructor.replaceOne.apply(this.constructor,t)};j.prototype.$session=function(t){if(arguments.length===0){if(this.$__.session?.hasEnded)return this.$__.session=null,null;return this.$__.session}if(t?.hasEnded)throw new Nr("Cannot set a document's session to a session that has ended. Make sure you haven't called `endSession()` on the session you are passing to `$session()`.");if(t==null&&this.$__.session==null)return;if(this.$__.session=t,!this.$isSubdocument){let r=this.$getAllSubdocs();for(let n of r)n.$session(t)}return t};j.prototype.$timestamps=function(t){if(arguments.length===0){if(this.$__.timestamps!=null)return this.$__.timestamps;if(this.$__schema)return this.$__schema.options.timestamps;return}let r=this.$timestamps();if(t!==r)this.$__.timestamps=t;return this};j.prototype.overwrite=function(t){let r=new Set(Object.keys(this._doc));for(let s of Object.keys(t))r.add(s);let n=this.$__schema.options;for(let s of r){if(s==="_id")continue;if(n.versionKey&&s===n.versionKey)continue;if(n.discriminatorKey&&s===n.discriminatorKey)continue;this.$set(s,t[s])}return this};j.prototype.$set=function(t,r,n,s){if(z.isPOJO(n))s=n,n=void 0;let i=n===!0;if(n&&!i){let y=this.$__.adhocPaths||(this.$__.adhocPaths={});y[t]=this.$__schema.interpretAsType(t,n,this.$__schema.options)}let o=s!=null&&"strict"in s,u=o?s.strict:this.$__.strictMode;if(t==null)[t,r]=[r,t];if(typeof t!=="string"){let y=t;if(y instanceof j)if(y.$__isNested)y=y.toObject();else y=y.$__schema===this.$__schema?G4(y,{...y._doc}):y._doc;let E=r?r+".":"";for(let A of tk(this.$__schema,y)){let P=E+A,S=y[A],B=this.$__schema.pathType(P);if(i&&!E&&S!=null&&B==="nested"&&this._doc[A]!=null)delete this._doc[A];if(B==="nested"&&z.isNonBuiltinObject(S)){this.$set(P,S,i,s),hoe(this.$get(P),P,this);continue}if(u){if(i&&S===void 0&&this.$get(P)!==void 0)continue;if(B==="adhocOrUndefined")B=j4(this,P,{typeOnly:!0});if(B!=="real"&&B!=="virtual"){if(u==="throw")throw B==="nested"?new hk(A,S):new mh(A);if(B!=="nested"||S!=null)continue}}this.$set(P,S,i,s)}let C=this._doc,D={};for(let A of Object.keys(this.$__schema.tree))if(Object.hasOwn(C,A))D[A]=C[A];for(let A of Object.keys(C))if(!Object.hasOwn(D,A))D[A]=C[A];return this._doc=D,this}let a=t.indexOf(".");if(a!==-1){let y=this.$__schema.aliases[t.slice(0,a)];if(typeof y==="string")t=y+t.slice(a)}let c=a===-1?[t]:t.split("."),l=this.$__schema.pathType(t);if(l==="adhocOrUndefined")l=j4(this,c,{typeOnly:!0});if(l==="adhocOrUndefined"&&!o){let y=Gie(this.$__schema,c);if(y!==void 0)u=y}r=Yie(r,!0);let f=this.$__.priorDoc!=null?this.$__.priorDoc.$__getValue(t):i?void 0:this.$__getValue(t);if(l==="nested"&&r){if(typeof r==="object")r=coe(r,mk);if(r==null||typeof r!=="object")return this.invalidate(t,new Nr.CastError("Object",r,t)),this;let y=this.$__.savedState,E=y!=null&&Object.hasOwn(y,t);if(y!=null&&!this.$isNew&&!E){let A=this.$__getValue(t);y[t]=A;for(let P of Object.keys(A||{}))y[t+"."+P]=A[P]}if(s?.merge)return this.$set(r,t,i,s);let C=this.$isModified(t);k4(this,t),this.$__setValue(t,{});let D={...s,_skipMarkModified:!0};for(let A of tk(this.$__schema,r,t))this.$set(t+"."+A,r[A],i,D);if(f!=null&&(!C||E)&&z.deepEqual(E?y[t]:f,r))this.unmarkModified(t);else this.markModified(t);return this}let h;if(l==="adhocOrUndefined"&&u){let y="";for(let E=0;E<c.length-1;++E)if(y=E===0?c[0]:y+"."+c[E],this.$__schema.pathType(y)==="virtual")return yk.set(t,r,this),this;if(h=this.$__schema.path(t)??j4(this,t),h==null){if(u==="throw")throw new mh(t);return this}}else if(l==="virtual")return this.$__schema.virtualpath(t).applySetters(r,this),this;else h=this.$__path(t);let d=t,p=this._doc,m="";for(let y=0;y<c.length-1;++y)if(p=p instanceof Map?p.get(c[y]):p[c[y]],m+=(m.length!==0?".":"")+c[y],!p){if(this.$set(m,{}),!this.$__isSelected(m))this.unmarkModified(m);if(p=this.$__getValue(m),p===null){d=m;break}}if(!h){if(this.$__set(d,t,s,i,c,h,r,f),l==="nested"&&r==null)k4(this,t);return this}if(h.$isSingleNested||h.$isMongooseArray)goe(this,t);if(r!=null&&s?.merge&&h.$isSingleNested){if(r instanceof j)r=r.toObject({virtuals:!1,transform:!1});for(let y of Object.keys(r))this.$set(t+"."+y,r[y],i,s);return this}let _=!0;try{let y=!1;if(r instanceof j&&h.options!=null){let{modelName:A,baseModelName:P}=r.constructor,S=h.options.ref;if(typeof S==="function"&&!S[nk])S=S.call(this,this);if(S=S?.modelName||S,S!=null&&(S===A||S===P))y=!0;else if(h.options.refPath!=null){let B=h.options.refPath;if(typeof B==="function"&&!B[nk]){let I=this.$__fullPathWithIndexes?.();B=B.call(this,this,I?I+"."+t:t)}if(typeof B!=="string")throw new Nr("`refPath` must be a string or a function that returns a string, got "+ug(B));let q=this.ownerDocument().get(B);y=q===A||q===P}}let E=!1;if(y&&(!r.$__.wasPopulated||z.deepEqual(r.$__.wasPopulated.value,r._doc._id))){let A=h.$isSingleNested?h.cast(r,this):r._doc._id;this.$populated(t,A,{[sk]:r.constructor}),r.$__.wasPopulated={value:A},E=!0}let C=h.options?.[this.$__schema.options.typeKey],D=Array.isArray(C)?C[0]?.ref:null;if(D&&foe(r,D)){this.$populated(t,r.map((A)=>A._doc._id),{[sk]:r[0].constructor});for(let A of r)A.$__.wasPopulated={value:A._doc._id};E=!0}if(!y||!h.$isSingleNested){let A=this;if(pk(this.$__schema.singleNestedPaths,t)!=null&&c.length>1)A=uoe(this,c,this.schema);let P={path:t};if(s?.overwriteImmutable)P.overwriteImmutable=!0;r=h.applySetters(r,A,!1,f,P)}if(h.$isMongooseDocumentArray&&Array.isArray(r)&&ts(r[0])&&r[0].$__.populated!=null){let A=r[0].$__.populated;for(let P of Object.keys(A))this.$populated(t+"."+P,r.map((S)=>S.$populated(P)),A[P].options);E=!0}if(!E&&this.$__.populated){if(Array.isArray(r)&&this.$__.populated[t]){for(let A=0;A<r.length;++A)if(r[A]instanceof j)r.set(A,r[A]._doc._id,!0)}delete this.$__.populated[t]}if(r!=null&&h.$isSingleNested)_oe(r,h,f);this.$markValid(t)}catch(y){if(y instanceof Nr.StrictModeError&&y.isImmutableError)this.invalidate(t,y);else if(y instanceof Nr.CastError)this.invalidate(y.path,y);else this.invalidate(t,new Nr.CastError(h.instance,r,t,y));_=!1}if(_){let y=null,E=null;if(!i){let C=this.$isSubdocument?this.ownerDocument():this;y=C.$__.savedState,E=this.$isSubdocument?this.$__.fullPath+"."+t:t,C.$__saveInitialState(E)}if(this.$__set(d,t,s,i,c,h,r,f),y!=null&&Object.hasOwn(y,E)){let C=this.$__.session,D=C?.[aoe]?.get(this)?.modifiedPaths,A=D!=null&&!D.has(E);if((!C?.transaction||A)&&z.deepEqual(r,y[E]))this.unmarkModified(t)}}if(h.$isSingleNested&&(this.isDirectModified(t)||r==null)||h.$isSchemaMap&&r==null)k4(this,t);return this};/*!
284
+ * ignore
285
+ */function foe(e,t){if(!Array.isArray(e))return!1;if(e.length===0)return!1;for(let r of e){if(!(r instanceof j))return!1;if(r.constructor.modelName==null)return!1;if(r.constructor.modelName!=t&&r.constructor.baseModelName!=t)return!1}return!0}j.prototype.set=j.prototype.$set;j.prototype.$__shouldModify=function(e,t,r,n,s,i,o,u){if(r?._skipMarkModified)return!1;if(this.$isNew)return!0;if(t in this.$__.activePaths.getStatePaths("modify"))return!0;if(o===void 0&&!this.$__isSelected(t))return!0;if(o===void 0&&t in this.$__.activePaths.getStatePaths("default"))return!1;if(this.$populated(t)&&o instanceof j&&og(o._doc._id,u))return!1;if(!og(o,u!==void 0?u:z.getValue(t,this)))return!0;if(!n&&o!==null&&o!==void 0&&t in this.$__.activePaths.getStatePaths("default")&&og(o,i.getDefault(this,n)))return!0;return!1};j.prototype.$__set=function(e,t,r,n,s,i,o,u){cd=cd||ph();let a=this.$isNew&&!r?._skipMarkModified?!0:this.$__shouldModify(e,t,r,n,s,i,o,u);if(a){if(this.$__.primitiveAtomics?.[t]){if(delete this.$__.primitiveAtomics[t],z.hasOwnKeys(this.$__.primitiveAtomics)===!1)delete this.$__.primitiveAtomics}if(this.markModified(e),o&&z.isMongooseArray(o)){if(o._registerAtomic("$set",o),z.isMongooseDocumentArray(o))o.forEach(function(d){d&&d.__parentArray&&(d.__parentArray=o)})}}else if(Array.isArray(o)&&Array.isArray(u)&&z.isMongooseArray(o)&&z.isMongooseArray(u)){if(o[As]=u[As],o[hd]=u[hd],z.isMongooseDocumentArray(o))o.forEach((d)=>{if(d!=null)d.$isNew=!1})}let c=this._doc,l=0,f=s.length,h="";for(;l<f;l++){let p=l+1===f;if(h+=h?"."+s[l]:s[l],H4.has(s[l]))continue;if(p)if(c instanceof Map)c.set(s[l],o);else if(c.$isSingleNested){if(!(s[l]in c))c[s[l]]=o,c._doc[s[l]]=o;else c._doc[s[l]]=o;if(a)c.markModified(s[l])}else c[s[l]]=o;else{let m=c instanceof Map,_=m?c.get(s[l]):c[s[l]],y=ts(c)&&!c.$__isNested?c._doc:c;if(!m&&!Object.hasOwn(y,s[l])&&s[l]in c)return;if(z.isPOJO(_))c=_;else if(_&&_ instanceof cd)c=_;else if(_&&!Array.isArray(_)&&_.$isSingleNested)c=_;else if(_&&Array.isArray(_))c=_;else if(_==null){if(_={},m)c.set(s[l],_);else c[s[l]]=_;c=_}else c=_}}};j.prototype.$__getValue=function(e){if(typeof e!=="string"&&!Array.isArray(e))throw TypeError(`Invalid \`path\`. Must be either string or array. Got "${e}" (type ${typeof e})`);return z.getValue(e,this._doc)};j.prototype.$inc=function(t,r){if(r==null)r=1;if(Array.isArray(t))return t.forEach((a)=>this.$inc(a,r)),this;let n=this.$__path(t);if(n==null){if(this.$__.strictMode==="throw")throw new mh(t);else if(this.$__.strictMode===!0)return this}else if(n.instance!=="Number")return this.invalidate(t,new Nr.CastError(n.instance,r,t)),this;let s=this.$__getValue(t)||0,i=!1,o=null,u=r;try{r=n.cast(r),o=n.applySetters(s+r,this),u=o-s,i=!0}catch(a){this.invalidate(t,new Nr.CastError("number",r,t,a))}if(i){if(this.$__.primitiveAtomics=this.$__.primitiveAtomics||{},this.$__.primitiveAtomics[t]==null)this.$__.primitiveAtomics[t]={$inc:u};else this.$__.primitiveAtomics[t].$inc+=u;this.markModified(t),this.$__setValue(t,o)}return this};j.prototype.$__setValue=function(t,r){if(Array.isArray(t)&&t.length===1)return this._doc[t[0]]=r,this;return z.setValue(t,r,this._doc),this};j.prototype.get=function(e,t,r){let n;if(r==null)r={};if(t)n=this.$__schema.interpretAsType(e,t,this.$__schema.options);let s=r.noDottedPath,i=s?Object.hasOwn(this.$__schema.paths,e)?this.$__schema.paths[e]:void 0:this.$__path(e);if(i==null){if(i=this.$__schema.virtualpath(e),i!=null)return i.applyGetters(void 0,this)}if(s){let c=Object.hasOwn(this._doc,e)?this._doc[e]:void 0;if(n)c=n.cast(c);if(i!=null&&r.getters!==!1)return i.applyGetters(c,this);return c}if(i?.instance==="Mixed"){let c=this.$__schema.virtualpath(e);if(c!=null)i=c}let o=e.indexOf(".")!==-1,u=this._doc,a=o?e.split("."):[e];if(typeof this.$__schema.aliases[a[0]]==="string")a[0]=this.$__schema.aliases[a[0]];for(let c=0,l=a.length;c<l;c++){if(H4.has(a[c]))return;if(u&&u._doc)u=u._doc;if(u==null)u=void 0;else if(u instanceof Map)u=u.get(a[c],{getters:!1});else if(c===l-1)u=z.getValue(a[c],u);else u=u[a[c]]}if(n)u=n.cast(u);if(i!=null&&r.getters!==!1)u=i.applyGetters(u,this);else if(Object.hasOwn(this.$__schema.nested,e)&&r.virtuals)return G4(this,So(u)||{},{path:e});return u};/*!
286
+ * ignore
287
+ */j.prototype[ioe]=j.prototype.get;j.prototype.$get=j.prototype.get;j.prototype.$__path=function(e){let t=this.$__.adhocPaths,r=t&&Object.hasOwn(t,e)?t[e]:null;if(r)return r;return this.$__schema.path(e)};j.prototype.markModified=function(e,t){if(this.$__saveInitialState(e),this.$__.activePaths.modify(e),t!=null&&!this.$isSubdocument)this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[e]=t};/*!
288
+ * ignore
289
+ */j.prototype.$__saveInitialState=function(t){let r=this.$__.savedState,n=t;if(r!=null){let s=n.indexOf("."),i=s===-1?n:n.slice(0,s);if(!Object.hasOwn(r,i))r[i]=So(this.$__getValue(i))}};j.prototype.unmarkModified=function(e){if(this.$__.activePaths.init(e),this.$__.pathsToScopes!=null)delete this.$__.pathsToScopes[e]};j.prototype.$ignore=function(e){this.$__.activePaths.ignore(e)};j.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.getStatePaths("modify"))};j.prototype.$isEmpty=function(e){let t={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(arguments.length!==0){let r=this.$get(e);if(r==null)return!0;if(typeof r!=="object")return!1;if(z.isPOJO(r))return Sk(r);return Object.keys(r.toObject(t)).length===0}return Object.keys(this.toObject(t)).length===0};/*!
290
+ * ignore
291
+ */function Sk(e){if(e==null)return!0;if(typeof e!=="object"||Array.isArray(e))return!1;for(let t of Object.keys(e))if(!Sk(e[t]))return!1;return!0}j.prototype.modifiedPaths=function(e){e=e||{};let t=Object.keys(this.$__.activePaths.getStatePaths("modify")),r=new Set,n=0,s=0,i=t.length;for(n=0;n<i;++n){let o=t[n],u=W4(o),a=u.length;for(s=0;s<a;++s)r.add(u[s]);if(!e.includeChildren)continue;let c=0,l=this.$get(o);if(typeof l==="object"&&l!==null){if(l._doc)l=l._doc;let f=l.length;if(Array.isArray(l))for(c=0;c<f;++c){let h=o+"."+c;if(!r.has(h)){if(r.add(h),ts(l[c])){let d=l[c].modifiedPaths(),p=0,m=d.length;for(p=0;p<m;++p)r.add(h+"."+d[p])}}}else{let h=Object.keys(l),d=0,p=h.length;for(d=0;d<p;++d)r.add(o+"."+h[d])}}}return Array.from(r)};j.prototype[Ek]=j.prototype.modifiedPaths;j.prototype.isModified=function(e,t,r){if(e){let n=t?.ignoreAtomics,s=this.$__.activePaths.states.modify;if(s==null)return!1;if(typeof e==="string")e=e.indexOf(" ")===-1?[e]:e.split(" ");for(let a of e)if(s[a]!=null)return!0;let i=r||this[Ek](),o=e.some(function(a){return!!~i.indexOf(a)}),u=Object.keys(s);if(n)u=u.filter((a)=>{let c=this.$__getValue(a);if(c?.[As]!=null&&c[As].$set===void 0)return!1;return!0});return o||e.some(function(a){return u.some(function(c){return c===a||a.startsWith(c+".")})})}return this.$__.activePaths.some("modify")};j.prototype.$isModified=j.prototype.isModified;j.prototype[noe]=j.prototype.isModified;j.prototype.$isDefault=function(e){if(e==null)return this.$__.activePaths.some("default");if(typeof e==="string"&&e.indexOf(" ")===-1)return Object.hasOwn(this.$__.activePaths.getStatePaths("default"),e);let t=e;if(!Array.isArray(t))t=t.split(" ");return t.some((r)=>Object.hasOwn(this.$__.activePaths.getStatePaths("default"),r))};j.prototype.$isDeleted=function(e){if(arguments.length===0)return!!this.$__.isDeleted;return this.$__.isDeleted=!!e,this};j.prototype.isDirectModified=function(e){if(e==null)return this.$__.activePaths.some("modify");if(typeof e==="string"&&e.indexOf(" ")===-1){let r=Object.hasOwn(this.$__.activePaths.getStatePaths("modify"),e);if(r||e.indexOf(".")===-1)return r;let n=e.split(".");for(let s=0;s<n.length-1;++s){let i=n.slice(0,s+1).join("."),o=this.$get(i);if(ts(o)&&o.isDirectModified(n.slice(s+1).join(".")))return!0}return!1}let t=e;if(typeof t==="string")t=t.split(" ");return t.some((r)=>this.isDirectModified(r))};j.prototype.isInit=function(e){if(e==null)return this.$__.activePaths.some("init");if(typeof e==="string"&&e.indexOf(" ")===-1)return Object.hasOwn(this.$__.activePaths.getStatePaths("init"),e);let t=e;if(!Array.isArray(t))t=t.split(" ");return t.some((r)=>Object.hasOwn(this.$__.activePaths.getStatePaths("init"),r))};j.prototype.isSelected=function(t){if(this.$__.selected==null)return!0;if(!t)return!1;if(t==="_id")return this.$__.selected._id!==0;if(t.indexOf(" ")!==-1)t=t.split(" ");if(Array.isArray(t))return t.some((o)=>this.$__isSelected(o));let r=wk(this),{paths:n,inclusive:s}=r;if(r.onlyId)return this.$__.selected._id===0;if(s===null)return!0;if(t in this.$__.selected)return s;let i=t.indexOf(".")!==-1;if(!r.hasNestedKey){if(i)for(let o=t.indexOf(".");o!==-1;o=t.indexOf(".",o+1)){let u=t.slice(0,o);if(u!=="_id"&&Object.hasOwn(this.$__.selected,u))return s}return!s}for(let o of n){if(o==="_id")continue;if(o.charAt(t.length)==="."&&o.slice(0,t.length)===t)return s||o!==t+".";if(i&&t.charAt(o.length)==="."&&t.slice(0,o.length)===o)return s}return!s};/*!
292
+ * Computes and caches the derived properties of `doc.$__.selected` that
293
+ * `isSelected()` and `isDirectSelected()` would otherwise recompute on every
294
+ * call. `$__.selected` is assigned once in the Document constructor and never
295
+ * mutated afterwards, so this can safely be cached for the document's lifetime.
296
+ */function wk(e){if(e.$__.selectedIndex!==void 0)return e.$__.selectedIndex;let t=e.$__.selected,r=Object.keys(t),n=null,s=!1;for(let i of r){if(i==="_id")continue;if(i.indexOf(".")!==-1)s=!0;if(n===null&&Jie(t[i]))n=!!t[i]}return e.$__.selectedIndex={paths:r,inclusive:n,hasNestedKey:s,onlyId:r.length===1&&r[0]==="_id"}}j.prototype.$__isSelected=j.prototype.isSelected;j.prototype.isDirectSelected=function(t){if(this.$__.selected==null)return!0;if(t==="_id")return this.$__.selected._id!==0;if(t.indexOf(" ")!==-1)t=t.split(" ");if(Array.isArray(t))return t.some((n)=>this.isDirectSelected(n));let r=wk(this);if(r.onlyId)return this.$__.selected._id===0;if(r.inclusive===null)return!0;if(Object.hasOwn(this.$__.selected,t))return r.inclusive;return!r.inclusive};j.prototype.validate=async function(t,r){if(typeof t==="function"||typeof r==="function"||typeof arguments[2]==="function")throw new Nr("Document.prototype.validate() no longer accepts a callback");if(this.$op="validate",arguments.length===1){if(typeof arguments[0]==="object"&&!Array.isArray(arguments[0]))r=arguments[0],t=null}if(r&&typeof r.pathsToSkip==="string"){let i=r.pathsToSkip.indexOf(" ")===-1;r.pathsToSkip=i?[r.pathsToSkip]:r.pathsToSkip.split(" ")}let n=r?._skipParallelValidateCheck;if(this.$isSubdocument!=null);else if(this.$__.validating&&!n)throw new Uie(this);else if(!n)this.$__.validating=!0;let s=this.$__middleware.hasHooks("validate");try{try{if(s)[r]=await this._execDocumentPreHooks("validate",r,[r]);else if(!n)await Promise.resolve()}catch(y){if(s)await this._execDocumentPostHooks("validate",r,y);return}if(this.$__.saveOptions&&this.$__.saveOptions.pathsToSave&&!t)t=[...this.$__.saveOptions.pathsToSave];let i=r&&typeof r==="object"&&"validateModifiedOnly"in r,o=r?.pathsToSkip||null,u;if(i)u=!!r.validateModifiedOnly;else u=this.$__schema.options.validateModifiedOnly;this.$__.validateModifiedOnly=u;let a=r?.validateAllPaths;if(a){if(o)throw TypeError("Cannot set both `validateAllPaths` and `pathsToSkip`");if(t)throw TypeError("Cannot set both `validateAllPaths` and `pathsToValidate`");if(i&&u)throw TypeError("Cannot set both `validateAllPaths` and `validateModifiedOnly`")}let c=this,l,f;if(a)[l,f]=Ck(this);else{let y=bk(this,t,o);l=u?y[0].filter((E)=>this.$isModified(E)):y[0],f=y[1]}if(typeof t==="string")t=t.split(" ");if(l.length===0){let y=ik(this);if(s)await this._execDocumentPostHooks("validate",r,y);else if(y!=null)throw y;return}let h={},d=Array.isArray(this.$__.saveOptions?.pathsToSave)?new Set(this.$__.saveOptions.pathsToSave):null,p=[];for(let y=0;y<l.length;++y){let E=l[y];if(d!=null&&!d.has(E)){p.push(Promise.resolve(null));continue}if(E==null||h[E]){p.push(Promise.resolve(null));continue}h[E]=!0;let C=c.$__schema.path(E);if(!C){p.push(Promise.resolve(null));continue}if(!c.$isValid(E)){p.push(Promise.resolve(null));continue}if(C[Ak]!=null&&E!==C.path){p.push(Promise.resolve(null));continue}let D=c.$__getValue(E),A;if(A=c.$populated(E))D=A;else if(ts(D)&&D.$__.wasPopulated)D=D._doc._id;let P=c.$__.pathsToScopes!=null&&E in c.$__.pathsToScopes?c.$__.pathsToScopes[E]:c,S={...f[E],path:E,validateAllPaths:a,_nestedValidate:!0};if(u)S.validateModifiedOnly=!0;p.push(C.doValidate(D,P,S).then(()=>null,(B)=>{if((C.$isSingleNested||C.$isArraySubdocument||C.$isMongooseDocumentArray)&&B instanceof ld)return null;return B}))}let m=await Promise.all(p);for(let y=0;y<m.length;++y){let E=m[y];if(E==null)continue;if(this.$__.validationError==null)this.$__.validationError=new ld(this);c.invalidate(l[y],E,void 0,!0)}let _=ik(this);if(s)await this._execDocumentPostHooks("validate",r,_);else if(_!=null)throw _}finally{this.$__.validateModifiedOnly=void 0,this.$op=null,this.$__.validating=null}};j.prototype.$validate=j.prototype.validate;/*!
297
+ * Event emitting and error persisting logic that needs to happen in both the `paths.length === 0`
298
+ * and `paths.length > 0` cases in `Document.prototype.validate()`.
299
+ *
300
+ * @param {Document} doc
301
+ * @return {Error}
302
+ * @private
303
+ */function ik(e){let t=e.$__.validationError;if(e.$__.validationError=null,e.$__.validating=null,e.$__.validateModifiedOnly&&t!=null){let r=Object.keys(t.errors);for(let n of r)if(!e.$isModified(n))delete t.errors[n];if(z.hasOwnKeys(t.errors)===!1)t=void 0}if(e.$__.cachedRequired=null,e.$emit("validate",e),e.constructor.emit("validate",e),t){for(let r in t.errors)if(!e[roe]&&t.errors[r]instanceof Nr.CastError)e.invalidate(r,t.errors[r])}return t}/*!
304
+ * Build the list for `validateAllPaths`. The document array path validates
305
+ * every subdocument, but skips nullish elements. Add those elements separately
306
+ * so their element-level validators still run.
307
+ */function Ck(e){let t=Object.keys(e.$__schema.paths).filter((n)=>n.charAt(n.length-1)!=="*"||n.charAt(n.length-2)!=="$"||n.charAt(n.length-3)!=="."),r={};for(let n=0;n<t.length;++n){let s=t[n],i=e.$__schema.path(s);if(i==null)continue;let o=e.$__getValue(s);if(!o)continue;if(i.$isSchemaMap)for(let u of o.keys())t.push(s+"."+u);else if(i.$isMongooseDocumentArray){if(i.embeddedSchemaType?.validators.length)for(let u=0;u<o.length;++u){let a=s+"."+u;t.push(a),r[a]={skipSubdocumentValidation:!0,index:u}}}else if(i.$isMongooseArray)K4(o,t,s)}return[t,r]}/*!
308
+ * ignore
309
+ */var ok=Object.freeze(["init","default","modify"]),uk=42;/*!
310
+ * Builds the list of paths to run validation on, plus per-path options for
311
+ * `doValidate()`.
312
+ *
313
+ * `activePaths` tells us which paths changed (`require`, `init`, `default`,
314
+ * `modify`), but that is neither a complete nor a minimal list of paths to
315
+ * validate, in four separate ways. Each phase below fixes exactly one:
316
+ *
317
+ * 1. Seed Collect the changed paths, dropping ones that have nothing to
318
+ * run and ones a subdocument already validates for us.
319
+ * 2. Resolve Some entries are not schema paths at all: a modified nested
320
+ * object is stored as one entry (`nest`), but the paths that
321
+ * have validators are its children (`nest.name`).
322
+ * 3. Cover Replace changed descendants with their actual subdocument or
323
+ * document array, which owns validation below that path.
324
+ * 4. Augment Primitive arrays, required document array elements, and maps
325
+ * need concrete element or key paths listed individually.
326
+ *
327
+ * Validating a subdocument or document array validates everything underneath
328
+ * it, so `arr` makes `arr.0.name` redundant. Phase 3 uses the actual
329
+ * subdocuments and their modified paths to remove descendants seeded earlier.
330
+ * It runs for nested documents as well, so every document selects containers
331
+ * from its own schema without relying on `$parentSchemaDocArray`.
332
+ *
333
+ * If a document array element is modified, for example `arr.0.name`,
334
+ * array-level validators on `arr` still run. This behavior dates back to gh-6818.
335
+ *
336
+ * `pathsToValidate` / `pathsToSkip` are applied before augment, so that asking
337
+ * for `arr` still validates its elements. Duplicates are fine; both callers
338
+ * skip paths they have already validated.
339
+ */function bk(e,t,r){let n=e.$__schema,{paths:s,singleNestedPaths:i}=n,o=e.$__.activePaths.states,u={},a={},c=new Set,l=o.require;if(l!=null){let p=null;for(let m in l){let _=Object.hasOwn(s,m),y=_?s[m]:n.path(m);if(typeof y?.originalRequiredValue==="function"){let C=e.$__.cachedRequired??(e.$__.cachedRequired={});try{C[m]=y.originalRequiredValue.call(e,e)}catch(D){e.invalidate(m,D)}}if(!e.$__isSelected(m)){if(p??=e.modifiedPaths(),!e.$isModified(m,null,p))continue}if(m.charCodeAt(m.length-1)===uk&&m.endsWith(".$*"))continue;let E=e.$__.cachedRequired;if(E!=null&&m in E&&!E[m])continue;if(!_&&y!=null&&Object.hasOwn(i,m))continue;if(c.add(m),y!=null&&y.schema!=null)a[m]=!0}}for(let p=0;p<ok.length;++p){let m=o[ok[p]];if(m==null)continue;for(let _ in m){if(_.charCodeAt(_.length-1)===uk&&_.endsWith(".$*"))continue;let y=Object.hasOwn(s,_),E=y?s[_]:n.path(_);if(E!=null&&(doe(E)||!y&&Object.hasOwn(i,_)))continue;if(E?.[Ak]!=null&&_!==E.path)continue;if(c.add(_),E!=null&&E.schema!=null)a[_]=!0}}if(c.size===0&&e.$__hasOnlyPrimitiveValues())return[[],u];for(let p of c){if(!pk(n.nested,p))continue;c.delete(p);let m=e.$__getValue(p);if(m==null||Array.isArray(m))continue;for(let _ of Object.keys(m)){let y=p+"."+_;if(c.add(y),Object.hasOwn(s,y)&&s[y].schema!=null)a[y]=!0}}let f=null,h=[],d=[];for(let p of Object.keys(s)){let m=s[p];if(m.$isSingleNested||m.$isMongooseDocumentArray){h.push([p,m]);continue}if(!m.$isSchemaMap||!m.$__schemaType.$isMongooseDocumentArray)continue;f??=e.modifiedPaths();let _=e.$get(p);if(_==null)continue;for(let y of _.keys()){let E=p+"."+y;if(f.includes(E))d.push([E,m.$__schemaType])}}for(let[p,m]of h.concat(d)){f??=e.modifiedPaths();let _;if(m.$isSingleNested){let E=e.$get(p);if(E==null)continue;_=[E]}else if(m.$isMongooseDocumentArray){if(_=e.$get(p),!_?.length)continue;if(f.includes(p)&&(m.validators.length>0||a[p]===!0)){if(a[p]!==!0&&!Object.hasOwn(o.modify,p))u[p]={skipSchemaValidators:!0};c.add(p),a[p]=!0}}else continue;let y=m.$isMongooseDocumentArray&&a[p]===!0;for(let E of _){if(E==null||!E.$basePath)continue;let C=m.$isMongooseDocumentArray?p+"."+E.__index:E.$__pathRelativeToParent(),D=E.$parent();if(D==null)throw Error("Cannot validate subdocument that does not have a parent");if(y){c.delete(C);for(let A of E.modifiedPaths({includeChildren:!0}))c.delete(C+"."+A);if(p!==m.path&&Object.hasOwn(o.modify,C))u[C]={skipSchemaValidators:!1}}if(!e.$isModified(C,null,f)||Object.hasOwn(D.$__.activePaths.getStatePaths("modify"),C)||D.$isDefault(C))continue;if(!y)for(let A of E.modifiedPaths())c.delete(C+"."+A);if(!y&&a[p]!==!0)c.add(C);if(a[C]=!0,e.$__.pathsToScopes??={},e.$__.pathsToScopes[C]=E.$isDocumentArrayElement?E.__parentArray:E.$parent(),u[C]??=E.$isDocumentArrayElement?{}:{skipSchemaValidators:!0},E.$isDocumentArrayElement&&E.__index!=null)u[C].index=E.__index}}if(Array.isArray(t))c=moe(c,t);else if(Array.isArray(r))c=yoe(c,r);poe(e,c,u);for(let p of c){let m=n.path(p);if(!m||!m.$isSchemaMap)continue;let _=e.$__getValue(p);if(_==null)continue;for(let y of _.keys())c.add(p+"."+y)}return[Array.from(c),u]}/*!
340
+ * Optimization: skip paths that cannot produce a validation error, either a
341
+ * primitive with no validators or an array of primitives with no validators on
342
+ * the array or its elements.
343
+ */function doe(e){if(!e.schema&&!e.embeddedSchemaType&&e.validators.length===0&&!e.$isSchemaMap&&!e.$isSchemaUnion)return!0;return!!e.$isMongooseArray&&!e.$isMongooseDocumentArray&&!e.embeddedSchemaType.$isMongooseArray&&e.validators.length===0&&e.embeddedSchemaType.validators.length===0}function poe(e,t,r){for(let n of t){let s=e.$__schema.path(n);if(!s)continue;if(!s.$isMongooseArray||!Array.isArray(s)&&s.$isMongooseDocumentArray&&!s.embeddedSchemaType?.validators.length)continue;if(s.$isMongooseArray&&!s.$isMongooseDocumentArray&&!s.embeddedSchemaType.$isMongooseArray&&s.embeddedSchemaType.validators.length===0)continue;let i=e.$__getValue(n);if(s.$isMongooseDocumentArray){let o=i?.length??0;for(let u=0;u<o;++u){let a=n+"."+u;t.add(a),r[a]={...r[n],...r[a],skipSubdocumentValidation:!0,index:u}}continue}K4(i,t,n)}}function K4(e,t,r){if(e!=null){let n=e.length;for(let s=0;s<n;++s)if(Array.isArray(e[s]))K4(e[s],t,r+"."+s);else if(Array.isArray(t))t.push(r+"."+s);else t.add(r+"."+s)}}/*!
344
+ * ignore
345
+ */j.prototype._execDocumentPreHooks=function(t,r,n){let s=_k(r,"pre");return this.$__middleware.execPre(t,this,n||[],{filter:s})};/*!
346
+ * ignore
347
+ */j.prototype._execDocumentPostHooks=function(t,r,n){let s=_k(r,"post");return this.$__middleware.execPost(t,this,[this],{error:n,filter:s})};/*!
348
+ * ignore
349
+ */function moe(e,t){let r=new Set(t),n=new Map([]);for(let i of t){if(i.indexOf(".")===-1)continue;let o=i.split("."),u=o[0];for(let a=1;a<o.length;++a)n.set(u,i),u=u+"."+o[a]}let s=new Set;for(let i of e){let o=!1,u=i.length;while((u=i.lastIndexOf(".",u-1))!==-1)if(r.has(i.slice(0,u))){o=!0;break}if(r.has(i)||o)s.add(i);else if(n.has(i))s.add(n.get(i))}return s}/*!
350
+ * ignore
351
+ */function yoe(e,t){t=new Set(t);for(let r of e)if(t.has(r))e.delete(r);return e}j.prototype.validateSync=function(){return z.warn("Mongoose: `Document.prototype.validateSync()` is deprecated and will be removed in Mongoose 10. Use `Document.prototype.validate()` instead."),this.$__validateSync.apply(this,arguments)};/*!
352
+ * ignore
353
+ */j.prototype.$__validateSync=function(e,t){let r=this;if(arguments.length===1&&typeof arguments[0]==="object"&&!Array.isArray(arguments[0]))t=arguments[0],e=null;let n=t&&typeof t==="object"&&"validateModifiedOnly"in t,s;if(n)s=!!t.validateModifiedOnly;else s=this.$__schema.options.validateModifiedOnly;let i=t?.pathsToSkip,o=t?.validateAllPaths;if(o){if(i)throw TypeError("Cannot set both `validateAllPaths` and `pathsToSkip`");if(e)throw TypeError("Cannot set both `validateAllPaths` and `pathsToValidate`")}if(typeof e==="string")e=e.indexOf(" ")===-1?[e]:e.split(" ");else if(typeof i==="string"&&i.indexOf(" ")!==-1)i=i.split(" ");let u,a;if(o)[u,a]=Ck(this);else{let f=bk(this,e,i);u=s?f[0].filter((h)=>this.$isModified(h)):f[0],a=f[1]}let c={};for(let f=0,h=u.length;f<h;++f){let d=u[f];if(c[d])continue;c[d]=!0;let p=r.$__schema.path(d);if(!p)continue;if(!r.$isValid(d))continue;let m=r.$__getValue(d),_=a[d],y=p.doValidateSync(m,r,{..._!=null&&typeof _==="object"?_:null,skipSchemaValidators:typeof _==="object"?_.skipSchemaValidators:_,path:d,validateModifiedOnly:s,validateAllPaths:o,_nestedValidate:!0});if(y){if((p.$isSingleNested||p.$isArraySubdocument||p.$isMongooseDocumentArray)&&y instanceof ld)continue;r.invalidate(d,y,void 0,!0)}}let l=r.$__.validationError;if(r.$__.validationError=void 0,r.$emit("validate",r),r.constructor.emit("validate",r),l){for(let f in l.errors)if(l.errors[f]instanceof Nr.CastError)r.invalidate(f,l.errors[f])}return l};j.prototype.invalidate=function(e,t,r,n){if(!this.$__.validationError)this.$__.validationError=new ld(this);if(this.$__.validationError.errors[e])return;if(!t||typeof t==="string")t=new fk({path:e,message:t,type:n||"user defined",value:r});if(this.$__.validationError===t)return this.$__.validationError;if(typeof t.setModel==="function"){let s=this.ownerDocument();if(Kie(s)==="model")t.setModel(s.constructor)}return this.$__.validationError.addError(e,t),this.$__.validationError};j.prototype.$markValid=function(e){if(!this.$__.validationError?.errors[e])return;if(delete this.$__.validationError.errors[e],z.hasOwnKeys(this.$__.validationError.errors)===!1)this.$__.validationError=null};/*!
354
+ * ignore
355
+ */function goe(e,t){if(!e.$__.validationError)return;let r=Object.keys(e.$__.validationError.errors);for(let n of r)if(n.startsWith(t+"."))delete e.$__.validationError.errors[n];if(z.hasOwnKeys(e.$__.validationError.errors)===!1)e.$__.validationError=null}/*!
356
+ * ignore
357
+ */function _oe(e,t,r){let n=t.schema;if(n==null)return;for(let s of Object.keys(n.paths)){let i=n.paths[s];if(i.$immutableSetter==null)continue;let o=r==null?void 0:r.$__getValue(s);i.$immutableSetter.call(e,o)}}j.prototype.$isValid=function(e){if(this.$__.validationError==null||z.hasOwnKeys(this.$__.validationError.errors)===!1)return!0;if(e==null)return!1;if(e.indexOf(" ")!==-1)e=e.split(" ");if(Array.isArray(e))return e.some((t)=>this.$__.validationError.errors[t]==null);return this.$__.validationError.errors[e]==null};j.prototype.$__reset=function(t,r){r=r??this.$__hasOnlyPrimitiveValues();let n=!this.$isSubdocument&&!r?this.$getAllSubdocs({useCache:!0}):null;if(n?.length>0)for(let s of n)s.$__reset(t);if(!r)this.$__resetAtomics();if(!t)this.$__.backup={},this.$__.backup.activePaths={modify:this.$__.activePaths.getStatePaths("modify"),default:this.$__.activePaths.getStatePaths("default")},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors;if(this.$__.activePaths.clearAllExcept("init"),this.$__.validationError)this.$__.validationError=void 0;if(this.$errors)this.$errors=void 0;for(let s of this.$__schema.requiredPaths())this.$__.activePaths.require(s);return this};/*!
358
+ * Clear atomics on all dirty (modified + default) paths. This is a lighter
359
+ * alternative to calling `$__dirty()` when we only need to clear atomics
360
+ * and don't need the full {path, value, schema} objects or parent-path
361
+ * deduplication.
362
+ */j.prototype.$__resetAtomics=function(){let t=this.$__.activePaths,r=t.getStatePaths("modify"),n=t.getStatePaths("default");ak(this,r),ak(this,n)};function ak(e,t){if(t==null)return;let r=e.$__schema.paths,n=Object.keys(t);for(let s=0;s<n.length;++s){let i=Object.hasOwn(r,n[s])?r[n[s]]:null;if(i!=null&&!i.$isMongooseArray&&!i.$isSchemaMap&&!i.$isSchemaUnion&&i.instance!=="Mixed")continue;let o=e.$__getValue(n[s]);if(o!=null){if(typeof o.clearAtomics==="function")o.clearAtomics();else if(o[As])o[hd]=o[As],o[As]={}}}}/*!
363
+ * ignore
364
+ */j.prototype.$__undoReset=function(){if(this.$__.backup?.activePaths==null)return;this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;for(let t of this.$__dirty()){let r=t.value;if(r?.[As]&&r[hd])r[As]=r[hd]}if(!this.$isSubdocument)for(let t of this.$getAllSubdocs())t.$__undoReset()};j.prototype.$__dirty=function(){let e=this,t=this.$__.activePaths.map("modify",function(s){return{path:s,value:e.$__getValue(s),schema:e.$__path(s)}});t=t.concat(this.$__.activePaths.map("default",function(s){if(s==="_id"||e.$__getValue(s)==null)return;return{path:s,value:e.$__getValue(s),schema:e.$__path(s)}}));let r=new Map(t.filter((s)=>s!=null).map((s)=>[s.path,s.value])),n=[];return t.forEach(function(s){if(!s)return;let i=null,o=!1,u=W4(s.path);for(let a=0;a<u.length-1;a++)if(r.has(u[a])){i=r.get(u[a]),o=!0;break}if(!o)n.push(s);else if(i!=null&&i[As]!=null&&i.hasAtomics())i[As]={},i[As].$set=i}),n};j.prototype.$__setSchema=function(e){zie(e.tree,this,void 0,e.options);for(let t of Object.keys(e.virtuals))e.virtuals[t]._applyDefaultGetters();if(e.path("schema")==null)this.schema=e;this.$__schema=e,this.$__middleware=e._getDocumentMiddleware(this.$isSubdocument),this[soe]=e};j.prototype.$__getArrayPathsToValidate=function(){return ag||(ag=Hc()),this.$__.activePaths.map("init","modify",function(e){return this.$__getValue(e)}.bind(this)).filter(function(e){return e&&Array.isArray(e)&&z.isMongooseDocumentArray(e)&&e.length}).reduce(function(e,t){return e.concat(t)},[]).filter(function(e){return e})};j.prototype.$getAllSubdocs=function(e){if(e?.useCache&&this.$__.saveOptions?.__subdocs)return this.$__.saveOptions.__subdocs;ag||(ag=Hc()),cd=cd||ph();let t=[];function r(n){let s=[];for(let{model:i}of n.$__schema.childSchemas){let o=n.$__getValue(i.path);if(o==null)continue;if(ts(o))s.push(o);if(Array.isArray(o)){for(let u of o)if(ts(u))s.push(u)}if(o instanceof Map){for(let u of o.values())if(ts(u))s.push(u)}}for(let i of s)r(i);t.push(...s)}if(r(this),this.$__.saveOptions)this.$__.saveOptions.__subdocs=t;return t};/*!
365
+ * Runs queued functions
366
+ */function Eoe(e){let t=e.$__schema&&e.$__schema.callQueue;if(!t.length)return;for(let r of t)if(r[0]!=="pre"&&r[0]!=="post"&&r[0]!=="on")e[r[0]].apply(e,r[1])}/*!
367
+ * ignore
368
+ */j.prototype.$__handleReject=function(t){if(this.$listeners("error").length)this.$emit("error",t);else if(this.constructor.listeners?.("error").length)this.constructor.emit("error",t)};j.prototype.$toObject=function(e,t){let r=this.$__schema._defaultToObjectOptions(t),n=this.$__hasOnlyPrimitiveValues();e=z.isPOJO(e)?{...e}:{},e._calledWithOptions=e._calledWithOptions||{...e};let s;if(e._calledWithOptions.minimize!=null)s=e.minimize;else if(this.$__schemaTypeOptions?.minimize!=null)s=this.$__schemaTypeOptions.minimize;else if(r?.minimize!=null)s=r.minimize;else s=this.$__schema.options.minimize;if(e.minimize=s,!n)e._seen=e._seen||new Map;if((e._calledWithOptions.depopulate??r?.depopulate??e.depopulate??!1)&&e._isNested&&this.$__.wasPopulated)return So(this.$__.wasPopulated.value||this._doc._id,e);if(r!=null){for(let d of Object.keys(r))if(e[d]==null)e[d]=r[d]}e._isNested=!0,e.json=t;let o=e._parentOptions;e._parentOptions=this.$isSubdocument?e:null;let u=e._calledWithOptions.schemaFieldsOnly??e.schemaFieldsOnly??r?.schemaFieldsOnly??!1,a;if(n&&!e.flattenObjectIds&&!e.flattenDecimals)a=this.$__toObjectShallow(u);else if(u){a={};for(let d of Object.keys(this.$__schema.paths)){let p=this.$__getValue(d);if(p===void 0)continue;let m=d,_=a;if(d.indexOf(".")!==-1){let y=d.split(".");m=y[y.length-1];for(let E=0;E<y.length-1;++E)_[y[E]]=_[y[E]]??{},_=_[y[E]]}if(p===null){_[m]=null;continue}_[m]=So(p,e)}}else a=So(this._doc,e)||{};let c=e._calledWithOptions.getters??e.getters??r?.getters??!1;if(c){if(Aoe(this,a),e.minimize)a=Zie(a)||{}}let l=e._calledWithOptions.virtuals??r?.virtuals??o?.virtuals??void 0;if(l||c&&l!==!1)G4(this,a,e,e);if(e.versionKey===!1&&this.$__schema.options.versionKey)delete a[this.$__schema.options.versionKey];let f=e._calledWithOptions.transform??!0,h=void 0;if(f===!0)h=r?.transform;else if(typeof f==="function")h=f;if(f)Ooe(this,a);if(e.useProjection)Soe(this,a);if(typeof h==="function"){let d=h(this,a,e);if(typeof d<"u")a=d}return a};/*!
369
+ * Internal shallow clone alternative to `$toObject()`: much faster, no options processing
370
+ */j.prototype.$__toObjectShallow=function(t){let r={};if(this._doc!=null){let n=t?Object.keys(this.$__schema.paths):Object.keys(this._doc);for(let s of n){let i=this._doc[s];if(i instanceof Date)r[s]=new Date(i);else if(i!==void 0)r[s]=i}}return r};j.prototype.toObject=function(e){return this.$toObject(e)};/*!
371
+ * Applies virtuals properties to `json`.
372
+ */function G4(e,t,r,n){let s=e.$__schema,i=s.virtuals,o=Object.keys(i),u=o.length,a=u,c,l,f=e._doc,h,d=typeof n?.aliases==="boolean"?n.aliases:!0;r=r||{};let p=null;if(Array.isArray(r.virtuals))p=new Set(r.virtuals);else if(r.virtuals?.pathsToSkip){p=new Set(o);for(let m=0;m<r.virtuals.pathsToSkip.length;m++)if(p.has(r.virtuals.pathsToSkip[m]))p.delete(r.virtuals.pathsToSkip[m])}if(!f)return t;for(u=0;u<a;++u){if(c=o[u],p!=null&&!p.has(c))continue;if(!d&&Object.hasOwn(s.aliases,c))continue;if(l=c,r.path!=null){if(!c.startsWith(r.path+"."))continue;l=c.substring(r.path.length+1)}if(l.indexOf(".")===-1&&l===c){if(h=i[c].applyGetters(void 0,e),h===void 0)continue;h=So(h,r),t[l]=h;continue}let m=l.split(".");if(h=So(e.get(c),r),h===void 0)continue;let _=m.length;f=t;for(let y=0;y<_-1;++y)f[m[y]]=f[m[y]]||{},f=f[m[y]];f[m[_-1]]=h}return t}function Aoe(e,t){let r=e.$__schema,n=Object.keys(r.paths),s=n.length,i,o=e._doc,u;if(!o)return t;while(s--){i=n[s];let a=r.paths[i];if(!a.getters?.length&&!a.embeddedSchemaType?.getters?.length)continue;if(!e.$__isSelected(i))continue;if(i.indexOf(".")===-1){if(t[i]=a.applyGetters(t[i],e),Array.isArray(t[i])&&a.embeddedSchemaType)for(let p=0;p<t[i].length;++p)t[i][p]=a.embeddedSchemaType.applyGetters(t[i][p],e);continue}let c=i.split("."),l=c.length,f=l-1,h=t,d;o=e._doc;for(let p=0;p<l;++p){if(d=c[p],u=o[d],h!=null&&typeof h!=="object")break;else if(p===f){if(h[d]=a.applyGetters(h[d],e),Array.isArray(h[d])&&a.embeddedSchemaType)for(let m=0;m<h[d].length;++m)h[d][m]=a.embeddedSchemaType.applyGetters(h[d][m],e)}else if(u==null){if(d in o)h[d]=u;break}else h=h[d]||(h[d]={});o=u}}return t}function Ooe(e,t){let r=e.$__schema,n=r.pathsWithTransforms();if(!e._doc||!n)return t;for(let i of n){let o=r.paths[i],u=o.options.transform??o.constructor?.defaultOptions?.transform,a=o.embeddedSchemaType?.options?.transform??o.embeddedSchemaType?.constructor?.defaultOptions?.transform;if(typeof u==="function"){let c=e.$get(i);if(c===void 0)continue;let l=u.call(e,c);ck(i,l),z.setValue(i,l,t)}else if(typeof a==="function"){let c=e.$get(i);if(c===void 0)continue;let l=[].concat(c);for(let f=0;f<l.length;++f){let h=a.call(e,l[f]);l[f]=h,ck(i,h)}t[i]=l}}return t}function ck(e,t){if(eoe(t))throw Error("`transform` function must be synchronous, but the transform on path `"+e+"` returned a promise.")}/*!
373
+ * ignore
374
+ */function Soe(e,t){let r=e.$__schema,n=Object.keys(r.paths||{});if(!e._doc)return t;let i=e.$__.selected;if(i===void 0)i={},gk.applyPaths(i,r);if(i==null||z.hasOwnKeys(i)===!1)return t;for(let o of n)if(i[o]!=null&&!i[o])delete t[o];return t}j.prototype.toJSON=function(e){return this.$toObject(e,!0)};/*!
375
+ * ignore
376
+ */j.prototype.ownerDocument=function(){return this};j.prototype.parent=function(){if(this.$isSubdocument||this.$__.wasPopulated)return this.$__.parent;return this};j.prototype.$parent=j.prototype.parent;j.prototype.$__setParent=function(t){this.$__.parent=t,this.$__parent=t};j.prototype.inspect=function(e){let t=z.isPOJO(e),r;if(t)r=e,r.minimize=!1;let n=arguments.length>0?this.toObject(r):this.toObject();if(n==null)return"MongooseDocument { "+n+" }";return n};if(ug.custom)j.prototype[ug.custom]=j.prototype.inspect;j.prototype.toString=function(){let e=this.inspect();if(typeof e==="string")return e;return ug(e)};j.prototype.equals=function(e){if(!e)return!1;let t=this.$__getValue("_id"),r=ts(e)?e.$__getValue("_id"):e;if(!t&&!r)return og(this,e);return t&&t.equals?t.equals(r):t===r};j.prototype.populate=async function(){let t={},r=[...arguments];if(typeof r[r.length-1]==="function")throw new Nr("Document.prototype.populate() no longer accepts a callback");if(r.length!==0){let i=z.populate.apply(null,r);for(let o of i)t[o.path]=o}let n=z.object.vals(t),s=this.constructor;if(this.$__isNested){s=this.$__[ooe].constructor;let i=this.$__.nestedPath;n.forEach(function(o){o.path=i+"."+o.path})}if(this.$session()!=null){let i=this.$session();n.forEach((o)=>{if(o.options==null){o.options={session:i};return}if(!("session"in o.options))o.options.session=i})}return n.forEach((i)=>{i._localModel=s}),s.populate(this,n)};j.prototype.$getPopulatedDocs=function(){let t=[];if(this.$__.populated!=null)t=t.concat(Object.keys(this.$__.populated));let r=[];for(let n of t){let s=this.$get(n);if(Array.isArray(s))r=r.concat(s);else if(s instanceof j)r.push(s)}return r};j.prototype.populated=function(e,t,r){if(t==null||t===!0){if(!this.$__.populated)return;if(typeof e!=="string")return;let s=e.endsWith(".$*")?e.replace(/\.\$\*$/,""):e,i=this.$__.populated[s];if(i)return t===!0?i:i.value;return}this.$__.populated||(this.$__.populated={}),this.$__.populated[e]={value:t,options:r};let n=e.split(".");for(let s=0;s<n.length-1;++s){let i=n.slice(0,s+1).join("."),o=this.$get(i);if(ts(o)&&this.$populated(i)){let u=n.slice(s+1).join(".");o.$populated(u,t,r);break}}return t};j.prototype.$populated=j.prototype.populated;j.prototype.$assertPopulated=function(t,r){if(Array.isArray(t))return t.forEach((n)=>this.$assertPopulated(n,r)),this;if(arguments.length>1)this.$set(r);if(!this.$populated(t))throw new Nr(`Expected path "${t}" to be populated`);return this};j.prototype.depopulate=function(e){if(typeof e==="string")e=e.indexOf(" ")===-1?[e]:e.split(" ");let t,r=this.$$populatedVirtuals?Object.keys(this.$$populatedVirtuals):[],n=this.$__?.populated||{};if(arguments.length===0){for(let i of r)delete this.$$populatedVirtuals[i],delete this._doc[i],delete n[i];let s=Object.keys(n);for(let i of s){if(t=this.$populated(i),!t)continue;if(delete n[i],Array.isArray(t)){let o=z.getValue(i,this._doc);if(o.isMongooseArray){let u=o.__array;for(let a=0;a<u.length;++a){let c=u[a];if(c==null)continue;u[a]=c instanceof j?c._doc._id:c._id}}else z.setValue(i,t,this._doc)}else z.setValue(i,t,this._doc)}return this}for(let s of e)if(t=this.$populated(s),delete n[s],r.indexOf(s)!==-1)delete this.$$populatedVirtuals[s],delete this._doc[s];else if(t)if(Array.isArray(t)){let i=z.getValue(s,this._doc);if(i.isMongooseArray){let o=i.__array;for(let u=0;u<o.length;++u){let a=o[u];if(a==null)continue;o[u]=a instanceof j?a._doc._id:a._id}}else z.setValue(s,t,this._doc)}else z.setValue(s,t,this._doc);return this};j.prototype.$__fullPath=function(e){return e||""};j.prototype.$getChanges=function(){let e=this.$__delta();return e?e[1]:{}};j.prototype.getChanges=function(){return z.warn("`getChanges()` is deprecated, use `$getChanges()` instead."),this.$getChanges()};j.prototype.$__delta=function(t,r){let n=this.$__dirty(),s=n,i=null;if(t!=null){s=[],i=[];for(let h of n)if(q4(h.path,r,t))s.push(h);else i.push(h)}let o=this.$__schema.options.optimisticConcurrency;if(o)if(Array.isArray(o)){if(!this.$__schema.options._optimisticConcurrencyTrie)this.$__schema.options._optimisticConcurrencyTrie=new ek(o);let h=this.$__schema.options._optimisticConcurrencyTrie,d=this.directModifiedPaths();if(t==null?d.find((m)=>h.overlapsPath(m.indexOf(".")===-1?m:m.split("."))):d.find((m)=>h.overlapsPath(m.indexOf(".")===-1?m:m.split("."))&&q4(m,r,t)))this.$__.version=s.length?3:1}else if(Array.isArray(o?.exclude)){if(!this.$__schema.options._optimisticConcurrencyExcludeTrie)this.$__schema.options._optimisticConcurrencyExcludeTrie=new ek(o.exclude);let h=this.$__schema.options._optimisticConcurrencyExcludeTrie,d=this.directModifiedPaths();if(t==null?d.find((m)=>!h.matchesPathOrAncestor(m.indexOf(".")===-1?m:m.split("."))):d.find((m)=>!h.matchesPathOrAncestor(m.indexOf(".")===-1?m:m.split("."))&&q4(m,r,t)))this.$__.version=s.length?3:1}else this.$__.version=s.length?3:1;if(!s.length&&this.$__.version!==3)return;let u={},a={},c=s.length,l=[],f=0;if(u._id=this._doc._id,ts(u?._id))u._id=u._id.toObject({transform:!1,depopulate:!0});for(;f<c;++f){let h=s[f],d=h.value,p=woe(this,h.path,d);if(p){l.push(p);continue}if(!this.$populated(h.path,!0)&&this.$__.selected){let _=h.path.split("."),y=_[0];if(this.$__.selected[y]&&this.$__.selected[y].$elemMatch)if(_.length>1&&_[1]==0&&typeof u[y]>"u")u[y]=this.$__.selected[y],_[1]="$",h.path=_.join(".");else{l.push(h.path);continue}}if(this.$isDefault(h.path)&&this.$__.selected){if(h.path.indexOf(".")===-1&&rk(this.$__.selected,h.path))continue;if(W4(h.path).find((y)=>rk(this.$__.isSelected,y)))continue}if(l.length)continue;if(d===void 0)qu(this,u,a,h,1,"$unset");else if(d===null)qu(this,u,a,h,null);else if(typeof d.getAtomics==="function")Coe(this,u,a,h,d);else if(d[lk.pathSymbol]&&Buffer.isBuffer(d))d=d.toObject(),qu(this,u,a,h,d);else if(this.$__.primitiveAtomics?.[h.path]!=null){let _=this.$__.primitiveAtomics[h.path],y=Hie(_);qu(this,u,a,h,_[y],y)}else d=So(d,{depopulate:!0,transform:!1,virtuals:!1,getters:!1,omitUndefined:!0,_isNested:!0}),qu(this,u,a,h,d)}if(l.length)throw new qie(l);if(this.$__.version)this.$__version(u,a);if(z.hasOwnKeys(a)===!1)return[u,null,i];return[u,a,i]};function woe(e,t,r){let n=e.$populated(t,!0);if(!n&&e.$__.selected){let i=t.split(".")[0];if(e.$__.selected[i]&&e.$__.selected[i].$slice!=null&&z.isMongooseArray(r)){if(r[As].$set)return i}if(e.$__.selected[i+".$"])return i}if(!(n&&z.isMongooseArray(r)))return;if(n.options.match||n.options.options&&Object.hasOwn(n.options.options,"limit")||n.options.options?.skip||n.options.select&&(n.options.select._id===0||/\s?-_id\s?/.test(n.options.select))){let i=r[As];if(z.hasOwnKeys(i)===!1||i.$set||i.$pop)return t}}function qu(e,t,r,n,s,i){if(i||(i="$set"),!r[i])r[i]={};if(r[i][n.path]=s,e.$__schema.options.versionKey===!1)return;if(boe(e,n.path))return;if((3&e.$__.version)===3)return;if(e.$__schema.options.optimisticConcurrency===!0||Array.isArray(e.$__schema.options.optimisticConcurrency)||Array.isArray(e.$__schema.options.optimisticConcurrency?.exclude))return;switch(i){case"$set":case"$unset":case"$pop":case"$pull":case"$pullAll":case"$push":case"$addToSet":case"$inc":break;default:return}if(i==="$push"||i==="$addToSet"||i==="$pullAll"||i==="$pull")if(/\.\d+\.|\.\d+$/.test(n.path))e.$__.version=3;else e.$__.version|=2;else if(/^\$p/.test(i))e.$__.version=3;else if(Array.isArray(s))e.$__.version=3;else if(/\.\d+\.|\.\d+$/.test(n.path))e.$__.version|=1}function Coe(e,t,r,n,s){if(r.$set?.[n.path])return;if(typeof s.getAtomics==="function"){s.getAtomics().forEach(function(f){let h=f[0],d=f[1];qu(e,t,r,n,d,h)});return}if(typeof s.$__getAtomics==="function"){s.$__getAtomics().forEach(function(f){let h=f[0],d=f[1];qu(e,t,r,n,d,h)});return}let i=s[As],o=Object.keys(i),u=o.length,a,c;if(u===0){if(z.isMongooseObject(s))s=s.toObject({depopulate:1,_isNested:!0});else if(s.valueOf)s=s.valueOf();return qu(e,t,r,n,s)}function l(f){return z.isMongooseObject(f)?f.toObject({depopulate:1,_isNested:!0}):f}while(u--){if(c=o[u],a=i[c],z.isMongooseObject(a))a=a.toObject({depopulate:!0,transform:!1,_isNested:!0});else if(Array.isArray(a))a=a.map(l);else if(a.valueOf)a=a.valueOf();if(c==="$addToSet")a={$each:a};qu(e,t,r,n,a,c)}}function boe(e,t){let r=e.$__schema.options.skipVersioning;if(!r)return!1;return t=t.replace(/\.\d+\./,"."),r[t]}j.prototype.$clone=function(){let t=new this.constructor;if(t.$isNew=this.$isNew,this._doc)t._doc=So(this._doc,{retainDocuments:!0,parentDoc:t});if(this.$__){let n=new this.$__.constructor;for(let s of Object.getOwnPropertyNames(this.$__)){if(s==="activePaths")continue;n[s]=So(this.$__[s])}Object.assign(n.activePaths,So({...this.$__.activePaths})),t.$__=n}return t};j.prototype.$createModifiedPathsSnapshot=function(){let t=new WeakMap;if(!this.$isSubdocument){let r=this.$getAllSubdocs();for(let n of r)t.set(n,n.$__.activePaths.clone())}return new Lie(t,this.$__.activePaths.clone(),this.$__.version)};j.prototype.$restoreModifiedPathsSnapshot=function(t){if(this.$__.activePaths=t.activePaths.clone(),this.$__.version=t.version,!this.$isSubdocument){let r=this.$getAllSubdocs();for(let n of r)if(t.subdocSnapshot.has(n))n.$__.activePaths=t.subdocSnapshot.get(n)}return this};j.prototype.$clearModifiedPaths=function(){if(this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("init"),this.$__.version=0,!this.$isSubdocument){let t=this.$getAllSubdocs();for(let r of t)r.$clearModifiedPaths()}return this};/*!
377
+ * Check if the given document only has primitive values
378
+ */j.prototype.$__hasOnlyPrimitiveValues=function(){if(this.$__.populated)return!1;let t=this._doc;for(let r in t){let n=t[r];if(n==null||typeof n!=="object")continue;if(Array.isArray(n))return!1;if(n instanceof Date||n instanceof Boolean||n instanceof Number||n instanceof String)continue;let s=n._bsontype;if(s==="ObjectId"||s==="Decimal128")continue;return!1}return!0};/*!
379
+ * Increment this document's version if necessary.
380
+ */j.prototype._applyVersionIncrement=function(){if(!this.$__.version)return;let t=(2&this.$__.version)===2;if(this.$__.version=void 0,t){let r=this.$__schema.options.versionKey,n=this.$__getValue(r)||0;this.$__setValue(r,n+1)}};/*!
381
+ * Module exports.
382
+ */j.VERSION_WHERE=1;j.VERSION_INC=2;j.VERSION_ALL=3;j.ValidationError=ld;Tk.exports=Dk=j});var be=g(function(ce){/*!
383
+ * Module dependencies.
384
+ */var Doe=Te().UUID,Toe=cv(),lg=ii(),Moe=Qa(),Pk=$2(),J4=ar(),Poe=ua(),Boe=xc(),hg=M2(),fg=Ov(),cg=Fn(),nc=Zn(),Foe=nu(),Noe=PA(),fd=td(),Ioe=v2(),ju=Xa(),{trustedSymbol:yh}=nh(),Y4;ce.specialProperties=ju;ce.isMongooseArray=hg.isMongooseArray;ce.isMongooseDocumentArray=fg.isMongooseDocumentArray;ce.registerMongooseArray=hg.registerMongooseArray;ce.registerMongooseDocumentArray=fg.registerMongooseDocumentArray;var Q4=/\s/,X4=/\s+/;ce.toCollectionName=function(e,t){if(e==="system.profile")return e;if(e==="system.indexes")return e;if(typeof t==="function"){if(typeof e!=="string")throw TypeError("Collection name must be a string");if(e.length===0)throw TypeError("Collection name cannot be empty");return t(e)}return e};ce.deepEqual=function e(t,r){if(t===r)return!0;if(typeof t!=="object"||typeof r!=="object")return t===r;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(nc(t,"ObjectId")&&nc(r,"ObjectId")||nc(t,"Decimal128")&&nc(r,"Decimal128"))return t.toString()===r.toString();if(t instanceof RegExp&&r instanceof RegExp)return t.source===r.source&&t.ignoreCase===r.ignoreCase&&t.multiline===r.multiline&&t.global===r.global&&t.dotAll===r.dotAll&&t.unicode===r.unicode&&t.sticky===r.sticky&&t.hasIndices===r.hasIndices;if(t==null||r==null)return!1;if(t.prototype!==r.prototype)return!1;if(t instanceof Map||r instanceof Map){if(!(t instanceof Map)||!(r instanceof Map))return!1;return e(Array.from(t.keys()),Array.from(r.keys()))&&e(Array.from(t.values()),Array.from(r.values()))}if(t instanceof Set||r instanceof Set){if(!(t instanceof Set)||!(r instanceof Set))return!1;if(t.size!==r.size)return!1;return e(Array.from(t.values()),Array.from(r.values()))}if(t instanceof Number&&r instanceof Number)return t.valueOf()===r.valueOf();if(Buffer.isBuffer(t))return ce.buffer.areEqual(t,r);if(Array.isArray(t)||Array.isArray(r)){if(!Array.isArray(t)||!Array.isArray(r))return!1;let o=t.length;if(o!==r.length)return!1;for(let u=0;u<o;++u)if(!e(t[u],r[u]))return!1;return!0}if(cg(t))t=t._doc;else if(fd(t))t=t.toObject();if(cg(r))r=r._doc;else if(fd(r))r=r.toObject();let n=Object.keys(t),s=Object.keys(r),i=n.length;if(i!==s.length)return!1;for(let o=i-1;o>=0;o--)if(n[o]!==s[o])return!1;for(let o of n)if(!e(t[o],r[o]))return!1;return!0};ce.last=function(e){if(e==null)return;if(e.length>0)return e[e.length-1];return};/*!
385
+ * ignore
386
+ */ce.cloneArrays=function(t){if(!Array.isArray(t))return t;return t.map((r)=>ce.cloneArrays(r))};/*!
387
+ * ignore
388
+ */ce.omit=function(t,r){if(r==null)return Object.assign({},t);if(!Array.isArray(r))r=[r];let n=Object.assign({},t);for(let s of r)delete n[s];return n};ce.clonePOJOsAndArrays=function(t){if(t==null)return t;if(cg(t))return t;if(Foe(t)){t={...t};for(let r of Object.keys(t))t[r]=ce.clonePOJOsAndArrays(t[r]);return t}if(Array.isArray(t)){t=[...t];for(let r=0;r<t.length;++r)t[r]=ce.clonePOJOsAndArrays(t[r]);return t}return t};ce.merge=function e(t,r,n,s){if(n=n||{},r==null)return t;let i=Object.keys(r),o=0,u=i.length,a;if(r[yh])t[yh]=r[yh];s=s||"";let c=n.omitNested||{};while(o<u){if(a=i[o++],n.omit&&n.omit[a])continue;if(c[s])continue;if(ju.has(a))continue;if(t[a]==null)t[a]=ce.clonePOJOsAndArrays(r[a]);else if(ce.isObject(r[a])){if(!ce.isObject(t[a]))t[a]={};if(r[a]!=null){if(n.isDiscriminatorSchemaMerge&&(r[a].$isSingleNested&&t[a].$isMongooseDocumentArray||r[a].$isMongooseDocumentArray&&t[a].$isSingleNested))continue;else if(r[a].instanceOfSchema){if(t[a].instanceOfSchema)Ioe(t[a],r[a].clone(),n.isDiscriminatorSchemaMerge);else t[a]=r[a].clone();continue}else if(nc(r[a],"ObjectId")){t[a]=new Moe(r[a]);continue}}e(t[a],r[a],n,s?s+"."+a:a)}else if(n.overwrite)t[a]=r[a]}return t};ce.toObject=function e(t){Y4||(Y4=su());let r;if(t==null)return t;if(t instanceof Y4)return t.toObject();if(Array.isArray(t)){r=[];for(let n of t)r.push(e(n));return r}if(ce.isPOJO(t)){if(r={},t[yh])r[yh]=t[yh];for(let n of Object.keys(t)){if(ju.has(n))continue;r[n]=e(t[n])}return r}return t};ce.isObject=Boe;ce.isPOJO=nu();ce.isNonBuiltinObject=function(t){return typeof t==="object"&&!Array.isArray(t)&&!(t instanceof Date)&&!(t instanceof Boolean)&&!(t instanceof Number)&&!(t instanceof String)&&!ce.isMongooseType(t)&&!(t instanceof Doe)&&t!=null};ce.isEmptyObject=function(t){if(t==null||typeof t!=="object")return!1;return ce.hasOwnKeys(t)===!1};ce.hasOwnKeys=function(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))return!0;return!1};ce.hasKey=function(t,r){let n=Object.keys(t);for(let s of n){if(s===r)return!0;if(ce.isPOJO(t[s])&&ce.hasKey(t[s],r))return!0}return!1};ce.tick=function(t){if(typeof t!=="function")return;return function(){try{t.apply(this,arguments)}catch(r){Poe(function(){throw r})}}};ce.isMongooseType=function(e){return nc(e,"ObjectId")||nc(e,"Decimal128")||e instanceof Buffer};ce.isMongooseObject=fd;ce.expires=function(t){if(!(t&&t.constructor.name==="Object"))return;if(!("expires"in t))return;t.expireAfterSeconds=typeof t.expires!=="string"?t.expires:Math.round(Toe(t.expires)/1000),delete t.expires};ce.populate=function(t,r,n,s,i,o,u,a){let c=null;if(arguments.length===1){if(t instanceof Pk)return t._docs={},t._childDocs=[],[t];if(Array.isArray(t))return l(t).map((h)=>ce.populate(h)[0]);if(ce.isObject(t))c=Object.assign({},t);else c={path:t}}else if(typeof n==="object")c={path:t,select:r,match:n,options:s};else c={path:t,select:r,model:n,match:s,options:i,populate:o,justOne:u,count:a};if(typeof c.path!=="string"&&!(Array.isArray(c.path)&&c.path.every((f)=>typeof f==="string")))throw TypeError("utils.populate: invalid path. Expected string or array of strings. Got typeof `"+typeof t+"`");return Roe(c);function l(f){let h=[];return f.forEach(function(d){if(Q4.test(d.path))d.path.split(X4).forEach(function(m){let _=Object.assign({},d);_.path=m,h.push(_)});else h.push(d)}),h}};function Roe(e){if(Array.isArray(e.populate)){let n=[];e.populate.forEach(function(s){if(Q4.test(s.path)){let i=Object.assign({},s);i.path.split(X4).forEach(function(u){i.path=u,n.push(ce.populate(i)[0])})}else n.push(ce.populate(s)[0])}),e.populate=ce.populate(n)}else if(e.populate!=null&&typeof e.populate==="object")e.populate=ce.populate(e.populate);let t=[],r=Q4.test(e.path)?e.path.split(X4):Array.isArray(e.path)?e.path:[e.path];if(e.options!=null)e.options=J4(e.options);for(let n of r)t.push(new Pk(Object.assign({},e,{path:n})));return t}ce.getValue=function(e,t,r){return lg.get(e,t,voe,r)};/*!
389
+ * ignore
390
+ */var $oe=Object.freeze({getters:!1});function voe(e,t){if(t==="$*"&&e instanceof Map)return e;let r=e?._doc||e;if(r?.isMongooseArrayProxy)r=r.__array;return r instanceof Map?r.get(t,$oe):r[t]}ce.setValue=function(e,t,r,n,s){lg.set(e,t,r,"_doc",n,s)};ce.object={};ce.object.vals=function(t){if(t==null)return[];let r=Object.keys(t),n=r.length,s=[];while(n--)s.push(t[r[n]]);return s};ce.isNullOrUndefined=function(e){return e==null};/*!
391
+ * ignore
392
+ */ce.array={};ce.array.flatten=function e(t,r,n){return n||(n=[]),t.forEach(function(s){if(Array.isArray(s))e(s,r,n);else if(!r||r(s))n.push(s)}),n};/*!
393
+ * ignore
394
+ */ce.hasUserDefinedProperty=function(e,t){if(e==null)return!1;if(Array.isArray(t)){for(let r of t)if(ce.hasUserDefinedProperty(e,r))return!0;return!1}if(Object.hasOwn(e,t))return!0;if(typeof e==="object"&&t in e){let r=e[t];return r!==Object.prototype[t]&&r!==Array.prototype[t]}return!1};/*!
395
+ * ignore
396
+ */var Mk=Math.pow(2,32)-1;ce.isArrayIndex=function(e){if(typeof e==="number")return e>=0&&e<=Mk;if(typeof e==="string"){if(!/^\d+$/.test(e))return!1;return e=+e,e>=0&&e<=Mk}return!1};ce.array.unique=function(e){let t=new Set,r=new Set,n=[];for(let s of e)if(typeof s==="number"||typeof s==="string"||s==null){if(t.has(s))continue;n.push(s),t.add(s)}else if(nc(s,"ObjectId")){let i=s.toString();if(r.has(i))continue;n.push(s),r.add(i)}else n.push(s);return n};ce.buffer={};ce.buffer.areEqual=function(e,t){if(!Buffer.isBuffer(e))return!1;if(!Buffer.isBuffer(t))return!1;return e.equals(t)};ce.getFunctionName=Noe;ce.decorate=function(e,t){for(let r in t){if(ju.has(r))continue;e[r]=t[r]}};ce.mergeClone=function(e,t){if(fd(t))t=t.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});let r=Object.keys(t),n=r.length,s=0,i;while(s<n){if(i=r[s++],ju.has(i))continue;if(!Object.hasOwn(cg(e)?e._doc:e,i)&&i in e)continue;if(typeof e[i]>"u")e[i]=J4(t[i],{transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});else{let o=t[i];if(o?.valueOf&&!(o instanceof Date))o=o.valueOf();if(ce.isObject(o)){let u=o,a=Buffer.isBuffer(o)&&o.isMongooseBuffer;if(fd(o)&&!a)u=u.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});if(a)u=Buffer.from(u);ce.mergeClone(e[i],u)}else e[i]=J4(o,{flattenDecimals:!1})}}};ce.each=function(e,t){for(let r of e)t(r)};ce.renameObjKey=function(e,t,r){return Object.keys(e).reduce((s,i)=>{if(i===t)s[r]=e[t];else s[i]=e[i];return s},{})};/*!
397
+ * ignore
398
+ */ce.getOption=function(e){let t=Array.prototype.slice.call(arguments,1);for(let r of t){if(r==null)continue;if(r[e]!=null)return r[e]}return null};/*!
399
+ * ignore
400
+ */ce.noop=function(){};ce.errorToPOJO=function(t){if(!(t instanceof Error))throw Error("`error` must be `instanceof Error`.");let n={};for(let s of Object.getOwnPropertyNames(t))n[s]=t[s];return n};/*!
401
+ * ignore
402
+ */ce.warn=function(t){return process.emitWarning(t,{code:"MONGOOSE"})};ce.injectTimestampsOption=function(t,r){if(r==null)return;t.timestamps=r}});var Mr=g(function(pg,$k){/*!
403
+ * Module dependencies.
404
+ */var Tr=ni(),Rk=js(),xoe=I2(),koe=f4(),dg=ar(),qoe=Li(),Z4=nv(),joe=iv(),Loe=Fn(),eO=uv(),Uoe=de().schemaTypeSymbol,ns=be(),dd=de().validatorErrorSymbol,Voe=de().documentIsModified,Bk=de().populateModelSymbol,tO=Tr.CastError,gh=Tr.ValidatorError,zoe={_skipMarkModified:!0};function ke(e,t,r,n){this[Uoe]=!0,this.path=e,this.instance=r,this.schemaName=this.constructor.schemaName,this.validators=[],this.getters=Object.hasOwn(this.constructor,"getters")?this.constructor.getters.slice():[],this.setters=Object.hasOwn(this.constructor,"setters")?this.constructor.setters.slice():[],this.splitPath(),t=t||{};let s=this.constructor.defaultOptions||{},i=Object.keys(s);for(let a of i)if(a==="validate")this.validate(s.validate);else if(Object.hasOwn(s,a)&&!Object.hasOwn(t,a))t[a]=s[a];if(t.select==null)delete t.select;let o=this.OptionsConstructor||Rk;if(this.options=new o(t),this.parentSchema=n,this._index=null,ns.hasUserDefinedProperty(this.options,"immutable"))this.$immutable=this.options.immutable,Z4(this);let u=Object.keys(this.options);for(let a of u){if(a==="cast"){if(Array.isArray(this.options[a]))this.castFunction.apply(this,this.options[a]);else this.castFunction(this.options[a]);continue}if(ns.hasUserDefinedProperty(this.options,a)&&typeof this[a]==="function"){if(a==="index"&&this._index){if(t.index===!1){let f=this._index;if(typeof f==="object"&&f!=null){if(f.unique)throw new Tr('Path "'+this.path+'" may not have `index` set to false and `unique` set to true');if(f.sparse)throw new Tr('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}this._index=!1}continue}let c=t[a];if(a==="default"){this.default(c);continue}let l=Array.isArray(c)?c:[c];this[a].apply(this,l)}}Object.defineProperty(this,"$$context",{enumerable:!1,configurable:!1,writable:!0,value:null})}ke.prototype.OptionsConstructor=Rk;ke.prototype.path;ke.prototype.toJSON=function(){let{parentSchema:t,...r}=this;return r};ke.prototype._createJSONSchemaTypeDefinition=function(t,r,n){let s=n?.useBsonType,i=n?._overrideRequired??(this.options.required==null?n?._defaultRequired===!0||this.path==="_id":this.options.required&&typeof this.options.required!=="function"),o=this.options.allowNull!==!1;if(s){if(i||!o)return{bsonType:r};return{bsonType:[r,"null"]}}if(i||!o)return{type:t};return{type:[t,"null"]}};ke.prototype._addJSONSchemaEnum=function(t){if(!Array.isArray(this.enumValues)||this.enumValues.length===0)return t;let r=Array.isArray(t.type??t.bsonType);return t.enum=r&&!this.enumValues.includes(null)?[...this.enumValues,null]:[...this.enumValues],t};ke.prototype.validators;ke.prototype.isRequired;ke.prototype.splitPath=function(){if(this._presplitPath!=null)return this._presplitPath;if(this.path==null)return;return this._presplitPath=this.path.indexOf(".")===-1?[this.path]:this.path.split("."),this._presplitPath};ke.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=(r)=>r;return this._cast=t,this._cast};ke.prototype.castFunction=function(t,r){if(arguments.length===0)return this._castFunction;if(t===!1)t=this.constructor._defaultCaster||((n)=>n);if(typeof t==="string")return this._castErrorMessage=t,this._castFunction;if(t!=null)this._castFunction=t;if(r!=null)this._castErrorMessage=r;return this._castFunction};ke.prototype.cast=function(){throw new Tr("Base SchemaType class does not implement a `cast()` function")};ke.set=function(t,r){if(!Object.hasOwn(this,"defaultOptions"))this.defaultOptions=Object.assign({},this.defaultOptions);this.defaultOptions[t]=r};ke.get=function(e){this.getters=Object.hasOwn(this,"getters")?this.getters:[],this.getters.push(e)};ke.prototype.default=function(e){if(arguments.length===1){if(e===void 0){this.defaultValue=void 0;return}if(e?.instanceOfSchema)throw new Tr("Cannot set default value of path `"+this.path+"` to a mongoose Schema instance.");return this.defaultValue=e,this.defaultValue}else if(arguments.length>1)this.defaultValue=[...arguments];return this.defaultValue};ke.prototype.index=function(e){return this._index=e,ns.expires(this._index),this};ke.prototype.unique=function(t,r){if(this._index===!1){if(!t)return;throw new Tr('Path "'+this.path+'" may not have `index` set to false and `unique` set to true')}if(!Object.hasOwn(this.options,"index")&&t===!1)return this;if(this._index==null||this._index===!0)this._index={};else if(typeof this._index==="string")this._index={type:this._index};if(this._index.unique=!!t,typeof r==="string")this._duplicateKeyErrorMessage=r;return this};ke.prototype.text=function(e){if(this._index===!1){if(!e)return this;throw new Tr('Path "'+this.path+'" may not have `index` set to false and `text` set to true')}if(!Object.hasOwn(this.options,"index")&&e===!1)return this;if(this._index===null||this._index===void 0||typeof this._index==="boolean")this._index={};else if(typeof this._index==="string")this._index={type:this._index};return this._index.text=e,this};ke.prototype.sparse=function(e){if(this._index===!1){if(!e)return this;throw new Tr('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}if(!Object.hasOwn(this.options,"index")&&e===!1)return this;if(this._index==null||typeof this._index==="boolean")this._index={};else if(typeof this._index==="string")this._index={type:this._index};return this._index.sparse=e,this};ke.prototype.immutable=function(e){return this.$immutable=e,Z4(this),this};ke.prototype.transform=function(e){return this.options.transform=e,this};ke.prototype.set=function(e){if(typeof e!=="function")throw TypeError("A setter must be a function.");return this.setters.push(e),this};ke.prototype.get=function(e){if(typeof e!=="function")throw TypeError("A getter must be a function.");return this.getters.push(e),this};ke.prototype.validateAll=function(e){for(let t=0;t<e.length;t++)this.validate(e[t]);return this};ke.prototype.validate=function(e,t,r){if(typeof e==="function"||e&&ns.getFunctionName(e.constructor)==="RegExp"){let o;if(typeof t==="function")o={validator:e,message:t},o.type=r||"user defined";else if(t instanceof Object&&!r){if(o=eO(t)?Object.assign({},t):dg(t),!o.message)o.message=o.msg;o.validator=e,o.type=o.type||"user defined"}else{if(t==null)t=Tr.messages.general.default;if(!r)r="user defined";o={message:t,type:r,validator:e}}return this.validators.push(o),this}let n,s,i;for(n=0,s=arguments.length;n<s;n++){if(i=arguments[n],!ns.isPOJO(i)){let o="Invalid validator. Received ("+typeof i+") "+i+". See https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.validate()";throw new Tr(o)}this.validate(i.validator,i)}return this};ke.prototype.required=function(e,t){let r={};if(arguments.length>0&&e==null)return this.validators=this.validators.filter(function(i){return i.validator!==this.requiredValidator},this),this.isRequired=!1,delete this.originalRequiredValue,this;if(typeof e==="object")r=e,t=r.message||t,e=e.isRequired;if(e===!1)return this.validators=this.validators.filter(function(i){return i.validator!==this.requiredValidator},this),this.isRequired=!1,delete this.originalRequiredValue,this;let n=this;if(this.isRequired=!0,this.originalRequiredValue=e,typeof this.originalRequiredValue!=="function"&&(ns.hasUserDefinedProperty(this.options,"allowNull")||this.allowNullValidator!=null))throw new Tr('Path "'+this.path+'" may not have `allowNull` specified when `required` is true');if(this.requiredValidator=function(i){let o=this?.$__?.cachedRequired;if(o!=null&&!this.$__isSelected(n.path)&&!this[Voe](n.path))return!0;if(o!=null&&n.path in o){let u=o[n.path]?n.checkRequired(i,this):!0;return delete o[n.path],u}else if(typeof e==="function")return e.apply(this)?n.checkRequired(i,this):!0;return n.checkRequired(i,this)},typeof e==="string")t=e,e=void 0;let s=t||Tr.messages.general.required;return this.validators.unshift(Object.assign({},r,{validator:this.requiredValidator,message:s,type:"required"})),this};ke.prototype.allowNull=function(e){if(arguments.length>0&&this.isRequired&&typeof this.originalRequiredValue!=="function")throw new Tr('Path "'+this.path+'" may not have `allowNull` specified when `required` is true');if(this.validators=this.validators.filter(function(t){return t.validator!==this.allowNullValidator},this),e!==!1)return delete this.options.allowNull,delete this.allowNullValidator,this;return this.options.allowNull=!1,this.allowNullValidator=function(t){return t!==null},this.validators.push({validator:this.allowNullValidator,message:Tr.messages.general.allowNull,type:"allowNull"}),this};ke.prototype.ref=function(e){return this.options.ref=e,this};ke.prototype.getDefault=function(t,r,n,s){let i;if(this.defaultValue==null)return this.defaultValue;if(typeof this.defaultValue==="function"){let o=n?.context??t;if(this.defaultValue===Date.now||this.defaultValue===Array||this.defaultValue.name==="ObjectId"||this.defaultValue.name==="ObjectID")i=this.defaultValue.call(o);else i=this.defaultValue.call(o,o)}else i=this.defaultValue;if(i!=null){if(typeof i==="object"&&i!=null&&i._bsontype!=="ObjectId"&&!this.options?.shared)i=dg(i);if(n?.skipCast)return this._applySetters(i,t);let o=this.applySetters(i,t,r,void 0,s??zoe);if(o&&!Array.isArray(o)&&o.$isSingleNested)o.$__parent=t;return o}return i};ke.prototype._applySetters=function(e,t,r,n,s){let i=e;if(r)return i;let o=this.setters;for(let u=o.length-1;u>=0;u--)i=o[u].call(t,i,n,this,s);return i};/*!
405
+ * ignore
406
+ */ke.prototype._castNullish=function(t){return t};ke.prototype.applySetters=function(e,t,r,n,s){let i=this._applySetters(e,t,r,n,s);if(i==null)return this._castNullish(i);return i=this.cast(i,t,r,n,s),i};ke.prototype.applyGetters=function(e,t){let r=e,n=this.getters,s=n.length;if(s===0)return r;for(let i=0;i<s;++i)r=n[i].call(t,r,this);return r};ke.prototype.select=function(t){return this.selected=!!t,this};ke.prototype.doValidate=async function(t,r,n){let s=!1,i=this.path,o=this.validators.filter((a)=>typeof a==="object"&&a!==null);if(!o.length)return;let u=[];for(let a=0,c=o.length;a<c;++a){let l=o[a],f=l.validator,h,d=eO(l)?Object.assign({},l):dg(l);if(d.path=n?.path||i,d.fullPath=this.$fullPath,d.value=t,typeof t==="string")d.length=t.length;if(t===void 0&&f!==this.requiredValidator)continue;if(f instanceof RegExp){if(h=f.test(t),h===!1)throw s=new(d.ErrorConstructor||gh)(d,r),s[dd]=!0,s;continue}else if(typeof f!=="function")continue;try{if(d.propsParameter)h=f.call(r,t,d);else h=f.call(r,t)}catch(p){if(h=!1,d.reason=p,p.message)d.message=p.message}if(typeof h?.then==="function")u.push(h.then(function(p){if(p===!1)throw s=new(d.ErrorConstructor||gh)(d,r),s[dd]=!0,s},function(p){throw d.reason=p,d.message=p.message,h=!1,s=new(d.ErrorConstructor||gh)(d,r),s[dd]=!0,s}));else if(h!==void 0&&!h)throw s=new(d.ErrorConstructor||gh)(d,r),s[dd]=!0,s}await Promise.all(u)};function Fk(e,t){if(e!==void 0&&!e){let n=new(t.ErrorConstructor||gh)(t);return n[dd]=!0,n}}ke.prototype.doValidateSync=function(e,t,r){let n=this.path;if(!this.validators.length)return null;let i=this.validators;if(e===void 0)if(this.validators.length!==0&&this.validators[0].type==="required")i=[this.validators[0]];else return null;let o=null,u=0,a=i.length;for(u=0;u<a;++u){let c=i[u];if(c===null||typeof c!=="object")continue;let l=c.validator,f=eO(c)?Object.assign({},c):dg(c);if(f.path=r?.path||n,f.fullPath=this.$fullPath,f.value=e,typeof e==="string")f.length=e.length;let h=!1;if(joe(l))continue;if(l instanceof RegExp){o=Fk(l.test(e),f);continue}if(typeof l!=="function")continue;try{if(f.propsParameter)h=l.call(t,e,f);else h=l.call(t,e)}catch(d){h=!1,f.reason=d}if(typeof h?.then==="function")continue;if(o=Fk(h,f),o)break}return o};ke._isRef=function(e,t,r,n){let s=n&&(e.options?.ref||e.options?.refPath);if(!s&&r?.$__!=null){let i=r.$__fullPath(e.path,!0),o=r.ownerDocument();s=i!=null&&o.$populated(i)||r.$populated(e.path)}if(s){if(t==null)return!0;if(!Buffer.isBuffer(t)&&t._bsontype!=="Binary"&&ns.isObject(t))return!0;return n}return!1};/*!
407
+ * ignore
408
+ */ke.prototype._castRef=function(t,r,n,s){if(t==null)return t;if(Loe(t))return t.$__.wasPopulated=t.$__.wasPopulated||{value:t._doc._id},t;if(Buffer.isBuffer(t)||!ns.isObject(t)){if(n)return t;throw new tO(this.instance,t,this.path,null,this)}let i=r.$__fullPath(this.path,!0),o=r.ownerDocument(),u=o.$populated(i,!0),a=t;if(!r.$__.populated||!r.$__.populated[i]||!r.$__.populated[i].options||!r.$__.populated[i].options.options||!r.$__.populated[i].options.options.lean){let c=u?u.options[Bk]:o.constructor.db.model(this.options.ref);a=c.hydrate(t,null,s),a.$__.wasPopulated={value:a._doc._id,options:{[Bk]:c}}}return a};/*!
409
+ * ignore
410
+ */function Nk(e,t){return this.castForQuery(null,e,t)}/*!
411
+ * ignore
412
+ */function Woe(e,t){let r=this;if(!Array.isArray(e))return[this.castForQuery(null,e,t)];return e.map(function(n){return r.castForQuery(null,n,t)})}function Ik(e,t){let r=this;if(!Array.isArray(e))return[this.castForQuery(null,e,t)];return e.map(function(n){if(Array.isArray(n)&&n.length===0)return n;return r.castForQuery(null,n,t)})}ke.prototype.$conditionalHandlers={$all:Woe,$eq:Nk,$in:Ik,$ne:Nk,$nin:Ik,$exists:xoe,$type:koe};ke.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=qoe(this.$conditionalHandlers,e),!n)throw new Tr("Can't use "+e);return n.call(this,t,r)}try{return this.applySetters(t,r)}catch(s){if(s instanceof tO&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};ke.checkRequired=function(e){if(arguments.length!==0)this._checkRequired=e;return this._checkRequired};ke.prototype.checkRequired=function(e){return e!=null};ke.prototype.clone=function(){let e=Object.assign({},this.options),t=new this.constructor(this.path,e,this.instance,this.parentSchema);if(t.validators=this.validators.slice(),this.requiredValidator!==void 0)t.requiredValidator=this.requiredValidator;if(this.allowNullValidator!==void 0)t.allowNullValidator=this.allowNullValidator;if(this.enumValidator!==void 0)t.enumValidator=this.enumValidator;if(this.minValidator!==void 0)t.minValidator=this.minValidator;if(this.maxValidator!==void 0)t.maxValidator=this.maxValidator;if(this.minlengthValidator!==void 0)t.minlengthValidator=this.minlengthValidator;if(this.maxlengthValidator!==void 0)t.maxlengthValidator=this.maxlengthValidator;if(this.defaultValue!==void 0)t.defaultValue=this.defaultValue;if(this.$immutable!==void 0&&this.options.immutable===void 0)t.$immutable=this.$immutable,Z4(t);if(this._index!==void 0)t._index=this._index;if(this.selected!==void 0)t.selected=this.selected;if(this.isRequired!==void 0)t.isRequired=this.isRequired;if(this.originalRequiredValue!==void 0)t.originalRequiredValue=this.originalRequiredValue;return t.getters=this.getters.slice(),t.setters=this.setters.slice(),t};ke.prototype.getEmbeddedSchemaType=function(){return this.embeddedSchemaType};/*!
413
+ * If _duplicateKeyErrorMessage is a string, replace unique index errors "E11000 duplicate key error" with this string.
414
+ *
415
+ * @api private
416
+ */ke.prototype._duplicateKeyErrorMessage=null;ke.prototype.toJSONSchema=function(t){throw new Tr(`Converting unsupported SchemaType to JSON Schema: ${this.instance} at path "${this.path}"`)};ke.prototype.autoEncryptionType=function(){return null};/*!
417
+ * Module exports.
418
+ */$k.exports=pg=ke;pg.CastError=tO;pg.ValidatorError=gh});var rO=g(function(Dge,vk){var wo=si();class ui{constructor(e){if(Object.assign(this,e),e?.options!=null)this.options=Object.assign({},e.options)}}Object.defineProperty(ui.prototype,"ref",wo);Object.defineProperty(ui.prototype,"refPath",wo);Object.defineProperty(ui.prototype,"localField",wo);Object.defineProperty(ui.prototype,"foreignField",wo);Object.defineProperty(ui.prototype,"justOne",wo);Object.defineProperty(ui.prototype,"count",wo);Object.defineProperty(ui.prototype,"match",wo);Object.defineProperty(ui.prototype,"options",wo);Object.defineProperty(ui.prototype,"skip",wo);Object.defineProperty(ui.prototype,"limit",wo);Object.defineProperty(ui.prototype,"perDocumentLimit",wo);vk.exports=ui});var mg=g(function(Tge,xk){xk.exports=function(t,r,n){if(t==null)return t;if(t._doc!=null)t=t._doc;if(arguments.length>=3){if(typeof t!=="object")return;if(n===void 0)return;if(t instanceof Map)t.set(r,n);else t[r]=n;return n}if(r==="$*")return t instanceof Map?Array.from(t.values()):Object.keys(t).map((s)=>t[s]);if(t instanceof Map)return t.get(r);return t[r]}});var nO=g(function(Mge,Uk){var kk=ze(),Hoe=S4(),qk=mg(),yg=ii(),gg=require("util"),Lk=be(),jk=/(\.\d+$|\.\d+\.)/g;Uk.exports=function(t,r,n,s,i){if(t==null)return[];if(typeof t!=="string")throw new kk("`refPath` must be a string or a function that returns a string, got "+gg.inspect(t));if(i!=null&&Hoe(i,t))throw new kk("refPath `"+t+"` must not be excluded in projection, got "+gg.inspect(i));if(jk.test(n)){let a=n.split(jk);if(a[a.length-1]==="")throw Error("Can't populate individual element in an array");let c="",l=t;for(let d=0;d<a.length;d+=2){let p=a[d];if(l.length>=p.length+1&&l.charAt(p.length)==="."&&l.slice(0,p.length)===p)c+=l.substring(0,p.length)+a[d+1],l=l.substring(p.length+1);else if(d===a.length-1){c+=l,l="";break}else throw Error("Could not normalize ref path, chunk "+p+" not in populated path")}let f=yg.get(c,r,qk),h=Array.isArray(f)?f:[f];return h=Lk.array.flatten(h),h}let o=yg.get(t,r,qk),u;if(s!=null&&Object.hasOwn(s.virtuals,t))u=[s.virtuals[t].applyGetters(void 0,r)];else u=Array.isArray(o)?o:[o];return u}});var _g=g(function(Pge,zk){var Koe=nO(),Vk=be(),Goe=de().modelSymbol;function Lu(e,t){this.path=t,this.getters=[],this.setters=[],this.options=Object.assign({},e)}Lu.prototype._applyDefaultGetters=function(){if(this.getters.length>0||this.setters.length>0)return;let t="$"+this.path;this.getters.push(function(){return this.$locals[t]}),this.setters.push(function(r){this.$locals[t]=r})};/*!
419
+ * ignore
420
+ */Lu.prototype.clone=function(){let e=new Lu(this.options,this.path);return e.getters=[].concat(this.getters),e.setters=[].concat(this.setters),e};Lu.prototype.get=function(e){return this.getters.push(e),this};Lu.prototype.set=function(e){return this.setters.push(e),this};Lu.prototype.applyGetters=function(e,t){if(Vk.hasUserDefinedProperty(this.options,["ref","refPath"])&&t.$$populatedVirtuals&&Object.hasOwn(t.$$populatedVirtuals,this.path))e=t.$$populatedVirtuals[this.path];let r=e;for(let n of this.getters)r=n.call(t,r,this,t);return r};Lu.prototype.applySetters=function(e,t){let r=e;for(let n of this.setters)r=n.call(t,r,this,t);return r};Lu.prototype._getModelNamesForPopulate=function(t){if(this.options.refPath)return Koe(this.options.refPath,t,this.path);let r=null;if(typeof this.options.ref==="function"&&!this.options.ref[Goe])r=this.options.ref.call(t,t);else r=this.options.ref;if(r!=null&&!Array.isArray(r))return[r];return r};/*!
421
+ * exports
422
+ */zk.exports=Lu});var sO=g(function(Bge,Wk){Wk.exports=function(t){let r={_id:{auto:!0}};r._id[t.options.typeKey]="ObjectId",t.add(r)}});var iO=g(function(Fge,Hk){Hk.exports=function(t,r){let n=t.discriminatorMapping?.value;if(n&&!("sparse"in r)){let s=t.options.discriminatorKey;r.partialFilterExpression=r.partialFilterExpression||{},r.partialFilterExpression[s]=n}return r}});var Gk=g(function(Nge,Kk){var oO=Dr(),Yoe=xc(),Joe=iO();Kk.exports=function(t){let r=[],n=new WeakMap,s=t.constructor.indexTypes,i=new Map;return o(t),r;function o(a,c,l){if(n.has(a))return;n.set(a,!0),c=c||"";let f=Object.keys(a.paths);for(let h of f){let d=a.paths[h];if(l!=null&&l.paths[h])continue;if(d._duplicateKeyErrorMessage!=null)a._duplicateKeyErrorMessagesByPath=a._duplicateKeyErrorMessagesByPath||{},a._duplicateKeyErrorMessagesByPath[h]=d._duplicateKeyErrorMessage;if(d.$isMongooseDocumentArray||d.$isSingleNested){if(oO(d,"options.excludeIndexes")!==!0&&oO(d,"schemaOptions.excludeIndexes")!==!0&&oO(d,"schema.options.excludeIndexes")!==!0)o(d.schema,c+h+".");if(d.schema.discriminators!=null){let m=d.schema.discriminators,_=Object.keys(m);for(let y of _)o(m[y],c+h+".",d.schema)}if(d.$isMongooseDocumentArray)continue}let p=d._index||d.embeddedSchemaType&&d.embeddedSchemaType._index;if(p!==!1&&p!=null){let m={},_=Yoe(p),y=_?{...p}:{},E=typeof p==="string"?p:_?p.type:!1;if(E&&s.indexOf(E)!==-1)m[c+h]=E;else if(y.text)m[c+h]="text",delete y.text;else{let D=!1;if(p==="descending"||p==="desc")D=!0;else if(p==="ascending"||p==="asc")D=!1;else D=Number(p)===-1;m[c+h]=D?-1:1}if(delete y.type,a.options.autoIndex!=null)y._autoIndex=a.options.autoIndex;let C=y?.name;if(typeof C==="string")if(i.has(C))Object.assign(i.get(C),m);else r.push([m,y]),i.set(C,m);else r.push([m,y]),i.set(C,m)}}if(n.delete(a),c)u(a,c);else a._indexes.forEach(function(h){let d=h[1];Joe(a,d)}),r=r.concat(a._indexes)}function u(a,c){let l=a._indexes,f=l.length;for(let h=0;h<f;++h){let d=l[h][0],p=l[h][1],m=Object.keys(d),_=m.length,y={};for(let C=0;C<_;++C){let D=m[C];y[c+D]=d[D]}let E=Object.assign({},p);if(p?.partialFilterExpression!=null){E.partialFilterExpression={};let C=p.partialFilterExpression;for(let D of Object.keys(C))E.partialFilterExpression[c+D]=C[D]}r.push([y,E])}}}});var uO=g(function(Ige,Yk){Yk.exports=function(t){switch(t){case"p":t="primary";break;case"pp":t="primaryPreferred";break;case"s":t="secondary";break;case"sp":t="secondaryPreferred";break;case"n":t="nearest";break}return t}});var Eg=g(function(Rge,Jk){/*!
423
+ * ignore
424
+ */Jk.exports=function(t){if(!(!t.paths.id&&t.paths._id&&t.options.id))return t;if(t.aliases?.id)return t;return t.virtual("id").get(Qoe),t};function Qoe(){if(this._doc)return this._doc._id?.toString()??null;if(this._id!=null)return this._id.toString();return null}});var aO=g(function($ge,Qk){Qk.exports=function(t,r){let n=Object.keys(t),s=Object.keys(r);if(n.length!==s.length)return!1;for(let i=0;i<n.length;i++){let o=n[i];if(o!==s[i]||t[o]!==r[o])return!1}return!0}});var Zk=g(function(vge,Xk){Xk.exports=function(t,r,n,s){if(s.justOne||s.count){if(t[r]=Array.isArray(n)?n[0]:n,typeof t[r]!=="object")t[r]=s.count?n:null}else t[r]=Array.isArray(n)?n:n==null?[]:[n],t[r]=t[r].filter(function(i){return i&&typeof i==="object"});return t[r]}});var pd=g(function(xge,eq){eq.exports=function(t){if(t.indexOf("$")===-1)return t;return t.replace(/\.\$(\[[^\]]*\])?(?=\.|$)/g,".0")}});var Ag=g(function(kge,tq){tq.exports=Xoe;/*!
425
+ * ignore
426
+ */function Xoe(e,t){if(e==null)return null;if(typeof e==="boolean")return t;if(typeof e[t]==="boolean")return e[t]?t:null;if(!(t in e))return t;return e[t]}});var lO=g(function(qge,nq){var rq=pd(),Uu=Ag();nq.exports=Gc;/*!
427
+ * ignore
428
+ */function Gc(e,t,r){if(t==null)return;if(Object.keys(t).some((u)=>u[0]==="$")){if(t.$push)o(t.$push);if(t.$addToSet)o(t.$addToSet);if(t.$set!=null){let u=Object.keys(t.$set);for(let a of u)cO(r,a,t.$set,e)}if(t.$setOnInsert!=null){let u=Object.keys(t.$setOnInsert);for(let a of u)cO(r,a,t.$setOnInsert,e)}}let i=Object.keys(t).filter((u)=>u[0]!=="$");for(let u of i)cO(r,u,t,e);function o(u){for(let a of Object.keys(u)){let c=r.path(rq(a));if(u[a]&&c&&c.$isMongooseDocumentArray&&c.schema.options.timestamps){let l=c.schema.options.timestamps,f=Uu(l,"createdAt"),h=Uu(l,"updatedAt");if(u[a].$each)u[a].$each.forEach(function(d){if(h!=null)d[h]=e;if(f!=null)d[f]=e;Gc(e,d,c.schema)});else{if(h!=null)u[a][h]=e;if(f!=null)u[a][f]=e;Gc(e,u[a],c.schema)}}}}}function Zoe(e,t,r){let n=t.schema.options.timestamps,s=e.length;if(!n){for(let u=0;u<s;++u)Gc(r,e[u],t.schema);return}let i=Uu(n,"createdAt"),o=Uu(n,"updatedAt");for(let u=0;u<s;++u){if(o!=null)e[u][o]=r;if(i!=null)e[u][i]=r;Gc(r,e[u],t.schema)}}function eue(e,t,r){let n=t.schema.options.timestamps;if(!n){Gc(r,e,t.schema);return}let s=Uu(n,"createdAt"),i=Uu(n,"updatedAt");if(i!=null)e[i]=r;if(s!=null)e[s]=r;Gc(r,e,t.schema)}function cO(e,t,r,n){let s=rq(t),i=e.path(s);if(!i)return;let o=[],u=s.split(".");for(let a=u.length-1;a>0;--a){let c=e.path(u.slice(0,a).join("."));if(c!=null&&(c.$isMongooseDocumentArray||c.$isSingleNested))o.push({parentPath:t.split(".").slice(0,a).join("."),parentSchemaType:c})}if(Array.isArray(r[t])&&i.$isMongooseDocumentArray)Zoe(r[t],i,n);else if(r[t]&&i.$isSingleNested)eue(r[t],i,n);else if(o.length>0)for(let a of o){let{parentPath:c,parentSchemaType:l}=a,f=l.schema.options.timestamps,h=Uu(f,"updatedAt");if(!f||h==null)continue;if(l.$isSingleNested)r[c+"."+h]=n;else if(l.$isMongooseDocumentArray){let d=t.substring(c.length+1);if(/^\d+$/.test(d)){r[c+"."+d][h]=n;continue}let p=d.indexOf(".");d=p!==-1?d.substring(0,p):d,r[c+"."+d+"."+h]=n}}else if(i.schema!=null&&i.schema!=e&&r[t]){let a=i.schema.options.timestamps,c=Uu(a,"createdAt"),l=Uu(a,"updatedAt");if(!a)return;if(l!=null)r[t][l]=n;if(c!=null)r[t][c]=n}}});var fO=g(function(jge,iq){/*!
429
+ * ignore
430
+ */var sq=be(),hO=Dr();iq.exports=tue;/*!
431
+ * ignore
432
+ */function tue(e,t,r,n,s,i,o){let u=n,a=u,c=s?.timestamps??!0;if(!c||u==null)return n;let l=c?.createdAt===!1,f=c?.updatedAt===!1;if(o){if(n?.$set)n=n.$set,u.$set={},a=u.$set;if(!f&&r&&!n[r])a[r]=e;if(!l&&t&&!n[t])a[t]=e;return u}if(n=n||{},Array.isArray(u)){if(r==null||f)return u;return u.push({$set:{[r]:e}}),u}if(u.$set=u.$set||{},!f&&r&&!n.$currentDate?.[r]){let h=!1;if(r.indexOf(".")!==-1){let d=r.split(".");for(let p=1;p<d.length;++p){let m=d.slice(-p).join("."),_=d.slice(0,-p).join(".");if(n[_]!=null){n[_][m]=e,h=!0;break}else if(n.$set?.[_]){n.$set[_][m]=e,h=!0;break}}}if(!h)u.$set[r]=e;if(Object.hasOwn(u,r))delete u[r]}if(!l&&t){let h=s?.overwriteImmutable,d=hO(n,t)!=null||hO(n.$set,t)!=null||hO(n.$setOnInsert,t)!=null;if(h&&d){if(n[t]!=null)u.$set[t]=n[t],delete n[t]}else{if(n[t])delete n[t];if(n.$set?.[t])delete n.$set[t];let p=!1;if(t.indexOf(".")!==-1){let m=t.split(".");for(let _=1;_<m.length;++_){let y=m.slice(-_).join("."),E=m.slice(0,-_).join(".");if(n[E]!=null){n[E][y]=e,p=!0;break}else if(n.$set?.[E]){n.$set[E][y]=e,p=!0;break}}}if(!p&&i)u.$setOnInsert=u.$setOnInsert||{},u.$setOnInsert[t]=e}}if(sq.hasOwnKeys(u.$set)===!1)delete u.$set;return u}});var uq=g(function(Lge,oq){oq.exports=function(t,r,n,s,i){let o=r?.updatedAt===!1,u=r?.createdAt===!1,a=n!=null?n():t.ownerDocument().constructor.base.now();if(!u&&(t.isNew||t.$isSubdocument)&&s&&!t.$__getValue(s)&&t.$__isSelected(s))t.$set(s,a,void 0,{overwriteImmutable:!0});if(!o&&i&&(t.isNew||t.$isModified())){let c=a;if(t.isNew&&s!=null)c=t.$__getValue(s);t.$set(i,c)}}});var hq=g(function(Uge,lq){var rue=lO(),nue=fO(),Og=Ag(),sue=uq(),Sg=Ao(),aq=new Set(["replaceOne","findOneAndReplace"]);lq.exports=function(t,r){let n=t.childSchemas.find(s);function s(l){return!!l.schema.options.timestamps}if(!r&&!n)return;let i=Og(r,"createdAt"),o=Og(r,"updatedAt"),u=r!=null&&Object.hasOwn(r,"currentTime")?r.currentTime:null,a={};if(t.$timestamps={createdAt:i,updatedAt:o},i&&!t.paths[i]){let f=t.base?.get("timestamps.createdAt.immutable")??null??!0;a[i]={[t.options.typeKey||"type"]:Date,immutable:f}}if(o&&!t.paths[o])a[o]=Date;t.add(a),t.pre("save",cq),t.methods.initializeTimestamps=function(l){if(l===!1)return this;let f=u!=null?u():this.constructor.base.now(),h=l!=null?Og(l,"createdAt"):i,d=l!=null?Og(l,"updatedAt"):o;if(h&&!this.get(h))this.$set(i,f);if(d&&!this.get(d))this.$set(o,f);if(this.$isSubdocument)return this;let p=this.$getAllSubdocs();for(let m of p)if(m.initializeTimestamps)m.initializeTimestamps(l);return this};let c={query:!0,model:!1};t.pre("findOneAndReplace",c,Yc),t.pre("findOneAndUpdate",c,Yc),t.pre("replaceOne",c,Yc),t.pre("update",c,Yc),t.pre("updateOne",c,Yc),t.pre("updateMany",c,Yc)};function cq(){let e=this.$__?.saveOptions?.timestamps;if(e===!1)return;let t=this.$__schema,{createdAt:r,updatedAt:n}=t.$timestamps,s=t.options.timestamps,i=s!=null&&Object.hasOwn(s,"currentTime")?s.currentTime:null;sue(this,e,i,r,n)}function Yc(){let e=this.model.schema,{createdAt:t,updatedAt:r}=e.$timestamps,n=e.options.timestamps,s=n!=null&&Object.hasOwn(n,"currentTime")?n.currentTime:null,i=s!=null?s():this.model.base.now();if(aq.has(this.op)&&this.getUpdate()==null)this.setUpdate({});nue(i,t,r,this.getUpdate(),this._mongooseOptions,this.options.upsert,aq.has(this.op)),rue(i,this.getUpdate(),this.model.schema)}cq[Sg.builtInMiddleware]=!0;Yc[Sg.builtInMiddleware]=!0});var pq=g(function(Vge,dq){var iue=ze(),fq=require("util");dq.exports=oue;function oue(e,t){if(typeof e==="string")return;if(typeof e==="function")return;throw new iue('Invalid ref at path "'+t+'". Got '+fq.inspect(e,{depth:0}))}});var md=g(function(_h){/*!
433
+ * ignore
434
+ */var mq=Object.freeze(["countDocuments","distinct","estimatedDocumentCount","find","findOne","findOneAndReplace","findOneAndUpdate","replaceOne","updateMany","updateOne","deleteMany","deleteOne","findOneAndDelete"]);_h.queryOperations=mq;/*!
435
+ * ignore
436
+ */var uue=mq.concat(["validate"]);_h.queryMiddlewareFunctions=uue;/*!
437
+ * ignore
438
+ */var aue=["aggregate"];_h.aggregateMiddlewareFunctions=aue;/*!
439
+ * ignore
440
+ */var cue=["bulkWrite","createCollection","insertMany"];_h.modelMiddlewareFunctions=cue;/*!
441
+ * ignore
442
+ */var lue=["validate","save","remove","updateOne","deleteOne","init"];_h.documentMiddlewareFunctions=lue});var Sq=g(function(Aq,Oq){/*!
443
+ * Module dependencies.
444
+ */var Cg=ng(),wg=de().arrayAtomicsSymbol,hue=de().arrayAtomicsBackupSymbol,yq=de().arrayParentSymbol,fue=de().arrayPathSymbol,gq=de().arraySchemaSymbol,_q=Array.prototype.push,Eq=/^\d+$/;function due(e,t,r,n){let s;if(Array.isArray(e)){let u=e.length;if(u===0)s=[];else if(u===1)s=[,],s[0]=e[0];else if(u<1e4)s=[],_q.apply(s,e);else{s=[];for(let a=0;a<u;++a)_q.call(s,e[a])}}else s=[];let i={[wg]:{},[hue]:void 0,[fue]:t,[gq]:n,[yq]:void 0,isMongooseArray:!0,isMongooseArrayProxy:!0,__array:s};if(e&&e[wg]!=null)i[wg]=e[wg];if(r?.$__)i[yq]=r,i[gq]=n||r.schema.path(t);let o=new Proxy(s,{get:function(u,a){if(Object.hasOwn(i,a))return i[a];if(Object.hasOwn(Cg,a))return Cg[a];if(n?.virtuals&&Object.hasOwn(n.virtuals,a))return n.virtuals[a].applyGetters(void 0,u);if(typeof a==="string"&&Eq.test(a)&&n?.embeddedSchemaType!=null)return n.embeddedSchemaType.applyGetters(s[a],r);return s[a]},set:function(u,a,c){if(typeof a==="string"&&Eq.test(a))Cg.set.call(o,a,c,!1);else if(Object.hasOwn(i,a))i[a]=c;else if(n?.virtuals&&Object.hasOwn(n.virtuals,a))n.virtuals[a].applySetters(c,u);else s[a]=c;return!0}});return o}/*!
445
+ * Module exports.
446
+ */Oq.exports=Aq=due});var Cq=g(function(Wge,wq){wq.exports=Te().Double});var Eh=g(function(Hge,Dq){/*!
447
+ * Module dependencies.
448
+ */var sc=Mr(),bq=Ao(),pue=xc(),bg=be();function zi(e,t,r,n){if(t?.default){let s=t.default;if(Array.isArray(s)&&s.length===0)t.default=Array;else if(!t.shared&&pue(s)&&bg.hasOwnKeys(s)===!1)t.default=function(){return{}}}sc.call(this,e,t,"Mixed",n),this[bq.schemaMixedSymbol]=!0}zi.schemaName="Mixed";zi.defaultOptions={};/*!
449
+ * Inherits from SchemaType.
450
+ */zi.prototype=Object.create(sc.prototype);zi.prototype.constructor=zi;zi.get=sc.get;zi.set=sc.set;zi.setters=[];zi.prototype.cast=function(e){if(e instanceof Error)return bg.errorToPOJO(e);return e};zi.prototype.castForQuery=function(e,t){return t};zi.prototype.toJSONSchema=function(t){return{}};/*!
451
+ * Module exports.
452
+ */Dq.exports=zi});var Mg=g(function(Kge,Nq){var mue=Eh(),yue=ze(),Tq=ar(),gue=be().deepEqual,_ue=be().isMongooseArray,Eue=Xn(),Aue=G2(),Mq=Fn(),Tg=require("util"),Fq=Xa(),Dg=Zn(),Oue=V2(),Pq=de().populateModelSymbol;/*!
453
+ * ignore
454
+ */class uu extends Map{constructor(e,t,r,n){if(Eue(e)==="Object")e=Object.keys(e).map((s)=>[s,e[s]]);super(e);this.$__parent=r?.$__!=null?r:null,this.$__path=t,this.$__schemaType=n==null?new mue(t):n,this.$__runDeferred()}$init(e,t){if(Bq(e),super.set(e,t),t?.$isSingleNested)t.$basePath=this.$__path+"."+e}$__set(e,t){super.set(e,t)}get(e,t){if(Dg(e,"ObjectId"))e=e.toString();if(t=t||{},t.getters===!1)return super.get(e);return this.$__schemaType.applyGetters(super.get(e),this.$__parent)}has(e){if(Dg(e,"ObjectId"))e=e.toString();return super.has(e)}set(e,t){if(Dg(e,"ObjectId"))e=e.toString();if(Bq(e),t=Aue(t),this.$__schemaType==null){this.$__deferred=this.$__deferred||[],this.$__deferred.push({key:e,value:t});return}let r,n=this.$__parent,s=n?.$__?.populated?n.$populated(o.call(this),!0)||n.$populated(this.$__path,!0):null,i=this.get(e);if(s!=null){if(this.$__schemaType.$isSingleNested)throw new yue(`Cannot manually populate single nested subdoc underneath Map at path "${this.$__path}". Try using an array instead of a Map.`);if(Array.isArray(t)&&this.$__schemaType.$isMongooseArray)t=t.map((u)=>{if(!Mq(u))u=new s.options[Pq](u);return u.$__.wasPopulated={value:u._doc._id},u});else if(t!=null){if(!Mq(t))t=new s.options[Pq](t);t.$__.wasPopulated={value:t._doc._id}}}else try{let u=this.$__schemaType.$isMongooseDocumentArray||this.$__schemaType.$isSingleNested||this.$__schemaType.$isMongooseArray||this.$__schemaType.$isSchemaMap?{path:o.call(this)}:null;t=this.$__schemaType.applySetters(t,this.$__parent,!1,this.get(e),u)}catch(u){if(this.$__parent?.$__!=null){this.$__parent.invalidate(o.call(this),u);return}throw u}if(super.set(e,t),n?.$__!=null&&!gue(t,i)){let u=o.call(this);if(n.markModified(u),_ue(t))t._registerAtomic("$set",t);if(this.$__schemaType.$isMongooseDocumentArray||this.$__schemaType.$isSingleNested)Oue(n,u)}function o(){if(r)return r;return r=this.$__path+"."+e,r}}clear(){super.clear();let e=this.$__parent;if(e!=null)e.markModified(this.$__path)}delete(e){if(Dg(e,"ObjectId"))e=e.toString();return this.set(e,void 0),super.delete(e)}toBSON(){return new Map(this)}toObject(e){if(e?.flattenMaps){let t={},r=this.keys();for(let n of r)t[n]=Tq(this.get(n),e);return t}return new Map(this)}$toObject(){return this.constructor.prototype.toObject.apply(this,arguments)}toJSON(e){if(typeof e?.flattenMaps==="boolean"?e.flattenMaps:!0){let t={},r=this.keys();for(let n of r)t[n]=Tq(this.get(n),e);return t}return new Map(this)}inspect(){return new Map(this)}$__runDeferred(){if(!this.$__deferred)return;for(let e of this.$__deferred)this.set(e.key,e.value);this.$__deferred=null}}if(Tg.inspect.custom)Object.defineProperty(uu.prototype,Tg.inspect.custom,{enumerable:!1,writable:!1,configurable:!1,value:uu.prototype.inspect});Object.defineProperty(uu.prototype,"$__set",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(uu.prototype,"$__parent",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(uu.prototype,"$__path",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(uu.prototype,"$__schemaType",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(uu.prototype,"$isMongooseMap",{enumerable:!1,writable:!1,configurable:!1,value:!0});Object.defineProperty(uu.prototype,"$__deferredCalls",{enumerable:!1,writable:!1,configurable:!1,value:!0});function Bq(e){let t=typeof e;if(t!=="string")throw TypeError(`Mongoose maps only support string keys, got ${t}`);if(e.startsWith("$"))throw Error(`Mongoose maps do not support keys that start with "$", got "${e}"`);if(e.includes("."))throw Error(`Mongoose maps do not support keys that contain ".", got "${e}"`);if(Fq.has(e))throw Error(`Mongoose maps do not support reserved key name "${e}"`)}Nq.exports=uu});var Rq=g(function(Gge,Iq){Iq.exports=Te().UUID});var Ah=g(function(Wi){/*!
455
+ * Module exports.
456
+ */Wi.Array=Sq();Wi.Buffer=k2();Wi.Document=Wi.Embedded=ph();Wi.DocumentArray=Hc();Wi.Double=Cq();Wi.Decimal128=T2();Wi.ObjectId=Qa();Wi.Map=Mg();Wi.Subdocument=X2();Wi.UUID=Rq()});var vq=g(function(Jge,$q){var Sue=js();class yd extends Sue{}var dO=si();Object.defineProperty(yd.prototype,"enum",dO);Object.defineProperty(yd.prototype,"of",dO);Object.defineProperty(yd.prototype,"castNonArrays",dO);/*!
457
+ * ignore
458
+ */$q.exports=yd});var kq=g(function(Qge,xq){xq.exports=pO;function pO(e){if(!Array.isArray(e))return{min:0,max:0,containsNonArrayItem:!0};if(e.length===0)return{min:1,max:1,containsNonArrayItem:!1};if(e.length===1&&!Array.isArray(e[0]))return{min:1,max:1,containsNonArrayItem:!1};let t=pO(e[0]);for(let r=1;r<e.length;++r){let n=pO(e[r]);if(n.min<t.min)t.min=n.min;if(n.max>t.max)t.max=n.max;t.containsNonArrayItem=t.containsNonArrayItem||n.containsNonArrayItem}return t.min=t.min+1,t.max=t.max+1,t}});var gd=g(function(Xge,qq){qq.exports=function(t){if(t==null)return t;if(t==="")return null;if(typeof t==="string"||typeof t==="boolean")t=Number(t);if(isNaN(t))throw Error("Cast to Number failed: value is not a valid number");if(t instanceof Number)return t.valueOf();if(typeof t==="number")return t;if(!Array.isArray(t)&&typeof t.valueOf==="function")return Number(t.valueOf());if(t.toString&&!Array.isArray(t)&&t.toString()==Number(t))return Number(t);throw Error("Cast to Number failed: value is not a valid number")}});var mO=g(function(Zge,jq){jq.exports=function(t){if(t==null||typeof t!=="object")return t;if(Array.isArray(t)){for(let r=t.length-1;r>=0;--r)if(t[r]===void 0)t.splice(r,1)}for(let r of Object.keys(t))if(t[r]===void 0)delete t[r];return t}});var zq=g(function(e_e,Vq){var Oh=es(),Uq=ec(),Pg=gd(),wue=nu(),Lq=mO(),Cue=new Set(["$and","$or"]),bue=new Set(["$cmp","$eq","$lt","$lte","$gt","$gte"]),Due=new Set(["$multiply","$divide","$log","$mod","$trunc","$avg","$max","$min","$stdDevPop","$stdDevSamp","$sum"]),Tue=new Set(["$abs","$exp","$ceil","$floor","$ln","$log10","$sqrt","$sin","$cos","$tan","$asin","$acos","$atan","$atan2","$asinh","$acosh","$atanh","$sinh","$cosh","$tanh","$degreesToRadians","$radiansToDegrees"]),Mue=new Set(["$arrayElemAt","$first","$last"]),Pue=new Set(["$year","$month","$week","$dayOfMonth","$dayOfYear","$hour","$minute","$second","$isoDayOfWeek","$isoWeekYear","$isoWeek","$millisecond"]),Bue=new Set(["$not"]);Vq.exports=function(t,r,n){if(typeof t==="boolean")return t;if(typeof t!=="object"||t===null)throw Error("`$expr` must be an object or boolean literal");return Ls(t,r,n)};function Ls(e,t,r){if(_d(e)||e===null)return e;if(e.$cond!=null)if(Array.isArray(e.$cond))e.$cond=e.$cond.map((s)=>Ls(s,t,r));else e.$cond.if=Ls(e.$cond.if,t,r),e.$cond.then=Ls(e.$cond.then,t,r),e.$cond.else=Ls(e.$cond.else,t,r);else if(e.$ifNull!=null)e.$ifNull.map((s)=>Ls(s,t,r));else if(e.$switch!=null){if(Array.isArray(e.$switch.branches))for(let s of e.$switch.branches){if(s?.case!=null)s.case=Ls(s.case,t,r);if(s?.then!=null)s.then=Ls(s.then,t,r);Lq(s)}if("default"in e.$switch)e.$switch.default=Ls(e.$switch.default,t,r)}let n=Object.keys(e);for(let s of n)if(Cue.has(s))e[s]=e[s].map((i)=>Ls(i,t,r));else if(bue.has(s))e[s]=Iue(e[s],t,r);else if(Due.has(s))e[s]=Nue(e[s],t,r);else if(Tue.has(s))e[s]=yO(e[s],t,r);else if(Bue.has(s))e[s]=Ls(e[s],t,r);if(e.$in)e.$in=Fue(e.$in,t,r);if(e.$size)e.$size=yO(e.$size,t,r);if(e.$round){let s=e.$round;if(!Array.isArray(s)||s.length<1||s.length>2)throw new Oh("Array",s,"$round");e.$round=s.map((i)=>yO(i,t,r))}return Lq(e),e}function yO(e){if(!Ed(e))return e;try{return Pg(e)}catch{throw new Oh("Number",e)}}function Fue(e,t,r){let n=e[1];if(!_d(n))return e;let s=e[0],i=t.path(n.slice(1));if(i===null){if(r===!1)return e;else if(r==="throw")throw new Uq("$in");return}if(!i.$isMongooseArray)throw Error("Path must be an array for $in");if(!Ed(s)&&(typeof s==="string"||wue(s)))return[Ls(s,t,r),n];if(typeof s==="object"&&s!=null&&s.$literal!=null)return[{$literal:i.embeddedSchemaType.cast(s.$literal)},n];return[i.embeddedSchemaType.cast(s),n]}function Nue(e){if(!Array.isArray(e)){if(!Ed(e))return e;try{return Pg(e)}catch{throw new Oh("Number",e)}}return e.map((t)=>{if(!Ed(t))return t;try{return Pg(t)}catch{throw new Oh("Number",t)}})}function Iue(e,t,r){if(!Array.isArray(e)||e.length!==2)throw Error("Comparison operator must be an array of length 2");e[0]=Ls(e[0],t,r);let n=e[0];if(Ed(e[1])){let s=null,i=null,o=null;if(_d(n))s=n.slice(1),i=t.path(s);else if(typeof n==="object"&&n!=null){for(let a of Object.keys(n))if(Pue.has(a)&&_d(n[a]))s=n[a].slice(1)+"."+a,o=Pg;else if(Mue.has(a)&&_d(n[a])){if(s=n[a].slice(1)+"."+a,i=t.path(n[a].slice(1)),i!=null){if(i.$isMongooseArray)i=i.embeddedSchemaType}}}let u=typeof e[1]==="object"&&e[1]!=null&&e[1].$literal!=null;if(i!=null)if(u)e[1]={$literal:i.cast(e[1].$literal)};else e[1]=i.cast(e[1]);else if(o!=null)if(u)try{e[1]={$literal:o(e[1].$literal)}}catch{throw new Oh(o.name.replace(/^cast/,""),e[1],s+".$literal")}else try{e[1]=o(e[1])}catch{throw new Oh(o.name.replace(/^cast/,""),e[1],s)}else if(s!=null&&r===!0)return;else if(s!=null&&r==="throw")throw new Uq(s)}else e[1]=Ls(e[1],t,r);return e}function _d(e){return typeof e==="string"&&e[0]==="$"}function Ed(e){if(typeof e==="string"&&e[0]==="$")return!1;if(typeof e==="object"&&e!==null&&Object.keys(e).find((t)=>t[0]==="$"))return e.$literal!=null;return!0}});var Bg=g(function(t_e,Wq){var Rue=es();Wq.exports=function(t,r){if(t==null)return t;if(typeof t?._id==="string")return t._id;if(t.toString&&t.toString!==Object.prototype.toString&&!Array.isArray(t))return t.toString();throw new Rue("string",t,r)}});var Yq=g(function(r_e,Gq){var $ue=es(),Hq=N2(),Kq=Bg();Gq.exports=function(t,r){if(t==null||typeof t!=="object")throw new $ue("$text",t,r);if(t.$search!=null)t.$search=Kq(t.$search,r+".$search");if(t.$language!=null)t.$language=Kq(t.$language,r+".$language");if(t.$caseSensitive!=null)t.$caseSensitive=Hq(t.$caseSensitive,r+".$caseSensitive");if(t.$diacriticSensitive!=null)t.$diacriticSensitive=Hq(t.$diacriticSensitive,r+".$diacriticSensitive");return t}});var gO=g(function(n_e,Jq){var vue=nu();Jq.exports=function(t){if(!vue(t))return t;let r=Object.keys(t);if(r.length!==1)return t;if(r[0]==="$eq")return t.$eq;if(r[0]==="$in"&&Array.isArray(t.$in)&&t.$in.length===1)return t.$in[0];return t}});var Sh=g(function(s_e,Qq){var xue=new Set(["$ref","$id","$db"]);Qq.exports=function(t){return t[0]==="$"&&!xue.has(t)}});var Ad=g(function(Xq){Xq.logicalOperators=new Set(["$and","$or","$nor"])});var Jc=g(function(o_e,sj){/*!
459
+ * Module dependencies.
460
+ */var kue=oi(),Zq=es(),_O=ec(),rj=Od(),que=zq(),jue=Bg(),Lue=Yq(),Uue=Dr(),ej=gO(),Vue=iu(),tj=K2(),EO=Sh(),{logicalOperators:zue}=Ad(),nj=require("util"),OO=xc(),AO=td(),Fg=be(),Wue=["Polygon","MultiPolygon"];sj.exports=function e(t,r,n,s){if(Array.isArray(r))throw Error("Query filter must be an object, got an array "+nj.inspect(r));if(r==null)return r;if(t?.discriminators!=null&&r[t.options.discriminatorKey]!=null){let p=ej(r[t.options.discriminatorKey]);t=tj(t,p)||t}let i=Object.keys(r),o=i.length,u,a,c,l,f,h,d;n=n||{};while(o--)if(f=i[o],d=r[f],zue.has(f)){if(!Array.isArray(d))throw new Zq("Array",d,f);for(let p=d.length-1;p>=0;p--){if(d[p]==null||typeof d[p]!=="object")throw new Zq("Object",d[p],f+"."+p);let m=Object.keys(d[p]).length,_=d[p][t.options.discriminatorKey];if(_==null)d[p]=e(t,d[p],n,s);else{let y=tj(s.schema,_);d[p]=e(y?y:t,d[p],n,s)}if(Fg.hasOwnKeys(d[p])===!1&&m!==0)d.splice(p,1)}if(d.length===0)delete r[f]}else if(f==="$where"){if(h=typeof d,h!=="string"&&h!=="function")throw Error("Must have a string or function for $where");if(h==="function")r[f]=d.toString();continue}else if(f==="$expr"){d=que(d,t);continue}else if(f==="$elemMatch")d=e(t,d,n,s);else if(f==="$text")d=Lue(d,f);else if(f==="$comment"&&!Object.hasOwn(t.paths,"$comment"))d=jue(d,f),r[f]=d;else if(EO(f))continue;else{if(!t)continue;if(c=t.path(f),!c){let p=f.split("."),m=p.length;while(m--){let _=p.slice(0,m).join("."),y=p.slice(m).join("."),E=t.path(_),C=E?.schema?.options?.discriminatorKey;if(E?.schema?.discriminators!=null&&C!=null&&y!==C){let D=ej(Uue(r,_+"."+C)),A=E.schema.discriminators,P=typeof D==="string"?kue(A,D):null;if(P!=null)c=P.path(y)}}}if(!c){let p=f.split("."),m=p.length,_,y,E;while(m--)if(_=p.slice(0,m).join("."),c=t.path(_),c)break;if(c){if(c.schema){E={},y=p.slice(m).join("."),E[y]=d;let A=e(c.schema,E,n,s)[y];if(A===void 0)delete r[f];else r[f]=A}else r[f]=d;continue}if(OO(d)){let A="";if(d.$near)A="$near";else if(d.$nearSphere)A="$nearSphere";else if(d.$within)A="$within";else if(d.$geoIntersects)A="$geoIntersects";else if(d.$geoWithin)A="$geoWithin";if(A){let P=new rj.Number("__QueryCasting__",null,null,t),S=d[A];if(d.$maxDistance!=null)d.$maxDistance=P.castForQuery(null,d.$maxDistance,s);if(d.$minDistance!=null)d.$minDistance=P.castForQuery(null,d.$minDistance,s);if(A==="$within"){let B=S.$center||S.$centerSphere||S.$box||S.$polygon;if(!B)throw Error("Bad $within parameter: "+JSON.stringify(d));S=B}else if(A==="$near"&&typeof S.type==="string"&&Array.isArray(S.coordinates))S=S.coordinates;else if((A==="$near"||A==="$nearSphere"||A==="$geoIntersects")&&S.$geometry&&typeof S.$geometry.type==="string"&&Array.isArray(S.$geometry.coordinates)){if(S.$maxDistance!=null)S.$maxDistance=P.castForQuery(null,S.$maxDistance,s);if(S.$minDistance!=null)S.$minDistance=P.castForQuery(null,S.$minDistance,s);if(AO(S.$geometry))S.$geometry=S.$geometry.toObject({transform:!1,virtuals:!1});S=S.$geometry.coordinates}else if(A==="$geoWithin"){if(S.$geometry){if(AO(S.$geometry))S.$geometry=S.$geometry.toObject({virtuals:!1});let B=S.$geometry.type;if(Wue.indexOf(B)===-1)throw Error('Invalid geoJSON type for $geoWithin "'+B+'", must be "Polygon" or "MultiPolygon"');S=S.$geometry.coordinates}else if(S=S.$box||S.$polygon||S.$center||S.$centerSphere,AO(S))S=S.toObject({virtuals:!1})}SO(S,P,s);continue}}if(Vue(t.nested,f))continue;let C="strict"in n?n.strict:t.options.strict,D=Hue(n,t._userProvidedOptions,t.options,s);if(n.upsert&&C){if(C==="throw")throw new _O(f);throw new _O(f,'Path "'+f+'" is not in schema, strict mode is `true`, and upsert is `true`.')}if(D==="throw")throw new _O(f,'Path "'+f+`" is not in schema and strictQuery is 'throw'.`);else if(D)delete r[f]}else if(d==null)continue;else if(Fg.isPOJO(d))if(a=Object.keys(d).some(EO),!a)r[f]=c.castForQuery(null,d,s);else{let p=Object.keys(d),m,_=p.length;while(_--)if(m=p[_],l=d[m],m==="$elemMatch"){if(l&&c?.schema!=null)e(c.schema,l,n,s);else if(l&&c?.$isMongooseArray)d[m]=c.castForQuery(m,l,s)}else if(m==="$not"){if(l&&c){if(u=Object.keys(l),u.length&&EO(u[0]))for(let y in l)l[y]=c.castForQuery(y,l[y],s);else d[m]=c.castForQuery(m,l,s);continue}}else d[m]=c.castForQuery(m,l,s)}else if(Array.isArray(d)&&["Buffer","Array"].indexOf(c.instance)===-1&&!n.sanitizeFilter){let p=[],m=d;for(let _ of m)p.push(c.castForQuery(null,_,s));r[f]={$in:p}}else r[f]=c.castForQuery(null,d,s)}return r};function SO(e,t,r){if(Array.isArray(e))e.forEach(function(n,s){if(Array.isArray(n)||OO(n))return SO(n,t,r);e[s]=t.castForQuery(null,n,r)});else{let n=Object.keys(e),s=n.length;while(s--){let i=n[s],o=e[i];if(Array.isArray(o)||OO(o))SO(o,t,r),e[i]=o;else e[i]=t.castForQuery(null,o,r)}}}function Hue(e,t,r,n){if("strictQuery"in e)return e.strictQuery;if("strictQuery"in t)return t.strictQuery;let s=n?.mongooseCollection?.conn?.base?.options;if(s){if("strictQuery"in s)return s.strictQuery}return r.strictQuery}});var oj=g(function(u_e,ij){var Kue=js();class wh extends Kue{}var Ng=si();Object.defineProperty(wh.prototype,"min",Ng);Object.defineProperty(wh.prototype,"max",Ng);Object.defineProperty(wh.prototype,"enum",Ng);Object.defineProperty(wh.prototype,"populate",Ng);/*!
461
+ * ignore
462
+ */ij.exports=wh});var Sd=g(function(a_e,aj){/*!
463
+ * Module requirements.
464
+ */var Gue=es();/*!
465
+ * ignore
466
+ */function Yue(e){let t=this;if(Array.isArray(e))return e.map(function(r){return uj(t.path,r)});else if(Buffer.isBuffer(e))return e;return uj(t.path,e)}/*!
467
+ * ignore
468
+ */function uj(e,t){let r=Number(t);if(isNaN(r))throw new Gue("number",t,e);return r}aj.exports=Yue});var wO=g(function(c_e,lj){/*!
469
+ * Module requirements.
470
+ */var Vu=ni(),Jue=oj(),_n=Mr(),Que=gd(),Ig=Sd(),Ch=be(),Xue=Li(),cj=_n.CastError;function tr(e,t,r,n){this.enumValues=[],_n.call(this,e,t,"Number",n)}tr.get=_n.get;tr.set=_n.set;tr.setters=[];/*!
471
+ * ignore
472
+ */tr._cast=Que;tr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
473
+ * ignore
474
+ */tr._defaultCaster=(e)=>{if(typeof e!=="number")throw Error();return e};tr.schemaName="Number";tr.defaultOptions={};/*!
475
+ * Inherits from SchemaType.
476
+ */tr.prototype=Object.create(_n.prototype);tr.prototype.constructor=tr;tr.prototype.OptionsConstructor=Jue;/*!
477
+ * ignore
478
+ */tr._checkRequired=(e)=>typeof e==="number"||e instanceof Number;tr.checkRequired=_n.checkRequired;tr.prototype.checkRequired=function(t,r){if(typeof t==="object"&&_n._isRef(this,t,r,!0))return t!=null;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():tr.checkRequired())(t)};tr.prototype.min=function(e,t){if(this.minValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.minValidator},this);if(e!=null){let r=t||Vu.messages.Number.min;if(typeof r==="string")r=r.replace(/{MIN}/,e);this.validators.push({validator:this.minValidator=function(n){return n==null||n>=e},message:r,type:"min",min:e})}return this};tr.prototype.max=function(e,t){if(this.maxValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.maxValidator},this);if(e!=null){let r=t||Vu.messages.Number.max;if(typeof r==="string")r=r.replace(/{MAX}/,e);this.validators.push({validator:this.maxValidator=function(n){return n==null||n<=e},message:r,type:"max",max:e})}return this};tr.prototype.enum=function(e,t){if(this.enumValidator)this.validators=this.validators.filter(function(n){return n.validator!==this.enumValidator},this),this.enumValidator=!1;if(e==null||e===!1)return this.enumValues=[],delete this.options.enum,this;if(!Array.isArray(e)){if(Ch.isPOJO(e)&&e.values!=null)t=e.message,e=e.values;else if(typeof e==="number")e=Array.prototype.slice.call(arguments),t=null;if(Ch.isPOJO(e)){let s=Object.keys(e).sort(),i=Object.values(e).sort();if(s.length===i.length&&s.every((o,u)=>o===String(i[u]))&&i.filter((o)=>typeof o==="number").length===Math.floor(i.length/2))e=i.filter((o)=>typeof o==="number");else e=Object.values(e)}t=t||Vu.messages.Number.enum}t=t==null?Vu.messages.Number.enum:t;for(let n of e)if(n!==void 0)this.enumValues.push(this.cast(n));let r=this.enumValues;return this.enumValidator=(n)=>n==null||r.indexOf(n)!==-1,this.validators.push({validator:this.enumValidator,message:t,type:"enum",enumValues:r}),this};tr.prototype.cast=function(e,t,r,n,s){if(typeof e!=="number"&&_n._isRef(this,e,t,r)){if(e==null||Ch.isNonBuiltinObject(e))return this._castRef(e,t,r,s)}let i=e?._id!==void 0?e._id:e,o;if(typeof this._castFunction==="function")o=this._castFunction;else if(typeof this.constructor.cast==="function")o=this.constructor.cast();else o=tr.cast();try{return o(i)}catch(u){throw new cj("Number",i,this.path,u,this)}};/*!
479
+ * ignore
480
+ */function Rg(e){return this.cast(e)}function Zue(e){let t=this;if(!Array.isArray(e))return[this.cast(e)];return e.map(function(r){return t.cast(r)})}var eae={..._n.prototype.$conditionalHandlers,$bitsAllClear:Ig,$bitsAnyClear:Ig,$bitsAllSet:Ig,$bitsAnySet:Ig,$gt:Rg,$gte:Rg,$lt:Rg,$lte:Rg,$mod:Zue};Object.defineProperty(tr.prototype,"$conditionalHandlers",{enumerable:!1,value:eae});tr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Xue(this.$conditionalHandlers,e),!n)throw new Vu("Can't use "+e+" with Number.");return n.call(this,t,r)}try{t=this.applySetters(t,r)}catch(s){if(s instanceof cj&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}return t};tr.prototype.toJSONSchema=function(t){return this._addJSONSchemaEnum(this._createJSONSchemaTypeDefinition("number","number",t))};/*!
481
+ * Module exports.
482
+ */lj.exports=tr});var wd=g(function(CO){/*!
483
+ * Module requirements.
484
+ */var hj=wO();/*!
485
+ * ignore
486
+ */CO.castToNumber=fj;CO.castArraysOfNumbers=dj;/*!
487
+ * ignore
488
+ */function fj(e){return hj.cast()(e)}function dj(e,t){e.forEach(function(r,n){if(Array.isArray(r))dj(r,t);else e[n]=fj.call(t,r)})}});var TO=g(function($g){/*!
489
+ * Module requirements.
490
+ */var pj=wd().castArraysOfNumbers,Cd=wd().castToNumber;/*!
491
+ * ignore
492
+ */$g.cast$geoIntersects=nae;$g.cast$near=tae;$g.cast$within=rae;function tae(e){let t=vg();if(Array.isArray(e))return pj(e,this),e;if(DO(this,e),e?.$geometry)return bO(e,this);if(!Array.isArray(e))throw TypeError("$near must be either an array or an object with a $geometry property");return t.prototype.castForQuery.call(this,null,e)}function bO(e,t){switch(e.$geometry.type){case"Polygon":case"LineString":case"Point":pj(e.$geometry.coordinates,t);break;default:break}return DO(t,e),e}function rae(e){if(DO(this,e),e.$box||e.$polygon){let t=e.$box?"$box":"$polygon";e[t].forEach((r)=>{if(!Array.isArray(r)){let n="Invalid $within $box argument. Expected an array, received "+r;throw TypeError(n)}r.forEach((n,s)=>{r[s]=Cd.call(this,n)})})}else if(e.$center||e.$centerSphere){let t=e.$center?"$center":"$centerSphere";e[t].forEach((r,n)=>{if(Array.isArray(r))r.forEach((s,i)=>{r[i]=Cd.call(this,s)});else e[t][n]=Cd.call(this,r)})}else if(e.$geometry)bO(e,this);return e}function nae(e){if(!e.$geometry)return;return bO(e,this),e}function DO(e,t){if(t.$maxDistance)t.$maxDistance=Cd.call(e,t.$maxDistance);if(t.$minDistance)t.$minDistance=Cd.call(e,t.$minDistance)}});var vg=g(function(f_e,_j){/*!
493
+ * Module dependencies.
494
+ */var sae=I2(),iae=f4(),gj=ze(),oae=vq(),rr=Mr(),xg=rr.CastError,kg=Eh(),uae=rO(),mj=_g(),aae=kq(),PO=Jc(),cae=ar(),lae=Xn(),yj=Sh(),ic=require("util"),En=be(),hae=wd().castToNumber,bh=TO(),fae=oi(),dae=Vi(),pae=Li(),bd,MO,mae=Object.freeze({});function lt(e,t,r,n,s){MO||(MO=Ah().Embedded);let i="type";if(n?.typeKey)i=n.typeKey;if(this.schemaOptions=n,t){let a={};if(En.isPOJO(t))if(t[i])a=cae(t),delete a[i],t=t[i];else t=kg;if(r?.ref!=null&&a.ref==null)a.ref=r.ref;if(t===Object)t=kg;let c=typeof t==="string"?t:En.getFunctionName(t),l=Od(),f=Object.hasOwn(l,c)?l[c]:t;if(typeof f==="function")if(f===lt)this.embeddedSchemaType=new f(e,a,n,null,s);else this.embeddedSchemaType=new f(e,a,n,s);else if(f instanceof rr){if(this.embeddedSchemaType=f,!(this.embeddedSchemaType instanceof MO))this.embeddedSchemaType.path=e}}this.$isMongooseArray=!0,rr.call(this,e,r,"Array",s);let o,u;if(this.defaultValue!=null)o=this.defaultValue,u=typeof o==="function";if(!("defaultValue"in this)||this.defaultValue!=null){let a=function(){return u?o.call(this):o!=null?[].concat(o):[]};a.$runBeforeSetters=!u,this.default(a)}}lt.schemaName="Array";lt.options={castNonArrays:!0};/*!
495
+ * ignore
496
+ */lt.defaultOptions={};lt.set=rr.set;lt.setters=[];lt.get=rr.get;/*!
497
+ * Inherits from SchemaType.
498
+ */lt.prototype=Object.create(rr.prototype);lt.prototype.constructor=lt;lt.prototype.OptionsConstructor=oae;/*!
499
+ * ignore
500
+ */lt._checkRequired=rr.prototype.checkRequired;lt.checkRequired=rr.checkRequired;/*!
501
+ * Virtuals defined on this array itself.
502
+ */lt.prototype.virtuals=null;lt.prototype.checkRequired=function(t,r){if(typeof t==="object"&&rr._isRef(this,t,r,!0))return!!t;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():lt.checkRequired())(t)};lt.prototype.enum=function(){let e=this;while(!0){let r=e?.embeddedSchemaType?.instance;if(r==="Array"){e=e.embeddedSchemaType;continue}if(r!=="String"&&r!=="Number")throw Error("`enum` can only be set on an array of strings or numbers , not "+r);break}let t=arguments;if(!Array.isArray(arguments)&&En.isObject(arguments))t=En.object.vals(t);return e.embeddedSchemaType.enum.apply(e.embeddedSchemaType,t),this};lt.prototype.applyGetters=function(e,t){if(t?.$__!=null&&t.$populated(this.path))return e;return rr.prototype.applyGetters.call(this,e,t)};lt.prototype._applySetters=function(e,t,r,n){if(this.embeddedSchemaType.$isMongooseArray&&e!=null&&e.length!==0){let s=[],i=this;while(i!=null&&i.$isMongooseArray&&!i.$isMongooseDocumentArray)s.push(i),i=i.embeddedSchemaType;let o=aae(e);if(o.min===o.max&&o.max<s.length&&o.containsNonArrayItem&&s.slice(o.max).every((u)=>u.options.castNonArrays??lt.options.castNonArrays))for(let u=o.max;u<s.length;++u)e=[e]}return rr.prototype._applySetters.call(this,e,t,r,n)};lt.prototype.cast=function(e,t,r,n,s){bd||(bd=Ah().Array);let i,o;if(Array.isArray(e)){if(!e.length&&t){let d=t.schema.indexedPaths(),p=this.path;for(i=0,o=d.length;i<o;++i){let _=d[i][0][p];if(_==="2dsphere"||_==="2d")return}let m=this.path.endsWith(".coordinates")?this.path.substring(0,this.path.lastIndexOf(".")):null;if(m!=null){for(i=0,o=d.length;i<o;++i)if(d[i][0][m]==="2dsphere")return}}s=s||mae;let c=En.isMongooseArray(e)?e.__array:e,l=s.path||this.path;if(s.arrayPathIndex!=null)l+="."+s.arrayPathIndex;if(e=bd(c,l,t,this),c=e.__array,r&&t?.$__!=null&&t.$populated(this.path))return e;let f=this.embeddedSchemaType,h=f.$isMongooseArray;if(f&&this.embeddedSchemaType.constructor!==kg)try{let d=c.length;for(i=0;i<d;i++){let p={};if(h){if(s.arrayPath!=null)p.arrayPathIndex=i;else if(f._arrayParentPath!=null)p.arrayPathIndex=i}if(s.hydratedPopulatedDocs)p.hydratedPopulatedDocs=s.hydratedPopulatedDocs;if(s.virtuals)p.virtuals=s.virtuals;if(c[i]===void 0&&f.defaultValue!==void 0)c[i]=f.getDefault(t,r,null,p);else c[i]=f.applySetters(c[i],t,r,void 0,p)}}catch(d){throw new xg("["+d.kind+"]",ic.inspect(e),this.path+"."+i,d,this)}return e}let u=this.options.castNonArrays??lt.options.castNonArrays;if(r||u){if(t&&r)t.markModified(this.path);return this.cast([e],t,r)}throw new xg("Array",ic.inspect(e),this.path,null,this)};/*!
503
+ * ignore
504
+ */lt.prototype._castForPopulate=function(t,r){if(bd||(bd=Ah().Array),Array.isArray(t)){let n,s=t.__array?t.__array:t,i=s.length;if(this.embeddedSchemaType&&this.embeddedSchemaType.constructor!==kg)try{for(n=0;n<i;n++){let o={};if(this.embeddedSchemaType.$isMongooseArray&&this.embeddedSchemaType._arrayParentPath!=null)o.arrayPathIndex=n;s[n]=this.embeddedSchemaType.cast(s[n],r,!1,void 0,o)}}catch(o){throw new xg("["+o.kind+"]",ic.inspect(t),this.path+"."+n,o,this)}return t}throw new xg("Array",ic.inspect(t),this.path,null,this)};lt.prototype.$toObject=lt.prototype.toObject;/*!
505
+ * ignore
506
+ */lt.prototype.discriminator=function(...e){let t=this;while(t.$isMongooseArray&&!t.$isMongooseDocumentArray)t=t.embeddedSchemaType;if(!t.$isMongooseDocumentArray)throw new gj("You can only add an embedded discriminator on a document array, "+this.path+" is a plain array");return t.discriminator(...e)};/*!
507
+ * ignore
508
+ */lt.prototype.clone=function(){let e=Object.assign({},this.options),t=new this.constructor(this.path,this.embeddedSchemaType,e,this.schemaOptions,this.parentSchema);if(t.validators=this.validators.slice(),this.requiredValidator!==void 0)t.requiredValidator=this.requiredValidator;return t};lt.prototype._castForQuery=function(e,t){let r=this.embeddedSchemaType,n=r?.schema?.options?.discriminatorKey,s=r?.discriminators;if(e&&s&&typeof n==="string"){let i=fae(s,e[n]);if(i)r=i;else{let o=dae(s,e[n]);if(o)r=o}}if(Array.isArray(e)){for(let i=this.setters.length-1;i>=0;i--)e=this.setters[i].call(this,e,this);e=e.map(function(i){if(En.isObject(i)&&i.$elemMatch)return i;return r.castForQuery(null,i,t)})}else e=r.castForQuery(null,e,t);return e};lt.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=pae(this.$conditionalHandlers,e),!n)throw Error("Can't use "+e+" with Array.");return n.call(this,t,r)}else return this._castForQuery(t,r)};lt.prototype.virtual=function(t,r){if(t instanceof mj||lae(t)==="VirtualType")return this.virtual(t.path,t.options);if(r=new uae(r),En.hasUserDefinedProperty(r,["ref","refPath"]))throw new gj("Cannot set populate virtual as a property of an array");let n=new mj(r,t);if(this.virtuals===null)this.virtuals={};return this.virtuals[t]=n,n};function yae(e,t){if(!Array.isArray(e))e=[e];return e=e.map((r)=>{if(!En.isObject(r))return r;if(r.$elemMatch!=null)return{$elemMatch:PO(this.embeddedSchemaType.schema,r.$elemMatch,null,this?.$$context)};let n={};return n[this.path]=r,PO(this.embeddedSchemaType.schema,n,null,this?.$$context)[this.path]},this),this.castForQuery(null,e,t)}function gae(e,t){let r=Object.keys(e),n=r.length;for(let s=0;s<n;++s){let i=r[s],o=e[i];if(i==="$not"){if(En.isPOJO(o)){for(let u of Object.keys(o))if(yj(u)&&o[u]!=null)o[u]=this.castForQuery(u,o[u],t)}continue}if(yj(i)&&o!=null)e[i]=this.castForQuery(i,o,t)}return e}var Xt=lt.prototype.$conditionalHandlers={};Xt.$all=yae;Xt.$options=String;Xt.$elemMatch=gae;Xt.$geoIntersects=bh.cast$geoIntersects;Xt.$or=BO("$or");Xt.$and=BO("$and");Xt.$nor=BO("$nor");function BO(e){return function(r,n){if(!Array.isArray(r))throw TypeError("conditional "+e+" requires an array");let s=[];for(let i of r)s.push(PO(this.embeddedSchemaType.schema??n.schema,i,null,this?.$$context));return s}}Xt.$near=Xt.$nearSphere=bh.cast$near;Xt.$within=Xt.$geoWithin=bh.cast$within;Xt.$size=Xt.$minDistance=Xt.$maxDistance=hae;Xt.$exists=sae;Xt.$type=iae;Xt.$eq=Xt.$gt=Xt.$gte=Xt.$lt=Xt.$lte=Xt.$not=Xt.$regex=Xt.$ne=lt.prototype._castForQuery;Xt.$nin=rr.prototype.$conditionalHandlers.$nin;Xt.$in=rr.prototype.$conditionalHandlers.$in;lt.prototype.toJSONSchema=function(t){let r=this.getEmbeddedSchemaType();return{...this._createJSONSchemaTypeDefinition("array","array",t),items:r.toJSONSchema(t)}};lt.prototype.autoEncryptionType=function(){return"array"};/*!
509
+ * Module exports.
510
+ */_j.exports=lt});var Oj=g(function(d_e,Aj){var{Long:_ae}=Te(),FO=9223372036854775807n,NO=-9223372036854775808n,Ej=`Mongoose only supports BigInts between ${NO} and ${FO} because MongoDB does not support arbitrary precision integers`;Aj.exports=function(t){if(t==null)return t;if(t==="")return null;if(typeof t==="bigint"){if(t>FO||t<NO)throw Error(Ej);return t}if(t instanceof _ae)return t.toBigInt();if(typeof t==="string"||typeof t==="number"){if(t=BigInt(t),t>FO||t<NO)throw Error(Ej);return t}throw Error(`Cannot convert value to BigInt: "${t}"`)}});var Cj=g(function(p_e,wj){/*!
511
+ * Module dependencies.
512
+ */var Sj=es(),Hi=Mr(),Eae=Oj(),Aae=Li();function Pr(e,t,r,n){Hi.call(this,e,t,"BigInt",n)}Pr.schemaName="BigInt";Pr.defaultOptions={};/*!
513
+ * Inherits from SchemaType.
514
+ */Pr.prototype=Object.create(Hi.prototype);Pr.prototype.constructor=Pr;/*!
515
+ * ignore
516
+ */Pr._cast=Eae;Pr.set=Hi.set;Pr.setters=[];Pr.get=Hi.get;Pr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
517
+ * ignore
518
+ */Pr._checkRequired=(e)=>e!=null;Pr.checkRequired=Hi.checkRequired;Pr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Pr.prototype.cast=function(e){let t;if(typeof this._castFunction==="function")t=this._castFunction;else if(typeof this.constructor.cast==="function")t=this.constructor.cast();else t=Pr.cast();try{return t(e)}catch(r){throw new Sj("BigInt",e,this.path,r,this)}};/*!
519
+ * ignore
520
+ */var Oae={...Hi.prototype.$conditionalHandlers,$gt:qg,$gte:qg,$lt:qg,$lte:qg};Object.defineProperty(Pr.prototype,"$conditionalHandlers",{enumerable:!1,value:Oae});/*!
521
+ * ignore
522
+ */function qg(e,t){return this.castForQuery(null,e,t)}Pr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Aae(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(s){if(s instanceof Sj&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};Pr.prototype._castNullish=function(t){if(typeof t>"u")return t;if((typeof this.constructor.cast==="function"?this.constructor.cast():Pr.cast())==null)return t;return t};Pr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","long",t)};Pr.prototype.autoEncryptionType=function(){return"long"};/*!
523
+ * Module exports.
524
+ */wj.exports=Pr});var Tj=g(function(m_e,Dj){/*!
525
+ * Module dependencies.
526
+ */var bj=es(),Ki=Mr(),Qc=N2(),Sae=Li();function nr(e,t,r,n){Ki.call(this,e,t,"Boolean",n)}nr.schemaName="Boolean";nr.defaultOptions={};/*!
527
+ * Inherits from SchemaType.
528
+ */nr.prototype=Object.create(Ki.prototype);nr.prototype.constructor=nr;/*!
529
+ * ignore
530
+ */nr._cast=Qc;nr.set=Ki.set;nr.setters=[];nr.get=Ki.get;nr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
531
+ * ignore
532
+ */nr._defaultCaster=(e)=>{if(e!=null&&typeof e!=="boolean")throw Error();return e};/*!
533
+ * ignore
534
+ */nr._checkRequired=(e)=>e===!0||e===!1;nr.checkRequired=Ki.checkRequired;nr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Object.defineProperty(nr,"convertToTrue",{get:()=>Qc.convertToTrue,set:(e)=>{Qc.convertToTrue=e}});Object.defineProperty(nr,"convertToFalse",{get:()=>Qc.convertToFalse,set:(e)=>{Qc.convertToFalse=e}});nr.prototype.cast=function(e){let t;if(typeof this._castFunction==="function")t=this._castFunction;else if(typeof this.constructor.cast==="function")t=this.constructor.cast();else t=nr.cast();try{return t(e)}catch(r){throw new bj("Boolean",e,this.path,r,this)}};var wae={...Ki.prototype.$conditionalHandlers};Object.defineProperty(nr.prototype,"$conditionalHandlers",{enumerable:!1,value:wae});nr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Sae(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(s){if(s instanceof bj&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};nr.prototype._castNullish=function(t){if(typeof t>"u")return t;let r=typeof this.constructor.cast==="function"?this.constructor.cast():nr.cast();if(r==null)return t;if(r.convertToFalse instanceof Set&&r.convertToFalse.has(t))return!1;if(r.convertToTrue instanceof Set&&r.convertToTrue.has(t))return!0;return t};nr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("boolean","bool",t)};nr.prototype.autoEncryptionType=function(){return"bool"};/*!
535
+ * Module exports.
536
+ */Dj.exports=nr});var Pj=g(function(y_e,Mj){var Cae=js();class IO extends Cae{}var bae=si();Object.defineProperty(IO.prototype,"subtype",bae);/*!
537
+ * ignore
538
+ */Mj.exports=IO});var Fj=g(function(g_e,Bj){/*!
539
+ * Module dependencies.
540
+ */var Xc=k2(),Dae=Pj(),An=Mr(),jg=Sd(),Vg=be(),Tae=Li(),RO=Xc.Binary,Ug=An.CastError;function tn(e,t,r,n){An.call(this,e,t,"Buffer",n)}tn.schemaName="Buffer";tn.defaultOptions={};/*!
541
+ * Inherits from SchemaType.
542
+ */tn.prototype=Object.create(An.prototype);tn.prototype.constructor=tn;tn.prototype.OptionsConstructor=Dae;/*!
543
+ * ignore
544
+ */tn._checkRequired=(e)=>!!e?.length;tn.set=An.set;tn.setters=[];tn.get=An.get;tn.checkRequired=An.checkRequired;tn.prototype.checkRequired=function(e,t){if(An._isRef(this,e,t,!0))return!!e;return this.constructor._checkRequired(e)};tn.prototype.cast=function(e,t,r,n,s){let i;if(An._isRef(this,e,t,r)){if(Buffer.isBuffer(e)&&e.isMongooseBuffer)return e;if(Buffer.isBuffer(e)){if(e=new Xc(e,[this.path,t]),this.options.subtype!=null)e._subtype=this.options.subtype;return e}if(e instanceof RO){if(i=new Xc(e.value(!0),[this.path,t]),typeof e.sub_type!=="number")throw new Ug("Buffer",e,this.path,null,this);return i._subtype=e.sub_type,i}if(e==null||Vg.isNonBuiltinObject(e))return this._castRef(e,t,r,s)}if(e?._id)e=e._id;if(Buffer.isBuffer(e)&&e.isMongooseBuffer)return e;if(Buffer.isBuffer(e)){if(e=new Xc(e,[this.path,t]),this.options.subtype!=null)e._subtype=this.options.subtype;return e}if(e instanceof RO){if(i=new Xc(e.value(!0),[this.path,t]),typeof e.sub_type!=="number")throw new Ug("Buffer",e,this.path,null,this);return i._subtype=e.sub_type,i}if(e===null)return e;let o=typeof e;if(o==="string"||o==="number"||Array.isArray(e)||o==="object"&&e.type==="Buffer"&&Array.isArray(e.data)){if(o==="number")e=[e];if(i=new Xc(e,[this.path,t]),this.options.subtype!=null)i._subtype=this.options.subtype;return i}if(Vg.isPOJO(e)&&(e.$binary instanceof RO||typeof e.$binary==="string")){let u=this.cast(Buffer.from(e.$binary,"base64"));if(e.$type!=null)return u._subtype=e.$type,u}throw new Ug("Buffer",e,this.path,null,this)};tn.prototype.subtype=function(e){return this.options.subtype=e,this};/*!
545
+ * ignore
546
+ */function Lg(e,t){return this.castForQuery(null,e,t)}var Mae={...An.prototype.$conditionalHandlers,$bitsAllClear:jg,$bitsAnyClear:jg,$bitsAllSet:jg,$bitsAnySet:jg,$gt:Lg,$gte:Lg,$lt:Lg,$lte:Lg};Object.defineProperty(tn.prototype,"$conditionalHandlers",{enumerable:!1,value:Mae});tn.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Tae(this.$conditionalHandlers,e),!n)throw Error("Can't use "+e+" with Buffer.");return n.call(this,t)}let s;try{s=this.applySetters(t,r)}catch(i){if(i instanceof Ug&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}return s?s.toObject({transform:!1,virtuals:!1}):s};tn.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","binData",t)};tn.prototype.autoEncryptionType=function(){return"binData"};/*!
547
+ * Module exports.
548
+ */Bj.exports=tn});var Ij=g(function(__e,Nj){var Pae=js();class Dd extends Pae{}var $O=si();Object.defineProperty(Dd.prototype,"min",$O);Object.defineProperty(Dd.prototype,"max",$O);Object.defineProperty(Dd.prototype,"expires",$O);/*!
549
+ * ignore
550
+ */Nj.exports=Dd});var $j=g(function(E_e,Rj){var Dh=require("assert");Rj.exports=function(t){if(t==null||t==="")return null;if(t instanceof Date)return Dh.ok(!isNaN(t.valueOf())),t;let r;if(Dh.ok(typeof t!=="boolean"),t instanceof Number||typeof t==="number")r=new Date(t);else if(typeof t==="string"&&!isNaN(Number(t))&&(Number(t)>=275761||Number(t)<-271820))r=new Date(Number(t));else if(typeof t.valueOf==="function")r=new Date(t.valueOf());else r=new Date(t);if(!isNaN(r.valueOf()))return r;Dh.ok(!1)}});var qj=g(function(A_e,kj){/*!
551
+ * Module requirements.
552
+ */var Wg=ni(),Bae=Ij(),ss=Mr(),Fae=$j(),Nae=Xn(),vj=be(),Iae=Li(),xj=ss.CastError;function Zt(e,t,r,n){ss.call(this,e,t,"Date",n)}Zt.schemaName="Date";Zt.defaultOptions={};/*!
553
+ * Inherits from SchemaType.
554
+ */Zt.prototype=Object.create(ss.prototype);Zt.prototype.constructor=Zt;Zt.prototype.OptionsConstructor=Bae;/*!
555
+ * ignore
556
+ */Zt._cast=Fae;Zt.set=ss.set;Zt.setters=[];Zt.get=ss.get;Zt.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
557
+ * ignore
558
+ */Zt._defaultCaster=(e)=>{if(e!=null&&!(e instanceof Date))throw Error();return e};Zt.prototype.expires=function(e){if(Nae(this._index)!=="Object")this._index={};return this._index.expires=e,vj.expires(this._index),this};/*!
559
+ * ignore
560
+ */Zt._checkRequired=(e)=>e instanceof Date;Zt.checkRequired=ss.checkRequired;Zt.prototype.checkRequired=function(e,t){if(typeof e==="object"&&ss._isRef(this,e,t,!0))return e!=null;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():Zt.checkRequired())(e)};Zt.prototype.min=function(e,t){if(this.minValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.minValidator},this);if(e){let r=t||Wg.messages.Date.min;if(typeof r==="string")r=r.replace(/{MIN}/,e===Date.now?"Date.now()":e.toString());let n=this;this.validators.push({validator:this.minValidator=function(s){let i=e;if(typeof e==="function"&&e!==Date.now)i=i.call(this);let o=i===Date.now?i():n.cast(i);return s===null||s.valueOf()>=o.valueOf()},message:r,type:"min",min:e})}return this};Zt.prototype.max=function(e,t){if(this.maxValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.maxValidator},this);if(e){let r=t||Wg.messages.Date.max;if(typeof r==="string")r=r.replace(/{MAX}/,e===Date.now?"Date.now()":e.toString());let n=this;this.validators.push({validator:this.maxValidator=function(s){let i=e;if(typeof i==="function"&&i!==Date.now)i=i.call(this);let o=i===Date.now?i():n.cast(i);return s===null||s.valueOf()<=o.valueOf()},message:r,type:"max",max:e})}return this};Zt.prototype.cast=function(e){let t;if(typeof this._castFunction==="function")t=this._castFunction;else if(typeof this.constructor.cast==="function")t=this.constructor.cast();else t=Zt.cast();try{return t(e)}catch(r){throw new xj("date",e,this.path,r,this)}};function zg(e){return this.cast(e)}var Rae={...ss.prototype.$conditionalHandlers,$gt:zg,$gte:zg,$lt:zg,$lte:zg};Object.defineProperty(Zt.prototype,"$conditionalHandlers",{enumerable:!1,value:Rae});Zt.prototype.castForQuery=function(e,t,r){if(e==null)try{return this.applySetters(t,r)}catch(s){if(s instanceof xj&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}let n=Iae(this.$conditionalHandlers,e);if(!n)throw Error("Can't use "+e+" with Date.");return n.call(this,t)};Zt.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","date",t)};Zt.prototype.autoEncryptionType=function(){return"date"};/*!
561
+ * Module exports.
562
+ */kj.exports=Zt});var Uj=g(function(O_e,Lj){var Co=T2(),jj=require("assert");Lj.exports=function(t){if(t==null)return t;if(typeof t==="object"&&typeof t.$numberDecimal==="string")return Co.fromString(t.$numberDecimal);if(t instanceof Co)return t;if(typeof t==="string")return Co.fromString(t);if(typeof Buffer==="function"&&Buffer.isBuffer(t))return new Co(t);if(typeof Uint8Array==="function"&&t instanceof Uint8Array)return new Co(t);if(typeof t==="number")return Co.fromString(String(t));if(typeof t.valueOf==="function"&&typeof t.valueOf()==="string")return Co.fromString(t.valueOf());jj.ok(!1)}});var zj=g(function(S_e,Vj){/*!
563
+ * Module dependencies.
564
+ */var On=Mr(),$ae=On.CastError,vae=Uj(),vO=Zn();function Ir(e,t,r,n){On.call(this,e,t,"Decimal128",n)}Ir.schemaName="Decimal128";Ir.defaultOptions={};/*!
565
+ * Inherits from SchemaType.
566
+ */Ir.prototype=Object.create(On.prototype);Ir.prototype.constructor=Ir;/*!
567
+ * ignore
568
+ */Ir._cast=vae;Ir.set=On.set;Ir.setters=[];Ir.get=On.get;Ir.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
569
+ * ignore
570
+ */Ir._defaultCaster=(e)=>{if(e!=null&&!vO(e,"Decimal128"))throw Error();return e};/*!
571
+ * ignore
572
+ */Ir._checkRequired=(e)=>vO(e,"Decimal128");Ir.checkRequired=On.checkRequired;Ir.prototype.checkRequired=function(t,r){if(On._isRef(this,t,r,!0))return!!t;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():Ir.checkRequired())(t)};Ir.prototype.cast=function(e,t,r,n,s){if(On._isRef(this,e,t,r)){if(vO(e,"Decimal128"))return e;return this._castRef(e,t,r,s)}let i;if(typeof this._castFunction==="function")i=this._castFunction;else if(typeof this.constructor.cast==="function")i=this.constructor.cast();else i=Ir.cast();try{return i(e)}catch(o){throw new $ae("Decimal128",e,this.path,o,this)}};/*!
573
+ * ignore
574
+ */function Hg(e){return this.cast(e)}var xae={...On.prototype.$conditionalHandlers,$gt:Hg,$gte:Hg,$lt:Hg,$lte:Hg};Object.defineProperty(Ir.prototype,"$conditionalHandlers",{enumerable:!1,value:xae});Ir.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","decimal",t)};Ir.prototype.autoEncryptionType=function(){return"decimal"};/*!
575
+ * Module exports.
576
+ */Vj.exports=Ir});var Hj=g(function(w_e,Wj){var kae=js();class Td extends kae{}var xO=si();Object.defineProperty(Td.prototype,"_id",xO);Object.defineProperty(Td.prototype,"minimize",xO);Object.defineProperty(Td.prototype,"discriminators",xO);Wj.exports=Td});var Gj=g(function(C_e,Kj){var is=Ao();/*!
577
+ * ignore
578
+ */Kj.exports=function(t){t.s.hooks.pre("save",!1,kO,null,!0),t.s.hooks.post("save",qO,null,!0),t.s.hooks.pre("save",jO),t.s.hooks.post("save",LO)};function kO(){if(this.$isSubdocument)return;let e=this.$getAllSubdocs({useCache:!0});if(!e.length)return;let t=this.$__.saveOptions;return Promise.all(e.map((r)=>r._execDocumentPreHooks("save",t,[t]))).then(()=>{if(this.$__.saveOptions)this.$__.saveOptions.__subdocs=null})}function qO(){if(this.$isSubdocument)return;let e=this.$getAllSubdocs({useCache:!0});if(!e.length)return;let t=this.$__.saveOptions,r=[];for(let n of e)r.push(n._execDocumentPostHooks("save",t));return Promise.all(r)}function jO(){let e=this.$__.removedSubdocs;if(!e?.length)return;let t=this.$__.saveOptions,r=[];for(let n of e)r.push(n._execDocumentPreHooks("deleteOne",t));return Promise.all(r)}function LO(){let e=this.$__.removedSubdocs;if(!e?.length)return;let t=this.$__.saveOptions,r=[];for(let n of e)r.push(n._execDocumentPostHooks("deleteOne",t));return this.$__.removedSubdocs=null,Promise.all(r)}kO[is.builtInMiddleware]=!0;kO[is.skipOnSubdocuments]=!0;qO[is.builtInMiddleware]=!0;qO[is.skipOnSubdocuments]=!0;jO[is.builtInMiddleware]=!0;jO[is.skipOnSubdocuments]=!0;LO[is.builtInMiddleware]=!0;LO[is.skipOnSubdocuments]=!0});var Yj=g(function(b_e,zO){var qae=de().objectIdSymbol,Rt=Ao(),Kg=be();/*!
579
+ * ignore
580
+ */zO.exports=function(t){t.post("init",Gg),t.pre("save",Yg),t.post("save",Jg),t.pre("deleteOne",{document:!0,query:!1},Qg),t.pre("updateOne",{document:!0,query:!1},Xg)};function Gg(){return VO.call(this),this}function Yg(){UO.call(this)}function Jg(){VO.call(this)}function Qg(){UO.call(this)}function Xg(){UO.call(this)}/*!
581
+ * ignore
582
+ */function UO(){let e,t;if(this.$__.shardval){e=Object.keys(this.$__.shardval),t=e.length,this.$where=this.$where||{};for(let r=0;r<t;++r)this.$where[e[r]]=this.$__.shardval[e[r]]}}/*!
583
+ * ignore
584
+ */zO.exports.storeShard=VO;/*!
585
+ * ignore
586
+ */function VO(){let e=this.$__schema.options.shardKey||this.$__schema.options.shardkey;if(!Kg.isPOJO(e))return;let t=this.$__.shardval={},r=Object.keys(e),n=r.length,s;for(let i=0;i<n;++i)if(s=this.$__getValue(r[i]),s==null)t[r[i]]=s;else if(Kg.isMongooseObject(s))t[r[i]]=s.toObject({depopulate:!0,_isNested:!0});else if(s instanceof Date||s[qae])t[r[i]]=s;else if(typeof s.valueOf==="function")t[r[i]]=s.valueOf();else t[r[i]]=s}Gg[Rt.builtInMiddleware]=!0;Gg[Rt.skipOnSubdocuments]=!0;Gg[Rt.requiresShardKey]=!0;Yg[Rt.builtInMiddleware]=!0;Yg[Rt.skipOnSubdocuments]=!0;Yg[Rt.requiresShardKey]=!0;Jg[Rt.builtInMiddleware]=!0;Jg[Rt.skipOnSubdocuments]=!0;Jg[Rt.requiresShardKey]=!0;Qg[Rt.builtInMiddleware]=!0;Qg[Rt.skipOnSubdocuments]=!0;Qg[Rt.requiresShardKey]=!0;Xg[Rt.builtInMiddleware]=!0;Xg[Rt.skipOnSubdocuments]=!0;Xg[Rt.requiresShardKey]=!0});var tL=g(function(D_e,eL){var Th=de().arrayAtomicsSymbol,Zg=de().sessionNewDocuments,e_=Ao(),Mh=be();eL.exports=function(t){t.pre("save",Qj),t.pre("deleteOne",{document:!0,query:!1},Xj)};function Qj(){Zj(this)}function Xj(){let e=Zj(this);if(e!=null&&!Object.hasOwn(e,"isDeleted"))e.isDeleted=this.$isDeleted()}function Zj(e){let t=e.$session();if(t==null)return null;if(t.transaction==null||t[Zg]==null)return null;if(!t[Zg].has(e)){let r={};if(e.isNew)r.isNew=!0;if(e.$__schema.options.versionKey)r.versionKey=e.get(e.$__schema.options.versionKey);r.modifiedPaths=new Set(Object.keys(e.$__.activePaths.getStatePaths("modify"))),r.atomics=jae(e),t[Zg].set(e,r)}return t[Zg].get(e)}function jae(e,t){let r=new Map;t=t||new Map;let n=Object.keys(e.$__.activePaths.init).concat(Object.keys(e.$__.activePaths.modify));for(let i of n){let o=e.$__getValue(i);if(Array.isArray(o)&&Mh.isMongooseDocumentArray(o)&&o.length&&o[Th]!=null&&Mh.hasOwnKeys(o[Th])){let u=t.get(i)||{};r.set(i,Jj(u,o[Th]))}}let s=e.$__dirty();for(let i of s){let{path:o,value:u}=i;if(u?.[Th]!=null&&Mh.hasOwnKeys(u[Th])){let a=t.get(o)||{};r.set(o,Jj(a,u[Th]))}}return r}function Jj(e,t){if(e=e||{},t.$pullAll!=null)e.$pullAll=(e.$pullAll||[]).concat(t.$pullAll);if(t.$push!=null)e.$push=e.$push||{},e.$push.$each=(e.$push.$each||[]).concat(t.$push.$each);if(t.$addToSet!=null)e.$addToSet=(e.$addToSet||[]).concat(t.$addToSet);if(t.$set!=null)e.$set=Array.isArray(t.$set)?[...t.$set]:Object.assign({},t.$set);return e}Qj[e_.builtInMiddleware]=!0;Xj[e_.builtInMiddleware]=!0});var WO=g(function(t_){t_.saveSubdocs=Gj();t_.sharding=Yj();t_.trackTransaction=tL()});var sL=g(function(M_e,nL){var rL=WO();nL.exports=function(t){for(let r of Object.values(rL))r(t,{deduplicate:!0});t.plugins=Object.values(rL).map((r)=>({fn:r,opts:{deduplicate:!0}})).concat(t.plugins)}});var aL=g(function(P_e,uL){var Lae=v2(),oL=Xa(),Uae=Zn(),Vae=Qa(),zae=Mr(),iL=xc();uL.exports=function e(t,r,n,s){let i=Object.keys(r),o=0,u=i.length,a;if(n=n||"",s=s||new WeakSet,s.has(r))return;s.add(r);while(o<u){if(a=i[o++],!n){if(a==="discriminators"||a==="base"||a==="_applyDiscriminators"||a==="_userProvidedOptions"||a==="options"||a==="tree")continue}if(n==="tree"&&r?.instanceOfSchema)continue;if(oL.has(a))continue;if(a==="parentSchema")continue;if(t[a]==null)t[a]=r[a];else if(iL(r[a])){if(!iL(t[a]))t[a]={};if(r[a]!=null){if(r[a].$isSingleNested&&t[a].$isMongooseDocumentArray||r[a].$isMongooseDocumentArray&&t[a].$isSingleNested||r[a].$isMongooseDocumentArrayElement&&t[a].$isMongooseDocumentArrayElement)continue;else if(r[a].instanceOfSchema){if(t[a].instanceOfSchema)Lae(t[a],r[a].clone(),!0);else t[a]=r[a].clone();continue}else if(Uae(r[a],"ObjectId")){t[a]=new Vae(r[a]);continue}else if(r[a]instanceof zae){if(t[a]==null)t[a]=r[a].clone();if(!r[a].$isMongooseDocumentArray&&!r[a].$isSingleNested)continue}}e(t[a],r[a],n?n+"."+a:a,s)}}if(r?.instanceOfSchema)t.tree=Object.assign({},r.tree,t.tree)}});var r_=g(function(B_e,hL){var cL=Eh(),Wae=sL(),Hae=ar(),Kae=H2().defineKey,Gae=Dr(),Yae=iu(),Ph=be(),Jae=aL(),lL={toJSON:!0,toObject:!0,_id:!0,id:!0,virtuals:!0,methods:!0,statics:!0,defaultSort:!0};function Qae(e,t){if(e.encryptionType()==null&&t.encryptionType()==null)return;let r=s(n(e),n(t));for(let i of r){if(e._hasEncryptedField(i)&&t._hasEncryptedField(i))throw Error(`encrypted fields cannot be declared on both the base schema and the child schema in a discriminator. path=${i}`);if(e._hasEncryptedField(i)||t._hasEncryptedField(i))throw Error(`encrypted fields cannot have the same path as a non-encrypted field for discriminators. path=${i}`)}function n(i){return[...Object.keys(i.paths),...Object.keys(i.singleNestedPaths)]}function*s(i,o){let u=new Set(i);for(let a of o)if(u.has(a))yield a}}/*!
587
+ * ignore
588
+ */hL.exports=function(t,r,n,s,i,o,u){if(!n?.instanceOfSchema)throw Error("You must pass a valid discriminator Schema");if(r==="__proto__")throw Error('Discriminator name "__proto__" is not allowed');if(o=o==null?!0:o,t.schema.discriminatorMapping&&!t.schema.discriminatorMapping.isRoot)throw Error('Discriminator "'+r+'" can only be a discriminator of the root model');if(i){let h=Gae(t.base,"options.applyPluginsToDiscriminators",!1)||!o;t.base._applyPlugins(n,{skipTopLevel:!h})}else if(!o)Wae(n);let a=t.schema.options.discriminatorKey,c=t.schema.path(a);if(c!=null){if(!Ph.hasUserDefinedProperty(c.options,"select"))c.options.select=!0;c.options.$skipDiscriminatorCheck=!0}else{let h={};h[a]={default:void 0,select:!0,$skipDiscriminatorCheck:!0},h[a][t.schema.options.typeKey]=String,t.schema.add(h),Kae({prop:a,prototype:t.prototype,options:t.schema.options})}if(n.path(a)&&n.path(a).options.$skipDiscriminatorCheck!==!0)throw Error('Discriminator "'+r+'" cannot have field with name "'+a+'"');let l=r;if(typeof s==="string"&&s.length||s!=null)l=s;Qae(t.schema,n);function f(h,d){if(h._baseSchema=d,d.paths._id&&d.paths._id.options&&!d.paths._id.options.auto)h.remove("_id");let p=Object.keys(d.paths),m=[];for(let S of p){if(h.nested[S]){m.push(S);continue}if(S.indexOf(".")===-1)continue;let B=S.split(".").slice(0,-1),q="";for(let I of B)if(q+=(q.length?".":"")+I,h.paths[q]instanceof cL||h.singleNestedPaths[q]instanceof cL)m.push(S)}h.obj={...h.obj},Jae(h,d),h._gatherChildSchemas();for(let S of m)delete h.paths[S];h._defaultsCache=null,h._pathsWithTransforms=void 0,h._hasSelectedPaths=void 0,h.childSchemas.forEach((S)=>{S.model.prototype.$__setSchema(S.schema)});let _={};if(_[a]={default:l,select:!0,set:function(S){if(S===l||Array.isArray(l)&&Ph.deepEqual(S,l))return l;throw Error(`Can't set discriminator key "`+a+'"')},$skipDiscriminatorCheck:!0},_[a][h.options.typeKey]=c?c.options[h.options.typeKey]:String,h.add(_),h.discriminatorMapping={key:a,value:l,isRoot:!1},d.options.collection)h.options.collection=d.options.collection;let y=h.options.toJSON,E=h.options.toObject,C=h.options._id,D=h.options.id,A=Object.keys(h.options);h.options.discriminatorKey=d.options.discriminatorKey;let P=h._userProvidedOptions;for(let S of A)if(!lL[S]){if(S in P&&!Ph.deepEqual(h.options[S],d.options[S]))throw Error("Can't customize discriminator option "+S+" (can only modify "+Object.keys(lL).join(", ")+")")}h.options=Hae(d.options);for(let S of Object.keys(P))h.options[S]=P[S];if(y)h.options.toJSON=y;if(E)h.options.toObject=E;if(typeof C<"u")h.options._id=C;if(h.options.id=D,o)h.s.hooks=t.schema.s.hooks.merge(h.s.hooks);if(i)h.plugins=Array.prototype.slice.call(d.plugins);h.callQueue=d.callQueue.concat(h.callQueue),delete h._requiredpaths}if(f(n,t.schema),!t.discriminators)t.discriminators={};if(!t.schema.discriminatorMapping)t.schema.discriminatorMapping={key:a,value:null,isRoot:!0};if(!t.schema.discriminators)t.schema.discriminators={};if(t.schema.discriminators[r]=n,Yae(t.discriminators,r)&&!n.options.overwriteModels&&!u)throw Error('Discriminator with name "'+r+'" already exists');return n}});var n_=g(function(F_e,fL){var Xae=oi(),Zae=Vi();fL.exports=function(t,r,n){let s=t.schema.options.discriminatorKey,i=r?.[s];if(i==null)i=n;if(t.discriminators&&i!=null){let o=Xae(t.discriminators,i);if(o)t=o;else{let u=Zae(t.discriminators,i);if(u)t=u}}return t}});var HO=g(function(N_e,dL){var ece=sO();dL.exports=function(t,r){if(r?._id==null)return t;if(t=t.clone(),!r._id)t.remove("_id"),t.options._id=!1;else if(!t.paths._id)ece(t),t.options._id=!0;return t}});var GO=g(function(I_e,pL){/*!
589
+ * Module dependencies.
590
+ */var tce=ze();class KO extends tce{constructor(e,t){let r=`Cannot create use schema for property "${e}" because the schema has the ${t} option enabled.`;super(r)}}Object.defineProperty(KO.prototype,"name",{value:"InvalidSchemaOptionError"});/*!
591
+ * exports
592
+ */pL.exports=KO});var QO=g(function(R_e,_L){/*!
593
+ * Module dependencies.
594
+ */var mL=es(),YO=require("events").EventEmitter,rce=q2(),nce=Hj(),Us=Mr(),sce=U2(),ice=I2(),yL=wd().castToNumber,oce=r_(),Bh=TO(),JO=n_(),uce=Eg(),ace=HO(),cce=_o().internalToObjectOptions,lce=Uc(),i_=be(),hce=GO(),fce=Li(),s_;_L.exports=rn;function rn(e,t,r,n){if(e.options.timeseries)throw new hce(t,"timeseries");let s=rn.defaultOptions?._id;if(s!=null)r=r||{},r._id=s;e=ace(e,r),this.Constructor=gL(e,null,r),this.Constructor.path=t,this.Constructor.prototype.$basePath=t,this.schema=e,this.$isSingleNested=!0,this.base=e.base,Us.call(this,t,r,"Embedded",n)}/*!
595
+ * ignore
596
+ */rn.prototype=Object.create(Us.prototype);rn.prototype.constructor=rn;rn.prototype.OptionsConstructor=nce;/*!
597
+ * ignore
598
+ */function gL(e,t,r){s_||(s_=X2());let n=function(o,u,a){if(this.$__parent=a,s_.apply(this,arguments),a==null)return;this.$session(a.$session())};e.plugin(uce,{deduplicate:!0});let s=t?.prototype??s_.prototype;n.prototype=Object.create(s),n.prototype.$__setSchema(e),n.prototype.constructor=n,n.prototype.$__schemaTypeOptions=r,n.$__required=r?.required,n.base=e.base,n.schema=e,n.$isSingleNested=!0,n.events=new YO,n.prototype.toBSON=function(){return this.toObject(cce)};for(let i in e.methods)n.prototype[i]=e.methods[i];for(let i in e.statics)n[i]=e.statics[i];for(let i in YO.prototype)n[i]=YO.prototype[i];return n}/*!
599
+ * ignore
600
+ */var au={...Us.prototype.$conditionalHandlers};au.$geoWithin=function(t,r){return{$geometry:this.castForQuery(null,t.$geometry,r)}};/*!
601
+ * ignore
602
+ */au.$near=au.$nearSphere=Bh.cast$near;au.$within=au.$geoWithin=Bh.cast$within;au.$geoIntersects=Bh.cast$geoIntersects;au.$minDistance=yL;au.$maxDistance=yL;au.$exists=ice;Object.defineProperty(rn.prototype,"$conditionalHandlers",{enumerable:!1,value:au});rn.prototype.cast=function(e,t,r,n,s){if(e?.$isSingleNested&&e.parent===t)return e;if(!r&&e!=null&&(typeof e!=="object"||Array.isArray(e)))throw new rce(this.path,e);let i=this.schema.path(this.schema.options.discriminatorKey),o=i==null?null:i.getDefault(t),u=JO(this.Constructor,e,o),a,c=t?.$__?.selected,l=this.path,f=c==null?null:Object.keys(c).reduce((h,d)=>{if(d.startsWith(l+"."))h=h||{},h[d.substring(l.length+1)]=c[d];return h},null);if(r){if(a=new u(void 0,f,t,{defaults:!1}),delete a.$__.defaults,s.path!=null){let{path:d,...p}=s;s=p}a.$init(e,s);let h=lce(f);sce(a,f,h)}else{if(s=Object.assign({},s,{priorDoc:n}),i_.hasOwnKeys(e)===!1)return new u({},f,t,s);return new u(e,f,t,s)}return a};rn.prototype.castForQuery=function(e,t,r,n){let s;if(e!=null){if(s=fce(this.$conditionalHandlers,e),!s)throw Error("Can't use "+e);return s.call(this,t)}if(t==null)return t;let i=JO(this.Constructor,t);if(t instanceof i)return t;if(this.options.runSetters)t=this._applySetters(t,r);let o=n?.strict??void 0;try{t=new i(t,o)}catch(u){if(!(u instanceof mL))throw new mL("Embedded",t,this.path,u,this);throw u}return t};rn.prototype.doValidate=async function(t,r,n){let s=JO(this.Constructor,t);if(t&&!(t instanceof s))t=new s(t,null,r?.$__!=null?r:null);if(n?.skipSchemaValidators){if(!t)return;return t.validate()}if(await Us.prototype.doValidate.call(this,t,r,n),t!=null)await t.validate()};rn.prototype.doValidateSync=function(e,t,r){if(!r?.skipSchemaValidators){let n=Us.prototype.doValidateSync.call(this,e,t);if(n)return n}if(!e)return;return e.$__validateSync()};rn.prototype.discriminator=function(e,t,r){r=r||{};let n=i_.isPOJO(r)?r.value:r,s=typeof r.clone==="boolean"?r.clone:!0;if(t.instanceOfSchema&&s)t=t.clone();if(t=oce(this.Constructor,e,t,n,null,null,r.overwriteExisting),this.parentSchema!=null)this.parentSchema._hasSelectedPaths=!0;return this.Constructor.discriminators[e]=gL(t,this.Constructor),this.Constructor.discriminators[e]};/*!
603
+ * ignore
604
+ */rn.defaultOptions={};rn.set=Us.set;rn.setters=[];rn.get=Us.get;/*!
605
+ * ignore
606
+ */rn.prototype.toJSON=function(){return{path:this.path,options:this.options}};/*!
607
+ * ignore
608
+ */rn.prototype.clone=function(){let e=new this.constructor(this.schema,this.path,{...this.options,_skipApplyDiscriminators:!0},this.parentSchema);if(e.validators=this.validators.slice(),this.requiredValidator!==void 0)e.requiredValidator=this.requiredValidator;return e.Constructor.discriminators=Object.assign({},this.Constructor.discriminators),e._appliedDiscriminators=this._appliedDiscriminators,e};rn.prototype.toJSONSchema=function(t){return{...this.schema.toJSONSchema(t),...this._createJSONSchemaTypeDefinition("object","object",t)}}});var XO=g(function($_e,AL){/*!
609
+ * Module dependencies.
610
+ */var dce=ze(),Yi=Mr(),o_=QO(),EL=n_();function Gi(e,t,r,n){if(this.$parentSchemaType=r?.$parentSchemaType,!this.$parentSchemaType)throw new dce("Cannot create DocumentArrayElement schematype without a parent");delete r.$parentSchemaType,Yi.call(this,e,r,"DocumentArrayElement",n),this.$isMongooseDocumentArrayElement=!0,this.Constructor=r?.Constructor,this.schema=t}Gi.schemaName="DocumentArrayElement";Gi.defaultOptions={};Gi.set=Yi.set;Gi.get=Yi.get;/*!
611
+ * Inherits from SchemaType.
612
+ */Gi.prototype=Object.create(Yi.prototype);Gi.prototype.constructor=Gi;Gi.prototype.cast=function(...e){return this.$parentSchemaType.cast(...e)[0]};Gi.prototype.doValidate=async function(t,r,n){let s=EL(this.Constructor,t);if(t&&!(t instanceof s))t=new s(t,r,null,null,n?.index??null);if(n?.skipSubdocumentValidation){if(n.skipSchemaValidators)return;return Yi.prototype.doValidate.call(this,t,r,n)}return o_.prototype.doValidate.call(this,t,r,n)};Gi.prototype.doValidateSync=function(t,r,n){let s=EL(this.Constructor,t);if(t&&!(t instanceof s))t=new s(t,r,null,null,n?.index??null);if(n?.skipSubdocumentValidation){if(n.skipSchemaValidators)return;return Yi.prototype.doValidateSync.call(this,t,r,n)}return o_.prototype.doValidateSync.call(this,t,r,n)};Gi.prototype.clone=function(){let e=Object.assign({},this.options,{$parentSchemaType:this.$parentSchemaType,Constructor:this.Constructor}),t=new this.constructor(this.path,this.schema,e,this.parentSchema);if(t.validators=this.validators.slice(),this.requiredValidator!==void 0)t.requiredValidator=this.requiredValidator;return t};/*!
613
+ * Module exports.
614
+ */AL.exports=Gi});var SL=g(function(v_e,OL){var pce=js();class Md extends pce{}var ZO=si();Object.defineProperty(Md.prototype,"excludeIndexes",ZO);Object.defineProperty(Md.prototype,"_id",ZO);Object.defineProperty(Md.prototype,"discriminators",ZO);/*!
615
+ * ignore
616
+ */OL.exports=Md});var FL=g(function(x_e,BL){/*!
617
+ * Module dependencies.
618
+ */var mce=oi(),wL=es(),yce=XO(),eS=require("events").EventEmitter,Fh=vg(),gce=SL(),cu=Mr(),CL=Jc(),_ce=r_(),bL=HO(),Ece=G2(),Ace=Sh(),os=be(),u_=n_(),Oce=Eg(),Sce=GO(),DL=de().arrayAtomicsSymbol,tS=de().arrayPathSymbol,ML=de().documentArrayParent,zu,Zc;function mr(e,t,r,n,s){if(t.options?.timeseries)throw new Sce(e,"timeseries");let i=mr.defaultOptions?._id;if(i!=null)n=n||{},n._id=i;if(n?._id!=null)t=bL(t,n);else if(r?._id!=null)t=bL(t,r);let o=PL(t,r);o.prototype.$basePath=e,o.path=e;let u=this,a=new yce(e+".$",t,{...n||{},$parentSchemaType:u,Constructor:o});Fh.call(this,e,a,r,null,s),this.schema=t,this.schemaOptions=n||{},this.$isMongooseDocumentArray=!0,this.Constructor=o,o.base=t.base;let c=this.defaultValue;if(!("defaultValue"in this)||c!=null)this.default(function(){let l=c.call(this);if(l!=null&&!Array.isArray(l))l=[l];return l})}mr.schemaName="DocumentArray";mr.options={castNonArrays:!0};/*!
619
+ * Inherits from SchemaArray.
620
+ */mr.prototype=Object.create(Fh.prototype);mr.prototype.constructor=mr;mr.prototype.OptionsConstructor=gce;Object.defineProperty(mr.prototype,"$conditionalHandlers",{enumerable:!1,value:{...Fh.prototype.$conditionalHandlers}});/*!
621
+ * ignore
622
+ */function PL(e,t,r){Zc||(Zc=ph());function n(){Zc.apply(this,arguments);let i=this[ML];if(i==null)return;this.$session(i.$session())}e.plugin(Oce,{deduplicate:!0});let s=r?.prototype??Zc.prototype;n.prototype=Object.create(s),n.prototype.$__setSchema(e),n.schema=e,n.prototype.constructor=n,n.$isArraySubdocument=!0,n.events=new eS,n.base=e.base;for(let i in e.methods)n.prototype[i]=e.methods[i];for(let i in e.statics)n[i]=e.statics[i];for(let i in eS.prototype)n[i]=eS.prototype[i];return n.options=t,n}mr.prototype.discriminator=function(e,t,r){if(typeof e==="function")e=os.getFunctionName(e);r=r||{};let n=os.isPOJO(r)?r.value:r,s=typeof r.clone==="boolean"?r.clone:!0;if(t.instanceOfSchema&&s)t=t.clone();if(t=_ce(this.Constructor,e,t,n,null,null,r?.overwriteExisting),this.parentSchema!=null)this.parentSchema._hasSelectedPaths=!0;let i=PL(t,null,this.Constructor);return i.baseCasterConstructor=this.Constructor,Object.defineProperty(i,"name",{value:e}),this.Constructor.discriminators[e]=i,this.Constructor.discriminators[e]};mr.prototype.doValidate=async function(t,r,n){zu||(zu=Hc());let s;try{await cu.prototype.doValidate.call(this,t,r)}catch(u){s=u}if(n?.updateValidator){if(s!=null)throw s;return}if(!os.isMongooseDocumentArray(t))t=new zu(t,this.path,r);let i=[];for(let u=0;u<t.length;++u){let a=t[u];if(a==null)continue;if(!(a instanceof Zc)){let l=u_(this.Constructor,t[u]);a=t[u]=new l(a,t,void 0,void 0,u)}if(n?.validateModifiedOnly&&!a.$isNew&&!a.$isModified())continue;let c=a.$isNew&&n?.validateModifiedOnly?{...n,validateModifiedOnly:!1}:n;i.push(a.validate(null,c))}let o;try{await Promise.all(i)}catch(u){o=u}if(s!=null)throw s;if(o!=null)throw o};mr.prototype.doValidateSync=function(e,t,r){let n=cu.prototype.doValidateSync.call(this,e,t),s=e?.length,i=n;if(!s)return i;for(let o=0,u=s;o<u;++o){let a=e[o];if(!a)continue;if(!(a instanceof Zc)){let f=u_(this.Constructor,e[o]);a=e[o]=new f(a,e,void 0,void 0,o)}if(r?.validateModifiedOnly&&!a.$isNew&&!a.$isModified())continue;let c=a.$isNew&&r?.validateModifiedOnly?{...r,validateModifiedOnly:!1}:r,l=a.$__validateSync(c);if(l&&i==null)i=l}return i};/*!
623
+ * ignore
624
+ */mr.prototype.getDefault=function(e,t,r){let n=typeof this.defaultValue==="function"?this.defaultValue.call(e):this.defaultValue;if(n==null)return n;if(r?.skipCast)return n;if(zu||(zu=Hc()),!Array.isArray(n))n=[n];n=new zu(n,this.path,e);for(let s=0;s<n.length;++s){let o=new(u_(this.Constructor,n[s]))({},n,void 0,void 0,s);o.$init(n[s]),o.isNew=!0,Object.assign(o.$__.activePaths.default,o.$__.activePaths.init),o.$__.activePaths.init={},n[s]=o}return n};var wce=Object.freeze({transform:!1,virtuals:!1}),TL=Object.freeze({skipId:!1,willInit:!0});mr.prototype.cast=function(e,t,r,n,s){if(zu||(zu=Hc()),e?.[tS]!=null&&e===n)return e;let i,o;s=s||{};let u=s.path||this.path;if(!Array.isArray(e)){let l=this.options.castNonArrays??mr.options.castNonArrays;if(!r&&!l)throw new wL("DocumentArray",e,this.path,null,this);if(!!t&&r)t.markModified(u);return this.cast([e],t,r,n,s)}if(!s.skipDocumentArrayCast||os.isMongooseDocumentArray(e))e=new zu(e,u,t,this);if(n!=null)e[DL]=n[DL]||{};if(s.arrayPathIndex!=null)e[tS]=u+"."+s.arrayPathIndex;let a=os.isMongooseDocumentArray(e)?e.__array:e,c=a.length;for(let l=0;l<c;++l){if(!a[l])continue;let f=u_(this.Constructor,a[l]),h=Ece(a[l],!0);if(a[l]!==h)a[l]=h;if(a[l]instanceof Zc){if(a[l][ML]!==t||a[l].__index!=null&&a[l].__index!==l)if(r){let d=new f(null,e,TL,i,l);a[l]=d.$init(a[l])}else{let d=new f(a[l],e,void 0,void 0,l);a[l]=d}if(a[l].__index==null)a[l].$setIndex(l)}else if(a[l]!=null)if(r){if(t)i||(i=Cce(this,t.$__.selected,r));else i=!0;if(o=new f(null,e,TL,i,l),s.path!=null||s.arrayPathIndex!=null){let{path:d,arrayPathIndex:p,...m}=s;s=m}a[l]=o.$init(a[l],s)}else if(o=n?.[l],o?._doc!=null&&a[l]._id!=null&&os.deepEqual(a[l]._id,o._doc._id)&&os.deepEqual(o.toObject(wce),a[l]))a[l]=o;else try{o=new f(a[l],e,void 0,void 0,l),a[l]=o}catch(d){throw new wL("embedded",a[l],e[tS],d,this)}}if(os.isMongooseDocumentArray(n)){for(let l=0;l<c;++l)if(a[l]!=null&&a[l]===n[l])a[l].__parentArray=e}return e};/*!
625
+ * ignore
626
+ */mr.prototype.clone=function(){let e=Object.assign({},this.options),t=new this.constructor(this.path,this.schema,e,this.schemaOptions,this.parentSchema);if(t.validators=this.validators.slice(),this.requiredValidator!==void 0)t.requiredValidator=this.requiredValidator;return t.Constructor.discriminators=Object.assign({},this.Constructor.discriminators),t._appliedDiscriminators=this._appliedDiscriminators,t};/*!
627
+ * ignore
628
+ */mr.prototype.applyGetters=function(e,t){return cu.prototype.applyGetters.call(this,e,t)};function Cce(e,t,r){if(!(r&&t))return;let n=e.path+".",s=Object.keys(t),i=s.length,o={},u,a,c;while(i--)if(a=s[i],a.startsWith(n)){if(c=a.substring(n.length),c==="$")continue;if(c.startsWith("$."))c=c.substring(2);u||(u=!0),o[c]=t[a]}return u&&o||void 0}/*!
629
+ * ignore
630
+ */mr.defaultOptions={};mr.set=cu.set;mr.setters=[];mr.get=cu.get;/*!
631
+ * Handle casting $elemMatch operators
632
+ */mr.prototype.$conditionalHandlers.$elemMatch=bce;function bce(e,t){let r=Object.keys(e),n=r.length;for(let a=0;a<n;++a){let c=r[a],l=e[c];if(Ace(c)&&l!=null)e[c]=this.castForQuery(c,l,t)}let s=this?.Constructor?.schema?.options?.discriminatorKey,i=this?.Constructor?.schema?.discriminators||{},o=s!=null&&e[s]!=null?mce(i,e[s]):null;if(o!=null)return CL(o,e,null,this?.$$context);let u=this.Constructor.schema??t.schema;return CL(u,e,null,this?.$$context)}mr.prototype.toJSONSchema=function(t){let r=this._createJSONSchemaTypeDefinition("object","object",{...t,_overrideRequired:!1});return{...this._createJSONSchemaTypeDefinition("array","array",t),items:{...r,...this.schema.toJSONSchema(t)}}};/*!
633
+ * Module exports.
634
+ */BL.exports=mr});var IL=g(function(k_e,NL){var Nh=require("assert"),Ih=Te(),Dce=Zn();NL.exports=function(t){if(t==null||t==="")return null;let r;if(Dce(t,"Long"))r=t.toNumber();else if(typeof t==="string")try{return r=Ih.Double.fromString(t),r}catch{Nh.ok(!1)}else if(typeof t==="object"){if(Array.isArray(t))Nh.ok(!1);let n=t.valueOf()??t.toString();if(typeof n==="string")try{return r=Ih.Double.fromString(n),r}catch{Nh.ok(!1)}else r=Number(n)}else r=Number(t);return new Ih.Double(r)}});var $L=g(function(q_e,RL){/*!
635
+ * Module dependencies.
636
+ */var Tce=es(),Ji=Mr(),Mce=IL();function Jr(e,t,r,n){Ji.call(this,e,t,"Double",n)}Jr.schemaName="Double";Jr.defaultOptions={};/*!
637
+ * Inherits from SchemaType.
638
+ */Jr.prototype=Object.create(Ji.prototype);Jr.prototype.constructor=Jr;/*!
639
+ * ignore
640
+ */Jr._cast=Mce;Jr.set=Ji.set;Jr.setters=[];Jr.get=Ji.get;/*!
641
+ * ignore
642
+ */Jr._defaultCaster=(e)=>{if(e!=null){if(e._bsontype!=="Double")throw Error()}return e};Jr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
643
+ * ignore
644
+ */Jr._checkRequired=(e)=>e!=null;Jr.checkRequired=Ji.checkRequired;Jr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Jr.prototype.cast=function(e){let t;if(typeof this._castFunction==="function")t=this._castFunction;else if(typeof this.constructor.cast==="function")t=this.constructor.cast();else t=Jr.cast();try{return t(e)}catch(r){throw new Tce("Double",e,this.path,r,this)}};/*!
645
+ * ignore
646
+ */function a_(e){return this.cast(e)}var Pce={...Ji.prototype.$conditionalHandlers,$gt:a_,$gte:a_,$lt:a_,$lte:a_};Object.defineProperty(Jr.prototype,"$conditionalHandlers",{enumerable:!1,value:Pce});Jr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("number","double",t)};Jr.prototype.autoEncryptionType=function(){return"double"};/*!
647
+ * Module exports.
648
+ */RL.exports=Jr});var xL=g(function(j_e,vL){var Bce=Zn(),c_=require("assert");vL.exports=function(t){if(t==null)return t;if(t==="")return null;if(Array.isArray(t))c_.ok(!1);let r=Bce(t,"Long")?t.toNumber():Number(t),n=2147483647,s=-2147483648;if(r===(r|0)&&r>=s&&r<=n)return r;c_.ok(!1)}});var jL=g(function(L_e,qL){/*!
649
+ * Module dependencies.
650
+ */var kL=es(),Qi=Mr(),Fce=xL(),l_=Sd(),Nce=Li();function Rr(e,t,r,n){Qi.call(this,e,t,"Int32",n)}Rr.schemaName="Int32";Rr.defaultOptions={};/*!
651
+ * Inherits from SchemaType.
652
+ */Rr.prototype=Object.create(Qi.prototype);Rr.prototype.constructor=Rr;/*!
653
+ * ignore
654
+ */Rr._cast=Fce;Rr.set=Qi.set;Rr.setters=[];Rr.get=Qi.get;/*!
655
+ * ignore
656
+ */Rr._defaultCaster=(e)=>{if(e!=null){if(typeof e!=="number"||e!==(e|0)||e<-2147483648||e>2147483647)throw Error()}return e};Rr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
657
+ * ignore
658
+ */Rr._checkRequired=(e)=>e!=null;Rr.checkRequired=Qi.checkRequired;Rr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Rr.prototype.cast=function(e){let t;if(typeof this._castFunction==="function")t=this._castFunction;else if(typeof this.constructor.cast==="function")t=this.constructor.cast();else t=Rr.cast();try{return t(e)}catch(r){throw new kL("Int32",e,this.path,r,this)}};/*!
659
+ * ignore
660
+ */var Ice={...Qi.prototype.$conditionalHandlers,$gt:h_,$gte:h_,$lt:h_,$lte:h_,$bitsAllClear:l_,$bitsAnyClear:l_,$bitsAllSet:l_,$bitsAnySet:l_};Object.defineProperty(Rr.prototype,"$conditionalHandlers",{enumerable:!1,value:Ice});/*!
661
+ * ignore
662
+ */function h_(e,t){return this.castForQuery(null,e,t)}Rr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Nce(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(s){if(s instanceof kL&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};Rr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("number","int",t)};Rr.prototype.autoEncryptionType=function(){return"int"};/*!
663
+ * Module exports.
664
+ */qL.exports=Rr});var UL=g(function(U_e,LL){var Rce=js();class rS extends Rce{}var $ce=si();Object.defineProperty(rS.prototype,"of",$ce);LL.exports=rS});var zL=g(function(V_e,VL){/*!
665
+ * ignore
666
+ */var nS=Mg(),vce=UL(),sS=Mr(),xce=ze(),kce=Kc(),Xi=be();class el extends sS{constructor(e,t,r,n){super(e,t,"Map",n);this.$isSchemaMap=!0,this._createNestedSchemaType(n,e,t,r)}cast(e,t,r,n,s){if(e instanceof nS)return e;let i=s?.path??this.path;if(r){let o=new nS({},i,t,this.$__schemaType);if(e instanceof global.Map)for(let u of e.keys()){let a=e.get(u);if(a==null)a=o.$__schemaType._castNullish(a);else a=o.$__schemaType.cast(a,t,!0,null,{...s,path:i+"."+u});o.$init(u,a)}else for(let u of Object.keys(e)){let a=e[u];if(a==null)a=o.$__schemaType._castNullish(a);else a=o.$__schemaType.cast(a,t,!0,null,{...s,path:i+"."+u});o.$init(u,a)}return o}return new nS(e,i,t,this.$__schemaType)}clone(){let e=super.clone();if(this.$__schemaType!=null)e.$__schemaType=this.$__schemaType.clone();return e}getEmbeddedSchemaType(){return this.$__schemaType}toJSONSchema(e){let t=this.getEmbeddedSchemaType(),r=this._createJSONSchemaTypeDefinition("object","object",e);return r.additionalProperties=t.toJSONSchema(e),r}autoEncryptionType(){return"object"}}el.set=sS.set;el.schemaName="Map";el.prototype.OptionsConstructor=vce;el.defaultOptions={};/*!
667
+ * ignore
668
+ */el.prototype._createNestedSchemaType=function(t,r,n,s){let i=r+".$*",o={type:{}};if(Xi.hasUserDefinedProperty(n,"of")){if(Xi.isPOJO(n.of)&&Xi.hasOwnKeys(n.of)&&!Xi.hasUserDefinedProperty(n.of,t.options.typeKey))o={[t.options.typeKey]:new kce(n.of)};else if(Xi.isPOJO(n.of))o=Object.assign({},n.of);else o={[t.options.typeKey]:n.of};if(o[t.options.typeKey]&&o[t.options.typeKey].instanceOfSchema)o[t.options.typeKey].eachPath((c,l)=>{if(l.options.select===!0||l.options.select===!1)throw new xce('Cannot use schema-level projections (`select: true` or `select: false`) within maps at path "'+r+"."+c+'"')});if(Xi.hasUserDefinedProperty(n,"ref"))o.ref=n.ref}this.$__schemaType=t.interpretAsType(i,o,s)};VL.exports=el});var KL=g(function(z_e,HL){var qce=js();class f_ extends qce{}var WL=si();Object.defineProperty(f_.prototype,"auto",WL);Object.defineProperty(f_.prototype,"populate",WL);/*!
669
+ * ignore
670
+ */HL.exports=f_});var JL=g(function(W_e,YL){var GL=Zn(),iS=Qa();YL.exports=function(t){if(t==null)return t;if(GL(t,"ObjectId"))return t;if(t._id){if(GL(t._id,"ObjectId"))return t._id;if(t._id.toString instanceof Function)return new iS(t._id.toString())}if(t.toString instanceof Function)return new iS(t.toString());return new iS(t)}});var ZL=g(function(H_e,XL){/*!
671
+ * Module dependencies.
672
+ */var jce=KL(),Sn=Mr(),Lce=JL(),Uce=Xn(),uS=Qa(),aS=Zn(),p_=be(),Vce=Sn.CastError,oS;function yr(e,t,r,n){let s=typeof e==="string"&&e.length===24&&/^[a-f0-9]+$/i.test(e),i=t?.suppressWarning;if((s||typeof e>"u")&&!i)p_.warn("mongoose: To create a new ObjectId please try `Mongoose.Types.ObjectId` instead of using `Mongoose.Schema.Types.ObjectId`. Set the `suppressWarning` option if you're trying to create a hex char path in your schema.");Sn.call(this,e,t,"ObjectId",n)}yr.schemaName="ObjectId";yr.defaultOptions={};/*!
673
+ * Inherits from SchemaType.
674
+ */yr.prototype=Object.create(Sn.prototype);yr.prototype.constructor=yr;yr.prototype.OptionsConstructor=jce;yr.get=Sn.get;yr.set=Sn.set;yr.setters=[];yr.prototype.auto=function(e){if(e)this.default(QL),this.set(Wce);return this};/*!
675
+ * ignore
676
+ */yr._checkRequired=(e)=>aS(e,"ObjectId");/*!
677
+ * ignore
678
+ */yr._cast=Lce;yr.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
679
+ * ignore
680
+ */yr._defaultCaster=(e)=>{if(!aS(e,"ObjectId"))throw Error(e+" is not an instance of ObjectId");return e};yr.checkRequired=Sn.checkRequired;yr.prototype.checkRequired=function(t,r){if(Sn._isRef(this,t,r,!0))return!!t;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():yr.checkRequired())(t)};yr.prototype.cast=function(e,t,r,n,s){if(!aS(e,"ObjectId")&&Sn._isRef(this,e,t,r)){if((Uce(e)||"").toLowerCase()==="objectid")return new uS(e.toHexString());if(e==null||p_.isNonBuiltinObject(e))return this._castRef(e,t,r,s)}let i;if(typeof this._castFunction==="function")i=this._castFunction;else if(typeof this.constructor.cast==="function")i=this.constructor.cast();else i=yr.cast();try{return i(e)}catch(o){throw new Vce("ObjectId",e,this.path,o,this)}};/*!
681
+ * ignore
682
+ */function d_(e){return this.cast(e)}var zce={...Sn.prototype.$conditionalHandlers,$gt:d_,$gte:d_,$lt:d_,$lte:d_};Object.defineProperty(yr.prototype,"$conditionalHandlers",{enumerable:!1,value:zce});/*!
683
+ * ignore
684
+ */function QL(){return new uS}QL.$runBeforeSetters=!0;function Wce(e){if(oS||(oS=su()),this instanceof oS){if(e===void 0)return new uS}return e}yr.prototype.toJSONSchema=function(t){let r=this._createJSONSchemaTypeDefinition("string","objectId",t);if(!t?.useBsonType)r.pattern="^[A-Fa-f0-9]{24}$";return r};yr.prototype.autoEncryptionType=function(){return"objectId"};/*!
685
+ * Module exports.
686
+ */XL.exports=yr});var tU=g(function(K_e,eU){var Hce=js();class Zi extends Hce{}var lu=si();Object.defineProperty(Zi.prototype,"enum",lu);Object.defineProperty(Zi.prototype,"match",lu);Object.defineProperty(Zi.prototype,"lowercase",lu);Object.defineProperty(Zi.prototype,"trim",lu);Object.defineProperty(Zi.prototype,"uppercase",lu);Object.defineProperty(Zi.prototype,"minLength",lu);Object.defineProperty(Zi.prototype,"minlength",lu);Object.defineProperty(Zi.prototype,"maxLength",lu);Object.defineProperty(Zi.prototype,"maxlength",lu);Object.defineProperty(Zi.prototype,"populate",lu);/*!
687
+ * ignore
688
+ */eU.exports=Zi});var cS=g(function(G_e,sU){/*!
689
+ * Module dependencies.
690
+ */var wn=Mr(),Vs=ni(),Kce=tU(),Gce=Bg(),m_=be(),Yce=Zn(),Jce=Li(),nU=wn.CastError;function yt(e,t,r,n){this.enumValues=[],this.regExp=null,wn.call(this,e,t,"String",n)}yt.schemaName="String";yt.defaultOptions={};/*!
691
+ * Inherits from SchemaType.
692
+ */yt.prototype=Object.create(wn.prototype);yt.prototype.constructor=yt;Object.defineProperty(yt.prototype,"OptionsConstructor",{configurable:!1,enumerable:!1,writable:!1,value:Kce});/*!
693
+ * ignore
694
+ */yt._cast=Gce;yt.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
695
+ * ignore
696
+ */yt._defaultCaster=(e)=>{if(e!=null&&typeof e!=="string")throw Error();return e};yt.get=wn.get;yt.set=wn.set;yt.setters=[];/*!
697
+ * ignore
698
+ */yt._checkRequired=(e)=>(e instanceof String||typeof e==="string")&&e.length;yt.checkRequired=wn.checkRequired;yt.prototype.enum=function(){if(this.enumValidator)this.validators=this.validators.filter(function(n){return n.validator!==this.enumValidator},this),this.enumValidator=!1;if(arguments[0]==null||arguments[0]===!1)return this.enumValues=[],delete this.options.enum,this;let e,t;if(m_.isObject(arguments[0]))if(Array.isArray(arguments[0].values))e=arguments[0].values,t=arguments[0].message;else e=m_.object.vals(arguments[0]),t=Vs.messages.String.enum;else e=arguments,t=Vs.messages.String.enum;for(let n of e)if(n!==void 0)this.enumValues.push(this.cast(n));let r=this.enumValues;return this.enumValidator=function(n){return n==null||~r.indexOf(n)},this.validators.push({validator:this.enumValidator,message:t,type:"enum",enumValues:r}),this};yt.prototype.lowercase=function(e){if(arguments.length>0&&!e)return this;return this.set((t)=>{if(typeof t!=="string")t=this.cast(t);if(t)return t.toLowerCase();return t})};yt.prototype.uppercase=function(e){if(arguments.length>0&&!e)return this;return this.set((t)=>{if(typeof t!=="string")t=this.cast(t);if(t)return t.toUpperCase();return t})};yt.prototype.trim=function(e){if(arguments.length>0&&!e)return this;return this.set((t)=>{if(typeof t!=="string")t=this.cast(t);if(t)return t.trim();return t})};yt.prototype.minlength=function(e,t){if(this.minlengthValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.minlengthValidator},this);if(e!=null){let r=t||Vs.messages.String.minlength;if(typeof r==="string")r=r.replace(/{MINLENGTH}/,e);this.validators.push({validator:this.minlengthValidator=function(n){return n===null||n.length>=e},message:r,type:"minlength",minlength:e})}return this};yt.prototype.minLength=yt.prototype.minlength;yt.prototype.maxlength=function(e,t){if(this.maxlengthValidator)this.validators=this.validators.filter(function(r){return r.validator!==this.maxlengthValidator},this);if(e!=null){let r=t||Vs.messages.String.maxlength;if(typeof r!=="function")r=r.replace(/{MAXLENGTH}/,e);this.validators.push({validator:this.maxlengthValidator=function(n){return n===null||n.length<=e},message:Zce(r),type:"maxlength",maxlength:e})}return this};yt.prototype.maxLength=yt.prototype.maxlength;yt.prototype.match=function(t,r){let n=r||Vs.messages.String.match,s=function(i){if(!t)return!1;return t.lastIndex=0,i!=null&&i!==""?t.test(i):!0};return this.validators.push({validator:s,message:n,type:"regexp",regexp:t}),this};yt.prototype.checkRequired=function(t,r){if(typeof t==="object"&&wn._isRef(this,t,r,!0))return t!=null;return(typeof this.constructor.checkRequired==="function"?this.constructor.checkRequired():yt.checkRequired())(t)};yt.prototype.cast=function(e,t,r,n,s){if(typeof e!=="string"&&wn._isRef(this,e,t,r))return this._castRef(e,t,r,s);let i;if(typeof this._castFunction==="function")i=this._castFunction;else if(typeof this.constructor.cast==="function")i=this.constructor.cast();else i=yt.cast();try{return i(e)}catch{throw new nU("string",e,this.path,null,this)}};/*!
699
+ * ignore
700
+ */function Pd(e,t){return this.castForQuery(null,e,t)}/*!
701
+ * ignore
702
+ */function Qce(e,t){let r=this;if(!Array.isArray(e))return[this.castForQuery(null,e,t)];return e.map(function(n){return r.castForQuery(null,n,t)})}/*!
703
+ * ignore
704
+ */function rU(e){if(e==null)return this._castNullish(e);return this.cast(e,this)}var Xce={...wn.prototype.$conditionalHandlers,$all:Qce,$gt:Pd,$gte:Pd,$lt:Pd,$lte:Pd,$options:rU,$regex:function(t){if(Object.prototype.toString.call(t)==="[object RegExp]")return t;return rU.call(this,t)},$not:Pd};Object.defineProperty(yt.prototype,"$conditionalHandlers",{enumerable:!1,value:Xce});yt.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Jce(this.$conditionalHandlers,e),!n)throw Error("Can't use "+e+" with String.");return n.call(this,t,r)}if(Object.prototype.toString.call(t)==="[object RegExp]"||Yce(t,"BSONRegExp"))return t;try{return this.applySetters(t,r)}catch(s){if(s instanceof nU&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};yt.prototype.toJSONSchema=function(t){return this._addJSONSchemaEnum(this._createJSONSchemaTypeDefinition("string","string",t))};yt.prototype.autoEncryptionType=function(){return"string"};/*!
705
+ * Module exports.
706
+ */sU.exports=yt;function Zce(e){return function(t,r){if(typeof e==="function")return Vs.ValidatorError.prototype.formatMessage(e,t,r);if(typeof e==="string"&&typeof t.value==="string"&&t.value.length>30)t=Object.assign({},t,{value:t.value.slice(0,30)+"..."});return Vs.ValidatorError.prototype.formatMessage(e,t,r)}}});var iU=g(function(Y_e,fS){var lS=Te().UUID,hS=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;fS.exports=function(t){if(t==null)return t;if(t instanceof lS)return t;if(typeof t==="string")if(hS.test(t))return new lS(t);else throw Error(`"${t}" is not a valid UUID string`);if(t.toString&&t.toString!==Object.prototype.toString){if(hS.test(t.toString()))return new lS(t.toString())}throw Error(`"${t}" cannot be casted to a UUID`)};fS.exports.UUID_FORMAT=hS});var cU=g(function(J_e,aU){/*!
707
+ * Module dependencies.
708
+ */var us=Mr(),oU=us.CastError,pS=iU(),uU=be(),y_=Sd(),ele=Li(),tle=pS.UUID_FORMAT;function rle(e){let t;if(typeof e!=="string"&&e!=null)return t=e.toString("hex"),t.substring(0,8)+"-"+t.substring(8,12)+"-"+t.substring(12,16)+"-"+t.substring(16,20)+"-"+t.substring(20,32);return e}function $r(e,t,r,n){us.call(this,e,t,"UUID",n)}$r.schemaName="UUID";$r.defaultOptions={};/*!
709
+ * Inherits from SchemaType.
710
+ */$r.prototype=Object.create(us.prototype);$r.prototype.constructor=$r;/*!
711
+ * ignore
712
+ */$r._cast=pS;$r.get=us.get;$r.set=us.set;$r.setters=[];$r.cast=function(t){if(arguments.length===0)return this._cast;if(t===!1)t=this._defaultCaster;return this._cast=t,this._cast};/*!
713
+ * ignore
714
+ */$r._checkRequired=(e)=>e!=null;$r.checkRequired=us.checkRequired;$r.prototype.checkRequired=function(t){if(Buffer.isBuffer(t))t=rle(t);return t!=null&&tle.test(t)};$r.prototype.cast=function(e,t,r,n,s){if(uU.isNonBuiltinObject(e)&&us._isRef(this,e,t,r))return this._castRef(e,t,r,s);let i;if(typeof this._castFunction==="function")i=this._castFunction;else if(typeof this.constructor.cast==="function")i=this.constructor.cast();else i=$r.cast();try{return i(e)}catch(o){throw new oU($r.schemaName,e,this.path,o,this)}};/*!
715
+ * ignore
716
+ */function nle(e){return this.cast(e)}/*!
717
+ * ignore
718
+ */function dS(e){return e.map((t)=>this.cast(t))}var sle={...us.prototype.$conditionalHandlers,$bitsAllClear:y_,$bitsAnyClear:y_,$bitsAllSet:y_,$bitsAnySet:y_,$all:dS,$in:dS,$ne:nle,$nin:dS};Object.defineProperty($r.prototype,"$conditionalHandlers",{enumerable:!1,value:sle});$r.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=ele(this.$conditionalHandlers,e),!n)throw Error("Can't use "+e+" with UUID.");return n.call(this,t,r)}try{return this.applySetters(t,r)}catch(s){if(s instanceof oU&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}};$r.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","binData",t)};$r.prototype.autoEncryptionType=function(){return"binData"};/*!
719
+ * Module exports.
720
+ */aU.exports=$r});var hU=g(function(Q_e,lU){var ile=js();class mS extends ile{}var ole=si();Object.defineProperty(mS.prototype,"of",ole);lU.exports=mS});var dU=g(function(X_e,fU){/*!
721
+ * ignore
722
+ */var ule=hU(),ale=Mr(),Rh=Symbol("firstValue");/*!
723
+ * ignore
724
+ */class Bd extends ale{constructor(e,t,r,n){super(e,t,"Union",n);if(!Array.isArray(t?.of)||t.of.length===0)throw Error("Union schema type requires an array of types");this.schemaTypes=t.of.map((s)=>n.interpretAsType(e,s,r)),this.$isSchemaUnion=!0}cast(e,t,r,n,s){let i=Rh,o;for(let u=0;u<this.schemaTypes.length;++u)try{let a=this.schemaTypes[u].cast(e,t,r,n,s);if(a===e)return a;if(i===Rh)i=a}catch(a){o=a}if(i!==Rh)return i;throw o}applySetters(e,t,r,n,s){e=this._applySetters(e,t,r,n,s);let i=Rh,o;for(let u=0;u<this.schemaTypes.length;++u)try{let a=this.schemaTypes[u]._applySetters(e,t,r,n,s);if(a==null)a=this.schemaTypes[u]._castNullish(a);else a=this.schemaTypes[u].cast(a,t,r,n,s);if(a===e)return a;if(i===Rh)i=a}catch(a){o=a}if(i!==Rh)return i;throw o}async doValidate(e,t,r){if(r&&r.skipSchemaValidators){if(e!=null&&typeof e.validate==="function")return e.validate();return}if(await super.doValidate(e,t,r),e!=null&&typeof e.validate==="function")await e.validate()}doValidateSync(e,t,r){if(!r||!r.skipSchemaValidators){let n=super.doValidateSync(e,t,r);if(n)return n}if(e!=null&&typeof e.$__validateSync==="function")return e.$__validateSync()}clone(){let e=super.clone();return e.schemaTypes=this.schemaTypes.map((t)=>t.clone()),e}toJSONSchema(e){let t=this.options.required&&typeof this.options.required!=="function",r={...e,_overrideRequired:!0},n=this.schemaTypes.map((s)=>s.toJSONSchema(r));if(t)return{anyOf:n};return{anyOf:[e?.useBsonType?{bsonType:"null"}:{type:"null"},...n]}}}Bd.schemaName="Union";Bd.defaultOptions={};Bd.prototype.OptionsConstructor=ule;fU.exports=Bd});var Od=g(function(zt){/*!
725
+ * Module exports.
726
+ */zt.Array=vg();zt.BigInt=Cj();zt.Boolean=Tj();zt.Buffer=Fj();zt.Date=qj();zt.Decimal128=zt.Decimal=zj();zt.DocumentArray=FL();zt.DocumentArrayElement=XO();zt.Double=$L();zt.Int32=jL();zt.Map=zL();zt.Mixed=Eh();zt.Number=wO();zt.ObjectId=ZL();zt.String=cS();zt.Subdocument=QO();zt.UUID=cU();zt.Union=dU();zt.Oid=zt.ObjectId;zt.Object=zt.Mixed;zt.Bool=zt.Boolean;zt.ObjectID=zt.ObjectId});var Kc=g(function(ES,TU){/*!
727
+ * Module dependencies.
728
+ */var cle=require("events").EventEmitter,lle=kc(),Mt=ze(),pU=LA(),hle=g$(),gS=Mr(),gU=js(),fle=rO(),E_=_g(),_U=sO(),$n=ar(),O_=Dr(),dle=Xn(),ple=Gk(),A_=uO(),mle=Eg(),mU=Fn(),yle=aO(),gle=v2(),oc=ii(),_le=Zk(),Ele=hq(),$h=Ao(),Ae=be(),Ale=pq(),Ole=/\.\d+(\.|$)/,uc,Sle=md().queryMiddlewareFunctions,wle=md().documentMiddlewareFunctions,EU=Sle.concat(wle).reduce((e,t)=>e.add(t),new Set),yS=Ae.isPOJO,AU=0,Cle=/^\d+$/;function J(e,t){if(!(this instanceof J))return new J(e,t);if(this.obj=e,this.paths={},this.aliases={},this.subpaths={},this.virtuals={},this.singleNestedPaths={},this.nested={},this.inherits={},this.callQueue=[],this._indexes=[],this._searchIndexes=[],this.methods=t?.methods||{},this.methodOptions={},this.statics=t?.statics||{},this.tree={},this.query=t?.query||{},this.childSchemas=[],this.plugins=[],this.$id=++AU,this.mapPaths=[],this.encryptedFields={},this.s={hooks:new lle},this.options=this.defaultOptions(t),Array.isArray(e))for(let s of e)this.add(s);else if(e)this.add(e);if(t?.virtuals){let s=t.virtuals,i=Object.keys(s);for(let o of i){let u=s[o].options?s[o].options:void 0,a=this.virtual(o,u);if(s[o].get)a.get(s[o].get);if(s[o].set)a.set(s[o].set)}}let r=e?._id&&Ae.isObject(e._id);if(!this.paths._id&&this.options._id&&!r)_U(this);this.setupTimestamp(this.options.timestamps)}function OU(e,t){for(let r of Object.keys(t)){let n=null;if(t[r]!=null)n=t[r];else{let i=O_(e.paths[r],"options");if(i==null)continue;n=i.alias}if(!n)continue;let s=e.paths[r].path;if(Array.isArray(n)){for(let i of n){if(typeof i!=="string")throw new Mt("Invalid value for alias option on "+s+", got "+i);e.aliases[i]=s,e.virtual(i).get(function(o){return function(){if(typeof this.get==="function")return this.get(o);return this[o]}}(s)).set(function(o){return function(u){return this.$set(o,u)}}(s))}continue}if(typeof n!=="string")throw new Mt("Invalid value for alias option on "+s+", got "+n);e.aliases[n]=s,e.virtual(n).get(function(i){return function(){if(typeof this.get==="function")return this.get(i);return this[i]}}(s)).set(function(i){return function(o){return this.$set(i,o)}}(s))}}/*!
729
+ * Inherit from EventEmitter.
730
+ */J.prototype=Object.create(cle.prototype);J.prototype.constructor=J;J.prototype.instanceOfSchema=!0;/*!
731
+ * ignore
732
+ */Object.defineProperty(J.prototype,"$schemaType",{configurable:!1,enumerable:!1,writable:!0});Object.defineProperty(J.prototype,"childSchemas",{configurable:!1,enumerable:!0,writable:!0});Object.defineProperty(J.prototype,"virtuals",{configurable:!1,enumerable:!0,writable:!0});J.prototype.obj;J.prototype.paths;J.prototype.tree;J.create=function(t,r){return new J(t,r)};J.prototype.clone=function(){let e=this._clone();return e.on("init",(t)=>this.emit("init",t)),e};/*!
733
+ * ignore
734
+ */J.prototype._clone=function(t){t=t||(this.base==null?J:this.base.Schema);let r=new t({},this._userProvidedOptions);r.base=this.base,r.obj=this.obj,r.options=$n(this.options),r.callQueue=this.callQueue.map(function(n){return n}),r.methods=$n(this.methods),r.methodOptions=$n(this.methodOptions),r.statics=$n(this.statics),r.query=$n(this.query),r.plugins=Array.prototype.slice.call(this.plugins),r._indexes=$n(this._indexes),r._searchIndexes=$n(this._searchIndexes),r.s.hooks=this.s.hooks.clone(),r.tree=$n(this.tree),r.paths=Object.fromEntries(Object.entries(this.paths).map(([n,s])=>[n,s.clone()])),r.nested=$n(this.nested),r.subpaths=$n(this.subpaths),r.mapPaths=[];for(let[n,s]of Object.entries(r.paths)){let i=n+".$*";if(!s.$isSchemaMap||!Object.hasOwn(r.paths,i))continue;r.paths[i]=s.$__schemaType,r.mapPaths.push(r.paths[i])}for(let n of Object.values(r.paths))if(n.$isSingleNested){let s=n.path;for(let i of Object.keys(n.schema.paths))r.singleNestedPaths[s+"."+i]=n.schema.paths[i];for(let i of Object.keys(n.schema.singleNestedPaths))r.singleNestedPaths[s+"."+i]=n.schema.singleNestedPaths[i];for(let i of Object.keys(n.schema.subpaths))r.singleNestedPaths[s+"."+i]=n.schema.subpaths[i];for(let i of Object.keys(n.schema.nested))r.singleNestedPaths[s+"."+i]="nested"}if(r._gatherChildSchemas(),r.virtuals=$n(this.virtuals),r.$globalPluginsApplied=this.$globalPluginsApplied,r.$isRootDiscriminator=this.$isRootDiscriminator,r.$implicitlyCreated=this.$implicitlyCreated,this.$timestamps!=null)r.$timestamps=Object.assign({},this.$timestamps);if(r.$id=++AU,r.$originalSchemaId=this.$id,this.discriminatorMapping!=null)r.discriminatorMapping=Object.assign({},this.discriminatorMapping);if(this.discriminators!=null)r.discriminators=Object.assign({},this.discriminators);if(this._applyDiscriminators!=null)r._applyDiscriminators=new Map(this._applyDiscriminators);return r.aliases=Object.assign({},this.aliases),r.encryptedFields=$n(this.encryptedFields),r};J.prototype.pick=function(e,t){let r=new J({},t||this.options);if(!Array.isArray(e))throw new Mt('Schema#pick() only accepts an array argument, got "'+typeof e+'"');for(let n of e)if(this._hasEncryptedField(n)){let s=this.encryptedFields[n],i=this.path(n);r.add({[n]:{encrypt:s,[this.options.typeKey]:i}})}else if(this.nested[n])r.add({[n]:O_(this.tree,n)});else{let s=this.path(n);if(s==null)throw new Mt("Path `"+n+"` is not in the schema");r.add({[n]:s})}if(!this._hasEncryptedFields())r.options.encryptionType=null;return r};J.prototype.omit=function(e,t){let r=new J(this,t||this.options);if(!Array.isArray(e))throw new Mt('Schema#omit() only accepts an array argument, got "'+typeof e+'"');return r.remove(e),r};J.prototype.defaultOptions=function(e){this._userProvidedOptions=e==null?{}:$n(e);let t=this.base?.options||{},r=t.strict??!0,n=t.strictQuery??!1,s=t.strictRead??!1,i=t.id??!0;if(e={strict:r,strictQuery:n,strictRead:s,bufferCommands:!0,capped:!1,versionKey:"__v",optimisticConcurrency:!1,minimize:!0,autoIndex:null,discriminatorKey:"__t",shardKey:null,read:null,validateBeforeSave:!0,validateModifiedOnly:!1,_id:!0,id:i,typeKey:"type",...e},e.strict??=r,e.strictQuery??=n,e.id??=i,e.versionKey&&typeof e.versionKey!=="string")throw new Mt("`versionKey` must be falsy or string, got `"+typeof e.versionKey+"`");if(bU(e.defaultSort),typeof e.read==="string")e.read=A_(e.read);else if(Array.isArray(e.read)&&typeof e.read[0]==="string")e.read={mode:A_(e.read[0]),tags:e.read[1]};if(e.optimisticConcurrency&&!e.versionKey)throw new Mt("Must set `versionKey` if using `optimisticConcurrency`");return e};J.prototype.discriminator=function(e,t,r){return this._applyDiscriminators=this._applyDiscriminators||new Map,this._applyDiscriminators.set(e,{schema:t,options:r}),this};/*!
735
+ * Get the document middleware for this schema, filtering out any hooks that are specific to queries.
736
+ */J.prototype._getDocumentMiddleware=function(t){let r=!!(this.options.shardKey||this.options.shardkey);return this.s.hooks.filter((n)=>{if(t&&n.fn[$h.skipOnSubdocuments])return!1;if(!r&&n.fn[$h.requiresShardKey])return!1;if(n.name==="updateOne"||n.name==="deleteOne")return!!n.document;if(n.name==="remove"||n.name==="init")return n.document==null||!!n.document;if(n.query!=null||n.document!=null)return n.document!==!1;return!0}).filter((n)=>{if(this.methods[n.name])return!n.fn[$h.builtInMiddleware];return!0})};/*!
737
+ * Get this schema's default toObject/toJSON options, including Mongoose global
738
+ * options.
739
+ */J.prototype._defaultToObjectOptions=function(e){let t=e?"toJSON":"toObject";if(this._defaultToObjectOptionsMap&&t in this._defaultToObjectOptionsMap)return this._defaultToObjectOptionsMap[t];let r=this.base?.options?.[t]||{},n=this.options[t]||{},s=Object.assign({},r,n);return this._defaultToObjectOptionsMap=this._defaultToObjectOptionsMap||{},this._defaultToObjectOptionsMap[t]=Ae.hasOwnKeys(s)?s:null,s};J.prototype.encryptionType=function(e){if(arguments.length===0)return this.options.encryptionType;if(!(typeof e==="string"||e===null))throw new Mt(`invalid \`encryptionType\`: ${e}`);this.options.encryptionType=e};J.prototype.add=function(t,r){if(t instanceof J||t?.instanceOfSchema)return gle(this,t),this;if(t._id===!1&&r==null)this.options._id=!1;if(r=r||"",r==="__proto__."||r==="constructor."||r==="prototype.")return this;let n=Object.keys(t),s=this.options.typeKey;for(let o of n){if(Ae.specialProperties.has(o))continue;let u=r+o,a=t[o];if(a==null)throw TypeError("Invalid value for schema path `"+u+'`, got value "'+a+'"');if(o==="_id"&&a===!1)continue;let c=!1;if(typeof a==="string"){let l=this.base?.Schema.Types??J.Types,f=a.charAt(0).toUpperCase()+a.substring(1);c=l[f]!=null}if(o!=="_id"&&(typeof a!=="object"&&typeof a!=="function"&&!c||a==null))throw TypeError(`Invalid schema configuration: \`${a}\` is not a valid type at path \`${o}\`. See https://bit.ly/mongoose-schematypes for a list of valid schema types.`);if(a instanceof E_||(a.constructor?.name??null)==="VirtualType"){this.virtual(a);continue}if(Array.isArray(a)&&a.length===1&&a[0]==null)throw TypeError("Invalid value for schema Array path `"+u+'`, got value "'+a[0]+'"');if(!(yS(a)||a instanceof gU)){if(r)this.nested[r.substring(0,r.length-1)]=!0;if(this.path(r+o,a),!a[0]?.instanceOfSchema&&Ae.isPOJO(a[0]?.discriminators)){let l=this.path(r+o);for(let f in a[0].discriminators)l.discriminator(f,a[0].discriminators[f])}}else if(Ae.hasOwnKeys(a)===!1){if(r)this.nested[r.substring(0,r.length-1)]=!0;this.path(u,a)}else if(!a[s]||s==="type"&&yS(a.type)&&a.type.type)this.nested[u]=!0,this.add(a,u+".");else{let l=a[s];if(yS(l)&&Ae.hasOwnKeys(l)){if(r)this.nested[r.substring(0,r.length-1)]=!0;let f={};if(this._userProvidedOptions.typeKey)f.typeKey=this._userProvidedOptions.typeKey;if(this._userProvidedOptions.strict!=null)f.strict=this._userProvidedOptions.strict;if(this._userProvidedOptions.toObject!=null)f.toObject=Ae.omit(this._userProvidedOptions.toObject,["transform"]);if(this._userProvidedOptions.toJSON!=null)f.toJSON=Ae.omit(this._userProvidedOptions.toJSON,["transform"]);let h=new J(l,f);h.$implicitlyCreated=!0;let d=Object.assign({},a,{[s]:h});this.path(r+o,d)}else{if(r)this.nested[r.substring(0,r.length-1)]=!0;if(this.path(r+o,a),!a?.instanceOfSchema&&Ae.isPOJO(a?.discriminators)){let f=this.path(r+o);for(let h in a.discriminators)f.discriminator(h,a.discriminators[h])}}}if(a.instanceOfSchema&&a.encryptionType()!=null){if(this.encryptionType()!=a.encryptionType())throw new Mt("encryptionType of a nested schema must match the encryption type of the parent schema.");for(let[l,f]of Object.entries(a.encryptedFields)){let h=u+"."+l;this._addEncryptedField(h,f)}}else if(typeof a==="object"&&"encrypt"in a){let{encrypt:l}=a;if(this.encryptionType()==null)throw new Mt("encryptionType must be provided");this._addEncryptedField(u,l)}else this._removeEncryptedField(u)}let i=Object.fromEntries(Object.entries(t).map(([o])=>[r+o,null]));return OU(this,i),this};J.prototype._addEncryptedField=function(t,r){if(this.path(t).autoEncryptionType()==null)throw new Mt(`Invalid BSON type for FLE field: '${t}'`);this.encryptedFields[t]=$n(r)};J.prototype._removeEncryptedField=function(t){delete this.encryptedFields[t]};J.prototype._hasEncryptedFields=function(){return Ae.hasOwnKeys(this.encryptedFields)};J.prototype._hasEncryptedField=function(t){return t in this.encryptedFields};J.prototype._buildEncryptedFields=function(){return{fields:Object.entries(this.encryptedFields).map(([t,r])=>{let n=this.path(t).autoEncryptionType();return{path:t,bsonType:n,...r}})}};J.prototype._buildSchemaMap=function(){function e(n,s,i){let o=0,u=n[o];for(;o<n.length-1;++o,u=n[o])s[u]=s[u]==null?{bsonType:"object",properties:{}}:s[u],s=s[u].properties;s[u]=i}let t=(n,[s,i])=>{let o=this.path(s).autoEncryptionType(),u=s.split("."),a={encrypt:{...i,bsonType:o}};return e(u,n,a),n};return{bsonType:"object",properties:Object.entries(this.encryptedFields).reduce(t,{})}};J.prototype.alias=function(e,t){return OU(this,{[e]:t}),this};J.prototype.removeIndex=function(t){if(arguments.length>1)throw new Mt("removeIndex() takes only 1 argument");if(typeof t!=="object"&&typeof t!=="string")throw new Mt("removeIndex() may only take either an object or a string as an argument");if(typeof t==="object"){for(let r=this._indexes.length-1;r>=0;--r)if(yle(this._indexes[r][0],t))this._indexes.splice(r,1)}else for(let r=this._indexes.length-1;r>=0;--r)if(this._indexes[r][1]!=null&&this._indexes[r][1].name===t)this._indexes.splice(r,1);return this};J.prototype.clearIndexes=function(){return this._indexes.length=0,this};J.prototype.searchIndex=function(t){return this._searchIndexes.push(t),this};J.reserved=Object.create(null);J.prototype.reserved=J.reserved;var Rn=J.reserved;Rn.prototype=Rn.emit=Rn.listeners=Rn.removeListener=Rn.collection=Rn.errors=Rn.get=Rn.init=Rn.isModified=Rn.isNew=Rn.populated=Rn.remove=Rn.save=Rn.toObject=Rn.validate=1;Rn.collection=1;J.prototype.path=function(e,t){if(t===void 0){if(Object.hasOwn(this.paths,e))return this.paths[e];let a=SU(e),c=ble(this,e,a);if(c!=null)return c;let l=wU(this,e);if(l!=null)return l;if(c=this.hasMixedParent(a),c!=null)return c;return Ole.test(e)?Dle(this,e,a):void 0}let r=e.indexOf(".")===-1?[e]:e.split("."),n=r.pop();if(Ae.specialProperties.has(n))throw new Mt("Cannot set special property `"+n+"` on a schema");let s=r.length===0?n:r[0];if(Object.hasOwn(Rn,s)&&!this.options.suppressReservedKeysWarning){let a=`\`${s}\` is a reserved schema pathname and may break some functionality. You are allowed to use it, but use at your own risk. To disable this warning pass \`suppressReservedKeysWarning\` as a schema option.`;Ae.warn(a)}if(typeof t==="object"&&Ae.hasUserDefinedProperty(t,"ref"))Ale(t.ref,e);let i=this.tree,o="";for(let a of r){if(Ae.specialProperties.has(a))throw new Mt("Cannot set special property `"+a+"` on a schema");if(o=o+=(o.length>0?".":"")+a,!i[a])this.nested[o]=!0,i[a]={};if(typeof i[a]!=="object"){let c="Cannot set nested path `"+e+"`. Parent path `"+o+"` already set to type "+i[a].name+".";throw new Mt(c)}i=i[a]}i[n]=$n(t),this.paths[e]=this.interpretAsType(e,t,this.options),this._defaultsCache=null,this._hasSelectedPaths=void 0;let u=this.paths[e];if(this.childSchemas=this.childSchemas.filter((a)=>a.path!==e),u.$isSchemaMap){let a=e+".$*";if(this.paths[a]=u.$__schemaType,this.mapPaths.push(this.paths[a]),u.$__schemaType.$isSingleNested)this.childSchemas.push({schema:u.$__schemaType.schema,model:u.$__schemaType.Constructor,path:e})}if(u.$isSingleNested){for(let a of Object.keys(u.schema.paths))this.singleNestedPaths[e+"."+a]=u.schema.paths[a];for(let a of Object.keys(u.schema.singleNestedPaths))this.singleNestedPaths[e+"."+a]=u.schema.singleNestedPaths[a];for(let a of Object.keys(u.schema.subpaths))this.singleNestedPaths[e+"."+a]=u.schema.subpaths[a];for(let a of Object.keys(u.schema.nested))this.singleNestedPaths[e+"."+a]="nested";Object.defineProperty(u.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),u.Constructor.base=this.base,this.childSchemas.push({schema:u.schema,model:u.Constructor,path:e})}else if(u.$isMongooseDocumentArray)Object.defineProperty(u.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),u.Constructor.base=this.base,this.childSchemas.push({schema:u.schema,model:u.Constructor,path:e});if(u.$isMongooseArray&&!u.$isMongooseDocumentArray){let a=e,c=u,l=[];while(c.$isMongooseArray)a=a+".$",c.embeddedSchemaType._arrayPath=a,c.embeddedSchemaType._arrayParentPath=e,c=c.embeddedSchemaType,this.subpaths[a]=c;for(let f of l)this.subpaths[f.path]=f}if(u.$isMongooseDocumentArray){for(let a of Object.keys(u.schema.paths)){let c=u.schema.paths[a];if(this.subpaths[e+"."+a]=c,typeof c==="object"&&c!=null&&c.$parentSchemaDocArray==null)c.$parentSchemaDocArray=u}for(let a of Object.keys(u.schema.subpaths)){let c=u.schema.subpaths[a];if(this.subpaths[e+"."+a]=c,typeof c==="object"&&c!=null&&c.$parentSchemaDocArray==null)c.$parentSchemaDocArray=u}for(let a of Object.keys(u.schema.singleNestedPaths)){let c=u.schema.singleNestedPaths[a];if(this.subpaths[e+"."+a]=c,typeof c==="object"&&c!=null&&c.$parentSchemaDocArray==null)c.$parentSchemaDocArray=u}}return this};/*!
740
+ * ignore
741
+ */J.prototype._gatherChildSchemas=function(){let t=[];for(let r of Object.keys(this.paths)){if(typeof r!=="string")continue;let n=this.paths[r];if(n.$isMongooseDocumentArray||n.$isSingleNested)t.push({schema:n.schema,model:n.Constructor,path:r});else if(n.$isSchemaMap&&n.$__schemaType.$isSingleNested)t.push({schema:n.$__schemaType.schema,model:n.$__schemaType.Constructor,path:r})}return this.childSchemas=t,t};/*!
742
+ * ignore
743
+ */function ble(e,t,r){if(Object.hasOwn(e.paths,t))return e.paths[t];if(Object.hasOwn(e.subpaths,r)){let n=e.subpaths[r];if(n==="nested")return;return n}if(Object.hasOwn(e.singleNestedPaths,r)&&typeof e.singleNestedPaths[r]==="object"){let n=e.singleNestedPaths[r];if(n==="nested")return;return n}return null}/*!
744
+ * ignore
745
+ */function SU(e){if(!/\.\d+/.test(e))return e;return e.replace(/\.\d+\./g,".$.").replace(/\.\d+$/,".$")}/*!
746
+ * ignore
747
+ */function wU(e,t){if(e.mapPaths.length===0)return null;for(let r of e.mapPaths){let n=r.path.replace(/\.\$\*/g,"");if(t===n||t.startsWith(n+".")&&t.slice(n.length+1).indexOf(".")===-1)return r;else if(r.schema&&t.startsWith(n+".")){let s=t.slice(n.length+1);return s=s.slice(s.indexOf(".")+1),r.schema.path(s)}else if(r.$isSchemaMap&&t.startsWith(n+".")){let s=t.slice(n.length+1);s=s.slice(s.indexOf(".")+1);let i=r.$__schemaType._presplitPath;if(s.indexOf(".")===-1&&i[i.length-1]==="$*")return r.$__schemaType;else if(s.indexOf(".")!==-1&&r.$__schemaType.schema&&i[i.length-1]==="$*")return r.$__schemaType.schema.path(s.slice(s.indexOf(".")+1))}}return null}Object.defineProperty(J.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null});J.prototype.interpretAsType=function(e,t,r){if(t instanceof gS){if(t.path===e)return t;let a=t.clone();return a.path=e,a}let n=this.base?.Schema.Types??J.Types,s=this.base?.Types??Ah();if(!Ae.isPOJO(t)&&!(t instanceof gU)){if(Ae.getFunctionName(t.constructor)!=="Object"){let c=t;t={},t[r.typeKey]=c}}let i=t[r.typeKey]&&(t[r.typeKey]instanceof Function||r.typeKey!=="type"||!t.type.type)?t[r.typeKey]:{};if(i instanceof gS){if(i.path===e)return i;let a=i.clone();return a.path=e,a}let o;if(Ae.isPOJO(i)||i==="mixed")return new n.Mixed(e,t,null,this);if(Array.isArray(i)||i===Array||i==="array"||i===n.Array){let a=i===Array||i==="array"?t.cast||t.of:i[0];if(a?.instanceOfSchema){if(!(a instanceof J))if(this.options._isMerging)a=new J(a);else throw TypeError("Schema for array path `"+e+`\` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with \`npm list mongoose\`. If you are still getting this error, please add \`new Schema()\` around the path: ${e}: new Schema(...)`);return new n.DocumentArray(e,a,t,null,this)}if(a&&a[r.typeKey]&&a[r.typeKey].instanceOfSchema){if(!(a[r.typeKey]instanceof J))if(this.options._isMerging)a[r.typeKey]=new J(a[r.typeKey]);else throw TypeError("Schema for array path `"+e+`\` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with \`npm list mongoose\`. If you are still getting this error, please add \`new Schema()\` around the path: ${e}: new Schema(...)`);return new n.DocumentArray(e,a[r.typeKey],t,a,this)}if(typeof a<"u"){if(Array.isArray(a)||a.type===Array||a.type=="Array"){if(a?.type=="Array")a.type=Array;return new n.Array(e,this.interpretAsType(e,a,r),t,null,this)}}let c=a!=null&&a[r.typeKey]&&(r.typeKey!=="type"||!a.type.type)?a[r.typeKey]:a;if(typeof a==="string")a=n[a.charAt(0).toUpperCase()+a.substring(1)];else if(Ae.isPOJO(c))if(Ae.hasOwnKeys(c)){let l={minimize:r.minimize};if(r.typeKey)l.typeKey=r.typeKey;if(Object.hasOwn(r,"strict"))l.strict=r.strict;if(Object.hasOwn(r,"strictQuery"))l.strictQuery=r.strictQuery;if(Object.hasOwn(r,"toObject"))l.toObject=Ae.omit(r.toObject,["transform"]);if(Object.hasOwn(r,"toJSON"))l.toJSON=Ae.omit(r.toJSON,["transform"]);if(Object.hasOwn(this._userProvidedOptions,"_id"))l._id=this._userProvidedOptions._id;else if(J.Types.DocumentArray.defaultOptions._id!=null)l._id=J.Types.DocumentArray.defaultOptions._id;let f=new J(c,l);return f.$implicitlyCreated=!0,new n.DocumentArray(e,f,t,null,this)}else return new n.Array(e,n.Mixed,t,null,this);if(a){if(i=a[r.typeKey]&&(r.typeKey!=="type"||!a.type.type)?a[r.typeKey]:a,Array.isArray(i))return new n.Array(e,this.interpretAsType(e,a,r),t,null,this);if(o=typeof i==="string"?i:i.schemaName||Ae.getFunctionName(i),o==="ClockDate")o="Date";if(o===void 0)throw TypeError(`Invalid schema configuration: Could not determine the embedded type for array \`${e}\`. See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.`);if(!Object.hasOwn(n,o))throw TypeError(`Invalid schema configuration: \`${o}\` is not a valid type within the array \`${e}\`.See https://bit.ly/mongoose-schematypes for a list of valid schema types.`);if(o==="Union"&&typeof a==="object")a.parentSchema=this}return new n.Array(e,a||n.Mixed,t,r,this)}if(i?.instanceOfSchema)return new n.Subdocument(i,e,t,this);if(Buffer.isBuffer(i))o="Buffer";else if(typeof i==="function"||typeof i==="object")o=i.schemaName||Ae.getFunctionName(i);else if(i===s.ObjectId)o="ObjectId";else if(i===s.Decimal128)o="Decimal128";else o=i==null?""+i:i.toString();if(o)o=o.charAt(0).toUpperCase()+o.substring(1);if(o==="ObjectID")o="ObjectId";if(o==="ClockDate")o="Date";if(o===void 0)throw TypeError(`Invalid schema configuration: \`${e}\` schematype definition is invalid. See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.`);if(n[o]==null)throw TypeError(`Invalid schema configuration: \`${o}\` is not a valid type at path \`${e}\`. See https://bit.ly/mongoose-schematypes for a list of valid schema types.`);return new n[o](e,t,r,this)};J.prototype.eachPath=function(e){let t=Object.keys(this.paths),r=t.length;for(let n=0;n<r;++n)e(t[n],this.paths[t[n]]);return this};J.prototype.requiredPaths=function(t){if(this._requiredpaths&&!t)return this._requiredpaths;let r=Object.keys(this.paths),n=r.length,s=[];while(n--){let i=r[n];if(this.paths[i].isRequired)s.push(i)}return this._requiredpaths=s,this._requiredpaths};J.prototype.pathsWithTransforms=function(t){if(this._pathsWithTransforms!==void 0&&!t)return this._pathsWithTransforms;let r=Object.keys(this.paths),n=[];for(let s of r){let i=this.paths[s],o=i.options.transform??i.constructor?.defaultOptions?.transform,u=i.embeddedSchemaType?.options?.transform??i.embeddedSchemaType?.constructor?.defaultOptions?.transform;if(o||u)n.push(s)}return this._pathsWithTransforms=n.length?n:null,this._pathsWithTransforms};J.prototype._getDefaultsCache=function(){if(this._defaultsCache==null)this._defaultsCache=new hle(this);return this._defaultsCache};J.prototype.indexedPaths=function(){if(this._indexedpaths)return this._indexedpaths;return this._indexedpaths=this.indexes(),this._indexedpaths};J.prototype.pathType=function(e){if(Object.hasOwn(this.paths,e))return"real";if(Object.hasOwn(this.virtuals,e))return"virtual";if(Object.hasOwn(this.nested,e))return"nested";let t=SU(e);if(Object.hasOwn(this.subpaths,t)||Object.hasOwn(this.subpaths,e))return"real";let r=Object.hasOwn(this.singleNestedPaths,t)||Object.hasOwn(this.singleNestedPaths,e);if(r)return r==="nested"?"nested":"real";if(wU(this,e)!=null)return"real";if(/\.\d+\.|\.\d+$/.test(e))return CU(this,e,t);return"adhocOrUndefined"};J.prototype.hasMixedParent=function(e){let t=e.split(/\./g);e="";for(let r=0;r<t.length;++r)if(e=r>0?e+"."+t[r]:t[r],Object.hasOwn(this.paths,e)&&this.paths[e]instanceof uc.Mixed)return this.paths[e];return null};J.prototype.setupTimestamp=function(e){return Ele(this,e)};function CU(e,t,r){let n=t.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);if(n.length<2)return Object.hasOwn(e.paths,n[0])?e.paths[n[0]]:"adhocOrUndefined";let s=e.path(n[0]),i=!1;if(!s)return"adhocOrUndefined";let o=n.length-1;for(let u=1;u<n.length;++u){i=!1;let a=n[u];if(u===o&&s&&!/\D/.test(a)){if(s.$isMongooseDocumentArray)s=s.embeddedSchemaType;else if(s instanceof uc.Array)s=s.embeddedSchemaType;else s=void 0;break}if(!/\D/.test(a)){if(s instanceof uc.Array&&u!==o)s=s.embeddedSchemaType;continue}if(!s?.schema){s=void 0;break}i=s.schema.pathType(a)==="nested",s=s.schema.path(a)}if(e.subpaths[r]=s,s)return"real";if(i)return"nested";return"adhocOrUndefined"}/*!
748
+ * ignore
749
+ */function Dle(e,t,r){return CU(e,t,r),e.subpaths[r]}J.prototype.queue=function(e,t){return this.callQueue.push([e,t]),this};J.prototype.pre=function(e){if(e instanceof RegExp){let t=Array.prototype.slice.call(arguments,1);for(let r of EU)if(e.test(r))this.pre.apply(this,[r].concat(t));return this}if(Array.isArray(e)){let t=Array.prototype.slice.call(arguments,1);for(let r of e)this.pre.apply(this,[r].concat(t));return this}return this.s.hooks.pre.apply(this.s.hooks,arguments),this};J.prototype.post=function(e){if(e instanceof RegExp){let t=Array.prototype.slice.call(arguments,1);for(let r of EU)if(e.test(r))this.post.apply(this,[r].concat(t));return this}if(Array.isArray(e)){let t=Array.prototype.slice.call(arguments,1);for(let r of e)this.post.apply(this,[r].concat(t));return this}return this.s.hooks.post.apply(this.s.hooks,arguments),this};J.prototype.plugin=function(e,t){if(typeof e!=="function")throw new Mt('First param to `schema.plugin()` must be a function, got "'+typeof e+'"');if(t?.deduplicate){for(let r of this.plugins)if(r.fn===e)return this}return this.plugins.push({fn:e,opts:t}),e(this,t),this};J.prototype.queryHelper=function(t,r){if(typeof t!=="string")throw new Mt('First param to `schema.queryHelper()` must be a string, got "'+typeof t+'"');if(typeof r!=="function")throw new Mt('Second param to `schema.queryHelper()` must be a function, got "'+typeof r+'"');return this.query[t]=r,this};J.prototype.method=function(e,t,r){if(typeof e!=="string")for(let n in e)this.methods[n]=e[n],this.methodOptions[n]=$n(r);else this.methods[e]=t,this.methodOptions[e]=$n(r);return this};J.prototype.static=function(e,t){if(typeof e!=="string")for(let r in e)this.statics[r]=e[r];else this.statics[e]=t;return this};J.prototype.index=function(e,t){if(e||(e={}),t||(t={}),t.expires)Ae.expires(t);for(let r in e)if(this.aliases[r])e=Ae.renameObjKey(e,r,this.aliases[r]);for(let r of Object.keys(e))if(e[r]==="ascending"||e[r]==="asc")e[r]=1;else if(e[r]==="descending"||e[r]==="desc")e[r]=-1;return this._indexes.push([e,t]),this};J.prototype.set=function(e,t,r){if(arguments.length===1)return this.options[e];switch(e){case"read":if(typeof t==="string")this.options[e]={mode:A_(t),tags:r};else if(Array.isArray(t)&&typeof t[0]==="string")this.options[e]={mode:A_(t[0]),tags:t[1]};else this.options[e]=t;this._userProvidedOptions[e]=this.options[e];break;case"timestamps":this.setupTimestamp(t),this.options[e]=t,this._userProvidedOptions[e]=this.options[e];break;case"_id":if(this.options[e]=t,this._userProvidedOptions[e]=this.options[e],t&&!this.paths._id)_U(this);else if(!t&&this.paths._id!=null&&this.paths._id.auto)this.remove("_id");break;default:this.options[e]=t,this._userProvidedOptions[e]=this.options[e];break}if(e==="strict")Fd(this,{strict:t});if(e==="strictQuery")Fd(this,{strictQuery:t});if(e==="toObject")t={...t},delete t.transform,Fd(this,{toObject:t});if(e==="toJSON")t={...t},delete t.transform,Fd(this,{toJSON:t});return this};/*!
750
+ * Recursively set options on implicitly created schemas
751
+ */function Fd(e,t){for(let{schema:r}of e.childSchemas){if(!r.$implicitlyCreated)continue;Object.assign(r.options,t),Fd(r,t)}}J.prototype.get=function(e){return this.options[e]};var Tle="2d 2dsphere hashed text".split(" ");Object.defineProperty(J,"indexTypes",{get:function(){return Tle},set:function(){throw new Mt("Cannot overwrite Schema.indexTypes")}});J.prototype.indexes=function(){return ple(this)};J.prototype.virtual=function(e,t){if(e instanceof E_||dle(e)==="VirtualType")return this.virtual(e.path,e.options);let r=e.split(".");for(let s of r)if(Ae.specialProperties.has(s))throw new Mt("Cannot set special property `"+s+"` on a schema");if(t=new fle(t),Ae.hasUserDefinedProperty(t,["ref","refPath"])){if(t.localField==null)throw new Mt("Reference virtuals require `localField` option");if(t.foreignField==null)throw new Mt("Reference virtuals require `foreignField` option");let s=this.virtual(e);if(s.options=t,this.pre("init",function(a,c){if(oc.has(e,a)){let l=oc.get(e,a);if(!this.$$populatedVirtuals)this.$$populatedVirtuals={};if(t.justOne||t.count)this.$$populatedVirtuals[e]=Array.isArray(l)?l[0]:l;else this.$$populatedVirtuals[e]=Array.isArray(l)?l:l==null?[]:[l];if(c?.hydratedPopulatedDocs&&!t.count){let f=s._getModelNamesForPopulate(this),h=this.$$populatedVirtuals[e];if(!Array.isArray(h)&&!mU(h)&&f?.length===1){let d=this.db.model(f[0]);this.$$populatedVirtuals[e]=d.hydrate(h)}else if(Array.isArray(h)&&f?.length===1){let d=this.db.model(f[0]);for(let m=0;m<h.length;++m)if(!mU(h[m]))h[m]=d.hydrate(h[m],null,{hydratedPopulatedDocs:!0});let p=t.foreignField;this.$populated(e,h.map((m)=>m==null?m:m.get(typeof p==="function"?p.call(m,m):p)),{populateModelSymbol:d})}}oc.unset(e,a)}}),s.set(function(u){if(!this.$$populatedVirtuals)this.$$populatedVirtuals={};return _le(this.$$populatedVirtuals,e,u,t)}),typeof t.get==="function")s.get(t.get);let i=e.split("."),o=i[0];for(let u=0;u<i.length-1;++u){if(this.paths[o]==null)continue;if(this.paths[o].$isMongooseDocumentArray||this.paths[o].$isSingleNested){let a=i.slice(u+1).join(".");this.paths[o].schema.virtual(a,t);break}else if(this.paths[o].$isSchemaMap){let a=i.slice(u+2).join(".");this.paths[o].$__schemaType.schema.virtual(a,t);break}o+="."+i[u+1]}return s}let n=this.virtuals;if(this.pathType(e)==="real")throw new Mt('Virtual path "'+e+'" conflicts with a real path in the schema');if(n[e]=r.reduce(function(s,i,o){return s[i]||(s[i]=o===r.length-1?new E_(t,e):{}),s[i]},this.tree),t?.applyToArray&&r.length>1){let s=this.path(r.slice(0,-1).join("."));if(s?.$isMongooseArray)return s.virtual(r[r.length-1],t);else throw new Mt(`Path "${s}" is not an array`)}return n[e]};J.prototype.virtualpath=function(e){return Object.hasOwn(this.virtuals,e)?this.virtuals[e]:null};J.prototype.remove=function(e){if(typeof e==="string")e=[e];if(Array.isArray(e))e.forEach(function(t){if(this.path(t)==null&&!this.nested[t])return;this._defaultsCache=null,this._hasSelectedPaths=void 0;for(let[r,n]of Object.entries(this.aliases))if(n===t||n.startsWith(t+".")){if(delete this.aliases[r],delete this.virtuals[r],O_(this.tree,r)instanceof E_)g_(this,r)}if(this.nested[t]){let r=Object.keys(this.paths).concat(Object.keys(this.nested));for(let n of r)if(n.startsWith(t+"."))delete this.paths[n],delete this.nested[n],g_(this,n);this.mapPaths=this.mapPaths.filter((n)=>!n.path.startsWith(t+".")),yU(this,t),delete this.nested[t],g_(this,t);return}delete this.paths[t];for(let r of Object.keys(this.paths))if(r.startsWith(t+"."))delete this.paths[r];this.mapPaths=this.mapPaths.filter((r)=>!r.path.startsWith(t+".")),yU(this,t),g_(this,t),this._removeEncryptedField(t)},this);return this};/*!
752
+ * ignore
753
+ */function yU(e,t){let r=t+".";for(let n of Object.keys(e.subpaths))if(n===t||n.startsWith(r))delete e.subpaths[n];for(let n of Object.keys(e.singleNestedPaths))if(n===t||n.startsWith(r))delete e.singleNestedPaths[n]}function g_(e,t){let r=t.split("."),n=r.pop(),s=e.tree;for(let i of r)if(s=s[i],s==null)return;delete s[n]}J.prototype.removeVirtual=function(e){if(typeof e==="string")e=[e];if(Array.isArray(e)){for(let t of e)if(this.virtuals[t]==null)throw new Mt(`Attempting to remove virtual "${t}" that does not exist.`);for(let t of e){if(Object.hasOwn(this.aliases,t)){let r=this.aliases[t];delete this.aliases[t];let n=O_(this.tree,r),s=n instanceof gS?n.options:n;for(let i of[this.paths[r]?.options,s])if(i?.alias===t)delete i.alias;else if(Array.isArray(i?.alias))i.alias=i.alias.filter((o)=>o!==t)}if(delete this.paths[t],delete this.virtuals[t],t.indexOf(".")!==-1)oc.unset(t,this.tree);else delete this.tree[t]}}return this};J.prototype.loadClass=function(e,t){if(e===Object.prototype||e===Function.prototype||Object.hasOwn(e.prototype,"$isMongooseModelPrototype")||Object.hasOwn(e.prototype,"$isMongooseDocumentPrototype"))return this;if(this.loadClass(Object.getPrototypeOf(e),t),!t)Object.getOwnPropertyNames(e).forEach(function(r){if(r.match(/^(length|name|prototype|constructor|__proto__)$/))return;let n=Object.getOwnPropertyDescriptor(e,r);if(Object.hasOwn(n,"value"))this.static(r,n.value)},this);return Object.getOwnPropertyNames(e.prototype).forEach(function(r){if(r.match(/^(constructor)$/))return;let n=Object.getOwnPropertyDescriptor(e.prototype,r);if(!t){if(typeof n.value==="function")this.method(r,n.value)}if(typeof n.get==="function"){if(this.virtuals[r])this.virtuals[r].getters=[];this.virtual(r).get(n.get)}if(typeof n.set==="function"){if(this.virtuals[r])this.virtuals[r].setters=[];this.virtual(r).set(n.set)}},this),this};/*!
754
+ * ignore
755
+ */J.prototype._getSchema=function(e){let t=this,r=t.path(e),n=[];if(r)return r.$fullPath=e,r;function s(o,u){let a=o.length+1,c,l;while(a--)if(l=o.slice(0,a).join("."),c=u.path(l),c){if(n.push(l),c.embeddedSchemaType||c.Constructor){if(c.embeddedSchemaType instanceof uc.Mixed)return c.embeddedSchemaType.$fullPath=n.join("."),c.embeddedSchemaType;if(a!==o.length){let f=c,h=a;while(h<o.length&&f.embeddedSchemaType&&(o[h]==="$"||__(o[h])))f=f.embeddedSchemaType,++h;if(h===o.length)return f;if(c.schema){let d;if(o[a]==="$"||__(o[a])){if(a+1===o.length)return c.embeddedSchemaType;if(d=s(o.slice(a+1),c.schema),d)d.$parentSchemaDocArray=d.$parentSchemaDocArray||(c.schema.$isSingleNested?null:c);return d}if(d=s(o.slice(a),c.schema),d)d.$parentSchemaDocArray=d.$parentSchemaDocArray||(c.schema.$isSingleNested?null:c);return d}}}else if(c.$isSchemaMap){if(a>=o.length)return c;if(a+1>=o.length)return c.$__schemaType;if(c.$__schemaType instanceof uc.Mixed)return c.$__schemaType;if(c.$__schemaType.schema!=null)return s(o.slice(a+1),c.$__schemaType.schema)}return c.$fullPath=n.join("."),c}}let i=e.split(".");for(let o=0;o<i.length;++o){if(i[o]==="$"||__(i[o]))i[o]="0";if(Cle.test(i[o]))i[o]="$"}return s(i,t)};/*!
756
+ * ignore
757
+ */J.prototype._getPathType=function(e){let t=this;if(t.path(e))return"real";function n(s,i){let o=s.length+1,u,a;while(o--)if(a=s.slice(0,o).join("."),u=i.path(a),u){if(u.embeddedSchemaType||u.Constructor){if(u.embeddedSchemaType instanceof uc.Mixed)return{schema:u,pathType:"mixed"};if(o!==s.length&&u.schema){if(s[o]==="$"||__(s[o])){if(o===s.length-1)return{schema:u,pathType:"nested"};return n(s.slice(o+1),u.schema)}return n(s.slice(o),u.schema)}return{schema:u,pathType:u.$isSingleNested?"nested":"array"}}return{schema:u,pathType:"real"}}else if(o===s.length&&Object.hasOwn(i.nested,a))return{schema:i,pathType:"nested"};return{schema:u||i,pathType:"undefined"}}return n(e.split("."),t)};J.prototype._transformDuplicateKeyError=function(t){if(!this._duplicateKeyErrorMessagesByPath)return t;if(t.code!==11000&&t.code!==11001)return t;if(t.keyPattern!=null){let r=t.keyPattern,n=Object.keys(r);if(n.length!==1)return t;let s=n[0];if(!Object.hasOwn(this._duplicateKeyErrorMessagesByPath,s))return t;return new Mt(this._duplicateKeyErrorMessagesByPath[s],{cause:t})}return t};/*!
758
+ * ignore
759
+ */function __(e){return e.startsWith("$[")&&e.endsWith("]")}J.prototype._preCompile=function(){bU(this.options.defaultSort),this.plugin(mle,{deduplicate:!0}),Mle(this),_S(this,new Set),this._hasSelectedPaths=DU(this,[])};/*!
760
+ * Throws if `defaultSort` is not a valid value for the `defaultSort` schema option. Disallows `$meta` sorts,
761
+ * like `{ score: { $meta: 'textScore' } }`, because MongoDB throws on `$meta` sorts for queries without `$text`.
762
+ */function bU(e){if(!e)return;let t="`defaultSort` must not be empty, use `defaultSort: null` to disable the default sort";if(typeof e==="string"){if(e.trim()==="")throw new Mt(t);return}if(typeof e!=="object")throw new Mt("`defaultSort` must be falsy, string, object, array, or Map, got `"+typeof e+"`");let r=e instanceof Map?Array.from(e):Array.isArray(e)?e:Object.entries(e);if(r.length===0)throw new Mt(t);for(let n of r){if(!Array.isArray(n))throw new Mt("`defaultSort` array must be an array of [key, value] arrays, like `[['name', 1]]`");if(n[1]!=null&&Object.hasOwn(n[1],"$meta"))throw new Mt("`defaultSort` does not support `$meta` sorts, got `$meta` for `"+n[0]+"`")}}/*!
763
+ * Clears caches that are derived from `schema.paths` on `schema` and all of its
764
+ * nested schemas, because nested schemas can change until the model is compiled.
765
+ */function _S(e,t){if(t.has(e))return;t.add(e),e._defaultsCache=null,e._pathsWithTransforms=void 0;for(let{schema:r}of e.childSchemas)_S(r,t);for(let r of Object.values(e.discriminators??{}))_S(r,t)}/*!
766
+ * Returns true if any path in `schema`, including paths in nested schemas,
767
+ * has a schema-level `select` option. If not, `applyPaths()` can skip walking
768
+ * the schema on every query. Mirrors the paths that `applyPaths()` checks.
769
+ */function DU(e,t){if(t.includes(e))return!1;t.push(e);for(let r of Object.keys(e.paths)){let n=e.paths[r];if(n.$isSchemaMap||r.endsWith(".$*")){if(n.options?.select===!1)return!0;continue}if(typeof n.selected==="boolean")return!0;if(n.$isMongooseArray&&!n.$isMongooseDocumentArray&&typeof n.embeddedSchemaType?.selected==="boolean")return!0;if(n.schema&&DU(n.schema,t))return!0}return t.pop(),!1}/*!
770
+ * Build precomputed path tries for optimisticConcurrency include/exclude so
771
+ * that lookups at save time are a single trie walk that handles nested paths
772
+ * and map wildcards like `settings.$*`.
773
+ */function Mle(e){let t=e.options.optimisticConcurrency;if(!t||t===!0)return;if(Array.isArray(t))e.options._optimisticConcurrencyTrie=new pU(t);else if(Array.isArray(t.exclude))e.options._optimisticConcurrencyExcludeTrie=new pU(t.exclude)}J.prototype.toJSONSchema=function(t){let r=t?.useBsonType??!1,n=r?{required:[],properties:{}}:{type:"object",required:[],properties:{}};for(let s of Object.keys(this.paths)){let i=this.paths[s];if(i._presplitPath.indexOf("$*")!==-1)continue;let o=i._presplitPath.length>1,u=n;if(o)for(let c=0;c<i._presplitPath.length-1;++c){let l=i._presplitPath[c];if(u.properties[l]==null)u.properties[l]=r?{bsonType:["object","null"],properties:{}}:{type:["object","null"],properties:{}};u=u.properties[l]}let a=i._presplitPath[i._presplitPath.length-1];if(s==="_id"){if(!u.required)u.required=[];u.required.push("_id")}else if(i.options.required&&typeof i.options.required!=="function"){if(!u.required)u.required=[];u.required.push(a)}u.properties[a]=i.toJSONSchema(t)}if(n.required.length===0)delete n.required;return n};/*!
774
+ * Module exports.
775
+ */TU.exports=ES=J;J.Types=uc=Od();/*!
776
+ * ignore
777
+ */ES.ObjectId=uc.ObjectId});var S_=g(function(MU,PU){/*!
778
+ * Connection states
779
+ */var hu=PU.exports=MU=Object.create(null);hu[0]="disconnected";hu[1]="connected";hu[2]="connecting";hu[3]="disconnecting";hu[99]="uninitialized";hu.disconnected=0;hu.connected=1;hu.connecting=2;hu.disconnecting=3;hu.uninitialized=99});var OS=g(function(eEe,BU){/*!
780
+ * Module dependencies.
781
+ */var Ple=ni();class AS extends Ple{constructor(e,t,r,n){let s=e.map((i)=>i.message).join(", ");if(s.length>200)s=s.slice(0,200)+"...";super(`${n} failed with ${e.length} Mongoose validation errors: ${s}`);this.validationErrors=e,this.results=t,this.rawResult=r,this.operation=n}}Object.defineProperty(AS.prototype,"name",{value:"MongooseBulkWriteError"});/*!
782
+ * exports
783
+ */BU.exports=AS});var NU=g(function(tEe,FU){/*!
784
+ * Module dependencies.
785
+ */var Ble=ze();class SS extends Ble{constructor(e,t){super(e);this.errors=t}}Object.defineProperty(SS.prototype,"name",{value:"SyncIndexesError"});FU.exports=SS});var wS=g(function(rEe,IU){IU.exports=function e(t,r,n,s){if(t[s])return;if(t[s]=!0,!n?.skipTopLevel){let a=null;for(let c of r){let l=c[1]==null?null:c[1].tags;if(!Array.isArray(l)){t.plugin(c[0],c[1]);continue}if(a=a||new Set(t.options.pluginTags||[]),!l.find((f)=>a.has(f)))continue;t.plugin(c[0],c[1])}}if(n=Object.assign({},n),delete n.skipTopLevel,n.applyPluginsToChildSchemas!==!1)for(let a of Object.keys(t.paths)){let c=t.paths[a];if(c.schema!=null)e(c.schema,r,n,s),c.Constructor.prototype.$__setSchema(c.schema)}let i=t.discriminators;if(i==null)return;let o=n.applyPluginsToDiscriminators,u=Object.keys(i);for(let a of u){let c=i[a];e(c,r,{skipTopLevel:!o},s)}}});var w_=g(function(nEe,CS){/*!
786
+ * ignore
787
+ */var RU=null;CS.exports.get=function(){return RU};CS.exports.set=function(e){RU=e}});var bS=g(function(sEe,$U){function Fle(){return{ok:1,nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[],writeErrors:[],insertedIds:[],writeConcernErrors:[]}}$U.exports=Fle});var xU=g(function(iEe,vU){var Nle=ze();class DS extends Nle{constructor(e,t){super(e);this.errors=t}}Object.defineProperty(DS.prototype,"name",{value:"CreateCollectionsError"});vU.exports=DS});var MS=g(function(TS){/*!
788
+ * Module dependencies.
789
+ */var Ile=Te().Binary,kU=Zn(),qU=td(),Rle=ni(),jU=require("util");TS.flatten=LU;TS.modifiedPaths=UU;/*!
790
+ * ignore
791
+ */function LU(e,t,r,n){let s;if(e&&qU(e)&&!Buffer.isBuffer(e))s=Object.keys(e.toObject({transform:!1,virtuals:!1})||{});else s=Object.keys(e||{});let i=s.length,o={};t=t?t+".":"";for(let u=0;u<i;++u){let a=s[u],c=e[a];o[t+a]=c;let l=n?.path?.(t+a),f=n?.nested?.[t+a];if(l?.instance==="Mixed")continue;if(VU(c)){if(r?.skipArrays&&Array.isArray(c))continue;let h=LU(c,t+a,r,n);for(let d in h)o[d]=h[d];if(Array.isArray(c))o[t+a]=c}if(f){let h=Object.keys(n.paths);for(let d of h)if(d.startsWith(t+a+".")&&!Object.hasOwn(o,d))o[d]=void 0}}return o}/*!
792
+ * ignore
793
+ */function UU(e,t,r,n=null){if(e==null||typeof e!=="object")return;if(n==null)n={raw:{update:e,path:t},trace:new WeakSet};if(n.trace.has(e))throw new Rle(`a circular reference in the update value, updateValue:
794
+ ${jU.inspect(n.raw.update,{showHidden:!1,depth:1})}
795
+ updatePath: '${n.raw.path}'`);n.trace.add(e);let s=Object.keys(e||{}),i=s.length;r=r||{},t=t?t+".":"";for(let o=0;o<i;++o){let u=s[o],a=e[u],c=t+u;if(r[c]=!0,!Buffer.isBuffer(a)&&qU(a))a=a.toObject({transform:!1,virtuals:!1});if(VU(a))UU(a,t+u,r,n)}return n.trace.delete(e),r}/*!
796
+ * ignore
797
+ */function VU(e){return e&&typeof e==="object"&&!(e instanceof Date)&&!kU(e,"ObjectId")&&(!Array.isArray(e)||e.length!==0)&&!(e instanceof Buffer)&&!kU(e,"Decimal128")&&!(e instanceof Ile)}});var HU=g(function(uEe,WU){var zU=MS().modifiedPaths;WU.exports=function(t){let r=Object.keys(t),n={},s={};for(let i of r){if(i.startsWith("$")){zU(t[i],"",n);continue}s[i]=t[i]}return zU(s,"",n),n}});var PS=g(function(aEe,KU){var $le=HU();KU.exports=function(t){if(t==null)return{};let r=$le(t);return Object.keys(r).reduce((n,s)=>{let i=s.match(/\$\[[^\]]+\]/g);if(i==null)return n;for(let o of i){let u=s.indexOf(o);if(u!==s.lastIndexOf(o))throw Error(`Path '${s}' contains the same array filter multiple times`);n[o.substring(2,o.length-1)]=s.substring(0,u-1).replace(/\$\[[^\]]+\]/g,"0")}return n},{})}});var JU=g(function(cEe,YU){var vle=pd(),GU=Dr(),xle=Vi(),BS=gO(),kle=PS();YU.exports=function(t,r,n,s,i){let o=s.indexOf(".")===-1?[s]:s.split("."),u=null,a="adhocOrUndefined";n=n||{},r=r||{};let c=Array.isArray(i?.arrayFilters)?i.arrayFilters:[],l=kle(r),f=0;for(let h=0;h<o.length;++h){let d=o.slice(f,h+1).join("."),p=vle(d);if(u=t.path(p),u==null)continue;if(a=t.pathType(p),(u.$isSingleNested||u.$isMongooseDocumentArrayElement)&&u.schema.discriminators!=null){let m=GU(u,"schema.options.discriminatorKey"),_=p+"."+m,y=_.replace(/\.\d+\./,"."),E=null;if(_ in n)E=BS(n[_]);if(y in n)E=BS(n[y]);let C=p.replace(/\.\d+$/,"");if(u.$isMongooseDocumentArrayElement&&GU(n[C],"$elemMatch."+m)!=null)E=BS(n[C].$elemMatch[m]);let D=d+"."+m;if(D in r)E=r[D];if(_ in r)E=r[_];for(let B of Object.keys(l)){let q=l[B]+"."+m,I=B+"."+m;if(q===y){let Oe=c.find((Ne)=>Object.hasOwn(Ne,I));if(Oe!=null)E=Oe[I]}}if(E==null)continue;let P=xle(u.Constructor.discriminators,E)?.schema;if(P==null)continue;let S=o.slice(h+1).join(".");if(u=P._getSchema(S),t=P,f=h+1,u!=null){a=P._getPathType(S);break}}}return{type:a,schematype:u}}});var XU=g(function(lEe,QU){var qle=ec();QU.exports=function(t,r,n,s,i,o,u){if(!t?.options?.immutable)return!1;let a=t.options.immutable;if(typeof a==="function")a=a.call(u,u);if(!a)return!1;if(o?.overwriteImmutable)return!1;if(r===!1)return!1;if(r==="throw")throw new qle(null,`Field ${i} is immutable and strict = 'throw'`);return delete n[s],!0}});var tV=g(function(hEe,eV){var jle=Dr();eV.exports=function(t,r,n){if(r==null)return;let s=Object.keys(r);for(let i of s){let o=i.startsWith("$");if(i==="$set"){let u=Object.keys(r[i]);for(let a of u)ZU(t,r[i],a,r,n)}else if(!o)ZU(t,r,i,r,n)}};function ZU(e,t,r,n,s){let i=e.path(r);if(i==null)return;let o=jle(i,"options.immutable",null);if(o==null)return;if(typeof o==="function")o=o.call(s,s);if(!o)return;n.$setOnInsert=n.$setOnInsert||{},n.$setOnInsert[r]=t[r],delete t[r]}});var FS=g(function(fEe,rV){var vh=Xa();rV.exports=function(t,r,n){if(r.indexOf(".")===-1){if(vh.has(r))return;t[r]=n;return}let s=r.split("."),i=s.pop(),o=t;for(let u of s){if(vh.has(u))continue;if(!Object.hasOwn(o,u)&&u in o)return;if(o[u]==null)o[u]={};o=o[u]}if(!vh.has(i))o[i]=n}});var kS=g(function(dEe,fV){var Nd=es(),kh=ze(),nV=cS(),sV=ec(),Lle=jc(),$S=gd(),Ule=Jc(),Vle=Xn(),NS=oi(),IS=Vi(),RS=JU(),zle=iu(),iV=XU(),oV=Fn(),Wle=Sh(),Hle=tV(),lV=Ao().schemaMixedSymbol,Kle=FS(),Cn=be(),{internalToObjectOptions:uV}=_o(),vS=new Set(["$currentDate","$inc","$min","$max","$mul","$rename","$set","$setOnInsert","$unset","$addToSet","$pop","$pull","$push","$pullAll","$bit"]);fV.exports=function(t,r,n,s,i){if(r==null)return;if(n=n||{},Array.isArray(r)){let f=r.length;for(let h=0;h<f;++h){let d=Object.keys(r[h]);for(let p of d)r[h][p]=Gle(p,r[h][p])}return r}if(t!=null&&i!=null&&Cn.hasUserDefinedProperty(i,t.options.discriminatorKey)&&typeof i[t.options.discriminatorKey]!=="object"&&t.discriminators!=null){let f=i[t.options.discriminatorKey],h=IS(s.model.discriminators,f);t=NS(t.discriminators,f)||h?.schema||t}else if(t!=null&&n.overwriteDiscriminatorKey&&Cn.hasUserDefinedProperty(r,t.options.discriminatorKey)&&t.discriminators!=null){let f=r[t.options.discriminatorKey],h=IS(s.model.discriminators,f);t=NS(t.discriminators,f)||h?.schema||t}else if(t!=null&&n.overwriteDiscriminatorKey&&r.$set!=null&&Cn.hasUserDefinedProperty(r.$set,t.options.discriminatorKey)&&t.discriminators!=null){let f=r.$set[t.options.discriminatorKey],h=IS(s.model.discriminators,f);t=NS(t.discriminators,f)||h?.schema||t}if(n.upsert&&!n.overwriteImmutable)Hle(t,r,s);if(oV(r)&&typeof r.toObject==="function")r=r.toObject(uV);let o=Object.keys(r),u=o.length,a={},c,l=!1;i=i||{};while(u--){let f=o[u];if(!vS.has(f)){if(!a.$set)if(r.$set)a.$set=r.$set;else a.$set={};if(a.$set[f]=r[f],o.splice(u,1),!~o.indexOf("$set"))o.push("$set")}else if(f==="$set"){if(!a.$set)a[f]=r[f]}else a[f]=r[f]}u=o.length;while(u--){let f=o[u];if(c=a[f],l=l||f.startsWith("$"),oV(c))c=c.toObject(uV),a[f]=c;if(c&&typeof c==="object"&&!Buffer.isBuffer(c)&&vS.has(f))hV(t,c,f,n,s,i);else{let h="Invalid atomic update value for "+f+". Expected an object, received "+typeof c;throw Error(h)}if(f.startsWith("$")&&Cn.isEmptyObject(c))delete a[f]}if(Cn.hasOwnKeys(a)===!1&&n.upsert&&Cn.hasOwnKeys(i))return{$setOnInsert:{...i}};return a};/*!
798
+ * ignore
799
+ */function Gle(e,t){if(e==="$unset"){if(typeof t!=="string"&&(!Array.isArray(t)||t.find((r)=>typeof r!=="string")))throw new kh("Invalid $unset in pipeline, must be a string or an array of strings");return t}if(e==="$project"){if(t==null||typeof t!=="object")throw new kh("Invalid $project in pipeline, must be an object");return t}if(e==="$addFields"||e==="$set"){if(t==null||typeof t!=="object")throw new kh("Invalid "+e+" in pipeline, must be an object");return t}else if(e==="$replaceRoot"||e==="$replaceWith"){if(t==null||typeof t!=="object")throw new kh("Invalid "+e+" in pipeline, must be an object");return t}throw new kh('Invalid update pipeline operator: "'+e+'"')}function hV(e,t,r,n,s,i,o){let u=n.strict;o=o?o+".":"";let a=Object.keys(t),c=a.length,l=!1,f,h,d,p=null,m=u??e.options.strict;while(c--){h=a[c],d=t[h];let _=o+h,y=!o&&Wle(h),E=y?e._getSchema(_):null,C=y&&Object.hasOwn(e.nested,h);if(y&&E==null&&!C)throw new kh('Invalid update: Unexpected modifier "'+h+'" as a key in operator "'+r+'". Did you mean something like { '+r+": { fieldName: { "+h+": [...] } } }? Modifiers must appear under a valid field path.");if(r==="$pull"){if(!y)E=e._getSchema(_);if(f=E,f==null){let A=RS(e,t,i,o+h,n);if(A.schematype!=null)f=A.schematype}if(f?.schema!=null){try{t[h]=Ule(f.schema,t[h],n,s)}catch(A){if(A instanceof Nd){p=Wu(A,s,h,p);continue}else throw A}l=!0;continue}}let D=o?o+h:h;if(e.discriminatorMapping!=null&&D===e.options.discriminatorKey&&e.discriminatorMapping.value!==t[h]&&!n.overwriteDiscriminatorKey){if(m==="throw"){let A=Error(`Can't modify discriminator key "`+D+'" on discriminator model');p=Wu(A,s,D,p);continue}else if(m){delete t[h];continue}}if(!y&&r!=="$pull")E=e._getSchema(_);if(f=E,Vle(d)==="Object"){if(f==null){let A=RS(e,t,i,o+h,n);if(A.schematype!=null)f=A.schematype}if(r!=="$setOnInsert"&&iV(f,u,t,h,o+h,n,s))continue;if(f&&(f.embeddedSchemaType||f.Constructor)&&r in xS)if("$each"in d){l=!0;try{t[h]={$each:xh(f,d.$each,r,h,s,o+h)}}catch(A){p=Wu(A,s,h,p)}if(d.$slice!=null)t[h].$slice=d.$slice|0;if(d.$sort)t[h].$sort=d.$sort;if(d.$position!=null)t[h].$position=$S(d.$position)}else{if(f?.$isSingleNested){let A=u==null?f.schema.options.strict:u;try{t[h]=f.castForQuery(null,d,s,{strict:A})}catch(P){p=Wu(P,s,h,p)}}else try{t[h]=xh(f,d,r,h,s,o+h)}catch(A){p=Wu(A,s,h,p)}if(t[h]===void 0){delete t[h];continue}l=!0}else if(r==="$currentDate"||r in xS&&f){try{t[h]=xh(f,d,r,h,s,o+h)}catch(A){p=Wu(A,s,h,p)}if(t[h]===void 0){delete t[h];continue}l=!0}else if(r==="$rename"){let A=new nV(`${o}${h}.$rename`);try{t[h]=xh(A,d,r,h,s,o+h)}catch(P){p=Wu(P,s,h,p)}if(t[h]===void 0){delete t[h];continue}l=!0}else{let A=o+h,P=e._getPathType(A),S=u;if(P?.schema&&S==null)S=P.schema.options.strict;if(P.pathType==="undefined"){if(S==="throw")throw new sV(A);else if(S){delete t[h];continue}}l|=hV(e,d,r,n,s,i,o+h)||Cn.isObject(d)&&Cn.hasOwnKeys(d)===!1}}else{let A=!C&&f==null&&(h==="$each"||h==="$or"||h==="$and"||h==="$in"),P=A?o:_;if(A)f=e._getSchema(P);if(r!=="$setOnInsert"&&iV(f,u,t,h,o+h,n,s))continue;let S=e._getPathType(P);if(f==null){let I=RS(e,t,i,P,n);if(I.schematype!=null)f=I.schematype,S=I.type}let B=u;if(S?.schema&&u==null)B=S.schema.options.strict;if(B&&!f&&!/real|nested/.test(S.pathType))if(B==="throw"&&zle(e.virtuals,P)==null)throw new sV(o+h);else delete t[h];else{if(r==="$rename"){try{if(t[h]==null)throw new Nd("String",t[h],`${o}${h}.$rename`);let I=new nV(`${o}${h}.$rename`,null,null,e);t[h]=I.castForQuery(null,t[h],s)}catch(I){p=Wu(I,s,h,p)}continue}try{if(o.length===0||h.indexOf(".")===-1)t[h]=xh(f,d,r,h,s,o+h);else if(B!==!1||f!=null)Kle(t,h,xh(f,d,r,h,s,o+h)),delete t[h]}catch(I){p=Wu(I,s,h,p)}if(Array.isArray(t[h])&&(r==="$addToSet"||r==="$push")&&h!=="$each"){if(f&&f.embeddedSchemaType&&!f.embeddedSchemaType.$isMongooseArray&&!f.embeddedSchemaType[lV])t[h]={$each:t[h]}}if(t[h]===void 0){delete t[h];continue}l=!0}}}if(p!=null)throw p;return l}/*!
800
+ * ignore
801
+ */function Wu(e,t,r,n){let s=t?.modelName!=null?t:t?.model;if(s!=null&&typeof e.setModel==="function")e.setModel(s);if(typeof t!=="object"||!t.options.multipleCastError)throw e;return n=n||new Lle,n.addError(r,e),n}var aV={$pop:1,$inc:1},Yle={$unset:1},xS={$push:1,$addToSet:1,$set:1,$setOnInsert:1};/*!
802
+ * ignore
803
+ */var cV={$set:1,$setOnInsert:1};function xh(e,t,r,n,s,i){if(!e){if(r in aV)try{return $S(t)}catch{throw new Nd("number",t,i)}return t}if(e.$isMongooseArray&&r in xS&&(Cn.isObject(t)||Array.isArray(t))&&!cV[r]){let u=0,a=e;while(a.$isMongooseArray)++u,a=a.embeddedSchemaType;let c=0,l=t;while(Array.isArray(l))++c,l=l[0];let f=u-c;while(c<u)t=[t],++c;let h=e.applySetters(Array.isArray(t)?t:[t],s);for(let d=0;d<f;++d)h=h[0];return h}if(r in Yle)return t;if(r in aV){if(t==null)throw new Nd("number",t,e.path);if(r==="$inc")return e.castForQuery(null,t,s);try{return $S(t)}catch{throw new Nd("number",t,e.path)}}if(r==="$currentDate"){if(typeof t==="object")return{$type:t.$type};return Boolean(t)}if(vS.has(n))return e.castForQuery(n,t,s);if(cV[r]){let u=t!=null&&e.$isMongooseArray&&e.$fullPath!=null&&!e.$fullPath.match(/\d+$/),a=e[lV]!=null;if(u||a)return e.applySetters(t,s);return e.castForQuery(null,t,s)}return e.castForQuery(null,t,s)}});var mV=g(function(pEe,pV){var dV=Sh();pV.exports=function(t,r,n){if(!Object.keys(n).some(dV))return r.castForQuery(null,n,t);let i=Object.keys(n),o=i.length;while(o--){let u=i[o],a=n[u];if(u==="$not"){if(a&&r&&!r.embeddedSchemaType&&!r.Constructor){let c=Object.keys(a);if(c.length&&dV(c[0]))for(let l of Object.keys(a))a[l]=r.castForQuery(l,a[l],t);else n[u]=r.castForQuery(u,a,t);continue}}else n[u]=r.castForQuery(u,a,t)}return n}});var gV=g(function(mEe,yV){var Jle=oi(),Qle=/^\d+$/;yV.exports=function(t,r,n){let s=t.path(r);if(s!=null)return s;let i=r.split("."),o="",u=!1;for(let a of i){if(u&&Qle.test(a))continue;if(o=o.length===0?a:o+"."+a,s=t.path(o),s?.schema){if(t=s.schema,!u&&s.$isMongooseDocumentArray)u=!0;if(n&&n[o])t=Jle(t.discriminators,n[o])??t;o=""}else if(s?.instance==="Mixed")break}return s}});var jS=g(function(yEe,qS){var Xle=oi(),Zle=mV(),_V=pd(),e1e=iu(),EV=gV(),{logicalOperators:t1e}=Ad(),r1e=PS(),AV=be();qS.exports=function(t){OV(t.options.arrayFilters,t.getUpdate(),t.schema,t.model,t._mongooseOptions,t)};function OV(e,t,r,n,s,i){if(!Array.isArray(e))return;let o=r1e(t),u=r.options.strict;if(s.strict!=null)u=s.strict;if(n?.base.options.strictQuery!=null)u=n.base.options.strictQuery;if(r._userProvidedOptions.strictQuery!=null)u=r._userProvidedOptions.strictQuery;if(s.strictQuery!=null)u=s.strictQuery;SV(e,r,u,o,i)}qS.exports.castArrayFiltersForUpdate=OV;function SV(e,t,r,n,s){let i={};for(let o of e){if(o==null)throw Error(`Got null array filter in ${e}`);let u=Object.keys(o).filter((_)=>o[_]!=null);if(u.length===0)continue;let a=[];for(let _ of u)if(t1e.has(_))SV(o[_],t,r,n,s);else if(_.charAt(0)!=="$")a.push(_);if(a.length===0)continue;let c=a[0],l=c.indexOf("."),f=l===-1?c:c.substring(0,l),h=e1e(n,f);if(h==null)continue;let d=_V(h),p=EV(t,d,i),m=p!=null?p.schema:null;if(m?.discriminators!=null&&o[f+"."+m.options.discriminatorKey])m=Xle(m.discriminators,o[f+"."+m.options.discriminatorKey])||m,i[d]=o[f+"."+m.options.discriminatorKey];for(let _ of a){if(n[_]===null)continue;if(AV.hasOwnKeys(n)===!1)continue;let y=_.indexOf("."),E=y===-1?null:_.substring(y),C;if(E==null||m==null)C=p;else E=_V(E),C=EV(m,E,i);if(C==null){if(!r)continue;let D=E==null?d+".0":d+".0"+E;throw Error(`Could not find path "${D}" in schema`)}if(typeof o[_]==="object")o[_]=Zle(s,C,o[_]);else o[_]=C.castForQuery(null,o[_])}}}});var C_=g(function(gEe,wV){wV.exports=function(t,r,n){if(!n||!r?.upsert)return;if(r.overwrite){if(!Id(t,n))t[n]=0}else if(!Id(t,n)&&!Id(t?.$set,n)&&!Id(t?.$inc,n)&&!Id(t?.$setOnInsert,n)){if(!t.$setOnInsert)t.$setOnInsert={};t.$setOnInsert[n]=0}};function Id(e,t){if(e==null||typeof e!=="object")return!1;return Object.hasOwn(e,t)}});var LS=g(function(_Ee,bV){var n1e=Dr();bV.exports=function(e,t,r,n,s,i){let o=n?.setDefaultsOnInsert??s?.setDefaultsOnInsert??t.base.options.setDefaultsOnInsert;if(!n.upsert||o===!1)return r;let u=Object.keys(r||{}),a=Object.create(null),c={},l=u.length,f=!1;for(let p=0;p<l;++p)if(u[p].charAt(0)==="$"){f=!0;break}let h=Object.keys(e),d=h.length;for(let p=0;p<d;++p){let m=h[p],_=e[m];if(_&&typeof _==="object"){let C=Object.keys(_),D=C.length,A=!1;for(let P=0;P<D;++P)if(C[P].charAt(0)==="$"){A=!0;break}if(A)continue}if(a[m]=!0,m.indexOf(".")===-1)continue;let y=t.paths[m]?t.paths[m].splitPath():m.split("."),E=y[0];for(let C=1;C<y.length;++C)a[E]=!0,E+="."+y[C]}if(n?.overwrite&&!f)return r;return t.eachPath(function(p,m){if(m.path==="_id"&&m.options.auto)return;let _=m.getDefault(null,!0,{context:i});if(typeof _>"u")return;let y=m.splitPath();if(y.includes("$*"))return;if(s1e(r,a,p,y,f))return;if(r=r||{},r.$setOnInsert=r.$setOnInsert||{},n1e(r,p)==null)r.$setOnInsert[p]=_;c[p]=_}),r};function s1e(e,t,r,n,s){if(t[r])return!0;let i=n[0];for(let o=1;o<n.length;++o){if(t[i])return!0;i+="."+n[o]}if(s){for(let o in e)if(o.charAt(0)==="$"){if(CV(e[o],r,n))return!0}}else if(CV(e,r,n))return!0;return!1}function CV(e,t,r){if(e==null||typeof e!=="object")return!1;if(Object.hasOwn(e,t))return!0;let n=r[0];for(let i=1;i<r.length;++i){if(Object.hasOwn(e,n))return!0;n+="."+r[i]}let s=t+".";for(let i in e)if(i.startsWith(s))return!0;return!1}});var US=g(function(EEe,vr){var i1e=ze(),o1e=Vi(),DV=lO(),TV=fO(),u1e=Jc(),MV=kS(),{castArrayFiltersForUpdate:PV}=jS(),b_=ar(),BV=C_(),{inspect:a1e}=require("util"),FV=LS();vr.exports=function(t,r,n){let s,i=t.schema.get("timestamps");if(typeof i?.currentTime==="function")s=i.currentTime();else s=t.base.now();if(r.insertOne)return(o)=>vr.exports.castInsertOne(t,r.insertOne,n).then(()=>o(null),(u)=>o(u));else if(r.updateOne)return(o)=>{try{vr.exports.castUpdateOne(t,r.updateOne,n,s),o(null)}catch(u){o(u)}};else if(r.updateMany)return(o)=>{try{vr.exports.castUpdateMany(t,r.updateMany,n,s),o(null)}catch(u){o(u)}};else if(r.replaceOne)return(o)=>{vr.exports.castReplaceOne(t,r.replaceOne,n).then(()=>o(null),(u)=>o(u))};else if(r.deleteOne)return(o)=>{try{vr.exports.castDeleteOne(t,r.deleteOne),o(null)}catch(u){o(u)}};else if(r.deleteMany)return(o)=>{try{vr.exports.castDeleteMany(t,r.deleteMany),o(null)}catch(u){o(u)}};else return(o)=>{let u=new i1e(`Invalid op passed to \`bulkWrite()\`: ${a1e(r)}`);o(u,null)}};vr.exports.castInsertOne=async function(t,r,n){let s=qh(t,r.document),i=new s(r.document);if(s.schema.options.timestamps&&D_(r,n))i.initializeTimestamps();if(n.session!=null)i.$session(n.session);let o=s?.schema?.options?.versionKey;if(o&&i[o]==null)i[o]=0;if(r.document=i,n.skipValidation||r.skipValidation)return r;return await r.document.$validate(),r};vr.exports.castUpdateOne=function(t,r,n,s){if(!r.filter)throw Error("Must provide a filter object.");if(!r.update)throw Error("Must provide an update object.");let i=qh(t,r.filter),o=i.schema,u=n.strict??i.schema.options.strict,a=b_(r.update);$d(o,r.filter);let c=D_(r,n);if(i.schema.$timestamps!=null&&c){let h=i.schema.$timestamps.createdAt,d=i.schema.$timestamps.updatedAt;TV(s,h,d,a,{timestamps:r.timestamps,overwriteImmutable:r.overwriteImmutable},r.upsert)}if(c)DV(s,a,i.schema);let l=t.base.options.setDefaultsOnInsert;if((r.setDefaultsOnInsert??l)!==!1)FV(r.filter,i.schema,a,{setDefaultsOnInsert:!0,upsert:r.upsert});if(BV(a,r,i.schema.options.versionKey),r.filter=Rd(i,r.filter,{strict:u,upsert:r.upsert}),Array.isArray(r.arrayFilters))r.arrayFilters=b_(r.arrayFilters),PV(r.arrayFilters,a,o,i,n);return r.update=MV(i.schema,a,{strict:u,upsert:r.upsert,arrayFilters:r.arrayFilters,overwriteDiscriminatorKey:r.overwriteDiscriminatorKey,overwriteImmutable:r.overwriteImmutable},i,r.filter),r};vr.exports.castUpdateMany=function(t,r,n,s){if(!r.filter)throw Error("Must provide a filter object.");if(!r.update)throw Error("Must provide an update object.");let i=qh(t,r.filter),o=i.schema,u=n.strict??i.schema.options.strict,a=b_(r.update),c=t.base.options.setDefaultsOnInsert;if((r.setDefaultsOnInsert??c)!==!1)FV(r.filter,i.schema,a,{setDefaultsOnInsert:!0,upsert:r.upsert});let f=D_(r,n);if(i.schema.$timestamps!=null&&f){let h=i.schema.$timestamps.createdAt,d=i.schema.$timestamps.updatedAt;TV(s,h,d,a,{timestamps:r.timestamps,overwriteImmutable:r.overwriteImmutable},r.upsert)}if(f)DV(s,a,i.schema);if($d(o,r.filter),BV(a,r,i.schema.options.versionKey),r.filter=Rd(i,r.filter,{strict:u,upsert:r.upsert}),Array.isArray(r.arrayFilters))r.arrayFilters=b_(r.arrayFilters),PV(r.arrayFilters,a,o,i,n);r.update=MV(i.schema,a,{strict:u,upsert:r.upsert,arrayFilters:r.arrayFilters,overwriteDiscriminatorKey:r.overwriteDiscriminatorKey,overwriteImmutable:r.overwriteImmutable},i,r.filter)};vr.exports.castReplaceOne=async function(t,r,n){let s=qh(t,r.filter),i=s.schema,o=n.strict??s.schema.options.strict;$d(i,r.filter),r.filter=Rd(s,r.filter,{strict:o,upsert:r.upsert});let u=new s(r.replacement,o,{skipId:!0});if(s.schema.options.timestamps&&D_(r,n))u.initializeTimestamps();if(n.session!=null)u.$session(n.session);let a=s?.schema?.options?.versionKey;if(a&&u[a]==null)u[a]=0;if(r.replacement=u,n.skipValidation||r.skipValidation){r.replacement=r.replacement.toBSON();return}await r.replacement.$validate(),r.replacement=r.replacement.toBSON()};vr.exports.castDeleteOne=function(t,r){let n=qh(t,r.filter),s=n.schema;$d(s,r.filter),r.filter=Rd(n,r.filter)};vr.exports.castDeleteMany=function(t,r){let n=qh(t,r.filter),s=n.schema;$d(s,r.filter),r.filter=Rd(n,r.filter)};vr.exports.cast={insertOne:vr.exports.castInsertOne,updateOne:vr.exports.castUpdateOne,updateMany:vr.exports.castUpdateMany,replaceOne:vr.exports.castReplaceOne,deleteOne:vr.exports.castDeleteOne,deleteMany:vr.exports.castDeleteMany};function Rd(e,t,r){try{return u1e(e.schema,t,r)}catch(n){if(typeof n.setModel==="function")n.setModel(e);throw n}}function $d(e,t){if(e==null)return;if(e.discriminatorMapping&&!e.discriminatorMapping.isRoot)t[e.discriminatorMapping.key]=e.discriminatorMapping.value}function qh(e,t){let r=e.schema.options.discriminatorKey;if(t!=null&&Object.hasOwn(t,r))e=o1e(e.discriminators,t[r])||e;return e}function D_(e,t){let r=e.timestamps,n=t.timestamps;if(r!=null)return r;else if(n!=null)return n;return!0}});var VS=g(function(AEe,NV){NV.exports=function(t,r,n){return t.mongoose=t.mongoose||{},t.mongoose.validationErrors=r,t.mongoose.results=n,t}});var HS=g(function(OEe,kV){/*!
804
+ * Module dependencies.
805
+ */var c1e=kA(),WS=require("events").EventEmitter,l1e=Kc(),ot=S_(),IV=OS(),$t=ni(),h1e=o4(),f1e=NU(),d1e=wS(),p1e=ar(),vV=w_(),m1e=Dr(),y1e=bS(),RV=iu(),g1e=ua(),jh=be(),_1e=xU(),ac=US(),{modelSymbol:T_}=de(),E1e=P4(),zS=VS(),A1e=de().arrayAtomicsSymbol,vd=de().sessionNewDocuments,O1e=globalThis.Date,S1e=["MONGODB-X509"];function ge(e){if(this.base=e,this.collections={},this.models={},this.config={},this.replica=!1,this.options=null,this.otherDbs=[],this.relatedDbs={},this.states=ot,this._readyState=ot.disconnected,this._closeCalled=!1,this._hasOpened=!1,this.plugins=[],typeof e>"u"||!e.connections.length)this.id=0;else this.id=e.nextConnectionId;this._queue=[]}/*!
806
+ * Inherit from EventEmitter
807
+ */Object.setPrototypeOf(ge.prototype,WS.prototype);Object.defineProperty(ge.prototype,"readyState",{get:function(){if(this._readyState===ot.connected&&this._lastHeartbeatAt!=null&&this.client?.topology?.s?.description?.type!=="LoadBalanced"&&typeof this.client?.topology?.s?.description?.heartbeatFrequencyMS==="number"&&O1e.now()-this._lastHeartbeatAt>=this.client.topology.s.description.heartbeatFrequencyMS*2)return ot.disconnected;return this._readyState},set:function(e){if(!(e in ot))throw new $t("Invalid connection state: "+e);if(this._readyState!==e){this._readyState=e;for(let t of this.otherDbs)t.readyState=e;if(ot.connected===e)this._hasOpened=!0;this.emit(ot[e])}}});ge.prototype.get=function(t){if(Object.hasOwn(this.config,t))return this.config[t];return m1e(this.options,t)};ge.prototype.set=function(t,r){if(Object.hasOwn(this.config,t))return this.config[t]=r,r;return this.options=this.options||{},this.options[t]=r,r};ge.prototype.collections;ge.prototype.name;ge.prototype.models;ge.prototype.id;Object.defineProperty(ge.prototype,"plugins",{configurable:!1,enumerable:!0,writable:!0});Object.defineProperty(ge.prototype,"host",{configurable:!0,enumerable:!0,writable:!0});Object.defineProperty(ge.prototype,"port",{configurable:!0,enumerable:!0,writable:!0});Object.defineProperty(ge.prototype,"user",{configurable:!0,enumerable:!0,writable:!0});Object.defineProperty(ge.prototype,"pass",{configurable:!0,enumerable:!0,writable:!0});ge.prototype.db;ge.prototype.client;ge.prototype.config;ge.prototype.createCollection=async function(t,r){if(typeof r==="function"||arguments.length>=3&&typeof arguments[2]==="function")throw new $t("Connection.prototype.createCollection() no longer accepts a callback");return await this._waitForConnect(),this.db.createCollection(t,r)};ge.prototype.bulkWrite=async function(t,r){await this._waitForConnect(),r=r||{};let n=r.ordered==null?!0:r.ordered,s=this.base.transactionAsyncLocalStorage?.getStore();if((!r||!Object.hasOwn(r,"session"))&&s?.session!=null)r={...r,session:s.session};let i=this.base.now(),o=null;if(n){let u=[];for(let a of t){if(typeof a.model!=="string"&&!a.model?.[T_])throw new $t("Must specify model in Connection.prototype.bulkWrite() operations");let c=a.model[T_]?a.model:this.model(a.model);if(a.name==null)throw new $t("Must specify operation name in Connection.prototype.bulkWrite()");if(!Object.hasOwn(ac.cast,a.name))throw new $t(`Unrecognized bulkWrite() operation name ${a.name}`);await ac.cast[a.name](c,a,r,i),u.push({...a,namespace:c.namespace()})}o=await this.client.bulkWrite(u,r)}else{let u=[],a=[],c=[],l=[],f=[];for(let d=0;d<t.length;++d){let p=t[d];if(typeof p.model!=="string"&&!p.model?.[T_]){let y=new $t("Must specify model in Connection.prototype.bulkWrite() operations");c.push({index:d,error:y}),f[d]=y;continue}let m;try{m=p.model[T_]?p.model:this.model(p.model)}catch(y){c.push({index:d,error:y});continue}if(p.name==null){let y=new $t("Must specify operation name in Connection.prototype.bulkWrite()");c.push({index:d,error:y}),f[d]=y;continue}if(!Object.hasOwn(ac.cast,p.name)){let y=new $t(`Unrecognized bulkWrite() operation name ${p.name}`);c.push({index:d,error:y}),f[d]=y;continue}let _=null;try{_=ac.cast[p.name](m,p,r,i)}catch(y){c.push({index:d,error:y}),f[d]=y;continue}if(E1e(_))l.push(_.then(()=>{u.push({...p,namespace:m.namespace()}),a.push(d)},(y)=>{c.push({index:d,error:y}),f[d]=y}));else u.push({...p,namespace:m.namespace()}),a.push(d)}if(l.length>0)await Promise.all(l);if(c=c.sort((d,p)=>d.index-p.index).map((d)=>d.error),u.length===0){if(r.throwOnValidationError&&c.length)throw new IV(c,f,o,"bulkWrite");let p=new(this.base.driver.get()).BulkWriteResult(y1e(),!1);return zS(p,c,f)}let h;[o,h]=await this.client.bulkWrite(u,r).then((d)=>[d,null]).catch((d)=>[null,d]);for(let d=0;d<a.length;++d)f[a[d]]=null;if(h){if(h.writeErrors?.forEach((d,p)=>{f[a[p]]=d}),c.length>0)zS(h,c,f),h.mongoose=h.mongoose||{},h.mongoose.validationErrors=c;throw h}if(c.length>0)if(r.throwOnValidationError)throw new IV(c,f,o,"bulkWrite");else zS(o,c,f)}return o};ge.prototype.createCollections=async function(t={}){let r={},n={},{continueOnError:s}=t;delete t.continueOnError;for(let i of Object.values(this.models))try{r[i.modelName]=await i.createCollection({})}catch(o){if(!s){n[i.modelName]=o;break}else r[i.modelName]=o}if(!s&&jh.hasOwnKeys(n)){let i=Object.entries(n).map(([u,a])=>`${u}: ${a.message}`).join(", ");throw new _1e(i,n)}return r};ge.prototype.withSession=async function(t){if(arguments.length===0)throw new $t("Please provide an executor function");return await this.client.withSession(t)};ge.prototype.startSession=async function(t){if(arguments.length>=2&&typeof arguments[1]==="function")throw new $t("Connection.prototype.startSession() no longer accepts a callback");return await this._waitForConnect(),this.client.startSession(t)};ge.prototype.transaction=function(t,r){return this.startSession().then((n)=>(n[vd]=new Map,n.withTransaction(()=>w1e(t,n,this.base),r).then((s)=>(delete n[vd],s)).catch((s)=>{throw delete n[vd],s}).finally(()=>{n.endSession().catch(()=>{})})))};/*!
808
+ * Reset document state in between transaction retries re: gh-13698
809
+ */async function w1e(e,t,r){$V(t);try{return r.transactionAsyncLocalStorage==null?await e(t):await new Promise((s)=>{r.transactionAsyncLocalStorage.run({session:t},()=>s(e(t)))})}catch(n){throw $V(t),n}}/*!
810
+ * If transaction was aborted, we need to reset newly inserted documents' `isNew`.
811
+ */function $V(e){for(let t of e[vd].keys()){let r=e[vd].get(t);if(Object.hasOwn(r,"isNew"))t.$isNew=r.isNew;if(Object.hasOwn(r,"versionKey"))t.set(t.schema.options.versionKey,r.versionKey);if(Object.hasOwn(r,"isDeleted"))t.$isDeleted(r.isDeleted);for(let n of r.modifiedPaths)t.$__.activePaths.modify(n);for(let n of r.atomics.keys()){let s=t.$__getValue(n);if(s==null)continue;s[A1e]=r.atomics.get(n)}}}ge.prototype.dropCollection=async function(t){if(arguments.length>=2&&typeof arguments[1]==="function")throw new $t("Connection.prototype.dropCollection() no longer accepts a callback");return await this._waitForConnect(),this.db.dropCollection(t)};ge.prototype._waitForConnect=async function(t){if((this.readyState===ot.connecting||this.readyState===ot.disconnected)&&this._shouldBufferCommands()){let r=this._getBufferTimeoutMS(),n=null,s=!1,i={},o=new Promise((u)=>{i.fn=u,this._queue.push(i)});if(t)await o;else await Promise.race([o,new Promise((u)=>{n=setTimeout(()=>{s=!0,u()},r)})]);if(s){let u=this._queue.indexOf(i);if(u!==-1)this._queue.splice(u,1);let a="Connection operation buffering timed out after "+r+"ms";throw new $t(a)}else if(n!=null)clearTimeout(n)}};/*!
812
+ * Get the default buffer timeout for this connection
813
+ */ge.prototype._getBufferTimeoutMS=function(){if(this.config.bufferTimeoutMS!=null)return this.config.bufferTimeoutMS;if(this.base?.get("bufferTimeoutMS")!=null)return this.base.get("bufferTimeoutMS");return 1e4};ge.prototype.listCollections=async function(){return await this._waitForConnect(),await this.db.listCollections().toArray()};ge.prototype.listDatabases=async function(){throw new $t("listDatabases() not implemented by driver")};ge.prototype.dropDatabase=async function(){if(arguments.length>=1&&typeof arguments[0]==="function")throw new $t("Connection.prototype.dropDatabase() no longer accepts a callback");await this._waitForConnect();for(let t of Object.values(this.models))delete t.$init;return this.db.dropDatabase()};/*!
814
+ * ignore
815
+ */ge.prototype._shouldBufferCommands=function(){if(this.config.bufferCommands!=null)return this.config.bufferCommands;if(this.base.get("bufferCommands")!=null)return this.base.get("bufferCommands");return!0};ge.prototype.error=function(t,r){if(r)return r(t),null;if(this.listeners("error").length>0)this.emit("error",t);return Promise.reject(t)};ge.prototype.onOpen=function(){this.readyState=ot.connected,this._flushQueue();for(let e in this.collections)if(Object.hasOwn(this.collections,e))this.collections[e].onOpen();this.emit("open")};ge.prototype._flushQueue=function(){let t=this._queue;this._queue=[];for(let r of t)r.fn.apply(r.ctx,r.args)};ge.prototype.openUri=async function(t,r){if(this.readyState===ot.connecting||this.readyState===ot.connected){if(this._connectionString===t)return this}this._closeCalled=!1;let n=!1;if(r&&"_fireAndForget"in r)n=r._fireAndForget,delete r._fireAndForget;try{C1e.apply(arguments)}catch(s){if(n)throw s;throw this.$initialConnection=Promise.reject(s),s}this.$initialConnection=this.createClient(t,r).then(()=>this).catch((s)=>{if(this.readyState=ot.disconnected,this.listeners("error").length>0)g1e(()=>this.emit("error",s));throw s});for(let s of Object.values(this.models))s.init().catch(function(){});if(n)return this;try{await this.$initialConnection}catch(s){throw xV(s)}return this};ge.prototype.on=function(t,r){if(t==="error"&&this.$initialConnection)this.$initialConnection.catch(()=>{});return WS.prototype.on.call(this,t,r)};ge.prototype.once=function(t,r){if(t==="error"&&this.$initialConnection)this.$initialConnection.catch(()=>{});return WS.prototype.once.call(this,t,r)};/*!
816
+ * ignore
817
+ */function C1e(e,t,r){if(typeof t==="function"&&r==null)throw new $t("Connection.prototype.openUri() no longer accepts a callback");else if(typeof r==="function")throw new $t("Connection.prototype.openUri() no longer accepts a callback")}/*!
818
+ * ignore
819
+ */function xV(e){if(e?.name==="MongoServerSelectionError"){let t=e;e=new h1e,e.assimilateError(t)}return e}ge.prototype.destroy=async function(t){if(typeof t==="function"||arguments.length===2&&typeof arguments[1]==="function")throw new $t("Connection.prototype.destroy() no longer accepts a callback");if(t!=null&&typeof t==="object")this.$wasForceClosed=!!t.force;else this.$wasForceClosed=!!t;return this._close(t,!0)};ge.prototype.close=async function(t){if(typeof t==="function"||arguments.length===2&&typeof arguments[1]==="function")throw new $t("Connection.prototype.close() no longer accepts a callback");if(t!=null&&typeof t==="object")this.$wasForceClosed=!!t.force;else this.$wasForceClosed=!!t;if(this._lastHeartbeatAt!=null)this._lastHeartbeatAt=null;for(let r of Object.values(this.models))delete r.$init;return this._close(t,!1)};ge.prototype._close=async function(t,r){let n=this,s=this._closeCalled;if(this._closeCalled=!0,this._destroyCalled=r,this.client!=null)this.client._closeCalled=!0,this.client._destroyCalled=r;let i=this;switch(this.readyState){case ot.disconnected:if(r){let o=this.base.connections.indexOf(i);if(o!==-1)this.base.connections.splice(o,1)}if(!s)await this.doClose(t),this.onClose(t);break;case ot.connected:if(this.readyState=ot.disconnecting,await this.doClose(t),r){let o=n.base.connections.indexOf(i);if(o!==-1)this.base.connections.splice(o,1)}this.onClose(t);break;case ot.connecting:return new Promise((o,u)=>{let a=()=>{if(this.removeListener("open",a),this.removeListener("error",a),r)this.destroy(t).then(o,u);else this.close(t).then(o,u)};this.once("open",a),this.once("error",a)});case ot.disconnecting:return new Promise((o)=>{this.once("close",()=>{if(r&&this.base.connections.indexOf(i)!==-1)this.base.connections.splice(this.base.connections.indexOf(i),1);o()})})}return this};ge.prototype.doClose=function(){throw new $t("Connection#doClose unimplemented by driver")};ge.prototype.onClose=function(t){this.readyState=ot.disconnected;for(let n in this.collections)if(Object.hasOwn(this.collections,n))this.collections[n].onClose(t);this.emit("close",t);let r=typeof t==="object"&&t!==null?t.force:t;for(let n of this.otherDbs)this._destroyCalled?n.destroy({force:r,skipCloseClient:!0}):n.close({force:r,skipCloseClient:!0})};ge.prototype.collection=function(e,t){let r={autoIndex:this.config.autoIndex??this.base.options.autoIndex,autoCreate:this.config.autoCreate??this.base.options.autoCreate,autoSearchIndex:this.config.autoSearchIndex??this.base.options.autoSearchIndex};t=Object.assign({},r,t?p1e(t):{}),t.$wasForceClosed=this.$wasForceClosed;let n=this.base?.__driver?.Collection||vV.get().Collection;if(!(e in this.collections))this.collections[e]=new n(e,this,t);return this.collections[e]};ge.prototype.plugin=function(e,t){return this.plugins.push([e,t]),this};ge.prototype.model=function(t,r,n,s){if(!(this instanceof ge))throw new $t("`connection.model()` should not be run with `new`. If you are doing `new db.model(foo)(bar)`, use `db.model(foo)(bar)` instead");let i;if(typeof t==="function")i=t,t=i.name;if(typeof r==="string")n=r,r=!1;if(jh.isObject(r)){if(!r.instanceOfSchema)r=new l1e(r);else if(!(r instanceof this.base.Schema))r=r._clone(this.base.Schema)}if(r&&!r.instanceOfSchema)throw new $t("The 2nd parameter to `mongoose.model()` should be a schema or a POJO");let o={cache:!1,overwriteModels:this.base.options.overwriteModels},u=Object.assign(o,s,{connection:this}),a=RV(this.models,t);if(a&&!n&&u.overwriteModels!==!0){if(r?.instanceOfSchema&&r!==a.schema)throw new $t.OverwriteModelError(t);return a}let c;if(r?.instanceOfSchema){if(d1e(r,this.plugins,null,"$connectionPluginsApplied"),c=this.base._model(i||t,r,n,u),!RV(this.models,t))this.models[t]=c;return c.init().catch(function(){}),c}if(a&&n)return c=a,r=c.prototype.schema,c.__subclass(this,r,n);if(arguments.length===1){if(c=a,!c)throw new $t.MissingSchemaError(t);return c}if(!c)throw new $t.MissingSchemaError(t);if(this===c.prototype.db&&(!n||n===c.collection.name)){if(!this.models[t])this.models[t]=c;return c}return this.models[t]=c.__subclass(this,r,n),this.models[t]};ge.prototype.deleteModel=function(t){if(typeof t==="string"){let r=this.model(t);if(r==null)return this;let n=r.collection.name;delete this.models[t],delete this.collections[n],this.emit("deleteModel",r)}else if(t instanceof RegExp){let r=t,n=this.modelNames();for(let s of n)if(r.test(s))this.deleteModel(s)}else throw new $t('First parameter to `deleteModel()` must be a string or regexp, got "'+t+'"');return this};ge.prototype.watch=function(t,r){let n=this._waitForConnect().then(()=>this.db.watch(t,r));return new c1e(n,t,r)};ge.prototype.asPromise=async function(){try{return await this.$initialConnection,this}catch(t){throw xV(t)}};ge.prototype.modelNames=function(){return Object.keys(this.models)};ge.prototype.shouldAuthenticate=function(){return this.user!=null&&(this.pass!=null||this.authMechanismDoesNotRequirePassword())};ge.prototype.authMechanismDoesNotRequirePassword=function(){if(this.options?.auth)return S1e.indexOf(this.options.auth.authMechanism)>=0;return!0};ge.prototype.optionsProvideAuthenticationData=function(t){return t&&t.user&&(t.pass||this.authMechanismDoesNotRequirePassword())};ge.prototype.getClient=function(){return this.client};ge.prototype.setClient=function(){throw new $t("Connection#setClient not implemented by driver")};/*!
820
+ * Called internally by `openUri()` to create a MongoClient instance.
821
+ */ge.prototype.createClient=function(){throw new $t("Connection#createClient not implemented by driver")};ge.prototype.syncIndexes=async function(t={}){let r={},n={},{continueOnError:s}=t;delete t.continueOnError;for(let i of Object.values(this.models))try{r[i.modelName]=await i.syncIndexes(t)}catch(o){if(!s){n[i.modelName]=o;break}else r[i.modelName]=o}if(!s&&jh.hasOwnKeys(n)){let i=Object.entries(n).map(([u,a])=>`${u}: ${a.message}`).join(", ");throw new f1e(i,n)}return r};/*!
822
+ * Module exports.
823
+ */ge.STATES=ot;kV.exports=ge});var KS=g(function(SEe,b1e){b1e.exports={name:"mongoose",description:"Mongoose MongoDB ODM",version:"9.13.2",author:"Guillermo Rauch <guillermo@learnboost.com>",keywords:["mongodb","document","model","schema","database","odm","data","datastore","query","nosql","orm","db"],type:"commonjs",license:"MIT",dependencies:{"@standard-schema/spec":"^1.1.0",kareem:"3.4.1",mongodb:"~7.9",mpath:"0.9.0",mquery:"6.0.1",ms:"2.1.3",sift:"17.1.4"},devDependencies:{"@ark/attest":"0.58.1","@eslint/js":"^9.39.3","@mongodb-js/mongodb-downloader":"^3.0.5","@types/node":"^20.19.0",acquit:"1.4.0","acquit-ignore":"0.2.2","acquit-require":"0.1.1",ajv:"8.20.0",c8:"12.0.0",cheerio:"1.2.0",dox:"1.0.0",eslint:"10.16.0","eslint-plugin-mocha-no-only":"1.2.0",express:"5.3.0","fs-extra":"~11.4.0",globals:"^17.4.0","highlight.js":"11.12.0",linkinator:"8.x","lodash.isequal":"4.5.0","lodash.isequalwith":"4.4.0","markdownlint-cli2":"0.24.2",marked:"18.3.0",mkdirp:"^3.0.1",mocha:"12.0.3",moment:"2.31.0","mongodb-client-encryption":"^7.2.0","mongodb-memory-server":"11.4.0","mongodb-runner":"^6.0.0",ncp:"^2.0.0",pug:"3.0.4",sinon:"22.1.0",tstyche:"^7.0.0",typescript:"5.9.3","typescript-eslint":"^8.31.1",uuid:"14.0.3",xss:"1.0.17"},directories:{lib:"./lib/mongoose"},scripts:{"docs:clean":"npm run docs:clean:stable","docs:clean:stable":"rm -rf index.html && rm -rf ./docs/*.html && rm -rf ./docs/api && rm -rf ./docs/tutorials/*.html && rm -rf ./docs/typescript/*.html && rm -rf ./docs/production/*.html && rm -rf ./docs/*.html && rm -rf ./docs/source/_docs && rm -rf ./tmp","docs:clean:5x":"rm -rf index.html && rm -rf ./docs/5.x && rm -rf ./docs/source/_docs && rm -rf ./tmp","docs:clean:6x":"rm -rf index.html && rm -rf ./docs/6.x && rm -rf ./docs/source/_docs && rm -rf ./tmp","docs:copy:tmp":"mkdirp ./tmp/docs/css && mkdirp ./tmp/docs/js && mkdirp ./tmp/docs/images && mkdirp ./tmp/docs/tutorials && mkdirp ./tmp/docs/typescript && mkdirp ./tmp/docs/production && mkdirp ./tmp/docs/api && ncp ./docs/css ./tmp/docs/css --filter=.css$ && ncp ./docs/js ./tmp/docs/js --filter=.js$ && ncp ./docs/images ./tmp/docs/images && ncp ./docs/tutorials ./tmp/docs/tutorials && ncp ./docs/typescript ./tmp/docs/typescript && ncp ./docs/production ./tmp/docs/production && ncp ./docs/api ./tmp/docs/api && cp index.html ./tmp && cp docs/*.html ./tmp/docs/","docs:copy:tmp:5x":"rm -rf ./docs/5.x && ncp ./tmp ./docs/5.x","docs:copy:tmp:6x":"rm -rf ./docs/6.x && ncp ./tmp ./docs/6.x","docs:generate":"node ./scripts/website.js","docs:generate:sponsorData":"node ./scripts/loadSponsorData.js","docs:test":"npm run docs:generate","docs:view":"node ./scripts/static.js","docs:prepare:publish:stable":"git checkout gh-pages && git merge master && env GENERATE_SEARCH=true npm run docs:generate","docs:prepare:publish:5x":"git checkout 5.x && git merge 5.x && npm run docs:clean:stable && npm run docs:generate && npm run docs:copy:tmp && git checkout gh-pages && npm run docs:copy:tmp:5x","docs:prepare:publish:6x":"git checkout 6.x && git merge 6.x && npm run docs:clean:stable && env DOCS_DEPLOY=true npm run docs:generate && mv ./docs/6.x ./tmp && git checkout gh-pages && npm run docs:copy:tmp:6x","docs:prepare:publish:7x":"env DOCS_DEPLOY=true npm run docs:generate && git checkout gh-pages && rm -rf ./docs/7.x && mv ./tmp ./docs/7.x","docs:prepare:publish:8x":"env DOCS_DEPLOY=true npm run docs:generate && git checkout gh-pages && rm -rf ./docs/8.x && mv ./tmp ./docs/8.x","docs:check-links":'linkinator http://127.0.0.1:8089 --silent --recurse --skip cdn.carbonads.com --skip m.servedby-buysellads.com --skip "127\\.0\\.0\\.1:8089/docs/\\d+.x"',"docs:update-mongodb-links":"node ./scripts/update-mongodb-links.js",checkLibCharset:"node ./scripts/checkLibCharset.js",lint:"eslint .","lint-js":"eslint . --ext .js --ext .cjs","lint-ts":"eslint . --ext .ts","lint-md":'markdownlint-cli2 "docs/**/*.md" "docs/*.md" "*.md"',release:"git pull && git push origin master --tags && npm publish","release-5x":"git pull origin 5.x && git push origin 5.x && git push origin 5.x --tags && npm publish --tag 5x","release-6x":"git pull origin 6.x && git push origin 6.x && git push origin 6.x --tags && npm publish --tag 6x",mongo:"node ./tools/repl.js","publish-7x":"npm publish --tag 7x","create-separate-require-instance":"rm -rf ./node_modules/mongoose-separate-require-instance && node ./scripts/create-tarball && tar -xzf mongoose.tgz -C ./node_modules && mv ./node_modules/package ./node_modules/mongoose-separate-require-instance",test:'mocha --exit --ignore "test/encryption/**/*.test.js" "./test/**/*.test.js"',"test:ci":"npm run test -- --reporter min --timeout 10000","test-deno":"deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.mjs","test-deno:ci":"npm run test-deno -- --reporter min","test-rs":'START_REPLICA_SET=1 mocha --timeout 30000 --exit --ignore "test/encryption/**/*.test.js" "./test/**/*.test.js"',"test-rs:ci":"npm run test-rs -- --reporter min","test:types":"tstyche","setup-test-encryption":"node scripts/setup-encryption-tests.js","test-encryption":"mocha --exit ./test/encryption/*.test.js","test-encryption:ci":"npm run test-encryption -- --reporter min",tdd:'mocha --watch --inspect --ignore "test/encryption/**/*.test.js" "./test/**/*.test.js" --watch-files lib/**/*.js test/**/*.js',"test-coverage":"c8 --reporter=html --reporter=text npm test","test-coverage:ci":"c8 --reporter=html --reporter=text npm run test:ci","ts-benchmark":"cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check","ts-benchmark:local":"node ./scripts/create-tarball && cd ./benchmarks/typescript/simple && rm -rf ./node_modules && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check","attest-benchmark":"node ./benchmarks/typescript/infer.bench.mts"},main:"./index.js",types:"./types/index.d.ts",engines:{node:">=20.19.0"},bugs:{url:"https://github.com/Automattic/mongoose/issues/new"},repository:{type:"git",url:"git://github.com/Automattic/mongoose.git"},homepage:"https://mongoosejs.com",config:{mongodbMemoryServer:{disablePostinstall:!0}},funding:{type:"opencollective",url:"https://opencollective.com/mongoose"}}});var jV=g(function(wEe,qV){var D1e=ar(),T1e=ni();function M1e(e,t){let r=t?t:{},n=r.readPreference?N1e(r.readPreference):I1e(e),s=D1e(r);return n&&n!=="primary"&&n!=="primaryPreferred"?P1e(n,s):s}function P1e(e,t){if(B1e(t)&&F1e(e))$1e();else return R1e(t)}function B1e(e){let t=e.config?.autoIndex,{autoCreate:r,autoIndex:n}=e;return!!(t||r||n)}function F1e(e){return e==="secondary"||e==="secondaryPreferred"}function N1e(e){return typeof e==="string"?e:e.mode}function I1e(e){let r=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(e);return r?r[1]:null}function R1e(e){return e.config={autoIndex:!1},e.autoCreate=!1,e.autoIndex=!1,e}function $1e(){throw new T1e('MongoDB prohibits index creation on connections that read from non-primary replicas. Connections that set "readPreference" to "secondary" or "secondaryPreferred" may not opt-in to the following connection options: autoCreate, autoIndex')}qV.exports=M1e});var UV=g(function(LV){LV.setTimeout=setTimeout});var WV=g(function(bEe,zV){/*!
824
+ * Module dependencies.
825
+ */var M_=HS(),tl=ni(),Bt=S_(),P_=Oa(),VV=KS(),v1e=jV(),x1e=UV().setTimeout,fu=be(),k1e=Kc(),q1e=globalThis.Date;function bo(){M_.apply(this,arguments),this._listening=!1,this._lastHeartbeatAt=null}bo.STATES=Bt;/*!
826
+ * Inherits from Connection.
827
+ */Object.setPrototypeOf(bo.prototype,M_.prototype);bo.prototype.useDb=function(e,t){if(t=t||{},t.useCache&&this.relatedDbs[e])return this.relatedDbs[e];let r=new this.constructor;r.name=e,r.base=this.base,r.collections={},r.models={},r.replica=this.replica,r.config=Object.assign({},this.config,r.config),r.name=this.name,r.options=this.options,r._readyState=this._readyState,r._closeCalled=this._closeCalled,r._hasOpened=this._hasOpened,r._listening=!1,r._parent=this,r.host=this.host,r.port=this.port,r.user=this.user,r.pass=this.pass;let n=this;if(r.client=n.client,this.db&&this._readyState===Bt.connected)s();else this._queue.push({fn:s});function s(){r.client=n.client,r.db=n.client.db(e),r._lastHeartbeatAt=n._lastHeartbeatAt,r.onOpen()}if(r.name=e,this.otherDbs.push(r),r.otherDbs.push(this),t?.useCache)this.relatedDbs[r.name]=r,r.relatedDbs=this.relatedDbs;return r};bo.prototype.aggregate=function(t,r){return new this.base.Aggregate(null,this).append(t).option(r??{})};bo.prototype.removeDb=function(t){let r=this.otherDbs.filter((n)=>n.name===t);if(!r.length)throw new tl(`No connections to database "${t}" found`);for(let n of r)n._closeCalled=!0,n._destroyCalled=!0,n._readyState=Bt.disconnected,n.$wasForceClosed=!0;delete this.relatedDbs[t],this.otherDbs=this.otherDbs.filter((n)=>n.name!==t)};bo.prototype.doClose=async function(t){if(this.client==null)return this;let r=!1;if(t!=null&&typeof t==="object")r=t.skipCloseClient,t=t.force;if(r)return this;return await this.client.close(t),await new Promise((n)=>x1e(n,1)),this};bo.prototype.listDatabases=async function(){return await this._waitForConnect(),await this.db.admin().listDatabases()};/*!
828
+ * ignore
829
+ */bo.prototype.createClient=async function(t,r){if(typeof t!=="string")throw new tl(`The \`uri\` parameter to \`openUri()\` must be a string, got "${typeof t}". Make sure the first parameter to \`mongoose.connect()\` or \`mongoose.createConnection()\` is a string.`);if(this._destroyCalled)throw new tl("Connection has been closed and destroyed, and cannot be used for re-opening the connection. Please create a new connection with `mongoose.createConnection()` or `mongoose.connect()`.");if(this.readyState===Bt.connecting||this.readyState===Bt.connected){if(this._connectionString!==t)throw new tl("Can't call `openUri()` on an active connection with different connection strings. Make sure you aren't calling `mongoose.connect()` multiple times. See: https://mongoosejs.com/docs/connections.html#multiple_connections")}if(r=v1e(t,r),r){let u=r.config?.autoIndex??r.autoIndex;if(u!=null)this.config.autoIndex=u!==!1,delete r.config,delete r.autoIndex;if("autoCreate"in r)this.config.autoCreate=!!r.autoCreate,delete r.autoCreate;if("sanitizeFilter"in r)this.config.sanitizeFilter=r.sanitizeFilter,delete r.sanitizeFilter;if("autoSearchIndex"in r)this.config.autoSearchIndex=r.autoSearchIndex,delete r.autoSearchIndex;if("bufferTimeoutMS"in r)this.config.bufferTimeoutMS=r.bufferTimeoutMS,delete r.bufferTimeoutMS;if(r.user||r.pass)r.auth=r.auth||{},r.auth.username=r.user,r.auth.password=r.pass,this.user=r.user,this.pass=r.pass;if(delete r.user,delete r.pass,r.bufferCommands!=null)this.config.bufferCommands=r.bufferCommands,delete r.bufferCommands}else r={};this._connectionOptions=r;let n=r.dbName;if(n!=null)this.$dbName=n;if(delete r.dbName,!fu.hasUserDefinedProperty(r,"driverInfo"))r.driverInfo={name:"Mongoose",version:VV.version};let{schemaMap:s,encryptedFieldsMap:i}=this._buildEncryptionSchemas();if((fu.hasOwnKeys(s)||fu.hasOwnKeys(i))&&!r.autoEncryption)throw Error("Must provide `autoEncryption` when connecting with encrypted schemas.");if(fu.hasOwnKeys(s))r.autoEncryption.schemaMap=s;if(fu.hasOwnKeys(i))r.autoEncryption.encryptedFieldsMap=i;this.readyState=Bt.connecting,this._connectionString=t;let o;try{o=new P_.MongoClient(t,r)}catch(u){throw this.readyState=Bt.disconnected,u}this.client=o,o.setMaxListeners(0),await o.connect(),GS(this,o,r,n);for(let u of this.otherDbs)GS(u,o,{},u.name);return this};bo.prototype._buildEncryptionSchemas=function(){let e={},t={},r=Object.values(this.models).filter((i)=>i.schema._hasEncryptedFields());for(let i of r){let{schema:o,collection:{collectionName:u}}=i,a=`${this.$dbName}.${u}`,c=o.encryptionType()==="csfle"?t:e;if(c[a]??=new k1e({},{encryptionType:o.encryptionType()}),o.discriminatorMapping&&!o.discriminatorMapping.isRoot){let f=o._baseSchema;o.eachPath((h)=>{if(f.path(h))return;if(!c[a]._hasEncryptedField(h))return;throw Error(`Cannot have duplicate keys in discriminators with encryption. key=${h}`)})}c[a].add(o)}let n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,o._buildSchemaMap()])),s=Object.fromEntries(Object.entries(e).map(([i,o])=>[i,o._buildEncryptedFields()]));return{schemaMap:n,encryptedFieldsMap:s}};/*!
830
+ * ignore
831
+ */bo.prototype.setClient=function(t){if(!(t instanceof P_.MongoClient))throw new tl("Must call `setClient()` with an instance of MongoClient");if(this.readyState!==Bt.disconnected)throw new tl("Cannot call `setClient()` on a connection that is already connected.");if(t.topology==null)throw new tl("Cannot call `setClient()` with a MongoClient that you have not called `connect()` on yet.");this._connectionString=t.s.url,GS(this,t,{},t.s.options.dbName);for(let r of Object.values(this.models))r.init().catch(function(){});return this};/*!
832
+ * ignore
833
+ */function GS(e,t,r,n){let s=n!=null?t.db(n):t.db();e.db=s,e.client=t,e.host=t?.s?.options?.hosts?.[0]?.host,e.port=t?.s?.options?.hosts?.[0]?.port,e.name=n!=null?n:s.databaseName,e._closeCalled=t._closeCalled;let i=()=>{if(e.readyState!==Bt.connected)e.readyState=Bt.connected,e.emit("reconnect"),e.emit("reconnected"),e.onOpen()},o=t?.topology?.description?.type||"";if(o==="Single")t.on("serverDescriptionChanged",(u)=>{if(u.newDescription.type==="Unknown")e.readyState=Bt.disconnected;else i()});else if(o.startsWith("ReplicaSet"))t.on("topologyDescriptionChanged",(u)=>{let a=u.newDescription;if(e.readyState===Bt.connected&&a.type!=="ReplicaSetWithPrimary")e.readyState=Bt.disconnected;else if(e.readyState===Bt.disconnected&&a.type==="ReplicaSetWithPrimary")i()});if(e._lastHeartbeatAt=null,t.on("serverHeartbeatSucceeded",()=>{e._lastHeartbeatAt=q1e.now();for(let u of e.otherDbs)u._lastHeartbeatAt=e._lastHeartbeatAt;if(e._queue.length>0&&e.readyState===Bt.connected)e._flushQueue();for(let u of e.otherDbs)if(u._queue.length>0&&u.readyState===Bt.connected)u._flushQueue();for(let u of Object.values(e.collections))if(u.buffer)u.onOpen()}),r.monitorCommands)t.on("commandStarted",(u)=>e.emit("commandStarted",u)),t.on("commandFailed",(u)=>e.emit("commandFailed",u)),t.on("commandSucceeded",(u)=>e.emit("commandSucceeded",u));e.onOpen();for(let u in e.collections)if(Object.hasOwn(e.collections,u))e.collections[u].onOpen()}/*!
834
+ * Module exports.
835
+ */zV.exports=bo});var HV=g(function(xd){/*!
836
+ * Module exports.
837
+ */xd.BulkWriteResult=B7();xd.Collection=u$();xd.Connection=WV();xd.ClientEncryption=Oa().ClientEncryption});var GV=g(function(TEe,KV){/*!
838
+ * Valid mongoose options
839
+ */var j1e=Object.freeze(["allowDiskUse","applyPluginsToChildSchemas","applyPluginsToDiscriminators","autoCreate","autoIndex","autoSearchIndex","bufferCommands","bufferTimeoutMS","cloneSchemas","createInitialConnection","debug","forceRepopulate","id","maxTimeMS","objectIdGetter","overwriteModels","returnDocument","returnOriginal","runValidators","sanitizeFilter","sanitizeProjection","selectPopulatedPaths","setDefaultsOnInsert","strict","strictPopulate","strictQuery","strictRead","timestamps.createdAt.immutable","toJSON","toObject","transactionAsyncLocalStorage","translateAliases","updatePipeline"]);KV.exports=j1e});var JV=g(function(MEe,YV){/*!
840
+ * Module dependencies.
841
+ */var L1e=ze();class YS extends L1e{constructor(e){let t=e.map((r)=>r.message).join(", ");if(t.length>50)t=t.slice(0,50)+"...";super(`eachAsync() finished with ${e.length} errors: ${t}`);this.errors=e}}Object.defineProperty(YS.prototype,"name",{value:"EachAsyncMultiError"});/*!
842
+ * exports
843
+ */YV.exports=YS});var QS=g(function(PEe,XV){/*!
844
+ * Module dependencies.
845
+ */var U1e=JV(),JS=ua();XV.exports=async function(t,r,n){let s=n.parallel||1,{batchSize:i,signal:o,continueOnError:u}=n,a=[],c=V1e(),l=!1;return new Promise((d,p)=>{if(o!=null){if(o.aborted)return d(null);o.addEventListener("abort",()=>(l=!0,d(null)),{once:!0})}if(i!=null){if(typeof i!=="number")throw TypeError("batchSize must be a number");else if(!Number.isInteger(i))throw TypeError("batchSize must be an integer");else if(i<1)throw TypeError("batchSize must be at least 1")}f((m,_)=>{if(m!=null)return p(m);d(_)})});function f(d){let p=0,m=0,_=null;for(let E=0;E<s;++E)c(y());function y(){let E=[],C=!1;return D;function D(A){if(C||l)return A();else if(_)return A();t(function(P,S){if(_!=null)return A();if(P!=null)if(P.name==="MongoCursorExhaustedError")S=null;else if(u)a.push(P);else return _=P,d(P),A();if(S==null){if(C=!0,p<=0){let I=u?QV(a):_;d(I)}else if(i&&E.length)h(E,m++,q);return A()}if(++p,JS(()=>A()),i)E.push(S);if(i&&E.length!==i){JS(()=>c(D));return}let B=i?E:S;function q(I){if(i)p-=E.length,E=[];else--p;if(I!=null)if(u)a.push(I);else return _=I,d(I);if((C||l)&&p<=0){let Oe=u?QV(a):_;return d(Oe)}JS(()=>c(D))}h(B,m++,q)})}}}function h(d,p,m){let _;try{_=r(d,p)}catch(y){return m(y)}if(typeof _?.then==="function")_.then(function(){m(null)},function(y){m(y||Error("`eachAsync()` promise rejected without error"))});else m(null)}};function V1e(){let e=[],t=null,r=0;return function(i){if(t===null&&e.length===0)return t=r++,i(n);e.push(i)};function n(){if(e.length!==0)t=r++,e.shift()(n);else t=null}}function QV(e){if(e.length===0)return null;return new U1e(e)}});var XS=g(function(BEe,ZV){ZV.exports=function(t){return new Promise((r)=>{let n=()=>{if(!t._initializationComplete)return;t.removeListener("cursor",n),t.removeListener("error",n),r()};t.on("cursor",n),t.on("error",n)})}});var Lh=g(function(FEe,tz){var B_;try{B_=typeof process<"u"&&"getBuiltinModule"in process?process.getBuiltinModule("node:diagnostics_channel"):require("node:diagnostics_channel")}catch{}var z1e=!!B_&&typeof B_.tracingChannel==="function";function W1e(e){return!!e&&e.hasSubscribers!==!1}function ez(e){let t=z1e?B_.tracingChannel(e):void 0;function r(n,s){if(!W1e(t))return n();return t.tracePromise(n,s())}return{channel:t,trace:r}}tz.exports={createTracedChannel:ez,cursorNextChannel:ez("mongoose:cursor:next")}});var cz=g(function(NEe,az){/*!
846
+ * Module dependencies.
847
+ */var kd=ze(),iz=require("stream").Readable,H1e=QS(),K1e=XS(),I_=od(),oz=kc(),ZS=ua(),{once:G1e}=require("events"),R_=require("util"),{cursorNextChannel:Y1e}=Lh(),{buildMiddlewareFilter:rz}=vu();function zs(e){iz.call(this,{autoDestroy:!0,objectMode:!0}),this.cursor=null,this._initializationComplete=!1,this.skipped=!1,this.query=e,this._closed=!1;let t=e.model;this._mongooseOptions={},this._transforms=[],this.model=t,this.options={},this._postMiddlewareFilter=null;let r=(s)=>{if(s!=null){if(this._initializationComplete=!0,s instanceof oz.skipWrappedFunction){let a=s.args[0];if(a!=null&&(!Array.isArray(a)||a.length)){let c=new kd('Cannot `skipMiddlewareFunction()` with a value when using `.find().cursor()`, value must be nullish or empty array, got "'+R_.inspect(a)+'".');if(this._markError(c),this.listeners("error").length>0)this._errorEmitted=!0,this.emit("error",c);return}this.skipped=!0,this.emit("cursor",null);return}if(this._markError(s),this.listeners("error").length>0)this._errorEmitted=!0,this.emit("error",s);return}let i=null;try{i=e._optionsForExec()}catch(a){this._markError(a),this.listeners("error").length>0&&this.emit("error",a);return}let{middleware:o,...u}=i;if(Object.assign(this.options,u),Object.hasOwn(this.options,"middleware"))delete this.options.middleware;if(this._postMiddlewareFilter=rz(e.options,"post"),this._transforms=this._transforms.concat(e._transforms.slice()),this.options.transform)this._transforms.push(this.options.transform);if(this.options.batchSize)this.options._populateBatchSize=Math.min(this.options.batchSize,5000);if(e._mongooseOptions._asyncIterator)this._mongooseOptions._asyncIterator=!0;if(t.collection._shouldBufferCommands()&&t.collection.buffer)t.collection.queue.push([()=>nz(e,this)]);else nz(e,this)},n=rz(e.options,"pre");t.hooks.execPre("find",e,[],{filter:n}).then(()=>r(null)).catch((s)=>r(s))}R_.inherits(zs,iz);/*!
848
+ * ignore
849
+ */function nz(e,t){try{let r=e.model.collection.find(e._conditions,t.options);t.cursor=r,t._initializationComplete=!0,t.emit("cursor",r)}catch(r){if(t._initializationComplete=!0,t._markError(r),t.listeners("error").length>0)t._errorEmitted=!0,t.emit("error",t._error)}}zs.prototype._read=function(){$_(this,(e,t)=>{if(e)return this._errorEmitted=!0,this.emit("error",e);if(!t){this.push(null),this.cursor.close((r)=>{if(r)return this.emit("error",r)});return}this.push(t)})};zs.prototype.getDriverCursor=async function(){if(this.cursor)return this.cursor;if(this._error)throw this._error;return await G1e(this,"cursor"),this.cursor};Object.defineProperty(zs.prototype,"map",{value:function(e){return this._transforms.push(e),this},enumerable:!0,configurable:!0,writable:!0});zs.prototype._markError=function(e){return this._error=e,this};zs.prototype.close=async function(){if(typeof arguments[0]==="function")throw new kd("QueryCursor.prototype.close() no longer accepts a callback");try{await this.cursor.close(),this._closed=!0,this.emit("close")}catch(t){if(this.listeners("error").length>0)this._errorEmitted=!0,this.emit("error",t);throw t}};zs.prototype._destroy=function(t,r){let n=null;if(!this._initializationComplete)n=K1e(this);else n=Promise.resolve();return n.then(()=>this.cursor?.close()).then(()=>{this._closed=!0;let s=!this._errorEmitted&&this.listeners("error").length>0;r(s?t:null)}).catch((s)=>{r(s)}),this};zs.prototype.rewind=function(){return uz(this,()=>{this.cursor.rewind()}),this};zs.prototype.next=async function(){if(typeof arguments[0]==="function")throw new kd("QueryCursor.prototype.next() no longer accepts a callback");if(this._closed)throw new kd("Cannot call `next()` on a closed cursor");let t=this;return Y1e.trace(function(){return new Promise((n,s)=>{$_(t,function(i,o){if(i)return s(i);n(o)})})},()=>({operation:t.query.op||"find",collection:t.query.mongooseCollection.name,database:t.model.db?.name,serverAddress:t.model.db?.host,serverPort:t.model.db?.port,batchSize:t.options.batchSize||t.query.options?.batchSize,tailable:t.options.tailable||t.query.options?.tailable||!1,args:{filter:t.query.getFilter(),options:t.query._mongooseOptions}}))};zs.prototype.eachAsync=function(e,t){if(typeof arguments[2]==="function")throw new kd("QueryCursor.prototype.eachAsync() no longer accepts a callback");if(typeof t==="function")t={};return t=t||{},H1e((r)=>$_(this,r),e,t)};zs.prototype.options;zs.prototype.addCursorFlag=function(e,t){return uz(this,()=>{this.cursor.addCursorFlag(e,t)}),this};if(Symbol.asyncIterator!=null)zs.prototype[Symbol.asyncIterator]=function(){return this._mongooseOptions._asyncIterator=!0,this};function $_(e,t){let r=t;if(r=function(n,s){if(n)return t(n);if(s===null)if(e._mongooseOptions._asyncIterator)return t(null,{done:!0});else return t(null,null);if(e._transforms.length&&s!==null)s=e._transforms.reduce(function(i,o){return o.call(e,i)},s);if(e._mongooseOptions._asyncIterator)return t(null,{value:s,done:!1});return t(null,s)},e._error)return ZS(function(){r(e._error)});if(e.skipped)return ZS(()=>r(null,null));if(e.cursor){if(e.query._mongooseOptions.populate&&!e._pop)e._pop=I_.preparePopulationOptionsMQ(e.query,e.query._mongooseOptions),e._pop.__noPromise=!0;if(e.query._mongooseOptions.populate&&e.options._populateBatchSize>1)if(e._batchDocs&&e._batchDocs.length)return F_(e,e._batchDocs.shift(),e._pop,r);else if(e._batchExhausted)return r(null,null);else{e._batchDocs=[],e.cursor.next().then((n)=>{N_.call({ctx:e,callback:r},null,n)},(n)=>{N_.call({ctx:e,callback:r},n)});return}else return e.cursor.next().then((n)=>{if(!n){r(null,null);return}if(!e.query._mongooseOptions.populate)return F_(e,n,null,r);F_(e,n,e._pop,(s,i)=>{if(s!=null)return r(s);e.query.model.populate(i,e._pop).then((o)=>r(null,o),(o)=>r(o))})},(n)=>{r(n)})}else e.once("error",t),e.once("cursor",function(n){if(e.removeListener("error",t),n==null){if(e.skipped)return t(null,null);return}$_(e,t)})}/*!
850
+ * ignore
851
+ */function N_(e,t){if(e)return this.callback(e);if(!t)return this.ctx._batchExhausted=!0,sz.call(this);if(this.ctx._batchDocs.push(t),this.ctx._batchDocs.length<this.ctx.options._populateBatchSize)ZS(()=>this.ctx.cursor.next().then((r)=>{N_.call(this,null,r)},(r)=>{N_.call(this,r)}));else sz.call(this)}/*!
852
+ * ignore
853
+ */function sz(){if(!this.ctx._batchDocs.length)return this.callback(null,null);this.ctx.query.model.populate(this.ctx._batchDocs,this.ctx._pop).then(()=>{F_(this.ctx,this.ctx._batchDocs.shift(),this.ctx._pop,this.callback)},(e)=>{this.callback(e)})}/*!
854
+ * ignore
855
+ */function F_(e,t,r,n){if(e.query._mongooseOptions.lean)return e.model.hooks.execPost("find",e.query,[[t]],{filter:e._postMiddlewareFilter}).then(()=>n(null,t),(a)=>n(a));let{model:s,_fields:i,_userProvidedFields:o,options:u}=e.query;I_.createModelAndInit(s,t,i,o,u,r,(a,c)=>{if(a!=null)return n(a);if(u.session!=null)c.$session(u.session);e.model.hooks.execPost("find",e.query,[[c]],{filter:e._postMiddlewareFilter}).then(()=>n(null,c),(l)=>n(l))})}/*!
856
+ * ignore
857
+ */function uz(e,t){if(e.cursor)return t();e.once("cursor",function(r){if(r==null)return;t()})}az.exports=zs});var ew=g(function(IEe,hz){var Uh=be();function J1e(e,t,r){lz(e,t,r,"maxTimeMS")}function Q1e(e,t,r){lz(e,t,r,"allowDiskUse")}hz.exports={applyGlobalMaxTimeMS:J1e,applyGlobalDiskUse:Q1e};function lz(e,t,r,n){if(Uh.hasUserDefinedProperty(e,n))return;if(Uh.hasUserDefinedProperty(t,n))e[n]=t[n];else if(Uh.hasUserDefinedProperty(r,n))e[n]=r[n]}});var tw=g(function(REe,fz){fz.exports=function(t,r){if(r.readConcern!==void 0)return;if(r?.session?.transaction)return;let n=t.options?.readConcern?.level;if(n!=null)r.readConcern={level:n}}});var rw=g(function($Ee,pz){var dz=be();pz.exports=function(t,r){if(r.writeConcern!=null)return;if(r?.session?.transaction)return;let n=t.options.writeConcern??{};if(dz.hasOwnKeys(n)){if(r.writeConcern={},!("w"in r)&&n.w!=null)r.writeConcern.w=n.w;if(!("j"in r)&&n.j!=null)r.writeConcern.j=n.j;if(!("wtimeout"in r)&&n.wtimeout!=null)r.writeConcern.wtimeout=n.wtimeout}else{if(!("w"in r)&&n.w!=null)r.w=n.w;if(!("j"in r)&&n.j!=null)r.j=n.j;if(!("wtimeout"in r)&&n.wtimeout!=null)r.wtimeout=n.wtimeout}}});var Ez=g(function(vEe,_z){var mz=$2(),yz=ar(),gz=Xa();/*!
858
+ * Deep clone a query's `_mongooseOptions` so a cloned query doesn't share state with the
859
+ * original. `clone()` returns class instances as-is, so explicitly copy `PopulateOptions`,
860
+ * including nested populate: populate options are mutable, and executing a query writes
861
+ * per-execution state like `session` and `lean` into them.
862
+ */_z.exports=function(t){let{populate:r,...n}=t,s=yz(n);if(r!=null){s.populate={};for(let i of Object.keys(r)){if(gz.has(i))continue;s.populate[i]=nw(r[i])}}return s};function nw(e){if(Array.isArray(e))return e.map(nw);if(e==null||typeof e!=="object")return e;let{populate:t,_docs:r,_childDocs:n,...s}=e,i=e instanceof mz?new mz(s):yz(s);if(t!==void 0)i.populate=nw(t);return i}});var v_=g(function(xEe,Az){var X1e=dh(),Z1e=nu();/*!
863
+ * ignore
864
+ */Az.exports=function e(t){if(t==null)return!1;let r=Object.keys(t),n=r.length;if(n===0)return!1;for(let s=0;s<n;++s){let i=r[s];if(i.startsWith("+"))continue;if(X1e(t[i])&&!!t[i])if(Z1e(t[i]))return e(t[i]);else return!!t[i]}return!1}});var Sz=g(function(kEe,Oz){Oz.exports=function(t,r){return t===r||r.startsWith(t+".")}});var wz=g(function(xr){/*!
865
+ * Module dependencies.
866
+ */var sw=xr.specialProperties=["__proto__","constructor","prototype"],x_=xr.clone=function e(t,r){if(t===void 0||t===null)return t;if(Array.isArray(t))return xr.cloneArray(t,r);if(t.constructor){if(/ObjectI[dD]$/.test(t.constructor.name))return typeof t.clone=="function"?t.clone():new t.constructor(t.id);if(t.constructor.name==="ReadPreference")return new t.constructor(t.mode,e(t.tags,r));if(t._bsontype=="Binary"&&t.buffer&&t.value)return typeof t.clone=="function"?t.clone():new t.constructor(t.value(!0),t.sub_type);if(t.constructor.name==="Date"||t.constructor.name==="Function")return new t.constructor(+t);if(t.constructor.name==="RegExp")return new RegExp(t);if(t.constructor.name==="Buffer")return Buffer.from(t)}if(the(t))return xr.cloneObject(t,r);if(t.valueOf)return t.valueOf()};/*!
867
+ * ignore
868
+ */xr.cloneObject=function(t,r){let n=r&&r.minimize,s={},i=Object.keys(t),o=i.length,u=!1,a,c="",l=0;for(l=0;l<o;++l){if(c=i[l],sw.indexOf(c)!==-1)continue;if(a=x_(t[c],r),!n||typeof a<"u")u||(u=!0),s[c]=a}return n?u&&s:s};xr.cloneArray=function(t,r){let n=[],s=t.length,i=0;for(;i<s;i++)n.push(x_(t[i],r));return n};xr.merge=function e(t,r){let n=Object.keys(r);for(let s of n){if(sw.indexOf(s)!==-1)continue;if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]>"u")t[s]=r[s];else if(xr.isObject(r[s]))e(t[s],r[s]);else t[s]=r[s]}};xr.mergeClone=function e(t,r){let n=Object.keys(r);for(let s of n){if(sw.indexOf(s)!==-1)continue;if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]>"u")t[s]=x_(r[s]);else if(xr.isObject(r[s]))e(t[s],r[s]);else t[s]=x_(r[s])}};xr.readPref=function(t){switch(t){case"p":t="primary";break;case"pp":t="primaryPreferred";break;case"s":t="secondary";break;case"sp":t="secondaryPreferred";break;case"n":t="nearest";break}return t};xr.readConcern=function(t){if(typeof t==="string"){switch(t){case"l":t="local";break;case"a":t="available";break;case"m":t="majority";break;case"lz":t="linearizable";break;case"s":t="snapshot";break}t={level:t}}return t};var ehe=Object.prototype.toString;xr.toString=function(e){return ehe.call(e)};var the=xr.isObject=function(e){return xr.toString(e)=="[object Object]"};xr.keys=Object.keys;xr.create=typeof Object.create=="function"?Object.create:rhe;function rhe(e){if(arguments.length>1)throw Error("Adding properties is not supported");function t(){}return t.prototype=e,new t}xr.inherits=function(e,t){e.prototype=xr.create(t.prototype),e.prototype.constructor=e};xr.isArgumentsObject=function(e){return Object.prototype.toString.call(e)==="[object Arguments]"}});var bz=g(function(Cz){var cr=Cz;cr.distinct=function(e){if(e._fields&&Object.keys(e._fields).length>0)return"field selection and slice";let t=Object.keys(cr.distinct),r;return t.every(function(n){if(e.options[n])return r=n,!1;return!0}),r};cr.distinct.select=cr.distinct.slice=cr.distinct.sort=cr.distinct.limit=cr.distinct.skip=cr.distinct.batchSize=cr.distinct.hint=cr.distinct.tailable=!0;cr.findOneAndUpdate=cr.findOneAndDelete=function(e){let t=Object.keys(cr.findOneAndUpdate),r;return t.every(function(n){if(e.options[n])return r=n,!1;return!0}),r};cr.findOneAndUpdate.limit=cr.findOneAndUpdate.skip=cr.findOneAndUpdate.batchSize=cr.findOneAndUpdate.tailable=!0;cr.findOneAndReplace=function(e){let t=Object.keys(cr.findOneAndUpdate),r;return t.every(function(n){if(e.options[n])return r=n,!1;return!0}),r};cr.countDocuments=function(e){if(e._fields&&Object.keys(e._fields).length>0)return"field selection and slice";let t=Object.keys(cr.countDocuments),r;return t.every(function(n){if(e.options[n])return r=n,!1;return!0}),r};cr.countDocuments.slice=cr.countDocuments.batchSize=cr.countDocuments.tailable=!0});var iw=g(function(Do,Dz){Do.isNode=typeof process<"u"&&typeof Dz=="object"&&typeof global=="object"&&typeof Buffer=="function"&&process.argv;Do.isMongo=!Do.isNode&&typeof printjson=="function"&&typeof ObjectId=="function"&&typeof rs=="function"&&typeof sh=="function";Do.isBrowser=!Do.isNode&&!Do.isMongo&&typeof window<"u";Do.type=Do.isNode?"node":Do.isMongo?"mongo":Do.isBrowser?"browser":"unknown"});var qd=g(function(Tz,Mz){var ow=["find","findOne","updateMany","updateOne","replaceOne","countDocuments","estimatedDocumentCount","distinct","findOneAndDelete","findOneAndReplace","findOneAndUpdate","aggregate","findCursor","deleteOne","deleteMany"];function uw(){}for(let e=0,t=ow.length;e<t;++e){let r=ow[e];uw.prototype[r]=nhe(r)}Mz.exports=Tz=uw;uw.methods=ow;function nhe(e){return function(){throw Error("collection."+e+" not implemented")}}});var Nz=g(function(Bz,Fz){var she=qd();class Pz extends she{constructor(e){super();this.collection=e,this.collectionName=e.collectionName}async find(e,t){return this.collection.find(e,t).toArray()}async findOne(e,t){return this.collection.findOne(e,t)}async countDocuments(e,t){return this.collection.countDocuments(e,t)}async estimatedDocumentCount(e,t){return this.collection.estimatedDocumentCount(e,t)}async distinct(e,t,r){return this.collection.distinct(e,t,r)}async updateMany(e,t,r){return this.collection.updateMany(e,t,r)}async updateOne(e,t,r){return this.collection.updateOne(e,t,r)}async replaceOne(e,t,r){return this.collection.replaceOne(e,t,r)}async deleteOne(e,t){return this.collection.deleteOne(e,t)}async deleteMany(e,t){return this.collection.deleteMany(e,t)}async findOneAndDelete(e,t){return this.collection.findOneAndDelete(e,t)}async findOneAndUpdate(e,t,r){return this.collection.findOneAndUpdate(e,t,r)}async findOneAndReplace(e,t,r){return this.collection.findOneAndReplace(e,t,r)}findCursor(e,t){return this.collection.find(e,t)}}Fz.exports=Bz=Pz});var Rz=g(function(LEe,Iz){var Vh=iw();if(Vh.type=="unknown")throw Error("Unknown environment");Iz.exports=Vh.isNode?Nz():Vh.isMongo?qd():qd()});var hw=g(function(xz,kz){var vz=require("assert"),k_=require("util"),ne=wz(),Hu=k_.debuglog("mquery");function U(e,t){if(!(this instanceof U))return new U(e,t);let r=this.constructor.prototype;if(this.op=r.op||void 0,this.options=Object.assign({},r.options),this._conditions=r._conditions?ne.clone(r._conditions):{},this._fields=r._fields?ne.clone(r._fields):void 0,this._updateDoc=r._updateDoc?ne.clone(r._updateDoc):void 0,this._path=r._path||void 0,this._distinctDoc=r._distinctDoc||void 0,this._collection=r._collection||void 0,this._traceFunction=r._traceFunction||void 0,t)this.setOptions(t);if(e)this.find(e)}U.prototype.toConstructor=function(){function t(n,s){if(!(this instanceof t))return new t(n,s);U.call(this,n,s)}ne.inherits(t,U);let r=t.prototype;return r.options={},r.setOptions(this.options),r.op=this.op,r._conditions=ne.clone(this._conditions),r._fields=ne.clone(this._fields),r._updateDoc=ne.clone(this._updateDoc),r._path=this._path,r._distinctDoc=this._distinctDoc,r._collection=this._collection,r._traceFunction=this._traceFunction,t};U.prototype.setOptions=function(e){if(!(e&&ne.isObject(e)))return this;let t=ne.keys(e),r;for(let n=0;n<t.length;++n){if(r=t[n],ne.specialProperties.indexOf(r)!==-1)continue;if(typeof this[r]=="function"){let s=Array.isArray(e[r])?e[r]:[e[r]];this[r].apply(this,s)}else this.options[r]=e[r]}return this};U.prototype.collection=function(t){return this._collection=new U.Collection(t),this};U.prototype.collation=function(e){return this.options.collation=e,this};U.prototype.$where=function(e){return this._conditions.$where=e,this};U.prototype.where=function(){if(!arguments.length)return this;if(!this.op)this.op="find";let e=typeof arguments[0];if(e=="string"){if(jd(arguments[0]),this._path=arguments[0],arguments.length===2)this._conditions[this._path]=arguments[1];return this}if(e=="object"&&!Array.isArray(arguments[0]))return this.merge(arguments[0]);throw TypeError("path must be a string or object")};U.prototype.equals=function(t){this._ensurePath("equals");let r=this._path;return this._conditions[r]=t,this};U.prototype.eq=function(t){this._ensurePath("eq");let r=this._path;return this._conditions[r]=t,this};U.prototype.or=function(t){let r=this._conditions.$or||(this._conditions.$or=[]);if(!Array.isArray(t))t=[t];return r.push.apply(r,t),this};U.prototype.nor=function(t){let r=this._conditions.$nor||(this._conditions.$nor=[]);if(!Array.isArray(t))t=[t];return r.push.apply(r,t),this};U.prototype.and=function(t){let r=this._conditions.$and||(this._conditions.$and=[]);if(!Array.isArray(t))t=[t];return r.push.apply(r,t),this};/*!
869
+ * gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance
870
+ *
871
+ * Thing.where('type').nin(array)
872
+ */"gt gte lt lte ne in nin all regex size maxDistance minDistance".split(" ").forEach(function(e){U.prototype[e]=function(){let t,r;if(arguments.length===1)this._ensurePath(e),r=arguments[0],t=this._path;else r=arguments[1],t=arguments[0];let n=Ku(this._conditions,t),s=n===null||typeof n==="object"?n:this._conditions[t]={};return s["$"+e]=r,this}});U.prototype.mod=function(){let e,t;if(arguments.length===1)this._ensurePath("mod"),e=arguments[0],t=this._path;else if(arguments.length===2&&!Array.isArray(arguments[1]))this._ensurePath("mod"),e=[arguments[0],arguments[1]],t=this._path;else if(arguments.length===3)e=[arguments[1],arguments[2]],t=arguments[0];else e=arguments[1],t=arguments[0];let r=Ku(this._conditions,t)||(this._conditions[t]={});return r.$mod=e,this};U.prototype.exists=function(){let e,t;if(arguments.length===0)this._ensurePath("exists"),e=this._path,t=!0;else if(arguments.length===1)if(typeof arguments[0]==="boolean")this._ensurePath("exists"),e=this._path,t=arguments[0];else e=arguments[0],t=!0;else if(arguments.length===2)e=arguments[0],t=arguments[1];let r=Ku(this._conditions,e)||(this._conditions[e]={});return r.$exists=t,this};U.prototype.elemMatch=function(){if(arguments[0]==null)throw TypeError("Invalid argument");let e,t,r;if(typeof arguments[0]==="function")this._ensurePath("elemMatch"),t=this._path,e=arguments[0];else if(ne.isObject(arguments[0]))this._ensurePath("elemMatch"),t=this._path,r=arguments[0];else if(typeof arguments[1]==="function")t=arguments[0],e=arguments[1];else if(arguments[1]&&ne.isObject(arguments[1]))t=arguments[0],r=arguments[1];else throw TypeError("Invalid argument");if(e)r=new U,e(r),r=r._conditions;let n=Ku(this._conditions,t)||(this._conditions[t]={});return n.$elemMatch=r,this};U.prototype.within=function(){if(this._ensurePath("within"),this._geoComparison="$geoWithin",arguments.length===0)return this;if(arguments.length===2)return this.box.apply(this,arguments);else if(2<arguments.length)return this.polygon.apply(this,arguments);let t=arguments[0];if(!t)throw TypeError("Invalid argument");if(t.center)return this.circle(t);if(t.box)return this.box.apply(this,t.box);if(t.polygon)return this.polygon.apply(this,t.polygon);if(t.type&&t.coordinates)return this.geometry(t);throw TypeError("Invalid argument")};U.prototype.box=function(){let e,t;if(arguments.length===3)e=arguments[0],t=[arguments[1],arguments[2]];else if(arguments.length===2)this._ensurePath("box"),e=this._path,t=[arguments[0],arguments[1]];else throw TypeError("Invalid argument");let r=Ku(this._conditions,e)||(this._conditions[e]={});return r[this._geoComparison||"$geoWithin"]={$box:t},this};U.prototype.polygon=function(){let e,t;if(typeof arguments[0]=="string")e=Array.from(arguments),t=e.shift();else this._ensurePath("polygon"),t=this._path,e=Array.from(arguments);let r=Ku(this._conditions,t)||(this._conditions[t]={});return r[this._geoComparison||"$geoWithin"]={$polygon:e},this};U.prototype.circle=function(){let e,t;if(arguments.length===1)this._ensurePath("circle"),e=this._path,t=arguments[0];else if(arguments.length===2)e=arguments[0],t=arguments[1];else throw TypeError("Invalid argument");if(!(("radius"in t)&&t.center))throw Error("center and radius are required");let r=Ku(this._conditions,e)||(this._conditions[e]={}),n=t.spherical?"$centerSphere":"$center",s=this._geoComparison||"$geoWithin";if(r[s]={},r[s][n]=[t.center,t.radius],"unique"in t)r[s].$uniqueDocs=!!t.unique;return this};U.prototype.near=function(){let t,r;if(this._geoComparison="$near",arguments.length===0)return this;else if(arguments.length===1)this._ensurePath("near"),t=this._path,r=arguments[0];else if(arguments.length===2)t=arguments[0],r=arguments[1];else throw TypeError("Invalid argument");if(!r.center)throw Error("center is required");let n=Ku(this._conditions,t)||(this._conditions[t]={}),s=r.spherical?"$nearSphere":"$near";if(Array.isArray(r.center)){n[s]=r.center;let i="maxDistance"in r?r.maxDistance:null;if(i!=null)n.$maxDistance=i;if(r.minDistance!=null)n.$minDistance=r.minDistance}else{if(r.center.type!="Point"||!Array.isArray(r.center.coordinates))throw Error(k_.format("Invalid GeoJSON specified for %s",s));if(n[s]={$geometry:r.center},"maxDistance"in r)n[s].$maxDistance=r.maxDistance;if("minDistance"in r)n[s].$minDistance=r.minDistance}return this};U.prototype.intersects=function(){if(this._ensurePath("intersects"),this._geoComparison="$geoIntersects",arguments.length===0)return this;let t=arguments[0];if(t!=null&&t.type&&t.coordinates)return this.geometry(t);throw TypeError("Invalid argument")};U.prototype.geometry=function(){if(!(this._geoComparison=="$within"||this._geoComparison=="$geoWithin"||this._geoComparison=="$near"||this._geoComparison=="$geoIntersects"))throw Error("geometry() must come after `within()`, `intersects()`, or `near()");let t,r;if(arguments.length===1)this._ensurePath("geometry"),r=this._path,t=arguments[0];else throw TypeError("Invalid argument");if(!(t.type&&Array.isArray(t.coordinates)))throw TypeError("Invalid argument");let n=Ku(this._conditions,r)||(this._conditions[r]={});return n[this._geoComparison]={$geometry:t},this};U.prototype.select=function(){let t=arguments[0];if(!t)return this;if(arguments.length!==1)throw Error("Invalid select: select only takes 1 argument");this._validate("select");let r=this._fields||(this._fields={}),n=typeof t,s,i;if((n=="string"||ne.isArgumentsObject(t))&&typeof t.length=="number"||Array.isArray(t)){if(n=="string")t=t.split(/\s+/);for(s=0,i=t.length;s<i;++s){let o=t[s];if(!o)continue;let u=o[0]=="-"?0:1;if(u===0)o=o.substring(1);jd(o),r[o]=u}return this}if(ne.isObject(t)){let o=ne.keys(t);for(s=0;s<o.length;++s){if(ne.specialProperties.indexOf(o[s])!==-1)continue;r[o[s]]=t[o[s]]}return this}throw TypeError("Invalid select() argument. Must be string or object.")};U.prototype.slice=function(){if(arguments.length===0)return this;this._validate("slice");let e,t;if(arguments.length===1){let n=arguments[0];if(typeof n==="object"&&!Array.isArray(n)){let s=Object.keys(n),i=s.length;for(let o=0;o<i;++o){if(ne.specialProperties.indexOf(s[o])!==-1)continue;this.slice(s[o],n[s[o]])}return this}this._ensurePath("slice"),e=this._path,t=arguments[0]}else if(arguments.length===2)if(typeof arguments[0]==="number")this._ensurePath("slice"),e=this._path,t=[arguments[0],arguments[1]];else e=arguments[0],t=arguments[1];else if(arguments.length===3)e=arguments[0],t=[arguments[1],arguments[2]];jd(e);let r=this._fields||(this._fields={});return r[e]={$slice:t},this};U.prototype.sort=function(e){if(!e)return this;let t,r,n;this._validate("sort");let s=typeof e;if(Array.isArray(e)){r=e.length;for(t=0;t<e.length;++t){if(!Array.isArray(e[t]))throw Error("Invalid sort() argument, must be array of arrays");ihe(this.options,e[t][0],e[t][1])}return this}if(arguments.length===1&&s=="string"){e=e.split(/\s+/),r=e.length;for(t=0;t<r;++t){if(n=e[t],!n)continue;let i=n[0]=="-"?-1:1;if(i===-1)n=n.substring(1);jd(n),$z(this.options,n,i)}return this}if(ne.isObject(e)){let i=ne.keys(e);for(t=0;t<i.length;++t){if(n=i[t],ne.specialProperties.indexOf(n)!==-1)continue;$z(this.options,n,e[n])}return this}if(typeof Map<"u"&&e instanceof Map)return ohe(this.options,e),this;throw TypeError("Invalid sort() argument. Must be a string, object, or array.")};/*!
873
+ * @ignore
874
+ */var aw={1:1,"-1":-1,asc:1,ascending:1,desc:-1,descending:-1};function $z(e,t,r){if(Array.isArray(e.sort))throw TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");let n;if(r&&r.$meta){n=e.sort||(e.sort={}),n[t]={$meta:r.$meta};return}n=e.sort||(e.sort={});let s=String(r||1).toLowerCase();if(s=aw[s],!s)throw TypeError("Invalid sort value: { "+t+": "+r+" }");n[t]=s}function ihe(e,t,r){if(e.sort=e.sort||[],!Array.isArray(e.sort))throw TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");let n=String(r||1).toLowerCase();if(n=aw[n],!n)throw TypeError("Invalid sort value: [ "+t+", "+r+" ]");e.sort.push([t,n])}function ohe(e,t){if(e.sort=e.sort||new Map,!(e.sort instanceof Map))throw TypeError("Can't mix sort syntaxes. Use either array or object or map consistently");t.forEach(function(r,n){let s=String(r||1).toLowerCase();if(s=aw[s],!s)throw TypeError("Invalid sort value: < "+n+": "+r+" >");e.sort.set(n,s)})}/*!
875
+ * limit, skip, batchSize, comment
876
+ *
877
+ * Sets these associated options.
878
+ *
879
+ * query.comment('feed query');
880
+ */["limit","skip","batchSize","comment"].forEach(function(e){U.prototype[e]=function(t){return this._validate(e),this.options[e]=t,this}});U.prototype.maxTime=U.prototype.maxTimeMS=function(e){return this._validate("maxTime"),this.options.maxTimeMS=e,this};U.prototype.hint=function(){if(arguments.length===0)return this;this._validate("hint");let e=arguments[0];if(ne.isObject(e)){let t=this.options.hint||(this.options.hint={});for(let r in e){if(ne.specialProperties.indexOf(r)!==-1)continue;t[r]=e[r]}return this}if(typeof e==="string")return this.options.hint=e,this;throw TypeError("Invalid hint. "+e)};U.prototype.j=function(t){return this.options.j=t,this};U.prototype.slaveOk=function(e){return this.options.slaveOk=arguments.length?!!e:!0,this};U.prototype.read=U.prototype.setReadPreference=function(e){if(arguments.length>1&&!U.prototype.read.deprecationWarningIssued)console.error("Deprecation warning: 'tags' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead."),U.prototype.read.deprecationWarningIssued=!0;return this.options.readPreference=ne.readPref(e),this};U.prototype.readConcern=U.prototype.r=function(e){return this.options.readConcern=ne.readConcern(e),this};U.prototype.tailable=function(){return this._validate("tailable"),this.options.tailable=arguments.length?!!arguments[0]:!0,this};U.prototype.writeConcern=U.prototype.w=function(t){if(typeof t==="object"){if(typeof t.j<"u")this.options.j=t.j;if(typeof t.w<"u")this.options.w=t.w;if(typeof t.wtimeout<"u")this.options.wtimeout=t.wtimeout}else this.options.w=t==="m"?"majority":t;return this};U.prototype.wtimeout=U.prototype.wTimeout=function(t){return this.options.wtimeout=t,this};U.prototype.merge=function(e){if(!e)return this;if(!U.canMerge(e))throw TypeError("Invalid argument. Expected instanceof mquery or plain object");if(e instanceof U){if(e._conditions)ne.merge(this._conditions,e._conditions);if(e._fields)this._fields||(this._fields={}),ne.merge(this._fields,e._fields);if(e.options)this.options||(this.options={}),ne.merge(this.options,e.options);if(e._updateDoc)this._updateDoc||(this._updateDoc={}),ne.mergeClone(this._updateDoc,e._updateDoc);if(e._distinctDoc)this._distinctDoc=e._distinctDoc;return this}return ne.merge(this._conditions,e),this};U.prototype.find=function(e){if(this.op="find",U.canMerge(e))this.merge(e);return this};U.prototype._find=async function(){let t=this._conditions,r=this._optionsForExec();if(this.$useProjection)r.projection=this._fieldsForExec();else r.fields=this._fieldsForExec();return Hu("find",this._collection.collectionName,t,r),this._collection.find(t,r)};U.prototype.cursor=function(t){if(this.op){if(this.op!=="find")throw TypeError(".cursor only support .find method")}else this.find(t);let r=this._conditions,n=this._optionsForExec();if(this.$useProjection)n.projection=this._fieldsForExec();else n.fields=this._fieldsForExec();return Hu("findCursor",this._collection.collectionName,r,n),this._collection.findCursor(r,n)};U.prototype.findOne=function(e){if(this.op="findOne",U.canMerge(e))this.merge(e);return this};U.prototype._findOne=async function(){let t=this._conditions,r=this._optionsForExec();if(this.$useProjection)r.projection=this._fieldsForExec();else r.fields=this._fieldsForExec();return Hu("findOne",this._collection.collectionName,t,r),this._collection.findOne(t,r)};U.prototype.countDocuments=function(e){if(this.op="countDocuments",this._validate(),U.canMerge(e))this.merge(e);return this};U.prototype._countDocuments=async function(){let t=this._conditions,r=this._optionsForExec();return Hu("countDocuments",this._collection.collectionName,t,r),this._collection.countDocuments(t,r)};U.prototype.estimatedDocumentCount=function(){return this.op="estimatedDocumentCount",this._validate(),this};U.prototype._estimatedDocumentCount=async function(){let t=this._conditions,r=this._optionsForExec();return Hu("estimatedDocumentCount",this._collection.collectionName,t,r),this._collection.estimatedDocumentCount(t,r)};U.prototype.distinct=function(e,t){if(this.op="distinct",this._validate(),!t&&typeof e==="string")t=e,e=void 0;if(typeof t=="string")this._distinctDoc=t;if(U.canMerge(e))this.merge(e);return this};U.prototype._distinct=async function(){if(!this._distinctDoc)throw Error("No value for `distinct` has been declared");let t=this._conditions,r=this._optionsForExec();return this._collection.distinct(this._distinctDoc,t,r)};U.prototype.updateMany=function(t,r,n){return cw(this,"updateMany",t,r,n)};U.prototype._updateMany=async function(){return lw(this,"updateMany")};U.prototype.updateOne=function(t,r,n){return cw(this,"updateOne",t,r,n)};U.prototype._updateOne=async function(){return lw(this,"updateOne")};U.prototype.replaceOne=function(t,r,n){return this.setOptions({overwrite:!0}),cw(this,"replaceOne",t,r,n)};U.prototype._replaceOne=async function(){return lw(this,"replaceOne")};/*!
881
+ * Internal helper for updateMany, updateOne
882
+ */function cw(e,t,r,n,s){if(e.op=t,U.canMerge(r))e.merge(r);if(n)e._mergeUpdate(n);if(ne.isObject(s))e.setOptions(s);return e}async function lw(e,t){let r=e._optionsForExec(),n=e._conditions,s=e._updateForExec();return Hu(t,e._collection.collectionName,n,s,r),e._collection[t](n,s,r)}U.prototype.deleteOne=function(e){if(this.op="deleteOne",U.canMerge(e))this.merge(e);return this};U.prototype._deleteOne=async function(){let e=this._optionsForExec();delete e.justOne;let t=this._conditions;return Hu("deleteOne",this._collection.collectionName,t,e),this._collection.deleteOne(t,e)};U.prototype.deleteMany=function(e){if(this.op="deleteMany",U.canMerge(e))this.merge(e);return this};U.prototype._deleteMany=async function(){let e=this._optionsForExec();delete e.justOne;let t=this._conditions;return this._collection.deleteMany(t,e)};U.prototype.findOneAndUpdate=function(e,t,r){if(this.op="findOneAndUpdate",this._validate(),U.canMerge(e))this.merge(e);if(t)this._mergeUpdate(t);return r&&this.setOptions(r),this};U.prototype._findOneAndUpdate=async function(){let e=this._conditions,t=this._updateForExec(),r=this._optionsForExec();return this._collection.findOneAndUpdate(e,t,r)};U.prototype.findOneAndReplace=function(e,t,r){if(this.op="findOneAndReplace",this._validate(),U.canMerge(e))this.merge(e);if(t)this._updateDoc=t,this.options=this.options||{},this.options.overwrite=!0;return r&&this.setOptions(r),this};U.prototype._findOneAndReplace=async function(){let e=this._conditions,t=this._updateForExec(),r=this._optionsForExec();return Hu("findOneAndReplace",this._collection.collectionName,e,t,r),this._collection.findOneAndReplace(e,t,r)};U.prototype.findOneAndDelete=function(e,t){if(this.op="findOneAndDelete",this._validate(),U.canMerge(e))this.merge(e);return t&&this.setOptions(t),this};U.prototype._findOneAndDelete=async function(){let e=this._optionsForExec(),t=this._conditions;return Hu("findOneAndDelete",this._collection.collectionName,t,e),this._collection.findOneAndDelete(t,e)};U.prototype.setTraceFunction=function(e){return this._traceFunction=e,this};U.prototype.exec=async function(t){if(typeof t==="string")this.op=t;vz.ok(this.op,"Missing query type: (find, etc)");let r="_"+this.op;if(typeof this[r]!=="function")throw TypeError(`this[${r}] is not a function`);return this[r]()};U.prototype.then=async function(e,t){return this.exec().then(e,t)};U.prototype.cursor=function(){if(this.op!="find")throw Error("cursor() is only available for find");let e=this._conditions,t=this._optionsForExec();if(this.$useProjection)t.projection=this._fieldsForExec();else t.fields=this._fieldsForExec();return this._collection.findCursor(e,t)};U.prototype.selected=function(){return!!(this._fields&&Object.keys(this._fields).length>0)};U.prototype.selectedInclusively=function(){if(!this._fields)return!1;let t=Object.keys(this._fields);if(t.length===0)return!1;for(let r=0;r<t.length;++r){let n=t[r];if(this._fields[n]===0)return!1;if(this._fields[n]&&typeof this._fields[n]==="object"&&this._fields[n].$meta)return!1}return!0};U.prototype.selectedExclusively=function(){if(!this._fields)return!1;let t=Object.keys(this._fields);if(t.length===0)return!1;for(let r=0;r<t.length;++r){let n=t[r];if(this._fields[n]===0)return!0}return!1};U.prototype._mergeUpdate=function(e){if(!this._updateDoc)this._updateDoc={};if(e instanceof U){if(e._updateDoc)ne.mergeClone(this._updateDoc,e._updateDoc)}else ne.mergeClone(this._updateDoc,e)};U.prototype._optionsForExec=function(){return ne.clone(this.options)};U.prototype._fieldsForExec=function(){return ne.clone(this._fields)};U.prototype._updateForExec=function(){let e=this._updateDoc==null?{}:ne.clone(this._updateDoc),t=ne.keys(e),r={};for(let n of t){if(this.options.overwrite){r[n]=e[n];continue}if(n[0]!=="$"){if(!r.$set)if(e.$set)r.$set=e.$set;else r.$set={};if(r.$set[n]=e[n],!~t.indexOf("$set"))t.push("$set")}else if(n==="$set"){if(!r.$set)r[n]=e[n]}else r[n]=e[n]}return this._compiledUpdate=r,r};U.prototype._ensurePath=function(e){if(!this._path){let t=e+"() must be used after where() when called with these arguments";throw Error(t)}};function Ku(e,t){return jd(t),Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function jd(e){if(e!=null&&ne.specialProperties.indexOf(String(e))!==-1)throw Error("Cannot use `"+e+"` as a query path")}/*!
883
+ * Permissions
884
+ */U.permissions=bz();U._isPermitted=function(e,t){let r=U.permissions[t];if(!r)return!0;return r[e]!==!0};U.prototype._validate=function(e){let t,r;if(e===void 0){if(r=U.permissions[this.op],typeof r!="function")return!0;t=r(this)}else if(!U._isPermitted(e,this.op))t=e;if(t)throw Error(t+" cannot be used with "+this.op)};U.canMerge=function(e){return e instanceof U||ne.isObject(e)};U.setGlobalTraceFunction=function(e){U.traceFunction=e};/*!
885
+ * Exports.
886
+ */U.utils=ne;U.env=iw();U.Collection=Rz();U.BaseCollection=qd();kz.exports=xz=U});var q_=g(function(UEe,qz){qz.exports=function(t,r){if(typeof t==="string")t=t.split(/\s+/);if(!Array.isArray(t)&&Object.prototype.toString.call(t)!=="[object Arguments]")return t;let s=t.length,i={};for(let o=0;o<s;++o){let u=t[o];if(!u)continue;let a=u.charAt(0)==="-"?0:1;if(!r&&a===0)u=u.slice(1);i[u]=a}return i}});var Uz=g(function(VEe,Lz){Lz.exports=function(t,r){let n=r?.arrayFilters;if(!Array.isArray(n))return;let s=Object.keys(t).map((i)=>Object.keys(t[i])).reduce((i,o)=>i.concat(o),[]);r.arrayFilters=r.arrayFilters.filter((i)=>jz(i,s))};function jz(e,t){let r=Object.keys(e)[0];if(r==null)return!0;if(r==="$and"||r==="$or"){if(!Array.isArray(e[r]))return!1;return e[r].find((i)=>jz(i,t))!=null}let n=r.indexOf("."),s=n===-1?r:r.slice(0,n);return t.find((i)=>i.includes("$["+s+"]"))!=null}});var j_=g(function(zEe,Vz){/*!
887
+ * ignore
888
+ */Vz.exports=function(t){if(typeof t!=="object"||t===null)return!1;let r=Object.keys(t),n=r.length;for(let s=0;s<n;++s)if(r[s][0]==="$")return!0;return!1}});var fw=g(function(WEe,zz){var uhe=ze(),ahe=j_(),{logicalOperators:che}=Ad(),{trustedSymbol:lhe}=nh();zz.exports=function e(t){if(t==null||typeof t!=="object")return t;if(Array.isArray(t)){for(let n of t)e(n);return t}let r=Object.keys(t);for(let n of r){let s=t[n];if(s?.[lhe])continue;if(che.has(n)){e(s);continue}else if(n[0]==="$")throw new uhe(n+" is not allowed with sanitizeFilter");if(ahe(s)){let i=Object.keys(s);if(i.length===1&&i[0]==="$eq")continue;t[n]={$eq:t[n]}}}return t}});var Hz=g(function(HEe,Wz){Wz.exports=function(t){if(t==null)return;let r=Object.keys(t);for(let n=0;n<r.length;++n){let s=t[r[n]];if(typeof s==="string"){t[r[n]]=1;continue}if(s==null||typeof s!=="object")continue;let i=s.$slice;if(!(s.$meta==="textScore"||s.$elemMatch!=null||typeof i==="number"||Array.isArray(i)&&i.every((u)=>typeof u==="number")))t[r[n]]=1}}});var Yz=g(function(KEe,Gz){var hhe=Uc(),fhe=v_();/*!
889
+ * ignore
890
+ */Gz.exports=function(t,r,n){if(n==null)return;let s=Object.keys(n);if(r=r||{},fhe(t))for(let i of s){if(!Kz(r,i))t[i]=1;else if(r[i]===0)delete t[i];let o=n[i]?.refPath;if(typeof o==="string"){if(!Kz(r,o))t[o]=1;else if(r[o]===0)delete t[o]}}else if(hhe(t))for(let i of s){if(r[i]==null)delete t[i];let o=n[i]?.refPath;if(typeof o==="string"&&r[o]==null)delete t[o]}};/*!
891
+ * ignore
892
+ */function Kz(e,t){let r=t.split("."),n=r.length,s=r[0];for(let i=1;i<n;++i){if(e[s]!=null||e[s+".$"]!=null)return!0;s+="."+r[i]}return e[s]!=null||e[s+".$"]!=null}});var Xz=g(function(GEe,Qz){/*!
893
+ * Module dependencies.
894
+ */var dhe=pd(),Jz=MS().flatten,phe=Fn();Qz.exports=async function(t,r,n,s){let i=Object.keys(n||{}),o={},u={},a={},c={},l=i.length,f=!1,h,d;for(let A=0;A<l;++A)if(i[A].startsWith("$")){if(f=!0,i[A]==="$push"||i[A]==="$addToSet"){let q=Object.keys(n[i[A]]);for(let I=0;I<q.length;++I)if(h=n[i[A]][q[I]],h?.$each)c[q[I]]=(c[q[I]]||[]).concat(h.$each);else c[q[I]]=(c[q[I]]||[]).concat([h]);continue}let P=Jz(n[i[A]],null,null,r),S=Object.keys(P),B=S.length;for(let q=0;q<B;++q){let I=dhe(S[q]);if(d=i[A],I.includes("$"))continue;if(d==="$set"||d==="$setOnInsert"||d==="$pull"||d==="$pullAll")u[I]=P[S[q]],a[I]=d==="$pull"||d==="$pullAll";else if(d==="$unset")u[I]=void 0;o[I]=!0}}if(!f)u=Jz(n,null,null,r),o=Object.keys(u);let p=Object.keys(u),m=p.length,_=[],y=[],E=null,C=t;for(let A=0;A<m;++A){let P=u[p[A]],S=r._getSchema(p[A]);if(S==null)continue;if(S.instance==="Mixed"&&S.path!==p[A]&&yhe(r,p[A]))continue;if(a[p[A]]&&S.$isMongooseArray)continue;if(P&&Array.isArray(P.$in))P.$in.forEach((B,q)=>{_.push(S.doValidate(B,C,{updateValidator:!0}).catch((I)=>{I.path=p[A]+".$in."+q,y.push(I)}))});else{if(E!=null&&mhe(E,p[A]))continue;if(S.$isMongooseDocumentArrayElement&&phe(P))E??=new Set,E.add(p[A]),_.push(S.doValidate(P,C,{updateValidator:!0}).catch((B)=>{if(B.errors)for(let q of Object.keys(B.errors)){let I=B.errors[q];I.path=p[A]+"."+q,y.push(I)}else B.path=p[A],y.push(B)}));else{if(S.$isSingleNested)E??=new Set,E.add(p[A]);_.push(S.doValidate(P,C,{updateValidator:!0}).catch((B)=>{if(B)B.path=p[A],y.push(B)}))}}}let D=Object.keys(c);for(let A of D){let P=r._getSchema(A);if(P&&P.$isMongooseDocumentArray)_.push(P.doValidate(c[A],s?.context==="query"?t:null).catch((S)=>{S.path=A,y.push(S)}));else{P=r._getSchema(A+".0");for(let S of c[A])_.push(P.doValidate(S,s?.context==="query"?t:null,{updateValidator:!0}).catch((B)=>{B.path=A,y.push(B)}))}}return await Promise.all(_),y};/*!
895
+ * Returns true if `path` is underneath a path in `alreadyValidated`. Checks each
896
+ * ancestor of `path` with a Set lookup, so the cost depends on the depth of `path`
897
+ * rather than on the number of subdocuments validated so far.
898
+ */function mhe(e,t){for(let r=t.indexOf(".");r!==-1;r=t.indexOf(".",r+1))if(e.has(t.slice(0,r)))return!0;return!1}/*!
899
+ * Returns true if the parent of `path` is a Mixed path, so `path` is a key
900
+ * inside a Mixed value rather than a path in the schema.
901
+ */function yhe(e,t){let r=t.lastIndexOf(".");if(r===-1)return!1;return e._getSchema(t.slice(0,r))?.instance==="Mixed"}});var z_=g(function(YEe,hW){/*!
902
+ * Module dependencies.
903
+ */var Ld=es(),ghe=B2(),Ud=kc(),St=ze(),Gu=j2(),dw=cz(),Vd=jc(),{applyGlobalMaxTimeMS:zd,applyGlobalDiskUse:Wd}=ew(),_he=uO(),Ehe=tw(),Ahe=rw(),Ohe=Jc(),She=jS(),L_=gd(),whe=kS(),Ws=ar(),mw=Ez(),Che=C_(),tW=Vi(),du=od(),bhe=_o().internalToObjectOptions,Dhe=Uc(),The=v_(),Mhe=Fn(),Phe=Y2(),Zz=Sz(),{logicalOperators:Bhe}=Ad(),U_=ii(),Hd=hw(),Fhe=q_(),_w=Uz(),Nhe=fw(),rW=Hz(),{buildMiddlewareFilter:nW}=vu(),Ihe=Yz(),Ew=LS(),eo=Xa(),Rhe=Xz(),to=require("util"),ee=be(),$he=md().queryMiddlewareFunctions,{createTracedChannel:vhe}=Lh(),{trace:xhe}=vhe("mongoose:query"),khe=new Set(["allowDiskUse","batchSize","collation","comment","explain","hint","j","lean","limit","maxTimeMS","populate","projection","read","select","skip","slice","sort","tailable","w","writeConcern","wtimeout"]),qhe=new Set(["find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate"]),jhe=new Map([["countDocuments","_countDocuments"],["distinct","__distinct"],["estimatedDocumentCount","_estimatedDocumentCount"],["find","_find"],["findOne","_findOne"],["findOneAndReplace","_findOneAndReplace"],["findOneAndUpdate","_findOneAndUpdate"],["replaceOne","_replaceOne"],["updateMany","_updateMany"],["updateOne","_updateOne"],["deleteMany","_deleteMany"],["deleteOne","_deleteOne"],["findOneAndDelete","_findOneAndDelete"]]),H=Symbol("mongoose#Query#update");function L(e,t,r,n){if(!this._mongooseOptions)this._mongooseOptions={};t=t||{},this._transforms=[],this._hooks=new Ud,this._execCount=0;let s=Object.keys(t);for(let o of s)this._mongooseOptions[o]=t[o];if(n)this.mongooseCollection=n;if(r)this.model=r,this.schema=r.schema;if(this.model?._mapreduce)this.lean();if(Hd.call(this,null,t),n)this.collection(n);if(e)this.find(e);this.options=this.options||{},this.$useProjection=!0;let i=this?.schema?.options?.collation||null;if(i!=null)this.options.collation=i}function yw(e){if(e==null)return!0;if(typeof e!=="object")return!0;for(let t of Object.keys(e)){let r=e[t];if(t==="$comment"||t==="$alwaysTrue")continue;if(!Array.isArray(r))return!1;if((t==="$and"||t==="$nor")&&r.every(yw))continue;if(t==="$or"&&(r.length===0||r.some(yw)))continue;return!1}return!0}function cc(e,t){if(t?.requireFilter&&yw(e))throw new St("Empty or invalid filter not allowed with requireFilter enabled")}/*!
904
+ * inherit mquery
905
+ */L.prototype=new Hd;L.prototype.constructor=L;Object.defineProperty(L.prototype,"_update",{configurable:!0,enumerable:!0,get:function(){return rl(this),this[H]},set:function(e){this[H]=e}});L.prototype.count=void 0;L.prototype.findOneAndRemove=void 0;L.base=Hd.prototype;/*!
906
+ * Overwrite mquery's `_distinct`, because Mongoose uses that name
907
+ * to store the field to apply distinct on.
908
+ */Object.defineProperty(L.prototype,"_distinct",{configurable:!0,writable:!0,enumerable:!0,value:void 0});L.prototype.toConstructor=function(){let t=this.model,r=this.mongooseCollection,n=function(o,u){if(!(this instanceof n))return new n(o,u);this._mongooseOptions=mw(s._mongooseOptions),L.call(this,o,u||null,t,r)};to.inherits(n,t.Query);let s=n.prototype;s.options={};let i=Object.assign({},this.options);if(i.sort!=null)s.sort(i.sort),delete i.sort;return s.setOptions(i),s.op=this.op,s._conditions=Ws(this._conditions),s._fields=Ws(this._fields),s[H]=Ws(this[H],{flattenDecimals:!1}),s._path=this._path,s._distinct=this._distinct,s._collection=this._collection,s._mongooseOptions=mw(this._mongooseOptions),n};L.prototype.clone=function(){let e=this.model,t=this.mongooseCollection,r=new this.model.Query({},{},e,t),n=Object.assign({},this.options);if(n.sort!=null)r.sort(n.sort),delete n.sort;return r.setOptions(n),r.op=this.op,r._conditions=Ws(this._conditions),r._fields=Ws(this._fields),r[H]=Ws(this[H],{flattenDecimals:!1}),r._path=this._path,r._distinct=this._distinct,r._collection=this._collection,r._mongooseOptions=mw(this._mongooseOptions),r};L.prototype.where=function(t){if(typeof t==="string"&&eo.has(t))throw new St(`Cannot use \`${t}\` as a query path`);return L.base.where.apply(this,arguments)};L.prototype.slice=function(...e){if(e.length===0)return this;this._validate("slice");let t,r;if(e.length===1){let s=e[0];if(typeof s==="object"&&!Array.isArray(s)){let i=Object.keys(s),o=i.length;for(let u=0;u<o;++u)this.slice(i[u],s[i[u]]);return this}this._ensurePath("slice"),t=this._path,r=e[0]}else if(e.length===2)if(typeof e[0]==="number")this._ensurePath("slice"),t=this._path,r=[e[0],e[1]];else t=e[0],r=e[1];else if(e.length===3)t=e[0],r=[e[1],e[2]];let n={};return n[t]={$slice:r},this.select(n),this};/*!
909
+ * ignore
910
+ */var Lhe=new Set($he);L.prototype._validateOp=function(){if(this.op!=null&&!Lhe.has(this.op))this.error(Error('Query has invalid `op`: "'+this.op+'"'));if(this.op!=="estimatedDocumentCount"&&this._conditions==null)throw new Gu(this._conditions,"filter",this.op)};L.prototype.mod=function(){let e,t;if(arguments.length===1)this._ensurePath("mod"),e=arguments[0],t=this._path;else if(arguments.length===2&&!Array.isArray(arguments[1]))this._ensurePath("mod"),e=[arguments[0],arguments[1]],t=this._path;else if(arguments.length===3)e=[arguments[1],arguments[2]],t=arguments[0];else e=arguments[1],t=arguments[0];if(t!=null&&eo.has(String(t)))throw new St(`Cannot use \`${t}\` as a query path`);let r=Object.hasOwn(this._conditions,t)&&this._conditions[t]||(this._conditions[t]={});return r.$mod=e,this};L.prototype.limit=function(t){if(this._validate("limit"),typeof t==="string")try{t=L_(t)}catch{throw new Ld("Number",t,"limit")}return this.options.limit=t,this};L.prototype.skip=function(t){if(this._validate("skip"),typeof t==="string")try{t=L_(t)}catch{throw new Ld("Number",t,"skip")}return this.options.skip=t,this};L.prototype.projection=function(e){if(arguments.length===0)return this._fields;return this._fields={},this._userProvidedFields={},this.select(e),this._fields};L.prototype.select=function(){let t=arguments[0];if(!t)return this;if(arguments.length!==1)throw new St("Invalid select: select only takes 1 argument");this._validate("select");let r=this._fields||(this._fields={}),n=this._userProvidedFields||(this._userProvidedFields={}),s=void 0;if(this.model!=null&&ee.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))s=this.model.db.options.sanitizeProjection;else if(this.model!=null&&ee.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))s=this.model.base.options.sanitizeProjection;else s=this._mongooseOptions.sanitizeProjection;function i(o){return typeof o==="string"&&s?o=1:o}if(t=Fhe(t,!0),ee.isObject(t)){if(Object.hasOwn(t,"__proto__"))t={...t},delete t.__proto__;if(this.selectedInclusively())Object.entries(t).forEach(([o,u])=>{if(u){if(r["-"+o]!=null)delete r["-"+o];r[o]=n[o]=i(u)}else Object.keys(n).forEach((a)=>{if(Zz(o,a))delete r[a],delete n[a]})});else if(this.selectedExclusively())Object.entries(t).forEach(([o,u])=>{if(!u){if(r["+"+o]!=null)delete r["+"+o];r[o]=n[o]=i(u)}else Object.keys(n).forEach((a)=>{if(Zz(o,a))delete r[a],delete n[a]})});else{let o=Object.keys(t);for(let u=0;u<o.length;++u){let a=t[o[u]],c=o[u];r[c]=i(a),n[c]=i(a)}}return this}throw TypeError("Invalid select() argument. Must be string or object.")};L.prototype.schemaLevelProjections=function(t){return this._mongooseOptions.schemaLevelProjections=t,this};L.prototype.sanitizeProjection=function(t){return this._mongooseOptions.sanitizeProjection=t,this};L.prototype.read=function(t,r){if(typeof t==="string")t=_he(t),this.options.readPreference={mode:t,tags:r};else this.options.readPreference=t;return this};L.prototype.toString=function(){if(this.op==="count"||this.op==="countDocuments"||this.op==="find"||this.op==="findOne"||this.op==="deleteMany"||this.op==="deleteOne"||this.op==="findOneAndDelete"||this.op==="remove")return`${this.model.modelName}.${this.op}(${to.inspect(this._conditions)})`;if(this.op==="distinct")return`${this.model.modelName}.distinct('${this._distinct}', ${to.inspect(this._conditions)})`;if(this.op==="findOneAndReplace"||this.op==="findOneAndUpdate"||this.op==="replaceOne"||this.op==="update"||this.op==="updateMany"||this.op==="updateOne")return`${this.model.modelName}.${this.op}(${to.inspect(this._conditions)}, ${to.inspect(this[H])})`;return`${this.model.modelName}.${this.op}()`};L.prototype.session=function(t){if(t==null)delete this.options.session;return this.options.session=t,this};L.prototype.writeConcern=function(t){if(t==null)return delete this.options.writeConcern,this;return this.options.writeConcern=t,this};L.prototype.w=function(t){if(t==null)delete this.options.w;if(this.options.writeConcern!=null)this.options.writeConcern.w=t;else this.options.w=t;return this};L.prototype.j=function(t){if(t==null)delete this.options.j;if(this.options.writeConcern!=null)this.options.writeConcern.j=t;else this.options.j=t;return this};L.prototype.wtimeout=function(t){if(t==null)delete this.options.wtimeout;if(this.options.writeConcern!=null)this.options.writeConcern.wtimeout=t;else this.options.wtimeout=t;return this};L.prototype.getOptions=function(){return this.options};L.prototype.setOptions=function(e,t){if(t){if(this._mongooseOptions=e&&Ws(e)||{},this.options=e||{},"populate"in e)this.populate(this._mongooseOptions);return this}if(e==null)return this;if(typeof e!=="object")throw new St('Options must be an object, got "'+e+'"');if(e=Object.assign({},e),Array.isArray(e.populate)){let r=e.populate;delete e.populate;let n=r.length;for(let s=0;s<n;++s)this.populate(r[s])}if("cloneUpdate"in e)this._mongooseOptions.cloneUpdate=e.cloneUpdate,delete e.cloneUpdate;if("defaults"in e)this._mongooseOptions.defaults=e.defaults;if(e.lean==null&&this.schema&&"lean"in this.schema.options)this._mongooseOptions.lean=this.schema.options.lean;if("overwriteDiscriminatorKey"in e)this._mongooseOptions.overwriteDiscriminatorKey=e.overwriteDiscriminatorKey,delete e.overwriteDiscriminatorKey;if("overwriteImmutable"in e)this._mongooseOptions.overwriteImmutable=e.overwriteImmutable,delete e.overwriteImmutable;if("sanitizeFilter"in e)this._mongooseOptions.sanitizeFilter=e.sanitizeFilter,delete e.sanitizeFilter;if("sanitizeProjection"in e){if(e.sanitizeProjection&&!this._mongooseOptions.sanitizeProjection)rW(this._fields);this._mongooseOptions.sanitizeProjection=e.sanitizeProjection,delete e.sanitizeProjection}if("schemaLevelProjections"in e)this._mongooseOptions.schemaLevelProjections=e.schemaLevelProjections,delete e.schemaLevelProjections;if("setDefaultsOnInsert"in e)this._mongooseOptions.setDefaultsOnInsert=e.setDefaultsOnInsert,delete e.setDefaultsOnInsert;if("strict"in e)this._mongooseOptions.strict=e.strict,delete e.strict;if("strictQuery"in e)this._mongooseOptions.strictQuery=e.strictQuery,delete e.strictQuery;if("timestamps"in e)this._mongooseOptions.timestamps=e.timestamps,delete e.timestamps;if("translateAliases"in e)this._mongooseOptions.translateAliases=e.translateAliases,delete e.translateAliases;if("updatePipeline"in e)this._mongooseOptions.updatePipeline=e.updatePipeline,delete e.updatePipeline;if(typeof e.limit==="string")try{e.limit=L_(e.limit)}catch{throw new Ld("Number",e.limit,"limit")}if(typeof e.skip==="string")try{e.skip=L_(e.skip)}catch{throw new Ld("Number",e.skip,"skip")}for(let r of Object.keys(e))if(khe.has(r)){let n=Array.isArray(e[r])?e[r]:[e[r]];this[r].apply(this,n)}else this.options[r]=e[r];return this};L.prototype.explain=function(t){if(arguments.length===0)this.options.explain=!0;else if(t===!1)delete this.options.explain;else this.options.explain=t;return this};L.prototype.allowDiskUse=function(e){if(arguments.length===0)this.options.allowDiskUse=!0;else if(e===!1)delete this.options.allowDiskUse;else this.options.allowDiskUse=e;return this};L.prototype.maxTimeMS=function(e){return this.options.maxTimeMS=e,this};L.prototype.getFilter=function(){return this._conditions};L.prototype.getQuery=function(){return this._conditions};L.prototype.setQuery=function(e){this._conditions=e};L.prototype.getUpdate=function(){return this._update};L.prototype.setUpdate=function(e,t){if(this[H]=t===!1?e:Ws(e),t!=null)this._mongooseOptions.cloneUpdate=t;this._updateIsShared=!1};L.prototype._fieldsForExec=function(){if(this._fields==null)return null;if(ee.hasOwnKeys(this._fields)===!1)return null;return Ws(this._fields)};L.prototype._updateForExec=function(){let e=Ws(this[H],{transform:!1,depopulate:!0}),t=Object.keys(e),r=t.length,n={};while(r--){let s=t[r];if(s[0]!=="$"){if(!n.$set)if(e.$set)n.$set=e.$set;else n.$set={};if(n.$set[s]=e[s],t.splice(r,1),!~t.indexOf("$set"))t.push("$set")}else if(s==="$set"){if(!n.$set)n[s]=e[s]}else n[s]=e[s]}return n};L.prototype._optionsForExec=function(e){let t=Ws(this.options);if(delete t.populate,e=e||this.model,!e)return t;if(ee.isEmptyObject(t.sort))delete t.sort;else if(t.sort==null&&!t.tailable&&qhe.has(this.op)){let s=this.schema?.options.defaultSort;if(s&&!sW(this._conditions))t.sort=iW({},s)}Ehe(e.schema,t),Ahe(e.schema,t);let r=this.model?.db?.base.transactionAsyncLocalStorage?.getStore();if(!Object.hasOwn(this.options,"session")&&r?.session!=null)t.session=r.session;let n=e?.schema?.options?.read;if(!("readPreference"in t)&&n)t.readPreference=n;if(t.upsert!==void 0)t.upsert=!!t.upsert;if(t.writeConcern){if(t.j)t.writeConcern.j=t.j,delete t.j;if(t.w)t.writeConcern.w=t.w,delete t.w;if(t.wtimeout)t.writeConcern.wtimeout=t.wtimeout,delete t.wtimeout}if(this._applyPaths(),this._fields!=null){this._fields=this._castFields(this._fields);let s=this._fieldsForExec();if(s!=null)t.projection=s}return t};L.prototype.lean=function(e){return this._mongooseOptions.lean=arguments.length?e:!0,this};L.prototype.set=function(e,t){if(rl(this),typeof e==="object"){let n=Object.keys(e);for(let s of n)this.set(s,e[s]);return this}let r=this[H];if(r==null)r={},this[H]=r;if(e in r)delete r[e];return r.$set=r.$set||{},r.$set[e]=t,this};L.prototype.get=function(t){let r=this[H];if(r==null)return;let n=r.$set;if(n==null)return r[t];if(ee.hasUserDefinedProperty(r,t))return r[t];if(ee.hasUserDefinedProperty(n,t))return n[t];return};L.prototype.error=function(t){if(arguments.length===0)return this._error;return this._error=t,this};L.prototype._unsetCastError=function(){if(this._error==null||!(this._error instanceof Ld))return;return this.error(null)};L.prototype.mongooseOptions=function(e){if(arguments.length>0)this._mongooseOptions=e;return this._mongooseOptions};L.prototype._castConditions=function(){if(this.model?.db.config?.sanitizeFilter??this.model?.db.options?.sanitizeFilter??this.model?.base.options.sanitizeFilter??this._mongooseOptions.sanitizeFilter)Nhe(this._conditions);try{this.cast(this.model),this._unsetCastError()}catch(t){this.error(t)}};/*!
911
+ * ignore
912
+ */function V_(e){try{She(e)}catch(t){e.error(t)}}L.prototype._find=async function(){if(this._applyTranslateAliases(),this._castConditions(),this.error()!=null)throw this.error();let t=this._mongooseOptions,r=this._userProvidedFields||{},n=this.model.db.options,s=this.model.base.options;zd(this.options,n,s),Wd(this.options,n,s);let i={session:this?.options?.session||null,lean:t.lean||null};if(t.defaults!=null)i.defaults=t.defaults;let o=this._optionsForExec(),u=this._conditions,a=o.projection,c=await this.mongooseCollection.find(u,o);if(o.explain)return c.explain(o.explain);let l=await c.toArray();if(l.length===0)return l;if(!t.populate){let h=this.schema.options.versionKey;if(t.lean?.versionKey===!1&&h)l.forEach((d)=>{if(h in d)delete d[h]});return t.lean?uW(this.model.schema,l,null,i):this._completeMany(l,a,r,i)}let f=du.preparePopulationOptionsMQ(this,t);if(this.options?._deferPopulate)return l=t.lean?l:await this._completeMany(l,a,r,i),this._deferredPopulate=f,l;if(t.lean)return this.model.populate(l,f);return l=await this._completeMany(l,a,r,i),await this.model.populate(l,f),l};L.prototype.find=function(e){if(typeof e==="function"||typeof arguments[1]==="function")throw new St("Query.prototype.find() no longer accepts a callback");if(this.op="find",Yu(e))this.merge(e),Kd(this);else if(e!=null)this.error(new Gu(e,"filter","find"));return this};L.prototype.findAndCount=async function(){if(this.options.sort==null&&!this.schema?.options.defaultSort)throw new St("Query.prototype.findAndCount() requires sort. Use `sort()` to set a sort order before calling `findAndCount()`.");if(ee.isEmptyObject(this.options.sort))throw new St("Query.prototype.findAndCount() does not allow an empty sort, like `sort(null)`. Remove the `sort()` call to use the schema's `defaultSort`.");if(this.options.limit==null)throw new St("Query.prototype.findAndCount() requires limit. Use `limit()` to set a limit before calling `findAndCount()`.");this.op="find";let t=this.clone().countDocuments().skip(0).limit(null);return Promise.all([this.exec(),t.exec()])};L.prototype.merge=function(e){if(!e){if(e===null)this._conditions=null;return this}this._conditions=this._conditions??{};let t={overwrite:!0};if(e instanceof L){if(e._conditions){if(t.omit={},this._conditions&&this._conditions.$and&&e._conditions.$and)t.omit.$and=!0,this._conditions.$and=this._conditions.$and.concat(e._conditions.$and);if(this._conditions&&this._conditions.$or&&e._conditions.$or)t.omit.$or=!0,this._conditions.$or=this._conditions.$or.concat(e._conditions.$or);ee.merge(this._conditions,e._conditions,t)}if(e._fields)this._fields||(this._fields={}),ee.merge(this._fields,e._fields,t);if(e.options)this.options||(this.options={}),ee.merge(this.options,e.options,t);if(e[H]!=null)rl(this),this[H]||(this[H]={}),ee.mergeClone(this[H],e[H]);if(e._distinct)this._distinct=e._distinct;return ee.merge(this._mongooseOptions,e._mongooseOptions),this}else if(this.model!=null&&e instanceof this.model.base.Types.ObjectId)return ee.merge(this._conditions,{_id:e},t),this;else if(Mhe(e))e=e.toObject(bhe);if(t.omit={},Array.isArray(e.$and)){if(t.omit.$and=!0,!this._conditions)this._conditions={};this._conditions.$and=(this._conditions.$and||[]).concat(e.$and.map((r)=>ee.isPOJO(r)?ee.merge({},r):r))}if(Array.isArray(e.$or)){if(t.omit.$or=!0,!this._conditions)this._conditions={};this._conditions.$or=(this._conditions.$or||[]).concat(e.$or.map((r)=>ee.isPOJO(r)?ee.merge({},r):r))}return ee.merge(this._conditions,e,t),this};L.prototype.collation=function(e){if(this.options==null)this.options={};return this.options.collation=e,this};L.prototype._completeOne=function(e,t,r,n){if(!e&&!this.options.includeResultMetadata)return n(null,null);let s=this.model,i=this._userProvidedFields||{},o=this._mongooseOptions,u=this.options;if(!u.lean&&o.lean)u.lean=o.lean;if(u.explain)return n(null,e);if(!o.populate){let c=this.schema.options.versionKey;if(o.lean?.versionKey===!1&&c){if(c in e)delete e[c]}return o.lean?gw(s.schema,e,null,t,u,n):eW(s,e,t,u,r,i,null,n)}let a=du.preparePopulationOptionsMQ(this,this._mongooseOptions);if(o.lean)return s.populate(e,a).then((c)=>{gw(s.schema,c,null,t,u,n)},(c)=>{n(c)});eW(s,e,t,u,r,i,[],(c,l)=>{if(c!=null)return n(c);s.populate(l,a).then((f)=>{n(null,f)},(f)=>{n(f)})})};L.prototype._completeMany=async function(t,r,n,s){let i=this.model;return Promise.all(t.map((o)=>new Promise((u,a)=>{let c=o;if(o=du.createModel(i,o,r,n,s),s.session!=null)o.$session(s.session);o.$init(c,s,(l)=>{if(l!=null)return a(l);u(o)})})))};L.prototype._findOne=async function(){if(this._applyTranslateAliases(),this._castConditions(),this.error())throw this.error();let t=this.model.db.options,r=this.model.base.options;zd(this.options,t,r),Wd(this.options,t,r);let n=this._optionsForExec(),s=await this.mongooseCollection.findOne(this._conditions,n);return new Promise((i,o)=>{this._completeOne(s,null,n.projection,(u,a)=>{if(u)return o(u);i(a)})})};L.prototype.findOne=function(e,t,r){if(typeof e==="function"||typeof t==="function"||typeof r==="function"||typeof arguments[3]==="function")throw new St("Query.prototype.findOne() no longer accepts a callback");if(this.op="findOne",r)this.setOptions(r);if(t)this.select(t);if(Yu(e))this.merge(e),Kd(this);else if(e!=null)this.error(new Gu(e,"filter","findOne"));return this};L.prototype._countDocuments=async function(){if(this._applyTranslateAliases(),this._castConditions(),this.error())throw this.error();let t=this.model.db.options,r=this.model.base.options;zd(this.options,t,r),Wd(this.options,t,r);let n=this._optionsForExec(),s=this._conditions;return this.mongooseCollection.countDocuments(s,n)};/*!
913
+ * If `translateAliases` option is set, call `Model.translateAliases()`
914
+ * on the following query properties: filter, projection, update, distinct.
915
+ */L.prototype._applyTranslateAliases=function(){let t=!1;if("translateAliases"in this._mongooseOptions)t=this._mongooseOptions.translateAliases;else if(this.model?.schema?._userProvidedOptions?.translateAliases!=null)t=this.model.schema._userProvidedOptions.translateAliases;else if(this.model?.base?.options?.translateAliases!=null)t=this.model.base.options.translateAliases;if(!t)return;if(this.model?.schema?.aliases&&ee.hasOwnKeys(this.model.schema.aliases)){if(rl(this),this.model.translateAliases(this._conditions,!0),this.model.translateAliases(this._fields,!0),this.model.translateAliases(this[H],!0),this._distinct!=null&&this.model.schema.aliases[this._distinct]!=null)this._distinct=this.model.schema.aliases[this._distinct]}};L.prototype._estimatedDocumentCount=async function(){if(this.error())throw this.error();let t=this._optionsForExec();return this.mongooseCollection.estimatedDocumentCount(t)};L.prototype.estimatedDocumentCount=function(e){if(typeof e==="function"||typeof arguments[1]==="function")throw new St("Query.prototype.estimatedDocumentCount() no longer accepts a callback");if(this.op="estimatedDocumentCount",e!=null)this.setOptions(e);return this};L.prototype.countDocuments=function(e,t){if(typeof e==="function"||typeof t==="function"||typeof arguments[2]==="function")throw new St("Query.prototype.countDocuments() no longer accepts a callback");if(this.op="countDocuments",Yu(e))this.merge(e);if(t!=null)this.setOptions(t);return this};L.prototype.__distinct=async function(){if(this._applyTranslateAliases(),this._castConditions(),this.error())throw this.error();let t=this.model.db.options,r=this.model.base.options;zd(this.options,t,r),Wd(this.options,t,r);let n=this._optionsForExec();return this.mongooseCollection.distinct(this._distinct,this._conditions,n)};L.prototype.distinct=function(e,t,r){if(typeof e==="function"||typeof t==="function"||typeof r==="function"||typeof arguments[3]==="function")throw new St("Query.prototype.distinct() no longer accepts a callback");if(this.op="distinct",Yu(t))this.merge(t),Kd(this);else if(t!=null)this.error(new Gu(t,"filter","distinct"));if(e!=null)this._distinct=e;if(r!=null)this.setOptions(r);return this};L.prototype.sort=function(e,t){if(arguments.length>2)throw new St("sort() takes at most 2 arguments");if(t!=null&&typeof t!=="object")throw new St("sort() options argument must be an object or nullish");if(this.options.sort==null)this.options.sort={};if(t?.override)this.options.sort={};return iW(this.options.sort,e),this};/*!
916
+ * Returns true if `filter` has a `$near` or `$nearSphere` condition, including within logical operators.
917
+ */function sW(e){for(let t of Object.keys(e)){let r=e[t];if(r==null||typeof r!=="object")continue;if(Bhe.has(t)){if(Array.isArray(r)&&r.some((n)=>n!=null&&typeof n==="object"&&sW(n)))return!0}else if(Object.hasOwn(r,"$near")||Object.hasOwn(r,"$nearSphere"))return!0}return!1}/*!
918
+ * Add the keys from `arg`, which can be any value that `Query.prototype.sort()` accepts, to the `sort` object.
919
+ */function iW(e,t){if(typeof t==="string"){let r=t.indexOf(" ")===-1?[t]:t.split(" ");for(let n of r){let s=n[0]=="-"?-1:1;if(s===-1)n=n.slice(1);if(eo.has(n))continue;e[n]=s}}else if(Array.isArray(t))for(let r of t){if(!Array.isArray(r))throw TypeError("Invalid sort() argument, must be array of arrays");let n=""+r[0];if(eo.has(n))continue;e[n]=pw(r[1],n)}else if(typeof t==="object"&&t!=null&&!(t instanceof Map))for(let r of Object.keys(t)){if(eo.has(r))continue;e[r]=pw(t[r],r)}else if(t instanceof Map)for(let r of t.keys()){if(r=""+r,eo.has(r))continue;e[r]=pw(t.get(r),r)}else if(t!=null)throw TypeError("Invalid sort() argument. Must be a string, object, array, or map.");return e}/*!
920
+ * Convert sort values
921
+ */function pw(e,t){if(e===1||e==="asc"||e==="ascending")return 1;if(e===-1||e==="desc"||e==="descending")return-1;if(e!=null&&Object.hasOwn(e,"$meta")&&e.$meta!=null)return{$meta:e.$meta};throw TypeError("Invalid sort value: { "+t+": "+e+" }")}L.prototype.deleteOne=function(t,r){if(typeof t==="function"||typeof r==="function"||typeof arguments[2]==="function")throw new St("Query.prototype.deleteOne() no longer accepts a callback");if(this.op="deleteOne",this.setOptions(r),Yu(t))this.merge(t),Kd(this);else if(t!=null)this.error(new Gu(t,"filter","deleteOne"));return this};L.prototype._deleteOne=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this._optionsForExec();return this.mongooseCollection.deleteOne(this._conditions,t)};L.prototype.deleteMany=function(e,t){if(typeof e==="function"||typeof t==="function"||typeof arguments[2]==="function")throw new St("Query.prototype.deleteMany() no longer accepts a callback");if(this.setOptions(t),this.op="deleteMany",Yu(e))this.merge(e),Kd(this);else if(e!=null)this.error(new Gu(e,"filter","deleteMany"));return this};L.prototype._deleteMany=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this._optionsForExec();return this.mongooseCollection.deleteMany(this._conditions,t)};function eW(e,t,r,n,s,i,o,u){if(n.includeResultMetadata&&t==null)return a(null),null;du.createModelAndInit(e,t,s,i,n,o,a);function a(c,l){if(c)return u(c);if(n.includeResultMetadata){if(t&&l){if(n.session!=null)l.$session(n.session);r.value=l}else r.value=null;return u(null,r)}if(n.session!=null)l.$session(n.session);u(null,l)}}function Kd(e){if(!e?.model?.schema)return;let t=e.model.schema;if(t?.discriminatorMapping&&!t.discriminatorMapping.isRoot)e._conditions[t.discriminatorMapping.key]=t.discriminatorMapping.value}L.prototype.findOneAndUpdate=function(e,t,r){if(typeof e==="function"||typeof t==="function"||typeof r==="function"||typeof arguments[3]==="function")throw new St("Query.prototype.findOneAndUpdate() no longer accepts a callback");switch(this.op="findOneAndUpdate",this._validate(),arguments.length){case 2:r=void 0;break;case 1:t=e,e=r=void 0;break}if(Yu(e))this.merge(e);else if(e!=null)this.error(new Gu(e,"filter","findOneAndUpdate"));if(r=r?Ws(r):{},r.projection)this.select(r.projection),delete r.projection;if(r.fields)this.select(r.fields),delete r.fields;let n=this?.model?.base?.options?.returnDocument,s=this?.model?.base?.options?.returnOriginal;if(r.new==null&&r.returnDocument==null&&r.returnOriginal==null){if(n!=null)r.returnDocument=n;else if(s!=null)r.returnOriginal=s}let i=this?.model?.base?.options?.updatePipeline;if(r.updatePipeline==null&&i!=null)r.updatePipeline=i;if(!r.updatePipeline&&Array.isArray(t))throw new St("Cannot pass an array to query updates unless the `updatePipeline` option is set.");if(this.setOptions(r),t)if(this[H]==null||ee.isEmptyObject(this[H]))this[H]=t,this._updateIsShared=!0;else this._mergeUpdate(t);return this};L.prototype._findOneAndUpdate=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),V_(this),this.error())throw this.error();let t=this.model.db.options,r=this.model.base.options;zd(this.options,t,r),Wd(this.options,t,r);let n=this._optionsForExec(this.model);if(oW(n),this[H]=this._castUpdate(this[H]),this._updateIsShared=!1,Che(this[H],n,this.schema.options.versionKey),this[H]=Ew(this._conditions,this.model.schema,this[H],n,this._mongooseOptions,this),!this[H]||ee.hasOwnKeys(this[H])===!1)if(n.upsert){let u=Ws(this[H]);delete u._id,this[H]={$set:u}}else return this._execCount=0,await this._findOne();else if(this[H]instanceof Error)throw this[H];else if(this[H].$set&&ee.hasOwnKeys(this[H].$set)===!1)delete this[H].$set;if(Gd(this,"runValidators",!1))await this.validate(this[H],n,!1);if(typeof this[H].toBSON==="function")this[H]=this[H].toBSON();let i=await this.mongooseCollection.findOneAndUpdate(this._conditions,this[H],n);for(let u of this._transforms)i=u(i);let o=!n.includeResultMetadata?i:i.value;return new Promise((u,a)=>{this._completeOne(o,i,n.projection,(c,l)=>{if(c)return a(c);u(l)})})};L.prototype.findOneAndDelete=function(e,t){if(typeof e==="function"||typeof t==="function"||typeof arguments[2]==="function")throw new St("Query.prototype.findOneAndDelete() no longer accepts a callback");if(this.op="findOneAndDelete",this._validate(),Yu(e))this.merge(e);return t&&this.setOptions(t),this};L.prototype._findOneAndDelete=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this.options.includeResultMetadata,r=this._conditions,n=this._optionsForExec(this.model),s=await this.mongooseCollection.findOneAndDelete(r,n);for(let o of this._transforms)s=o(s);let i=!t?s:s.value;return new Promise((o,u)=>{this._completeOne(i,s,n.projection,(a,c)=>{if(a)return u(a);o(c)})})};L.prototype.findOneAndReplace=function(e,t,r){if(typeof e==="function"||typeof t==="function"||typeof r==="function"||typeof arguments[4]==="function")throw new St("Query.prototype.findOneAndReplace() no longer accepts a callback");if(this.op="findOneAndReplace",this._validate(),Yu(e))this.merge(e);else if(e!=null)this.error(new Gu(e,"filter","findOneAndReplace"));if(t!=null)this._mergeUpdate(t);r=r||{};let n=this?.model?.base?.options?.returnDocument,s=this?.model?.base?.options?.returnOriginal;if(r.new==null&&r.returnDocument==null&&r.returnOriginal==null){if(n!=null)r.returnDocument=n;else if(s!=null)r.returnOriginal=s}return this.setOptions(r),this};L.prototype._findOneAndReplace=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this._conditions,r=this._optionsForExec();oW(r);let n=this.options.includeResultMetadata,s={skipId:!0};if("strict"in this._mongooseOptions)s.strict=this._mongooseOptions.strict;let i=Gd(this,"runValidators",!1);try{let a=new this.model(this[H],null,s);if(i)await a.validate();else if(a.$__.validationError)throw a.$__.validationError;this[H]=a.toBSON()}catch(a){if(a instanceof Vd)throw a;let c=new Vd;throw c.errors[a.path]=a,c}let o=await this.mongooseCollection.findOneAndReplace(t,this[H],r);for(let a of this._transforms)o=a(o);let u=!n?o:o.value;return new Promise((a,c)=>{this._completeOne(u,o,r.projection,(l,f)=>{if(l)return c(l);a(f)})})};L.prototype.findById=function(e,t,r){return this.findOne({_id:e},t,r)};L.prototype.findByIdAndUpdate=function(e,t,r){return this.findOneAndUpdate({_id:e},t,r)};L.prototype.findByIdAndDelete=function(e,t){return this.findOneAndDelete({_id:e},t)};function oW(e){if("new"in e){let t=e.new?"'after'":"'before'";ee.warn("mongoose: the `new` option for `findOneAndUpdate()` and `findOneAndReplace()` is deprecated. Use `returnDocument: "+t+"` instead."),e.returnDocument=e.new?"after":"before",delete e.new}if("returnOriginal"in e){let t=e.returnOriginal?"'before'":"'after'";ee.warn("mongoose: the `returnOriginal` option for `findOneAndUpdate()` and `findOneAndReplace()` is deprecated. Use `returnDocument: "+t+"` instead."),e.returnDocument=e.returnOriginal?"before":"after",delete e.returnOriginal}if(typeof e.returnDocument==="string")e.returnOriginal=e.returnDocument==="before"}function Gd(e,t,r){let n=e._optionsForExec(e.model);if(t in n)return n[t];if(t in e.model.base.options)return e.model.base.options[t];return r}/*!
922
+ * ignore
923
+ */function gw(e,t,r,n,s,i){if(s.lean&&typeof s.lean.transform==="function"){s.lean.transform(t);for(let o=0;o<e.childSchemas.length;o++){let u=r?r+"."+e.childSchemas[o].model.path:e.childSchemas[o].model.path,a=e.childSchemas[o].schema,c=U_.get(u,t);if(c==null)continue;if(Array.isArray(c))for(let l=0;l<c.length;l++)s.lean.transform(c[l]);else s.lean.transform(c);gw(a,c,u,n,s)}if(i)return i(null,t);else return}if(s.includeResultMetadata)return i(null,n);return i(null,t)}/*!
924
+ * ignore
925
+ */function uW(e,t,r,n){if(n.lean&&typeof n.lean.transform==="function"){for(let s of t)n.lean.transform(s);for(let s=0;s<e.childSchemas.length;s++){let i=r?r+"."+e.childSchemas[s].model.path:e.childSchemas[s].model.path,o=e.childSchemas[s].schema,u=U_.get(i,t);if(u==null)continue;u=u.flat();for(let a=0;a<u.length;a++)n.lean.transform(u[a]);uW(o,u,i,n)}}return t}L.prototype._mergeUpdate=function(e){if(rl(this),!this._mongooseOptions.updatePipeline&&Array.isArray(e))throw new St("Cannot pass an array to query updates unless the `updatePipeline` option is set.");if(!this[H])this[H]=Array.isArray(e)?[]:{};if(e==null||typeof e==="object"&&ee.hasOwnKeys(e)===!1)return;if(e instanceof L){if(Array.isArray(this[H]))throw new St(`Cannot mix array and object updates (current: ${zh(this[H])}, incoming: ${zh(e[H])})`);if(e[H])ee.mergeClone(this[H],e[H])}else if(Array.isArray(e)){if(!Array.isArray(this[H]))if(this[H]==null||ee.isEmptyObject(this[H]))this[H]=[];else throw new St(`Cannot mix array and object updates (current: ${zh(this[H])}, incoming: ${zh(e)})`);this[H]=this[H].concat(e)}else{if(Array.isArray(this[H]))throw new St(`Cannot mix array and object updates (current: ${zh(this[H])}, incoming: ${zh(e)})`);ee.mergeClone(this[H],e)}};function zh(e){let t=to.inspect(e,{depth:2,maxArrayLength:5,breakLength:80,compact:!0});if(t.length>200)return`${t.slice(0,197)}...`;return t}L.prototype.validate=async function(t,r,n){if(typeof arguments[3]==="function")throw new St("Query.prototype.validate() no longer accepts a callback");if(await cW(this,"validate"),n)await t.$validate();else{let s=await Rhe(this,this.model.schema,t,r);if(s.length>0){let i=new Vd(null);for(let o of s)i.addError(o.path,o);throw i}}await aW(this,null,null,"validate")};L.prototype._updateMany=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),V_(this),this.error()!=null)throw this.error();let t=this._optionsForExec(this.model);if(rl(this),this[H]=this._castUpdate(this[H]),this[H]==null||ee.hasOwnKeys(this[H])===!1)return{acknowledged:!1};if(_w(this[H],t),this[H]=Ew(this._conditions,this.model.schema,this[H],t,this._mongooseOptions,this),Gd(this,"runValidators",!1))await this.validate(this[H],t,!1);if(typeof this[H].toBSON==="function")this[H]=this[H].toBSON();return this.mongooseCollection.updateMany(this._conditions,this[H],t)};L.prototype._updateOne=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),V_(this),this.error()!=null)throw this.error();let t=this._optionsForExec(this.model);if(rl(this),this[H]=this._castUpdate(this[H]),this[H]==null||ee.hasOwnKeys(this[H])===!1)return{acknowledged:!1};if(_w(this[H],t),this[H]=Ew(this._conditions,this.model.schema,this[H],t,this._mongooseOptions,this),Gd(this,"runValidators",!1))await this.validate(this[H],t,!1);if(typeof this[H].toBSON==="function")this[H]=this[H].toBSON();return this.mongooseCollection.updateOne(this._conditions,this[H],t)};L.prototype._replaceOne=async function(){if(this._applyTranslateAliases(),this._castConditions(),cc(this._conditions,this.options),V_(this),this.error()!=null)throw this.error();let t=this._optionsForExec(this.model),r={skipId:!0};if("strict"in this._mongooseOptions)r.strict=this._mongooseOptions.strict;let n=Gd(this,"runValidators",!1);try{if(this[H]=new this.model(this[H],null,r),_w(this[H],t),n)await this.validate(this[H],t,!0);else if(this[H].$__.validationError)throw this[H].$__.validationError;if(typeof this[H].toBSON==="function")this[H]=this[H].toBSON()}catch(s){if(s instanceof Vd)throw s;let i=new Vd;throw i.errors[s.path]=s,i}return this.mongooseCollection.replaceOne(this._conditions,this[H],t)};L.prototype.updateMany=function(e,t,r,n){if(typeof r==="function")n=r,r=void 0;else if(typeof t==="function")n=t,t=e,e={},r=void 0;else if(typeof e==="function")n=e,e=void 0,t=void 0,r=void 0;else if(typeof e==="object"&&!t&&!r&&!n)t=e,e=void 0,r=void 0,n=void 0;return Aw(this,"updateMany",e,t,r,n)};L.prototype.updateOne=function(e,t,r,n){if(typeof r==="function")n=r,r=void 0;else if(typeof t==="function")n=t,t=e,e={},r=void 0;else if(typeof e==="function")n=e,e=void 0,t=void 0,r=void 0;else if(typeof e==="object"&&!t&&!r&&!n)t=e,e=void 0,r=void 0,n=void 0;return Aw(this,"updateOne",e,t,r,n)};L.prototype.replaceOne=function(e,t,r,n){if(typeof r==="function")n=r,r=void 0;else if(typeof t==="function")n=t,t=e,e={},r=void 0;else if(typeof e==="function")n=e,e=void 0,t=void 0,r=void 0;else if(typeof e==="object"&&!t&&!r&&!n)t=e,e=void 0,r=void 0,n=void 0;return Aw(this,"replaceOne",e,t,r,n)};function Aw(e,t,r,n,s,i){if(e.op=t,n=n||{},!(r instanceof L)&&r!=null&&r.toString()!=="[object Object]")e.error(new Gu(r,"filter",t));else e.merge(r);let o=e?.model?.base?.options?.updatePipeline;if(o!=null&&s?.updatePipeline==null)s=s||{},s.updatePipeline=o;if(!s?.updatePipeline&&Array.isArray(n))throw new St("Cannot pass an array to query updates unless the `updatePipeline` option is set.");if(ee.isObject(s))e.setOptions(s);if(e[H]==null||ee.isEmptyObject(e[H]))e[H]=n,e._updateIsShared=!0;else e._mergeUpdate(n);if(i)return e.exec(i),e;return e}L.prototype.transform=function(e){return this._transforms.push(e),this};L.prototype.orFail=function(e){return this.transform((t)=>{switch(this.op){case"find":if(t.length===0)throw Wh(e,this);break;case"findOne":if(t==null)throw Wh(e,this);break;case"replaceOne":case"updateMany":case"updateOne":if(t?.matchedCount===0)throw Wh(e,this);break;case"findOneAndDelete":case"findOneAndUpdate":case"findOneAndReplace":if(this.options.includeResultMetadata&&t!=null&&t.value==null)throw Wh(e,this);if(!this.options.includeResultMetadata&&t==null)throw Wh(e,this);break;case"deleteMany":case"deleteOne":if(t.deletedCount===0)throw Wh(e,this);break;default:break}return t}),this};function Wh(e,t){if(typeof e==="function")e=e.call(t);if(e==null)e=new ghe(t.getQuery(),t.model.modelName);return e}L.prototype.isPathSelectedInclusive=function(e){return Phe(this._fields,e)};L.prototype.exec=async function(t){if(typeof t==="function"||arguments.length>=2&&typeof arguments[1]==="function")throw new St("Query.prototype.exec() no longer accepts a callback");if(this._validateOp(),typeof t==="string")this.op=t;if(this.op==null)throw new St("Query must have `op` before executing");if(this.model==null)throw new St("Query must have an associated model before executing");let r=jhe.get(this.op);if(!r)throw new St('Query has invalid `op`: "'+this.op+'"');if(this.options?.sort&&typeof this.options.sort==="object"&&Object.hasOwn(this.options.sort,""))throw new St('Invalid field "" passed to sort()');if(this._execCount>0){let s=this.toString();if(s.length>60)s=s.slice(0,60)+"...";throw new St("Query was already executed: "+s)}this._execCount++;let n=this;return xhe(async function(){let i=null;try{await n._hooks.execPre("exec",n,[])}catch(a){if(a instanceof Ud.skipWrappedFunction)i=a;else throw a}let o,u=null;try{await cW(n),o=i?i.args[0]:await n[r]();for(let a of n._transforms)o=a(o)}catch(a){if(a instanceof Ud.skipWrappedFunction)o=a.args[0];else u=a;u=n.model.schema._transformDuplicateKeyError(u)}return o=await aW(n,o,u),await n._hooks.execPost("exec",n,[]),o},()=>({operation:n.op,collection:n.mongooseCollection.name,database:n.model.db?.name,serverAddress:n.model.db?.host,serverPort:n.model.db?.port,args:{filter:n.getFilter(),fields:n._fields,options:n._mongooseOptions}}))};/*!
926
+ * ignore
927
+ */async function aW(e,t,r,n){if(e._queryMiddleware==null){if(r!=null)throw r;return t}let i={filter:nW(e.options,"post")};if(r)i.error=r;let[o]=await e._queryMiddleware.execPost(n||e.op,e,[t],i);return o}/*!
928
+ * ignore
929
+ */function cW(e,t){if(e._queryMiddleware==null)return;let r=nW(e.options,"pre");return e._queryMiddleware.execPre(t||e.op,e,[],{filter:r})}function rl(e){if(!e._updateIsShared)return;if(e.mongooseOptions().cloneUpdate===!1)return;e[H]=Ws(e[H],{flattenDecimals:!1}),e._updateIsShared=!1}L.prototype.then=function(e,t){return this.exec().then(e,t)};L.prototype.catch=function(e){return this.exec().then(null,e)};L.prototype.finally=function(e){return this.exec().finally(e)};L.prototype[Symbol.toStringTag]=function(){return`Query { ${this.op} }`};L.prototype.pre=function(e){return this._hooks.pre("exec",e),this};L.prototype.post=function(e){return this._hooks.post("exec",e),this};L.prototype._castUpdate=function(t){let r=this.schema,n=r.options.discriminatorKey,s=r._baseSchema||r;if(this._mongooseOptions.overwriteDiscriminatorKey&&t[n]!=null&&s.discriminators){let o=Object.values(s.discriminators).find((u)=>u.discriminatorMapping.value===t[n]);if(o!=null)r=o}let i;if("upsert"in this.options)i=this.options.upsert;return whe(r,t,{strict:this._mongooseOptions.strict,upsert:i,arrayFilters:this.options.arrayFilters,overwriteDiscriminatorKey:this._mongooseOptions.overwriteDiscriminatorKey,overwriteImmutable:this._mongooseOptions.overwriteImmutable},this,this._conditions)};L.prototype.populate=function(...e){if(!e.some(Boolean))return this;let t=ee.populate.apply(null,e),r=this._mongooseOptions;if(r.lean!=null){let s=r.lean;for(let i of t)if(i?.options?.lean==null)i.options=i.options||{},i.options.lean=s}if(!ee.isObject(r.populate))r.populate={};let n=r.populate;for(let s of t){let i=s.path;if(n[i]?.populate&&s.populate)s.populate=n[i].populate.concat(s.populate);n[s.path]=s}return this};L.prototype.getPopulatedPaths=function(){let t=this._mongooseOptions.populate||{},r=Object.keys(t);for(let n of Object.keys(t)){let s=t[n];if(!Array.isArray(s.populate))continue;lW(r,s.populate,n+".")}return r};/*!
930
+ * ignore
931
+ */function lW(e,t,r){for(let n of t){if(e.push(r+n.path),!Array.isArray(n.populate))continue;lW(e,n.populate,r+n.path+".")}}L.prototype.cast=function(e,t){t||(t=this._conditions),e=e||this.model;let r=e.schema.options.discriminatorKey;if(t!=null&&Object.hasOwn(t,r))e=tW(e.discriminators,t[r])||e;let n={upsert:this.options?.upsert};if("strict"in this._mongooseOptions)n.strict=this._mongooseOptions.strict;if("strictQuery"in this._mongooseOptions)n.strictQuery=this._mongooseOptions.strictQuery;n.sanitizeFilter=e.db.config?.sanitizeFilter??e.db.options?.sanitizeFilter??e.base.options.sanitizeFilter??this._mongooseOptions.sanitizeFilter;try{return Ohe(e.schema,t,n,this)}catch(s){if(typeof s.setModel==="function")s.setModel(e);throw s}};L.prototype._castFields=function(t){let r,n,s,i,o;if(t){s=Object.keys(t),n=[];for(let u=0;u<s.length;++u)if(i=s[u],t[i].$elemMatch)r||(r={}),r[i]=t[i],n.push(i)}if(r){o=this.cast(this.model,r);for(let u=0;u<n.length;++u)i=n[u],t[i]=o[i]}return t};L.prototype._applyPaths=function(){if(!this.model)return;this._fields=this._fields||{};let t=void 0;if(this.model!=null&&ee.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))t=this.model.db.options.sanitizeProjection;else if(this.model!=null&&ee.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))t=this.model.base.options.sanitizeProjection;else t=this._mongooseOptions.sanitizeProjection;if(t)rW(this._fields);if(this._mongooseOptions.schemaLevelProjections??!0){let s=this.model.schema,i=s.options.discriminatorKey;if(this._conditions!=null&&Object.hasOwn(this._conditions,i))s=tW(this.model.discriminators,this._conditions[i])?.schema??s;du.applyPaths(this._fields,s,t)}let n=!0;if("selectPopulatedPaths"in this.model.base.options)n=this.model.base.options.selectPopulatedPaths;if("selectPopulatedPaths"in this.model.schema.options)n=this.model.schema.options.selectPopulatedPaths;if(n)Ihe(this._fields,this._userProvidedFields,this._mongooseOptions.populate)};L.prototype.cursor=function(t){if(t)this.setOptions(t);try{this._castConditions()}catch(r){return new dw(this)._markError(r)}if(this.error())return new dw(this)._markError(this.error());return new dw(this)};L.prototype.tailable=function(e,t){if(typeof e?.constructor==="function"&&e.constructor.name==="Object")t=e,e=!0;if(e===void 0)e=!0;if(t&&typeof t==="object")for(let r of Object.keys(t))if(r==="awaitData"||r==="awaitdata")this.options.awaitData=!!t[r];else this.options[r]=t[r];return this.options.tailable=arguments.length?!!e:!0,this};L.prototype.near=function(){let e=[],t=this._mongooseOptions.nearSphere;if(arguments.length===1)if(Array.isArray(arguments[0]))e.push({center:arguments[0],spherical:t});else if(typeof arguments[0]==="string")e.push(arguments[0]);else if(ee.isObject(arguments[0])){if(typeof arguments[0].spherical!=="boolean")arguments[0].spherical=t;e.push(arguments[0])}else throw TypeError("invalid argument");else if(arguments.length===2)if(typeof arguments[0]==="number"&&typeof arguments[1]==="number")e.push({center:[arguments[0],arguments[1]],spherical:t});else if(typeof arguments[0]==="string"&&Array.isArray(arguments[1]))e.push(arguments[0]),e.push({center:arguments[1],spherical:t});else if(typeof arguments[0]==="string"&&ee.isObject(arguments[1])){if(e.push(arguments[0]),typeof arguments[1].spherical!=="boolean")arguments[1].spherical=t;e.push(arguments[1])}else throw TypeError("invalid argument");else if(arguments.length===3)if(typeof arguments[0]==="string"&&typeof arguments[1]==="number"&&typeof arguments[2]==="number")e.push(arguments[0]),e.push({center:[arguments[1],arguments[2]],spherical:t});else throw TypeError("invalid argument");else throw TypeError("invalid argument");return L.base.near.apply(this,e)};L.prototype.nearSphere=function(){return this._mongooseOptions.nearSphere=!0,this.near.apply(this,arguments),this};L.prototype[Symbol.asyncIterator]=function(){return this._mongooseOptions._asyncIterator=!0,this.cursor()};L.prototype.box=function(e,t){if(!Array.isArray(e)&&ee.isObject(e))t=e.ur,e=e.ll;return L.base.box.call(this,e,t)};L.prototype.center=L.base.circle;L.prototype.centerSphere=function(){if(typeof arguments[0]?.constructor==="function"&&arguments[0].constructor.name==="Object")arguments[0].spherical=!0;if(typeof arguments[1]?.constructor==="function"&&arguments[1].constructor.name==="Object")arguments[1].spherical=!0;L.base.circle.apply(this,arguments)};L.prototype.selectedInclusively=function(){return The(this._fields)};L.prototype.selectedExclusively=function(){return Dhe(this._fields)};L.prototype.model;function Yu(e){return e instanceof L||ee.isObject(e)||e===null}/*!
932
+ * Export
933
+ */hW.exports=L});var gW=g(function(JEe,yW){/*!
934
+ * Module dependencies.
935
+ */var Yd=ze(),pW=require("stream").Readable,Uhe=QS(),Vhe=XS(),zhe=ua(),mW=kc(),W_=require("util"),{cursorNextChannel:Whe}=Lh(),{buildMiddlewareFilter:Hhe}=vu();function Hs(e){pW.call(this,{autoDestroy:!0,objectMode:!0}),this.cursor=null,this._initializationComplete=!1,this.agg=e,this._transforms=[];let{_connection:t,_model:r}=e;if(delete e.options.cursor.useMongooseAggCursor,this._mongooseOptions={},t){let n=e.options||{};if(Object.hasOwn(n,"middleware")){let{middleware:s,...i}=n;n=i}this.cursor=t.db.aggregate(e._pipeline,n),this._initializationComplete=!0,setImmediate(()=>this.emit("cursor",this.cursor))}else Khe(r,this,e)}W_.inherits(Hs,pW);/*!
936
+ * ignore
937
+ */function Khe(e,t,r){let n=Hhe(r.options,"pre");e.hooks.execPre("aggregate",r,[],{filter:n}).then(()=>s(null),(i)=>s(i));function s(i){if(i!=null){Ghe(t,i);return}if(typeof r.options?.cursor?.transform==="function")t._transforms.push(r.options.cursor.transform);if(e.collection._shouldBufferCommands()&&e.collection.buffer)e.collection.queue.push([()=>fW(e,t,r)]);else fW(e,t,r)}}/*!
938
+ * ignore
939
+ */function fW(e,t,r){try{let n=r.options;if(Object.hasOwn(n,"middleware")){let{middleware:i,...o}=n;n=o}let s=e.collection.aggregate(r._pipeline,n);t.cursor=s,t._initializationComplete=!0,t.emit("cursor",s)}catch(n){if(t._initializationComplete=!0,t._markError(n),t.listeners("error").length>0)t._errorEmitted=!0,t.emit("error",t._error)}}function Ghe(e,t){if(e._initializationComplete=!0,t instanceof mW.skipWrappedFunction){let r=t.args[0];if(r!=null&&(!Array.isArray(r)||r.length)){let n=new Yd('Cannot `skipMiddlewareFunction()` with a value when using `.aggregate().cursor()`, value must be nullish or empty array, got "'+W_.inspect(r)+'".');if(e._markError(n),e.listeners("error").length>0)e._errorEmitted=!0,e.emit("error",n);return}e.emit("cursor",null);return}if(e._markError(t),e.listeners("error").length>0)e._errorEmitted=!0,e.emit("error",t)}Hs.prototype._read=function(){let e=this;H_(this,function(t,r){if(t)return e._errorEmitted=!0,e.emit("error",t);if(!r){e.push(null),e.cursor.close(function(n){if(n)return e.emit("error",n)});return}e.push(r)})};if(Symbol.asyncIterator!=null){let e="Mongoose does not support using async iterators with an existing aggregation cursor. See https://bit.ly/mongoose-async-iterate-aggregation";Hs.prototype[Symbol.asyncIterator]=function(){throw new Yd(e)}}Object.defineProperty(Hs.prototype,"map",{value:function(e){return this._transforms.push(e),this},enumerable:!0,configurable:!0,writable:!0});Hs.prototype._markError=function(e){return this._error=e,this};Hs.prototype.close=async function(){if(typeof arguments[0]==="function")throw new Yd("AggregationCursor.prototype.close() no longer accepts a callback");try{await this.cursor.close()}catch(t){if(this.listeners("error").length>0)this._errorEmitted=!0,this.emit("error",t);throw t}this.emit("close")};Hs.prototype._destroy=function(t,r){let n=null;if(!this._initializationComplete)n=Vhe(this);else n=Promise.resolve();return n.then(()=>this.cursor?.close()).then(()=>{this._closed=!0;let s=!this._errorEmitted&&this.listeners("error").length>0;r(s?t:null)}).catch((s)=>{r(s)}),this};Hs.prototype.next=async function(){if(typeof arguments[0]==="function")throw new Yd("AggregationCursor.prototype.next() no longer accepts a callback");let t=this,r=this.agg._model;return Whe.trace(function(){return new Promise((s,i)=>{H_(t,(o,u)=>{if(o!=null)return i(o);s(u)})})},()=>({operation:"aggregate",collection:r?.collection?.name,database:r?.db?.name,serverAddress:r?.db?.host,serverPort:r?.db?.port,batchSize:t.agg.options?.cursor?.batchSize,tailable:!1,args:{pipeline:t.agg._pipeline,options:t.agg.options}}))};Hs.prototype.eachAsync=function(e,t){if(typeof arguments[2]==="function")throw new Yd("AggregationCursor.prototype.eachAsync() no longer accepts a callback");let r=this;if(typeof t==="function")t={};return t=t||{},Uhe(function(n){return H_(r,n)},e,t)};if(Symbol.asyncIterator!=null)Hs.prototype[Symbol.asyncIterator]=function(){return this.transformNull()._transformForAsyncIterator()};/*!
940
+ * ignore
941
+ */Hs.prototype._transformForAsyncIterator=function(){if(this._transforms.indexOf(dW)===-1)this.map(dW);return this};/*!
942
+ * ignore
943
+ */Hs.prototype.transformNull=function(e){if(arguments.length===0)e=!0;return this._mongooseOptions.transformNull=e,this};/*!
944
+ * ignore
945
+ */function dW(e){return e==null?{done:!0}:{value:e,done:!1}}Hs.prototype.addCursorFlag=function(e,t){let r=this;return Yhe(this,function(){r.cursor.addCursorFlag(e,t)}),this};/*!
946
+ * ignore
947
+ */function Yhe(e,t){if(e.cursor)return t();e.once("cursor",function(){t()})}function H_(e,t){let r=t;if(e._transforms.length)r=function(n,s){if(n||s===null&&!e._mongooseOptions.transformNull)return t(n,s);t(n,e._transforms.reduce(function(i,o){return o(i)},s))};if(e._error)return zhe(function(){r(e._error)});if(e.cursor)return e.cursor.next().then((n)=>{if(!n)return r(null,null);r(null,n)},(n)=>r(n));else e.once("error",t),e.once("cursor",function(){H_(e,t)})}yW.exports=Hs});var Ow=g(function(QEe,_W){_W.exports=function(t,r,n){let s=r?.discriminatorMapping;if(n=n||"",s&&!s.isRoot){let i=t,o=(n.length>0?n+".":n)+s.key,u=s.value;if(i[0]!=null&&i[0].$match&&(i[0].$match[o]===void 0||i[0].$match[o]===u))i[0].$match[o]=u;else if(i[0]?.$geoNear)i[0].$geoNear.query=i[0].$geoNear.query||{},i[0].$geoNear.query[o]=u;else if(i[0]?.$search)if(i[1]?.$match!=null)i[1].$match[o]=i[1].$match[o]||u;else{let a={};a[o]=u,i.splice(1,0,{$match:a})}else{let a={};a[o]=u,i.unshift({$match:a})}}}});var AW=g(function(XEe,EW){EW.exports=function e(t){if(!Array.isArray(t))return;for(let r of t){if(r==null)continue;let n=r.$group||r.$bucket||r.$bucketAuto;if(n!=null)for(let i of Object.keys(n))Jhe(n[i]);let s=Object.keys(r)[0];if(s&&typeof r[s]==="object"){let i=r[s];for(let o of Object.keys(i))if(i[o]!=null&&i[o].$function!=null&&typeof i[o].$function.body==="function")i[o].$function.body=i[o].$function.body.toString()}if(r.$facet!=null)for(let i of Object.keys(r.$facet))e(r.$facet[i])}};function Jhe(e){if(e==null||e.$accumulator==null)return;for(let t of["init","accumulate","merge","finalize"])if(typeof e.$accumulator[t]==="function")e.$accumulator[t]=String(e.$accumulator[t])}});var ww=g(function(ZEe,CW){/*!
948
+ * Module dependencies
949
+ */var wW=gW(),Os=ze(),G_=z_(),{applyGlobalMaxTimeMS:Qhe,applyGlobalDiskUse:Xhe}=ew(),Zhe=ar(),efe=Xn(),Sw=Ow(),{buildMiddlewareFilter:K_}=vu(),tfe=AW(),Hh=be(),{modelSymbol:rfe}=de(),{createTracedChannel:nfe}=Lh(),{trace:OW}=nfe("mongoose:aggregate"),sfe=G_.prototype.read,ife=G_.prototype.readConcern,SW=new Set(["$$DESCEND","$$PRUNE","$$KEEP"]);function Ze(e,t){if(this._pipeline=[],t==null||t[rfe])this._model=t;else this._connection=t;if(this.options={},arguments.length===1&&Array.isArray(e))this.append.apply(this,e)}Ze.prototype.options;Ze.prototype._optionsForExec=function(){let e=this.options||{},t=this.model()?.db?.base.transactionAsyncLocalStorage?.getStore();if(!Object.hasOwn(e,"session")&&t?.session!=null)e.session=t.session;return e};Ze.prototype.model=function(e){if(arguments.length===0)return this._model;if(this._model=e,e.schema!=null){if(this.options.readPreference==null&&e.schema.options.read!=null)this.options.readPreference=e.schema.options.read;if(this.options.collation==null&&e.schema.options.collation!=null)this.options.collation=e.schema.options.collation}return e};Ze.prototype.append=function(){let e=arguments.length===1&&Array.isArray(arguments[0])?arguments[0]:[...arguments];if(!e.every(ofe))throw new Os("Arguments must be aggregate pipeline operators");return this._pipeline=this._pipeline.concat(e),this};Ze.prototype.addFields=function(e){if(typeof e!=="object"||e===null||Array.isArray(e))throw new Os("Invalid addFields() argument. Must be an object");return this.append({$addFields:Object.assign({},e)})};Ze.prototype.project=function(e){let t={};if(typeof e==="object"&&!Array.isArray(e))Object.keys(e).forEach(function(r){if(r==="__proto__")return;t[r]=e[r]});else if(arguments.length===1&&typeof e==="string")e.split(/\s+/).forEach(function(r){if(!r)return;let n=r[0]==="-"?0:1;if(n===0)r=r.substring(1);t[r]=n});else throw new Os("Invalid project() argument. Must be string or object");return this.append({$project:t})};Ze.prototype.near=function(e){if(e==null)throw new Os("Aggregate `near()` must be called with non-nullish argument");if(e.near==null)throw new Os("Aggregate `near()` argument must have a `near` property");let t=Array.isArray(e.near)?e.near:e.near.coordinates;if(typeof e.near==="object"&&(!Array.isArray(t)||t.length<2||t.find((n)=>typeof n!=="number")))throw new Os(`Aggregate \`near()\` argument has invalid coordinates, got "${t}"`);let r={};return r.$geoNear=e,this.append(r)};/*!
950
+ * define methods
951
+ */"group match skip limit out densify fill".split(" ").forEach(function(e){Ze.prototype[e]=function(t){let r={};return r["$"+e]=t,this.append(r)}});Ze.prototype.unwind=function(){let e=[...arguments],t=[];for(let r of e)if(r&&typeof r==="object")t.push({$unwind:r});else if(typeof r==="string")t.push({$unwind:r[0]==="$"?r:"$"+r});else throw new Os('Invalid arg "'+r+'" to unwind(), must be string or object');return this.append.apply(this,t)};Ze.prototype.replaceRoot=function(e){let t;if(typeof e==="string")t=e.startsWith("$")?e:"$"+e;else t=e;return this.append({$replaceRoot:{newRoot:t}})};Ze.prototype.count=function(e){return this.append({$count:e})};Ze.prototype.sortByCount=function(e){if(e&&typeof e==="object")return this.append({$sortByCount:e});else if(typeof e==="string")return this.append({$sortByCount:e[0]==="$"?e:"$"+e});else throw TypeError('Invalid arg "'+e+'" to sortByCount(), must be string or object')};Ze.prototype.lookup=function(e){return this.append({$lookup:e})};Ze.prototype.graphLookup=function(e){let t={};if(e){if(!Hh.isObject(e))throw TypeError("Invalid graphLookup() argument. Must be an object.");Hh.mergeClone(t,e);let r=t.startWith;if(r&&typeof r==="string")t.startWith=t.startWith.startsWith("$")?t.startWith:"$"+t.startWith}return this.append({$graphLookup:t})};Ze.prototype.sample=function(e){return this.append({$sample:{size:e}})};Ze.prototype.sort=function(e){let t={};if(efe(e)==="Object"){let r=["desc","descending",-1];Object.keys(e).forEach(function(n){if(e[n]instanceof Object&&e[n].$meta){t[n]=e[n];return}t[n]=r.indexOf(e[n])===-1?1:-1})}else if(arguments.length===1&&typeof e==="string")e.split(/\s+/).forEach(function(r){if(!r)return;let n=r[0]==="-"?-1:1;if(n===-1)r=r.substring(1);t[r]=n});else throw TypeError("Invalid sort() argument. Must be a string or object.");return this.append({$sort:t})};Ze.prototype.unionWith=function(e){return this.append({$unionWith:e})};Ze.prototype.read=function(e,t){return sfe.call(this,e,t),this};Ze.prototype.readConcern=function(e){return ife.call(this,e),this};Ze.prototype.redact=function(e,t,r){if(arguments.length===3){if(typeof t==="string"&&!SW.has(t)||typeof r==="string"&&!SW.has(r))throw new Os("If thenExpr or elseExpr is string, it must be either $$DESCEND, $$PRUNE or $$KEEP");e={$cond:{if:e,then:t,else:r}}}else if(arguments.length!==1)throw TypeError("Invalid arguments");return this.append({$redact:e})};Ze.prototype.explain=async function(t){if(typeof t==="function"||typeof arguments[1]==="function")throw new Os("Aggregate.prototype.explain() no longer accepts a callback");let r=this._model;if(!this._pipeline.length)throw new Os("Aggregate has empty pipeline");Sw(this._pipeline,this._model.schema);let n=K_(this.options,"pre"),s=K_(this.options,"post"),{middleware:i,...o}=this.options??{};try{await r.hooks.execPre("aggregate",this,[],{filter:n})}catch(c){return await r.hooks.execPost("aggregate",this,[null],{error:c,filter:s})}let u=await r.collection.aggregate(this._pipeline,o);if(t==null)t=!0;let a=null;try{a=await u.explain(t)}catch(c){return await r.hooks.execPost("aggregate",this,[null],{error:c,filter:s})}return await r.hooks.execPost("aggregate",this,[a],{error:null,filter:s}),a};Ze.prototype.allowDiskUse=function(e){return this.options.allowDiskUse=e,this};Ze.prototype.hint=function(e){return this.options.hint=e,this};Ze.prototype.session=function(e){if(e==null)delete this.options.session;else this.options.session=e;return this};Ze.prototype.option=function(e){for(let t in e)this.options[t]=e[t];return this};Ze.prototype.cursor=function(e){if(this._optionsForExec(),Hh.hasUserDefinedProperty(e,"middleware")){let{middleware:t,...r}=e;this.options.middleware=t,e=r}return this.options.cursor=e||{},new wW(this)};Ze.prototype.collation=function(e){return this.options.collation=e,this};Ze.prototype.facet=function(e){return this.append({$facet:e})};Ze.prototype.search=function(e){return this.append({$search:e})};Ze.prototype.pipeline=function(){return this._pipeline};Ze.prototype.pipelineForUnionWith=function(){for(let t of this._pipeline)if(t?.$out!=null||t?.$merge!=null)throw new Os("Aggregate pipeline for $unionWith cannot include `$out` or `$merge` stages");return this._pipeline};Ze.prototype.exec=async function(){if(!this._model&&!this._connection)throw new Os("Aggregate not bound to any Model");if(typeof arguments[0]==="function")throw new Os("Aggregate.prototype.exec() no longer accepts a callback");if(this._connection){if(!this._pipeline.length)throw new Os("Aggregate has empty pipeline");this._optionsForExec();let s=this;return OW(async function(){return await(await s._connection.client.db().aggregate(s._pipeline,s.options)).toArray()},()=>({operation:"aggregate",database:s._connection.name,serverAddress:s._connection.host,serverPort:s._connection.port,args:{pipeline:s._pipeline,options:s.options}}))}let t=this._model,r=this._model.collection;if(Qhe(this.options,t.db.options,t.base.options),Xhe(this.options,t.db.options,t.base.options),this._optionsForExec(),this.options?.cursor)return new wW(this);Sw(this._pipeline,this._model.schema),tfe(this._pipeline);let n=this;return OW(async function(){let i=K_(n.options,"pre"),o=K_(n.options,"post");try{await t.hooks.execPre("aggregate",n,[],{filter:i})}catch(l){return await t.hooks.execPost("aggregate",n,[null],{error:l,filter:o})}if(!n._pipeline.length)throw new Os("Aggregate has empty pipeline");let{middleware:u,...a}=Zhe(n.options||{}),c;try{c=await(await r.aggregate(n._pipeline,a)).toArray()}catch(l){return await t.hooks.execPost("aggregate",n,[null],{error:l,filter:o})}return await t.hooks.execPost("aggregate",n,[c],{error:null,filter:o}),c},()=>({operation:"aggregate",collection:r.name,database:t.db?.name,serverAddress:t.db?.host,serverPort:t.db?.port,args:{pipeline:n._pipeline,options:n.options}}))};Ze.prototype.then=function(e,t){return this.exec().then(e,t)};Ze.prototype.catch=function(e){return this.exec().then(null,e)};Ze.prototype.finally=function(e){return this.exec().finally(e)};Ze.prototype[Symbol.asyncIterator]=function(){return this.cursor({useMongooseAggCursor:!0}).transformNull()._transformForAsyncIterator()};/*!
952
+ * Helpers
953
+ */function ofe(e){if(typeof e!=="object"||e===null)return!1;let t=Object.keys(e);return t.length===1&&t[0][0]==="$"}Ze._prepareDiscriminatorPipeline=Sw;/*!
954
+ * Exports
955
+ */CW.exports=Ze});var DW=g(function(e6e,bW){var ufe=ar();class Cw{constructor(e){if(e==null)return;Object.assign(this,ufe(e))}}Cw.prototype.__subdocs=null;bW.exports=Cw});var MW=g(function(t6e,TW){TW.exports=function e(t,r){let n=Object.keys(r.paths),s=n.length;for(let i=0;i<s;++i){let o="",u=n[i],a=r.paths[u],c=a.splitPath(),l=c.length,f=t;for(let h=0;h<l;++h){if(f==null)break;let d=c[h];if(o+=(!o.length?"":".")+d,h===l-1){if(typeof f[d]<"u"){if(a.$isSingleNested)e(f[d],a.schema);else if(a.$isMongooseDocumentArray&&Array.isArray(f[d]))f[d].forEach((m)=>e(m,a.schema));break}let p=a.getDefault(t,!1,{skipCast:!0});if(typeof p<"u"){if(f[d]=p,a.$isSingleNested)e(p,a.schema);else if(a.$isMongooseDocumentArray&&Array.isArray(p))p.forEach((m)=>e(m,a.schema))}}else{if(f[d]==null)f[d]={};f=f[d]}}}}});var Dw=g(function(r6e,PW){PW.exports=bw;function bw(e,t=new WeakSet,r=!1){if(t.has(e))return;t.add(e);for(let n of Object.keys(e.paths)){let s=e.paths[n];if(!s.schema)continue;if(bw(s.schema,t),!s.schema._applyDiscriminators)continue;if(s._appliedDiscriminators&&!r)continue;for(let i of s.schema._applyDiscriminators.keys()){let{schema:o,options:u}=s.schema._applyDiscriminators.get(i);bw(o,t),s.discriminator(i,o,r?{...u,overwriteExisting:!0}:u)}s._appliedDiscriminators=!0}}});var NW=g(function(n6e,FW){var{buildMiddlewareFilter:BW,middlewareFiltersFromLastArg:afe}=vu();/*!
956
+ * ignore
957
+ */FW.exports=Jd;/*!
958
+ * ignore
959
+ */Jd.middlewareFunctions=["deleteOne","remove","save","updateOne","validate","init"];/*!
960
+ * ignore
961
+ */var cfe=new Set(Jd.middlewareFunctions.flatMap((e)=>[e,`$__${e}`]));function Jd(e,t,r){r=r||{};let n={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0,contextParameter:!0},s=r.decorateDoc?e:e.prototype;e.$appliedHooks=!0;for(let c of Object.keys(t.paths)){let l=t.paths[c],f=null,h=Tw(l);if(h)f=h.childModel,l=h.type;else continue;if(f.$appliedHooks)continue;if(Jd(f,l.schema,{...r,decorateDoc:!1,isChildSchema:!0}),f.discriminators!=null){let d=Object.keys(f.discriminators);for(let p of d)Jd(f.discriminators[p],f.discriminators[p].schema,r)}}let i=t._getDocumentMiddleware(e.prototype.$isSubdocument);e._middleware=i;let o=s.$__init;if(i.hasHooks("init"))s.$__init=i.createWrapperSync("init",o,null,{...n,getOptions:(c)=>{let l=c[1];return{pre:{filter:BW(l,"pre")},post:{filter:BW(l,"post")}}}});else s.$__init=o;let u=Object.keys(t.methods),a=Object.assign({},n,{checkForPromise:!0});for(let c of u){if(cfe.has(c))continue;if(!i.hasHooks(c))continue;let l=s[c];s[`$__${c}`]=s[c];let f=l.supportsMiddlewareOption===!0?{...a,getOptions:afe}:a;s[c]=i.createWrapper(c,l,null,f)}}function Tw(e){if(e.$isSingleNested||e.$isMongooseDocumentArray)return{childModel:e.Constructor,type:e};if(e.instance==="Array"){let t=e.getEmbeddedSchemaType();if(t)return Tw(t)}if(e.instance==="Map"){let t=e.getEmbeddedSchemaType();if(t)return Tw(t)}return null}});var $W=g(function(s6e,RW){var lfe=Dr(),IW=be();RW.exports=function e(t,r){let n=Mw();function s(i,o){Object.defineProperty(t.prototype,i,{get:function(){let u={};for(let a in o.methods[i])u[a]=o.methods[i][a].bind(this);return u},configurable:!0})}for(let i of Object.keys(r.methods)){let o=r.methods[i];if(Object.hasOwn(r.tree,i))throw Error('You have a method and a property in your schema both named "'+i+'"');if(typeof o==="function"&&n.prototype[i]===o){delete r.methods[i];continue}if(r.reserved[i]&&!lfe(r,`methodOptions.${i}.suppressWarning`,!1))IW.warn(`mongoose: the method name "${i}" is used by mongoose internally, overwriting it may cause bugs. If you're sure you know what you're doing, you can suppress this error by using \`schema.method('${i}', fn, { suppressWarning: true })\`.`);if(typeof o==="function")t.prototype[i]=o;else s(i,r)}t.$appliedMethods=!0;for(let i of Object.keys(r.paths)){let o=r.paths[i];if(o.$isSingleNested&&!o.Constructor.$appliedMethods)e(o.Constructor,o.schema);if(o.$isMongooseDocumentArray&&!o.Constructor.$appliedMethods)e(o.Constructor,o.schema)}}});var kW=g(function(i6e,xW){var vW=g4(),hfe=Uc(),ffe=v_(),Q_=be().isPOJO;xW.exports=function(t,r,n){if(r==null)return t;if(t==null)return t;let s=null;if(ffe(r))s=!1;else if(hfe(r))s=!0;if(s==null)return t;else if(s)return n=n||vW(r),Y_(t,r,n);else return n=n||vW(r),J_(t,r,n)};function Y_(e,t,r,n,s){if(e==null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>Y_(o,t,r,n,s));let i={...e};n=s?n||{}:t;for(let o of Object.keys(i)){let u=s?s+"."+o:o;if(Object.hasOwn(t,u)||Object.hasOwn(n,o))if(Q_(t[u])||Q_(n[o]))i[o]=Y_(i[o],t,r,n[o],u);else delete i[o];else if(r[u])i[o]=Y_(i[o],t,r,n[o],u)}return i}function J_(e,t,r,n,s){if(e==null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>J_(o,t,r,n,s));let i={...e};n=s?n||{}:t;for(let o of Object.keys(i)){let u=s?s+"."+o:o;if(Object.hasOwn(t,u)||Object.hasOwn(n,o)){if(Q_(t[u])||Q_(n[o]))i[o]=J_(i[o],t,r,n[o],u);continue}else if(r[u])i[o]=J_(i[o],t,r,n[o],u);else delete i[o]}return i}});var jW=g(function(o6e,qW){qW.exports=function(t){let r=!1;for(let n of Object.keys(t))if(t[n]==="text")r=!0;return r}});var UW=g(function(u6e,LW){var dfe=jW();LW.exports=function(t,r,n){if(dfe(t))return;if(Object.hasOwn(n,"collation")&&!Object.hasOwn(r,"collation"))r.collation=n.collation}});var zW=g(function(a6e,VW){var{middlewareFiltersFromLastArg:pfe}=vu(),{queryMiddlewareFunctions:mfe,aggregateMiddlewareFunctions:yfe,modelMiddlewareFunctions:gfe,documentMiddlewareFunctions:_fe}=md(),Efe=Array.from(new Set([...mfe,...yfe,...gfe,..._fe]));VW.exports=function(t,r,n){r=r.filter((s)=>{if(Efe.indexOf(s.name)!==-1)return!!s.model;return s.model!==!1});for(let s of Object.keys(n))if(r.hasHooks(s)){let i=t[s],o=i.supportsMiddlewareOption===!0?{getOptions:pfe}:void 0;t[s]=r.createWrapper(s,i,null,o)}}});var HW=g(function(c6e,WW){WW.exports=function(t,r){for(let n in r.statics)t[n]=r.statics[n]}});var ZW=g(function(l6e,XW){var KW=Ag(),GW=ii(),YW=be();XW.exports=JW;function JW(e,t,r){if(t==null)return t;return Afe(e,t,r),QW(e,t,r)}function Afe(e,t,r){for(let n of e.childSchemas){let s=n.model.path,i=n.schema;if(!s)continue;let o=GW.get(s,t);if(o==null||Array.isArray(o)&&o.flat(1/0).length===0)continue;JW(i,o,r)}}function QW(e,t,r){if(t==null||typeof t!=="object")return;if(Array.isArray(t)){for(let u of t)QW(e,u,r);return}if(e.discriminators&&YW.hasOwnKeys(e.discriminators))for(let u of Object.keys(e.discriminators)){let a=e.discriminators[u],c=a.discriminatorMapping.key,l=a.discriminatorMapping.value;if(t[c]==l){e=a;break}}let n=KW(e.options.timestamps,"createdAt"),s=KW(e.options.timestamps,"updatedAt"),i=r?.currentTime,o=null;if(i!=null)o=i();else if(e.base?.now)o=e.base.now();else o=new Date;if(n&&t[n]==null&&!r?.isUpdate)t[n]=o;if(s)t[s]=o}});var sH=g(function(h6e,nH){var eH=ii(),tH=be();nH.exports=rH;function rH(e,t,r){if(t==null)return t;let n=r,s=null;if(Array.isArray(r)){n=[],s=[];for(let i of r)if(i.length===1)s.push(i[0]);else n.push(i)}return Ofe(e,t,n),Pw(e,t,s)}function Ofe(e,t,r){let n=!1;for(let s of e.childSchemas){let i=s.model.path,o=s.schema;if(!i)continue;let u=eH.get(i,t);if(u==null||Array.isArray(u)&&u.flat(1/0).length===0)continue;let a=null;if(Array.isArray(r)){a=[];for(let c of r)if(c[0]==i)a.push(c.slice(1));if(a.length===0)continue}rH(o,u,a),n=!0}if(r?.length&&!n)Pw(e,t,r)}function Pw(e,t,r){if(t==null||typeof t!=="object")return;if(Array.isArray(t)){for(let n of t)Pw(e,n,r);return}if(e.discriminators&&tH.hasOwnKeys(e.discriminators))for(let n of Object.keys(e.discriminators)){let s=e.discriminators[n],i=s.discriminatorMapping.key,o=s.discriminatorMapping.value;if(t[i]==o){e=s;break}}if(r==null)r=Object.keys(e.virtuals);for(let n of r){if(e.virtuals[n]==null)continue;let s=e.virtuals[n],i=Array.isArray(n)?n:n.indexOf(".")===-1?[n]:n.split("."),o=t;for(let c=0;c<i.length-1;++c)o[i[c]]=i[c]in o?o[i[c]]:{},o=o[i[c]];let u=s.applyGetters(o[i[i.length-1]],t);if((s.options?.ref||s.options?.refPath)&&u===void 0)if(s.options.justOne)u=null;else u=[];o[i[i.length-1]]=u}}});var X_=g(function(f6e,iH){iH.exports=function e(t){if(!(this instanceof e))return new e(t);return this.val=t,this}});var Qd=g(function(d6e,oH){/*!
962
+ * ignore
963
+ */oH.exports=new WeakMap});var lH=g(function(p6e,cH){var Sfe=ar(),eE=Qd(),wfe=de().modelSymbol,uH=be();cH.exports=aH;var Z_=Symbol("mongoose#assignRawDocsToIdStructure#hasArray");function aH(e,t,r,n,s){let i=[],o=n.isVirtual&&n.justOne&&e.length>1?!1:n.sort&&e.length>1,u=n.$nullIfNotFound,a,c,l;if(uH.isMongooseArray(e))e=e.__array;let f=0,h=e.length;if(o&&s&&n[Z_]===void 0){n[Z_]=!1;for(let d in r)if(Array.isArray(r[d])){n[Z_]=!0;break}}for(f=0;f<h;++f){if(l=e[f],Array.isArray(l)){aH(l,t,r,n,!0),i.push(l);continue}if(l===null&&o===!1){i.push(l);continue}if(c=String(l),a=t[c],n.clone&&a!=null)if(n.lean){let d=eE.get(a);a=Sfe(a),eE.set(a,d)}else a=a.constructor.hydrate(a._doc);if(s)if(a)if(o){let d=r[c];if(n[Z_])i.push(a);else i[d]=a}else i.push(a);else if(l?.[wfe]!=null)i.push(l);else i.push(n.retainNullValues||u?null:l);else i[f]=a||null}if(e.length=0,i.length)i.forEach(function(d,p){e[p]=d})}});var Bw=g(function(m6e,hH){hH.exports=tE;/*!
964
+ * ignore
965
+ */function tE(e,t){if(e.virtuals[t])return{virtual:e.virtuals[t],path:void 0};let r=t.split("."),n="",s="";for(let i=0;i<r.length;++i){if(n+=(n.length>0?".":"")+r[i],e.virtuals[n]){if(i===r.length-1)return{virtual:e.virtuals[n],path:s};continue}if(e.nested[n])continue;if(e.paths[n]&&e.paths[n].schema){e=e.paths[n].schema;let o=r.slice(i+1).join(".");if(e.virtuals[o]){if(i===r.length-2)return{virtual:e.virtuals[o],nestedSchemaPath:[s,n].filter((u)=>!!u).join(".")};continue}if(i+1<r.length&&e.discriminators)for(let u of Object.keys(e.discriminators)){let a=tE(e.discriminators[u],o);if(a!=null){let c=[s,n,a.nestedSchemaPath].filter((l)=>!!l).join(".");return{virtual:a.virtual,nestedSchemaPath:c}}}s+=(s.length>0?".":"")+n,n="";continue}else if(e.paths[n]?.$isSchemaMap&&e.paths[n].$__schemaType?.schema){e=e.paths[n].$__schemaType.schema,++i;let o=r.slice(i+1).join(".");if(e.virtuals[o]){if(i===r.length-2)return{virtual:e.virtuals[o],nestedSchemaPath:[s,n,"$*"].filter((u)=>!!u).join(".")};continue}if(i+1<r.length&&e.discriminators)for(let u of Object.keys(e.discriminators)){let a=tE(e.discriminators[u],o);if(a!=null){let c=[s,n,a.nestedSchemaPath,"$*"].filter((l)=>!!l).join(".");return{virtual:a.virtual,nestedSchemaPath:c}}}s+=(s.length>0?".":"")+"$*"+n,n=""}if(e.discriminators)for(let o of Object.keys(e.discriminators)){let u=tE(e.discriminators[o],t);if(u)return u}return null}}});var dH=g(function(rE,fH){(function(e,t){typeof rE==="object"&&typeof fH<"u"?t(rE):typeof define==="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.sift={}))})(rE,function(e){var t=function(w,b){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,k){T.__proto__=k}||function(T,k){for(var Q in k)if(Object.prototype.hasOwnProperty.call(k,Q))T[Q]=k[Q]},t(w,b)};function r(w,b){if(typeof b!=="function"&&b!==null)throw TypeError("Class extends value "+String(b)+" is not a constructor or null");t(w,b);function T(){this.constructor=w}w.prototype=b===null?Object.create(b):(T.prototype=b.prototype,new T)}typeof SuppressedError==="function"&&SuppressedError;var n=function(w){var b="[object "+w+"]";return function(T){return s(T)===b}},s=function(w){return Object.prototype.toString.call(w)},i=function(w){if(w instanceof Date)return w.getTime();else if(u(w))return w.map(i);else if(w&&typeof w.toJSON==="function")return w.toJSON();return w},o=function(w){return w==null?null:w},u=n("Array"),a=n("Object"),c=n("Function"),l=function(w,b){return w.hasOwnProperty(b)&&!c(w[b])},f=function(w,b){return Array.isArray(b)&&!(w in b)&&isNaN(Number(w))},h=function(w,b){var T=w[b],k=Object.prototype[b];return k===void 0||T!==k||Object.prototype.hasOwnProperty.call(w,b)?T:void 0},d=function(w){return w&&(w.constructor===Object||w.constructor===Array||w.constructor.toString()==="function Object() { [native code] }"||w.constructor.toString()==="function Array() { [native code] }")&&!h(w,"toJSON")},p=function(w,b){if(w==null&&w==b)return!0;if(w===b)return!0;if(Object.prototype.toString.call(w)!==Object.prototype.toString.call(b))return!1;if(u(w)){if(w.length!==b.length)return!1;for(var T=0,k=w.length;T<k;T++)if(!p(w[T],b[T]))return!1;return!0}else if(a(w)){if(Object.keys(w).length!==Object.keys(b).length)return!1;for(var Q in w){if(!Object.prototype.hasOwnProperty.call(w,Q))continue;if(!p(w[Q],b[Q]))return!1}return!0}return!1},m=function(w,b,T,k,Q,fe,_e){if(_e===void 0)_e=!0;var et=b[k];if(u(w)&&isNaN(Number(et))&&!l(w,et)){for(var Qr=0,kr=w.length;Qr<kr;Qr++)if(!m(w[Qr],b,T,k,Qr,w,_e))return!1}if(k===b.length||w==null)return T(w,Q,fe,k===0,k===b.length&&(k>0||_e));return m(w[et],b,T,k+1,et,w)},_=function(){function w(b,T,k,Q){this.params=b,this.owneryQuery=T,this.options=k,this.name=Q,this.init()}return w.prototype.init=function(){},w.prototype.reset=function(){this.done=!1,this.keep=!1},w}(),y=function(w){r(b,w);function b(T,k,Q,fe){var _e=w.call(this,T,k,Q)||this;return _e.children=fe,_e}return b.prototype.reset=function(){this.keep=!1,this.done=!1;for(var T=0,k=this.children.length;T<k;T++)this.children[T].reset()},b.prototype.childrenNext=function(T,k,Q,fe,_e){var et=!0,Qr=!0;for(var kr=0,tf=this.children.length;kr<tf;kr++){var io=this.children[kr];if(!io.done)io.next(T,k,Q,fe,_e);if(!io.keep)Qr=!1;if(io.done){if(!io.keep)break}else et=!1}this.done=et,this.keep=Qr},b}(_),E=function(w){r(b,w);function b(T,k,Q,fe,_e){var et=w.call(this,T,k,Q,fe)||this;return et.name=_e,et}return b}(y),C=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.next=function(T,k,Q,fe,_e){this.childrenNext(T,k,Q,fe,_e)},b}(y),D=function(w){r(b,w);function b(T,k,Q,fe,_e){var et=w.call(this,k,Q,fe,_e)||this;return et.keyPath=T,et.propop=!0,et._nextNestedValue=function(Qr,kr,tf,io,rG){return et.childrenNext(Qr,kr,tf,io,rG),!et.done},et}return b.prototype.next=function(T,k,Q,fe,_e){m(T,this.keyPath,this._nextNestedValue,0,k,Q,_e!==!1)},b}(y),A=function(w,b){if(w instanceof Function)return w;if(w instanceof RegExp)return function(k){var Q=typeof k==="string"&&w.test(k);return w.lastIndex=0,Q};var T=i(w);return function(k){return b(T,i(k))}},P=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){this._test=A(this.params,this.options.compare)},b.prototype.next=function(T,k,Q){if(!Array.isArray(Q)||Q.hasOwnProperty(k)){if(this._test(T,k,Q))this.done=!0,this.keep=!0}},b}(_),S=function(w,b,T){return new P(w,b,T)},B=function(w){return function(b,T,k,Q){return w(b,T,k,Q)}},q=function(w){return B(function(b,T,k,Q){var fe=typeof i(b),_e=w(b);return new P(function(et){var Qr=o(et);return typeof i(Qr)===fe&&_e(Qr)},T,k,Q)})},I=function(w,b,T,k){var Q=k.operations[w];if(!Q)Oe(w);return Q(b,T,k,w)},Oe=function(w){throw Error("Unsupported operation: ".concat(w))},Ne=function(w,b){for(var T in w){if(!Object.prototype.hasOwnProperty.call(w,T))continue;if(b.operations.hasOwnProperty(T)||T.charAt(0)==="$")return!0}return!1},ae=function(w,b,T,k,Q){if(Ne(b,Q)){var fe=G(b,T,Q),_e=fe[0],et=fe[1];if(et.length)throw Error("Property queries must contain only operations, or exact objects.");return new D(w,b,k,Q,_e)}return new D(w,b,k,Q,[new P(b,k,Q)])},sr=function(w,b,T){if(b===void 0)b=null;if(T===void 0)T={};var k=h(T,"compare"),Q=h(T,"operations"),fe={compare:k||p,operations:Object.assign({},Q||{})},_e=G(w,null,fe),et=_e[0],Qr=_e[1],kr=[];if(et.length)kr.push(new D([],w,b,fe,et));if(kr.push.apply(kr,Qr),kr.length===1)return kr[0];return new C(w,b,fe,kr)},G=function(w,b,T){var k=[],Q=[];if(!d(w))return k.push(new P(w,w,T)),[k,Q];for(var fe in w){if(!Object.prototype.hasOwnProperty.call(w,fe))continue;if(T.operations.hasOwnProperty(fe)){var _e=I(fe,w[fe],w,T);if(_e){if(!_e.propop&&b&&!T.operations[b])throw Error("Malformed query. ".concat(fe," cannot be matched against property."))}if(_e!=null)k.push(_e)}else if(fe.charAt(0)==="$")Oe(fe);else Q.push(ae(fe.split("."),w[fe],fe,w,T))}return[k,Q]},De=function(w){return function(b,T,k){return w.reset(),w.next(b,T,k),w.keep}},gt=function(w,b){if(b===void 0)b={};return De(sr(w,null,b))},Ss=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){this._test=A(this.params,this.options.compare)},b.prototype.reset=function(){w.prototype.reset.call(this),this.keep=!0},b.prototype.next=function(T,k,Q){if(!f(k,Q)&&this._test(T))this.done=!0,this.keep=!1},b}(_),Je=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){if(!this.params||typeof this.params!=="object")throw Error("Malformed query. $elemMatch must by an object.");this._queryOperation=sr(this.params,this.owneryQuery,this.options)},b.prototype.reset=function(){w.prototype.reset.call(this),this._queryOperation.reset()},b.prototype.next=function(T,k,Q){if(u(T)){for(var fe=0,_e=T.length;fe<_e;fe++){this._queryOperation.reset();var et=T[fe];this._queryOperation.next(et,fe,T,!1),this.keep=this.keep||this._queryOperation.keep}this.done=this.keep||!a(Q)}else this.done=!1,this.keep=!1},b}(_),vn=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){this._queryOperation=sr(this.params,this.owneryQuery,this.options)},b.prototype.reset=function(){w.prototype.reset.call(this),this._queryOperation.reset()},b.prototype.next=function(T,k,Q,fe,_e){this._queryOperation.next(T,k,Q,fe,_e),this.done=this._queryOperation.done,this.keep=!this._queryOperation.keep},b}(_),Ks=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){},b.prototype.next=function(T){if(u(T)&&T.length===this.params)this.done=!0,this.keep=!0},b}(_),Gs=function(w){if(w.length===0)throw Error("$and/$or/$nor must be a nonempty array")},Xu=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!1,T}return b.prototype.init=function(){var T=this;Gs(this.params),this._ops=this.params.map(function(k){return sr(k,null,T.options)})},b.prototype.reset=function(){this.done=!1,this.keep=!1;for(var T=0,k=this._ops.length;T<k;T++)this._ops[T].reset()},b.prototype.next=function(T,k,Q,fe,_e){var et=!1,Qr=!1;for(var kr=0,tf=this._ops.length;kr<tf;kr++){var io=this._ops[kr];if(io.next(T,k,Q,fe,_e),io.keep){et=!0,Qr=io.keep;break}}this.keep=Qr,this.done=et},b}(_),GK=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!1,T}return b.prototype.next=function(T,k,Q,fe,_e){w.prototype.next.call(this,T,k,Q,fe,_e),this.keep=!this.keep},b}(Xu),nC=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.init=function(){var T=this,k=Array.isArray(this.params)?this.params:[this.params];this._testers=k.map(function(Q){if(Ne(Q,T.options))throw Error("cannot nest $ under ".concat(T.name.toLowerCase()));return A(Q,T.options.compare)})},b.prototype.next=function(T,k,Q){if(f(k,Q))return;var fe=!1,_e=!1;for(var et=0,Qr=this._testers.length;et<Qr;et++){var kr=this._testers[et];if(kr(T)){fe=!0,_e=!0;break}}this.keep=_e,this.done=fe},b}(_),YK=function(w){r(b,w);function b(T,k,Q,fe){var _e=w.call(this,T,k,Q,fe)||this;return _e.propop=!0,_e._in=new nC(T,k,Q,fe),_e}return b.prototype.next=function(T,k,Q,fe){if(this._in.next(T,k,Q),this._in.keep)this.keep=!1,this.done=!0},b.prototype.reset=function(){w.prototype.reset.call(this),this.keep=!0,this._in.reset()},b}(_),JK=function(w){r(b,w);function b(){var T=w!==null&&w.apply(this,arguments)||this;return T.propop=!0,T}return b.prototype.reset=function(){w.prototype.reset.call(this),this.keep=!this.params},b.prototype.next=function(T,k,Q,fe,_e){if(_e&&(Q==null?T!==void 0:Object.prototype.hasOwnProperty.call(Q,k)))this.done=!0,this.keep=Boolean(this.params)},b}(_),QK=function(w){r(b,w);function b(T,k,Q,fe){var _e=w.call(this,T,k,Q,T.map(function(et){return sr(et,k,Q)}),fe)||this;return _e.propop=!1,Gs(T),_e}return b.prototype.next=function(T,k,Q,fe,_e){this.childrenNext(T,k,Q,fe,_e)},b}(E),XK=function(w){r(b,w);function b(T,k,Q,fe){var _e=w.call(this,T,k,Q,T.map(function(et){return sr(et,k,Q)}),fe)||this;return _e.propop=!0,_e}return b.prototype.next=function(T,k,Q,fe,_e){this.childrenNext(T,k,Q,fe,_e)},b}(E),sC=function(w,b,T){return new P(w,b,T)},iC=function(w,b,T,k){return new Ss(w,b,T,k)},oC=function(w,b,T,k){return new Xu(w,b,T,k)},uC=function(w,b,T,k){return new GK(w,b,T,k)},aC=function(w,b,T,k){return new Je(w,b,T,k)},cC=function(w,b,T,k){return new YK(w,b,T,k)},lC=function(w,b,T,k){return new nC(w,b,T,k)},hC=q(function(w){return function(b){return b!=null&&b<w}}),fC=q(function(w){return function(b){return b===w||b<=w}}),dC=q(function(w){return function(b){return b!=null&&b>w}}),pC=q(function(w){return function(b){return b===w||b>=w}}),mC=function(w,b,T){var k=w[0],Q=w[1];return new P(function(fe){return i(fe)%k===Q},b,T)},yC=function(w,b,T,k){return new JK(w,b,T,k)},gC=function(w,b,T){return new P(new RegExp(w,Object.prototype.hasOwnProperty.call(b,"$options")?b.$options:void 0),b,T)},_C=function(w,b,T,k){return new vn(w,b,T,k)},EC={number:function(w){return typeof w==="number"},string:function(w){return typeof w==="string"},bool:function(w){return typeof w==="boolean"},array:function(w){return Array.isArray(w)},null:function(w){return w===null},timestamp:function(w){return w instanceof Date}},AC=function(w,b,T){return new P(function(k){if(typeof w==="string"){if(!Object.prototype.hasOwnProperty.call(EC,w))throw Error("Type alias does not exist");return EC[w](k)}return k!=null?k instanceof w||k.constructor===w:!1},b,T)},OC=function(w,b,T,k){return new QK(w,b,T,k)},SC=function(w,b,T,k){return new XK(w,b,T,k)},wC=function(w,b,T){return new Ks(w,b,T,"$size")},CC=function(){return null},ZK=function(){try{return Boolean(process.env.CSP_ENABLED)}catch(w){return!1}},bC=function(w,b,T){var k;if(c(w))k=w;else if(!ZK())k=Function("obj","return "+w);else throw Error('In CSP mode, sift does not support strings in "$where" condition');return new P(function(Q){return k.bind(Q)(Q)},b,T)},eG=Object.freeze({__proto__:null,$Size:Ks,$all:SC,$and:OC,$elemMatch:aC,$eq:sC,$exists:yC,$gt:dC,$gte:pC,$in:lC,$lt:hC,$lte:fC,$mod:mC,$ne:iC,$nin:cC,$nor:uC,$not:_C,$options:CC,$or:oC,$regex:gC,$size:wC,$type:AC,$where:bC}),DC=function(w,b,T){if(T===void 0)T={};return sr(w,b,{compare:h(T,"compare"),operations:Object.assign({},eG,h(T,"operations")||{})})},tG=function(w,b){if(b===void 0)b={};var T=DC(w,null,b);return De(T)};e.$Size=Ks,e.$all=SC,e.$and=OC,e.$elemMatch=aC,e.$eq=sC,e.$exists=yC,e.$gt=dC,e.$gte=pC,e.$in=lC,e.$lt=hC,e.$lte=fC,e.$mod=mC,e.$ne=iC,e.$nin=cC,e.$nor=uC,e.$not=_C,e.$options=CC,e.$or=oC,e.$regex=gC,e.$size=wC,e.$type=AC,e.$where=bC,e.EqualsOperation=P,e.createDefaultQueryOperation=DC,e.createEqualsOperation=S,e.createOperationTester=De,e.createQueryOperation=sr,e.createQueryTester=gt,e.default=tG,Object.defineProperty(e,"__esModule",{value:!0})})});var mH=g(function(y6e,Fw){var pH=dH();Fw.exports=pH.default;Object.assign(Fw.exports,pH)});var AH=g(function(g6e,EH){var Cfe=Mg(),bfe=X_(),Dfe=lH(),Nw=Dr(),Tfe=rh(),Mfe=Bw(),nE=Qd(),Zd=Fn(),yH=mg(),Pfe=w4(),Kh=ii(),gH=mH().default,lc=be(),{populateModelSymbol:Bfe}=de();EH.exports=function(t){let r=Object.assign({},Nw(t,"allOptions.options.options"),Nw(t,"allOptions.options")),n=Object.assign({},t.options,r,{justOne:t.justOne,isVirtual:t.isVirtual});n.$nullIfNotFound=t.isVirtual;let s=t.populatedModel,i=[].concat(t.rawIds);t.allIds=[].concat(t.allIds),Dfe(t.rawIds,t.rawDocs,t.rawOrder,n);let{docs:o,rawIds:u,options:a}=t,c=t.count&&t.isVirtual,l,f=0;function h(d){if(++f,c)return d;if(d instanceof bfe)return d.val;if(d===void 0)return d;let p=t.allIds[l];if(t.path.endsWith(".$*"))return Xd(d,a,n,p);if(t.justOne===!0&&Array.isArray(d)){let m=[];for(let _ of d){let y=nE.get(_);if(y==null||y===s)m.push(_)}while(d.length>m.length)Array.prototype.pop.apply(d,[]);for(let _=0;_<m.length;++_)d[_]=m[_];return Xd(d[0],a,n,p)}else if(t.justOne===!1&&!Array.isArray(d))return Xd([d],a,n,p);else if(t.justOne===!0&&!Array.isArray(d)&&Array.isArray(p))return Xd(d,a,n,d==null?d:p[f-1]);return Xd(d,a,n,p)}for(l=0;l<o.length;++l){f=0;let d=t.path.endsWith(".$*")?t.path.slice(0,-3):t.path,p=Kh.get(d,o[l],yH);if(p==null&&!Mfe(t.originalModel.schema,d))continue;let m;if(c)m=Ffe(u[l]);else if(Array.isArray(t.match))m=Array.isArray(u[l])?u[l].filter((A)=>A==null||gH(t.match[l])(A)):[u[l]].filter((A)=>A==null||gH(t.match[l])(A))[0];else m=u[l];let _=t.originalModel.schema,y=Zd(o[l]),E=y?p instanceof Map:lc.isPOJO(p);if(E=E&&Nw(_._getSchema(d),"$isSchemaMap"),!t.isVirtual&&E){let A=p instanceof Map?Array.from(p.keys()):Object.keys(p);m=m.reduce((P,S,B)=>(P.set(A[B],S),P),new Map)}if(y&&Array.isArray(m)){for(let A of m)if(Zd(A))A.$__.parent=o[l]}else if(y&&Zd(m))m.$__.parent=o[l];if(t.isVirtual&&y){if(o[l].$populated(d,t.justOne?i[0]:i,t.allOptions),Array.isArray(m))m=m.map((A)=>A==null?void 0:A);Kh.set(d,m,o[l],function(P,S,B){if(arguments.length>=3)return P[S]=B,P[S];if(P instanceof Map&&S==="$*")return[...P.values()];return P[S]},h,!1);continue}let C=d.split("."),D=o[l];for(let A=0;A<C.length-1;++A){if(Array.isArray(D)&&!lc.isArrayIndex(C[A]))break;if(C[A]==="$*")break;if(D[C[A]]==null){let P=C.slice(0,A+1).join("."),S=_._getSchema(P);if(m==null&&S?.$isMongooseArray)break;D[C[A]]={}}if(D=D[C[A]],typeof D!=="object")break}if(y){if(t.allOptions.options[Bfe]=t.allOptions.model,o[l].$populated(d,t.unpopulatedValues[l],t.allOptions.options),Zd(m))m.$__.wasPopulated={value:t.unpopulatedValues[l]};if(m instanceof Map&&!m.$isMongooseMap)m=new Cfe(m,d,o[l],o[l].schema.path(d).$__schemaType)}if(Kh.set(d,m,o[l],yH,h,!1),y)Pfe(o[l],[t.allOptions.options])}};function Ffe(e){if(Array.isArray(e)){if(e.some((t)=>Array.isArray(t)||t===null))return e.map((t)=>{if(t==null)return 0;if(Array.isArray(t))return t.filter((r)=>r!=null).length;return 1});return e.filter((t)=>t!=null).length}return e==null?0:1}function Xd(e,t,r,n){let s=typeof r.transform==="function",i=s?r.transform:(o)=>o;if(Array.isArray(e)){let o=[],u=e.length;for(let l=0;l<u;++l){let f=e[l],h=Array.isArray(n)?n[l]:n;if(!Iw(f)&&(!r.retainNullValues||f!=null)&&!s)continue;else if(!r.retainNullValues&&f==null)continue;else if(s)f=i(Iw(f)?f:null,h);if(_H(f,t),o.push(f),t.originalLimit&&o.length>=t.originalLimit)break}let a=o.length;while(e.length>a)Array.prototype.pop.apply(e,[]);let c=0;if(lc.isMongooseArray(e))for(c=0;c<a;++c)e.set(c,o[c],!0);else for(c=0;c<a;++c)e[c]=o[c];return e}if(Iw(e)||lc.isPOJO(e))return _H(e,t),i(e,n);if(e instanceof Map)return e;if(r.justOne===!1)return[];return e==null?i(e,n):i(null,n)}function _H(e,t){if(e!=null&&t.excludeId)if(typeof e.$__setValue==="function")delete e._doc._id;else delete e._id}function Iw(e){if(e==null)return!1;return Array.isArray(e)||Tfe(e,"$isMongooseMap")||Zd(e)||nE.has(e)}});var SH=g(function(_6e,OH){var Nfe=jc();OH.exports=function(t){if(t instanceof Nfe)return Object.keys(t.errors).map((r)=>({message:t.errors[r].message,path:r.split(".").map((s)=>{let i=+s;return Number.isInteger(i)&&String(i)===s?i:s})}));return[{message:t.message}]}});var Rw=g(function(E6e,bH){var Ife=X_(),Rfe=b4(),{trusted:sE}=nh(),wH=j_();bH.exports=function(t,r,n,s,i){let o=$fe(r);if(n.size===1){let u=Array.from(n)[0],a=s.schema.path(u);if(u!=="_id"||!o._id)t=CH(t,a,i),o[u]=sE({$in:t});else if(u==="_id"&&o._id){let l=wH(o[u])?o[u]:{$eq:o[u]};o[u]={...sE({$in:t}),...l}}let c=Rfe(u);for(let l=0;l<c.length-1;++l){let f=c[l];if(o[f]!=null&&o[f].$elemMatch!=null){o[f]={...o[f],$elemMatch:{...o[f].$elemMatch,[u.slice(f.length+1)]:sE({$in:t})}},delete o[u];break}}}else{let u=[];if(Array.isArray(o.$or))o.$and=[{$or:o.$or},{$or:u}],delete o.$or;else o.$or=u;for(let a of n)if(a!=="_id"||!o._id){let c=s.schema.path(a);t=CH(t,c,i),u.push({[a]:{$in:t}})}else if(a==="_id"&&o._id){let c=wH(o[a])?o[a]:{$eq:o[a]};o[a]={...sE({$in:t}),...c}}}return o};function CH(e,t,r){if(e=e.filter((n)=>!(n instanceof Ife)),!r)return e;return e.filter((n)=>{try{return t.cast(n),!0}catch{return!1}})}function $fe(e){if(Array.isArray(e)){if(e.length>1)return{$or:[].concat(e.map((t)=>Object.assign({},t)))};return Object.assign({},e[0])}return Object.assign({},e)}});var TH=g(function(A6e,DH){DH.exports=function(t,r,n){if(t.length===0)return n();let s=t.length,i=null;for(let o of t)r(o,function(u){if(i!=null)return;if(u!=null)return i=u,n(i);if(--s<=0)return n()})}});var BH=g(function(O6e,PH){/*!
966
+ * ignore
967
+ */var MH=Eh(),vfe=Dr(),xfe=Vi(),kfe=Fn(),iE=Qd(),ro=ii(),qfe=de().populateModelSymbol;PH.exports=function e(t,r,n,s,i){let o=r.path(s),u=n;if(o)return o;let a=r.discriminatorMapping?.key;if(a&&t!=null){if(n?.[a]!=null)r=xfe(t.discriminators,n[a])?.schema||r;else if(t.discriminators!=null)return Object.keys(t.discriminators).reduce((l,f)=>{let h=t.discriminators[f];return l.concat(e(h,h.schema,null,s))},[])}function c(l,f,h,d){let p=l.length+1,m,_;while(p--){if(_=l.slice(0,p).join("."),m=f.path(_),m==null)continue;if(m.embeddedSchemaType||m.schema){if(m.embeddedSchemaType instanceof MH)return m.embeddedSchemaType;let C=null;if(m.schema?.discriminators!=null){let D=m.schema.discriminators,A=_+"."+m.schema.options.discriminatorKey,P=h?ro.get(A,h)||[]:[];C=Object.keys(D).reduce(function(S,B){let q=D[B].discriminatorMapping.value;if(n==null||P.indexOf(B)!==-1||P.indexOf(q)!==-1)S.push(D[B]);return S},[])}if(p!==l.length&&m.schema){let D;if(l[p]==="$"){if(p+1===l.length)return m;if(D=c(l.slice(p+1),f,h?ro.get(_,h):null,d.concat(l.slice(0,p))),D)D.$parentSchemaDocArray=D.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m);return D}if(C!=null&&C.length>0){D=[];for(let A of C){let P=c(l.slice(p),A,h?ro.get(_,h):null,d.concat(l.slice(0,p)));if(P!=null){if(P.$parentSchemaDocArray=P.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m),P.$parentSchemaDocArray)D.$parentSchemaDocArray=P.$parentSchemaDocArray;D.push(P)}}return D}else{if(D=c(l.slice(p),m.schema,h?ro.get(_,h):null,d.concat(l.slice(0,p))),D)D.$parentSchemaDocArray=D.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m);return D}}else if(p!==l.length&&m.$isMongooseArray&&m.embeddedSchemaType.$isMongooseArray){let D=m;while(D.$isMongooseArray&&!D.$isMongooseDocumentArray)D=D.embeddedSchemaType;let A=c(l.slice(p),D.schema,null,d.concat(l.slice(0,p)));if(A!=null)return A;if(D.schema.discriminators){let P=[];for(let S of Object.keys(D.schema.discriminators)){let B=D.schema.discriminators[S]||D.schema,q=c(l.slice(p),B,null,d.concat(l.slice(0,p)));if(q!=null)P.push(q)}if(P.length>0)return P}}}else if(m.$isSchemaMap&&m.$__schemaType instanceof MH)return m.$__schemaType;let y=d.concat([_]).join(".");if(kfe(u)&&u.$populated(y,!0)&&p<l.length){let C=u.$populated(y,!0).options[qfe];if(C!=null)return c(l.slice(p),C.schema,h?ro.get(_,h):null,d.concat(l.slice(0,p)))}let E=vfe(u,_);if(E!=null){let D=(Array.isArray(E)&&E.length>0?iE.get(E[0]):iE.get(E))?.schema??null;if(D!=null){let A=c(l.slice(p),D,h?ro.get(_,h):null,d.concat(l.slice(0,p)));if(A!=null)return A.$parentSchemaDocArray=A.$parentSchemaDocArray||(D.$isSingleNested?null:D),A}}return m}}i=i||s.split(".");for(let l=0;l<i.length;++l)if(i[l]==="$")i[l]="0";return c(i,r,n,[])}});var kH=g(function(S6e,xH){var jw=ni(),jfe=X_(),Lfe=ar(),To=Dr(),Ufe=oi(),Vfe=Vi(),zfe=Xn(),IH=iu(),FH=BH(),Wfe=Bw(),ep=Fn(),Lw=mg(),pu=ii(),tp=nO(),Pt=be(),xw=de().modelSymbol,$w=de().populateModelSymbol,kw=Ao().schemaMixedSymbol,Hfe=h4(),Kfe=new RegExp("\\.\\d+(?=\\.|$)"),Gfe=new RegExp("\\.\\d+(?=\\.|$)","g");xH.exports=function(t,r,n){let s,i=r.length,o=[],u=n.model?.modelName||n.model,a,c,l,f,h={},d=t.schema;if(n._localModel!=null&&n._localModel.schema.nested[n.path])return[];let p=Wfe(t.schema,n.path);if((p==null?null:p.virtual)!=null)return Jfe(t,r,n,p);let _=d.paths[n.path]?.splitPath()??n.path.split("."),y=FH(t,d,null,n.path,_);if(y=Array.isArray(y)?y:[y].filter((D)=>D!=null),!(n.strictPopulate===!1||n.options?.strictPopulate===!1)&&y.length===0&&n._localModel!=null)return new Hfe(n._fullPath||n.path);for(let D=0;D<i;D++){s=r[D];let A=null;if(ep(s)&&s.populated(n.path)){if((n.forceRepopulate??s.constructor.base.options.forceRepopulate)===!1)continue}let P=ep(s)?s.$__schema:d;if(a=FH(t,P,s,n.path,_),a!=null&&a.$isMongooseDocumentArray&&a.options.ref==null&&a.options.refPath==null)continue;if(a?.$parentSchemaDocArray&&To(n,"options.sort")!=null)return new jw("Cannot populate with `sort` on path "+n.path+" because it is a subproperty of a document array");l=null;let B=!1,q=null,I=null,Oe=null;if(a?.instance==="Embedded"){if(a.options.ref){let Je={localField:n.path+"._id",foreignField:"_id",justOne:!0},vn=C(s,a,u,t),Ks=pu.get(n.path,s),Gs=pu.get("_id",Ks);qw(t,o,h,vn.modelNames,n,Je,Gs,s,I,Ks)}continue}if(Array.isArray(a)){let Je=a;for(let vn of Je){let Ks,Gs;try{Gs=C(s,vn,u,t),Ks=Gs.modelNames,B=B||Gs.isRefPath,q=q||Gs.refPath,A=Gs.justOne}catch(Xu){return Xu}if(B&&!Gs.isRefPath)continue;if(!Ks)continue;l=l||[],f=f||new Set;for(let Xu of Ks)if(f.has(Xu)===!1)f.add(Xu),l.push(Xu)}}else{try{let Je=C(s,a,u,t);if(l=Je.modelNames,B=Je.isRefPath,q=q||Je.refPath,A=Je.justOne,I=To(a,"options.populate",null),B)Oe=l,l=Array.from(new Set(l))}catch(Je){return Je}if(!l)continue}let Ne={},ae=n.path,sr="_id";if("justOne"in n&&n.justOne!==void 0)A=n.justOne;else if(a&&!a[kw]){if(n.path.endsWith("."+a.path)||n.path===a.path)A=Array.isArray(a)?a.every((Je)=>!Je.$isMongooseArray):!a.$isMongooseArray}if(!l)continue;Ne.isVirtual=!1,Ne.justOne=A,Ne.localField=ae,Ne.foreignField=sr;let G=$H(s,ae,t,n,null,a),De=String(Pt.getValue(sr,s));n._docs[De]=Array.isArray(G)?G.slice():G;let gt=To(n,"match",null),Ss=typeof gt==="function";if(Ss)gt=gt.call(s,s);if(Vw(gt),Ne.match=gt,Ne.hasMatchFunction=Ss,Ne.isRefPath=B,Ne.modelNamesInOrder=Oe,B){let Je=typeof q==="string"?q.replace(Gfe,""):q;l=Qfe(s,d,Ne,n,Je,G)||l}try{qw(t,o,h,l,n,Ne,G,s,I)}catch(Je){return Je}}return o;function C(D,A,P,S){let B,q=!1,I=null,Oe=A;if(A?.instance==="Array")A=A.embeddedSchemaType;if(A?.$isSchemaMap)A=A.$__schemaType;let Ne=A?.options?.ref;if(c=A?.options?.refPath,A!=null&&A[kw]&&!Ne&&!c&&!P)return{modelNames:null};if(P)B=[P];else if(c!=null){if(typeof c==="function"){let ae=NH(c,D,A,n.path,d,n._queryProjection);B=ae.modelNames,c=ae.refPath}else B=tp(c,D,n.path,d,n._queryProjection);q=!0}else{let ae,sr,G,De,gt=S,Ss=S.schema.options.discriminatorKey;if(!A&&Ss&&(De=Pt.getValue(Ss,D))){let Je=Vfe(S.discriminators,De)||S;if(Je!=null)gt=Je;else try{gt=Uw(S.db,De)}catch(vn){return vn}if(G=gt.schema._getSchema(n.path),G?.embeddedSchemaType)G=G.embeddedSchemaType}else G=A;if(Oe&&Oe.path.endsWith(".$*"))I=!Oe.$isMongooseArray&&!Oe._arrayPath;else if(G!=null)I=!G.$isMongooseArray&&!G._arrayPath;if((ae=To(G,"options.ref"))!=null)if(G!=null&&typeof ae==="function"&&n.path.endsWith("."+G.path)){B=new Set;let Je=n.path.slice(0,n.path.length-G.path.length-1),vn=pu.get(Je,D,Lw),Ks=Array.isArray(vn)?Pt.array.flatten(vn):vn?[vn]:[];for(let Gs of Ks)B.add(vw(ae,Gs));if(Ks.length===0)B=[vw(ae,D)];else B=Array.from(B)}else ae=vw(ae,D),B=[ae];else if((sr=To(G,"options.refPath"))!=null)if(q=!0,typeof sr==="function"){let Je=NH(sr,D,G,n.path,d,n._queryProjection);B=Je.modelNames,sr=Je.refPath}else B=tp(sr,D,n.path,d,n._queryProjection)}if(!B)if(n._localModel==null)B=[S.modelName];else return{modelNames:B,justOne:I,isRefPath:q,refPath:c};if(!Array.isArray(B))B=[B];return{modelNames:B,justOne:I,isRefPath:q,refPath:c}}};function NH(e,t,r,n,s,i){let o=[],u=null,a=r?.path;if(a!=null&&n.length>a.length+1&&n.charAt(n.length-a.length-1)==="."&&n.slice(n.length-a.length)===a){let d=function(p,m,_){if(p==null)return;if(_>=f.length){h=!0;let A=m+"."+a,P=e.call(p,p,A);u=u||P,o.push(...Yfe(P,t,n,A,s,i));return}let y=f[_],E=p?._doc??p;if(y==="$*"){if(E instanceof Map){for(let[A,P]of E.entries())if(P!=null){let S=m.length===0?A:m+"."+A;d(P,S,_+1)}return}if(E!=null&&typeof E==="object")for(let A of Object.keys(E)){let P=E[A];if(P!=null){let S=m.length===0?A:m+"."+A;d(P,S,_+1)}}return}let C=E[y],D=m.length===0?y:m+"."+y;if(Array.isArray(C)){for(let A=0;A<C.length;++A)if(C[A]!=null)d(C[A],D+"."+A,_+1)}else if(C!=null)d(C,D,_+1)},l=n.slice(0,n.length-a.length-1),f=l.indexOf(".")===-1?[l]:l.split("."),h=!1;if(d(t,"",0),h)return{modelNames:o,refPath:u}}let c=e.call(t,t,n);return u=u||c,o.push(...tp(c,t,n,s,i)),{modelNames:o,refPath:u}}function Yfe(e,t,r,n,s,i){let o=typeof e==="string"&&Kfe.test(e)?r:n;try{return tp(e,t,o,s,i)}catch(u){if(o===n&&typeof u?.message==="string"&&u.message.startsWith("Could not normalize ref path"))return tp(e,t,r,s,i);throw u}}/*!
968
+ * ignore
969
+ */function Jfe(e,t,r,n){let s=[],i={},o=n.virtual;for(let u of t){let a=null,c={},l,f=n.nestedSchemaPath?n.nestedSchemaPath+".":"";if(typeof r.localField==="string")l=r.localField;else if(typeof o.options.localField==="function")l=f+o.options.localField.call(u,u);else if(Array.isArray(o.options.localField))l=o.options.localField.map((E)=>f+E);else l=f+o.options.localField;if(c.count=o.options.count,o.options.skip!=null&&!Object.hasOwn(r,"skip"))r.skip=o.options.skip;if(o.options.limit!=null&&!Object.hasOwn(r,"limit"))r.limit=o.options.limit;if(o.options.perDocumentLimit!=null&&!Object.hasOwn(r,"perDocumentLimit"))r.perDocumentLimit=o.options.perDocumentLimit;let h=o.options.foreignField;if(!l||!h)return new jw(`Cannot populate virtual \`${r.path}\` on model \`${e.modelName}\`, because options \`localField\` and / or \`foreignField\` are missing`);if(typeof l==="function")l=l.call(u,u);if(typeof h==="function")h=h.call(u,u);c.isRefPath=!1;let d=null;if("justOne"in r&&r.justOne!==void 0)d=r.justOne;if(n.nestedSchemaPath&&typeof o.options.ref==="function"){let E=Pt.getValue(n.nestedSchemaPath,u);a=Array.isArray(E)?E.flatMap((C)=>o._getModelNamesForPopulate(C)):o._getModelNamesForPopulate(E)}else a=o._getModelNamesForPopulate(u);if(o.options.refPath)d=!!o.options.justOne,c.isRefPath=!0;else if(o.options.ref)d=!!o.options.justOne;c.isVirtual=!0,c.virtual=o,c.justOne=d;let p=To(c,"virtual.options.match",null)||To(c,"virtual.options.options.match",null),m=To(r,"match",null)||p,_=typeof m==="function";if(_)m=m.call(u,u,c.virtual);if(Array.isArray(l)&&Array.isArray(h)&&l.length===h.length){m=Object.assign({},m);for(let E=1;E<l.length;++E)m[h[E]]=vH(pu.get(l[E],u,Lw),e.schema),_=!0;l=l[0],h=h[0]}c.localField=l,c.foreignField=h,c.match=m,c.hasMatchFunction=_,Vw(m);let y=$H(u,l,e,r,o);try{qw(e,s,i,a,r,c,y,u)}catch(E){return E}}return s}/*!
970
+ * ignore
971
+ */function qw(e,t,r,n,s,i,o,u,a,c){let l=s.connection??e.db;if(c=c===void 0?o:c,Array.isArray(c))c=Pt.cloneArrays(c);if(n==null)return;let f=Pt.array.flatten(n),h=f.length;while(h--){let d=f[h];if(d==null)continue;let p;if(s.model&&s.model[xw])p=s.model;else if(d[xw])p=d,d=p.modelName;else try{p=Uw(l,d)}catch(y){if(o!==void 0)throw y;p=null}let m=o,_=i.modelNamesInOrder||n;if(i.isRefPath&&Array.isArray(o)&&o.length===_.length)m=RH(o,_,d);if(!IH(r,d)){let y={model:p};if(i.isVirtual&&To(i.virtual,"options.options"))y.options=Lfe(i.virtual.options.options);else if(a!=null)y.options=Object.assign({},a);Pt.merge(y,s),s[$w]=p,y[$w]=p,r[d]={model:p,options:y,match:i.hasMatchFunction?[i.match]:i.match,docs:[u],ids:[m],allIds:[o],unpopulatedValues:[c],localField:new Set([i.localField]),foreignField:new Set([i.foreignField]),justOne:i.justOne,isVirtual:i.isVirtual,virtual:i.virtual,count:i.count,isRefPath:!!i.isRefPath,[$w]:p},t.push(r[d])}else if(r[d].localField.add(i.localField),r[d].foreignField.add(i.foreignField),r[d].docs.push(u),r[d].ids.push(m),r[d].allIds.push(o),r[d].unpopulatedValues.push(c),r[d].isRefPath=r[d].isRefPath||!!i.isRefPath,i.hasMatchFunction)r[d].match.push(i.match)}}function Uw(e,t){if(IH(e.models,t)==null&&e._parent!=null)return Uw(e._parent,t);return e.model(t)}function RH(e,t,r){if(!Array.isArray(t))return t===r?Array.isArray(e)?Pt.array.flatten(e):[e]:[];if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,s)=>RH(n,t[s],r));return[]}/*!
972
+ * ignore
973
+ */function vw(e,t){if(typeof e==="function"&&!e[xw])return e.call(t,t);return e}/*!
974
+ * ignore
975
+ */function $H(e,t,r,n,s,i){let o=r.schema._getPathType(t),u=o==="real"?r.schema.path(t):o.schema,a=u?.getters||[];t=u?.instance==="Embedded"?t+"._id":t;let c=To(n,"options",{}),l="getters"in c?c.getters:To(s,"options.getters",!1);if(a.length!==0&&l){let f=ep(e)?e:r.hydrate(e),h=Pt.getValue(t,e);if(Array.isArray(h)){let d=Pt.getValue(t.split(".").slice(0,-1),f);return h.map((p,m)=>u.applyGetters(p,d[m]))}else return u.applyGetters(h,f)}else return vH(pu.get(t,e,Lw),i)}function vH(e,t){if(ep(e))return e._doc._id;if(e?._id!=null&&!t?.$isSchemaMap)return e._id;if(Array.isArray(e)){let r=e.__array??e;for(let n=0;n<r.length;++n)if(ep(r[n]))r[n]=r[n]._doc._id;if(Pt.isMongooseArray(e)&&e.$schema())return e.$schema()._castForPopulate(e,e.$parent());return[].concat(e)}if(zfe(e)==="Object"&&t?.[kw]==null){let r=[];for(let n of Object.keys(e))r.push(e[n]);return r}if(e instanceof Map)return Array.from(e.values());return e}/*!
976
+ * ignore
977
+ */function Qfe(e,t,r,n,s,i){if(!r.isRefPath||s==null)return;let o=s.split("."),u="",a=void 0;for(let c=0;c<o.length;++c){let l=o[c];u=u+(u.length===0?"":".")+l;let f=t.path(u);if(f!=null&&f.$isMongooseDocumentArray&&f.Constructor.discriminators!=null&&Pt.hasOwnKeys(f.Constructor.discriminators)){let h=Pt.getValue(u,e),d=n.path.substring(u.length+1),p=f.Constructor.schema.options.discriminatorKey;a=[];for(let m of h){let _=Pt.getValue(p,m),E=Ufe(f.Constructor.discriminators,_)?.schema;if(E==null)continue;let C=E.path(d);if(C==null||C.options.refPath==null){let A=Pt.getValue(r.localField.substring(u.length+1),m);i.forEach((P,S)=>{if(P===A)i[S]=jfe(P)});continue}let D=Pt.getValue(o.slice(c+1).join("."),m);a.push(D)}}}return a}function Vw(e){if(e==null)return;if(typeof e!=="object")return;for(let t of Object.keys(e)){if(t==="$where")throw new jw("Cannot use $where filter with populate() match");if(e[t]!=null&&typeof e[t]==="object")Vw(e[t])}}});var jH=g(function(w6e,qH){var Xfe=Dr();qH.exports=function(t){if(Array.isArray(t)){let n=Object.keys(t[0]);return n.length===1&&n[0]==="_id"&&t[0]._id!=="hashed"}if(typeof t!=="object")return!1;let r=Xfe(t,"key",{});return Object.keys(r).length===1&&Object.hasOwn(r,"_id")}});var zH=g(function(C6e,VH){var LH=Dr(),oE=be(),UH=Object.freeze({locale:"simple"});VH.exports=function(t,r,n){if(n.textIndexVersion!=null){delete n.key._fts,delete n.key._ftsx;let u={...n.weights,...n.key};if(Object.keys(u).length!==Object.keys(t).length)return!1;for(let a of Object.keys(u)){if(!(a in t))return!1;let c=u[a];if(c!==LH(r,"weights."+a)&&!(c===1&&LH(r,"weights."+a)==null))return!1}if(r.default_language!==n.default_language)return n.default_language==="english"&&r.default_language==null;return!0}let s=["unique","partialFilterExpression","sparse","expireAfterSeconds","collation"];for(let u of s){if(!(u in r)&&!(u in n))continue;if(u==="collation"){let a=r.collation??UH,c=n.collation??UH;for(let l of Object.keys(a))if(a[l]!==c[l])return!1}else if(!oE.deepEqual(r[u],n[u]))return!1}let i=Object.keys(t),o=Object.keys(n.key);if(i.length!==o.length)return!1;for(let u=0;u<i.length;++u){if(i[u]!==o[u])return!1;if(!oE.deepEqual(t[i[u]],n.key[o[u]]))return!1}return!0}});var HH=g(function(b6e,WH){WH.exports=function(t,r){if(r.timeseries==null)return!1;let{timeField:n,metaField:s}=r.timeseries;if(typeof n!=="string"||typeof s!=="string")return!1;return Object.keys(t.key).length===2&&t.key[n]===1&&t.key[s]===1}});var JH=g(function(D6e,YH){var Zfe=j_();function ede(e,t){return GH({baseModelName:e.baseModelName,discriminatorMapping:e.schema.discriminatorMapping,indexes:t,indexesType:"schema"})}function tde(e,t){return GH({baseModelName:e.baseModelName,discriminatorMapping:e.schema.discriminatorMapping,indexes:t,indexesType:"db"})}YH.exports={getRelatedSchemaIndexes:ede,getRelatedDBIndexes:tde};function GH({baseModelName:e,discriminatorMapping:t,indexes:r,indexesType:n}){let s=t?.key,i=t?.value;if(!s)return r;if(Boolean(e))return r.filter((u)=>{let a=KH(u,n);return a&&a[s]===i});return r.filter((u)=>{let a=KH(u,n);return!a||!a[s]||Zfe(a[s])&&!("$eq"in a[s])})}function KH(e,t){if(t==="schema")return e[1]?.partialFilterExpression;return e.partialFilterExpression}});var XH=g(function(T6e,QH){QH.exports=rde;/*!
978
+ * Run `fn` over every entry of `params` with at most `limit` calls in flight at
979
+ * a time, resolving to the results in input order. Currently only used by
980
+ * `Model.insertMany()` to bound how many documents validate concurrently.
981
+ */async function rde(e,t,r){if(!(r>0))throw Error("Limit must be positive");let n=e.length;if(n===0)return[];let s=Array(n);if(r>=n){for(let l=0;l<n;++l)try{s[l]=t(e[l],l)}catch(f){s[l]=Promise.reject(f),s.length=l+1;break}return Promise.all(s)}let i=0,o=!1,u=null;function a(){if(i>=n||o)return;let l=i++,f;try{f=Promise.resolve(t(e[l],l))}catch(h){if(!o)o=!0,u=h;return}return f.then((h)=>(s[l]=h,a()),(h)=>{if(!o)o=!0,u=h})}let c=[];for(let l=0;l<r;++l)c.push(a());if(await Promise.all(c),o)throw u;return s}});var eK=g(function(M6e,ZH){ZH.exports=function e(t,r,n){if(r==null)return;for(let s=0;s<r.length;++s)if(Array.isArray(r[s]))e(t,r[s],n+"."+s);else t.push(n+"."+s)}});var sK=g(function(P6e,nK){var tK=Dr(),nde=Fn(),uE=ii(),rK=q_();/*!
982
+ * ignore
983
+ */nK.exports=function(t,r,n){let s=rK(tK(r,"select",null),!0)||rK(tK(r,"options.select",null),!0);if(s==null)return;for(let i of t){if(!Object.hasOwn(s,"-"+i))continue;for(let o of n)if(nde(o))uE.unset(i,o._doc);else uE.unset(i,o)}}});var oK=g(function(B6e,iK){var sde=Rw(),ide=Dr(),Gh=be();iK.exports=zw;/*!
984
+ * If a single populate query would have more than this many elements in its `$in` filter,
985
+ * Mongoose splits the populate into a separate query per document to avoid going over
986
+ * MongoDB's 16 MB BSON size limit on queries. Overwritable for testing purposes. See gh-5890.
987
+ */zw.maxInFilterLength=50000;/*!
988
+ * Split a populate models-map entry into a separate query per document if either:
989
+ *
990
+ * 1. The `perDocumentLimit` option is set, so each document needs its own query with its
991
+ * own `limit` (gh-7318), or
992
+ * 2. A single populate query for `mod` would have too many elements in its `$in` filter
993
+ * (gh-5890). With multiple foreign fields, `createPopulateQueryFilter()` repeats the ids
994
+ * under `$or` once per foreign field, so the threshold counts one copy of `ids` per
995
+ * foreign field.
996
+ *
997
+ * Returns a list of `[mod, match, select, assignmentOpts]` params, one per document, for
998
+ * `_execPopulateQuery()`. Returns `null` if the populate query doesn't need to be split.
999
+ * A `null` `match` means the document has no ids to query: `_execPopulateQuery()` skips
1000
+ * executing a query, and `_assign()` just sets the document's populated path to the
1001
+ * default value.
1002
+ *
1003
+ * Splitting on document boundaries means each document's populated value is the result of
1004
+ * exactly one query, so split entries can typically be assigned from only their own query's
1005
+ * results (`_assignFromOwnResults`) rather than scanning every populate query's results.
1006
+ * refPath is the exception: a single document's array can contain ids for multiple models,
1007
+ * so assigning refPath populate results relies on every query's results being available for
1008
+ * every document. refPath entries are therefore only split when `perDocumentLimit` requires
1009
+ * it, not to keep the `$in` filter small. A single document whose ids alone overflow the
1010
+ * BSON size limit cannot be split.
1011
+ */function zw(e,t,r,n){if(e.docs.length<=1)return null;let s=e.options.perDocumentLimit==null?ide(e.options,"options.perDocumentLimit",null):e.options.perDocumentLimit,i=t.length*e.foreignField.size;if(s==null&&(i<=zw.maxInFilterLength||e.isRefPath))return null;return e.docs.map((o,u)=>{let a={...e,docs:[o],ids:[e.ids[u]],allIds:[e.allIds[u]],unpopulatedValues:[e.unpopulatedValues[u]],match:Array.isArray(e.match)?[e.match[u]]:e.match,_assignFromOwnResults:!e.isRefPath},c=Gh.array.flatten(a.ids,ode);c=Gh.array.unique(c);let l=c.length===0||c.every(Gh.isNullOrUndefined)?null:sde(c,a.match,a.foreignField,a.model,a.options.skipInvalidIds);return[a,l,r,n]})}/*!
1012
+ * ignore
1013
+ */function ode(e){return e!==void 0}});var Mw=g(function(CK,bK){/*!
1014
+ * Module dependencies.
1015
+ */var ude=ww(),ade=kA(),no=su(),{createTracedChannel:Jw}=Lh(),{trace:cde}=Jw("mongoose:model:save"),{trace:lde}=Jw("mongoose:model:insertMany"),{trace:hde}=Jw("mongoose:model:bulkWrite"),fde=B2(),Kw=require("events").EventEmitter,mu=kc(),cE=OS(),we=ni(),dK=j2(),dde=t4(),nl=z_(),pde=DW(),Gw=Kc(),aE=jc(),pK=QA(),mde=ZA(),yde=U2(),gde=_4(),_de=MW(),Ede=Dw(),Ade=NW(),mK=$W(),Ode=kW(),Sde=tw(),yK=UW(),wde=zW(),gK=HW(),Cde=ZW(),_K=rw(),bde=sH(),Dde=AH(),Tde=US(),hc=ar(),Mde=SH(),Pde=Rw(),Bde=C_(),Ww=bS(),EK=K2(),Fde=r_(),Nde=TH(),np=Dr(),Ide=iu(),Rde=Xn(),sp=Fn(),Yh=oi(),Jh=Vi(),$de=kH(),uK=ua(),Qw=_o().internalToObjectOptions,Xw=jH(),AK=zH(),vde=aO(),xde=HH(),{getRelatedDBIndexes:kde,getRelatedSchemaIndexes:qde}=JH(),Zw=iO(),jde=Y2(),OK=Qd(),Lde=XH(),Ude=q_(),Vde=Ow(),SK=eK(),zde=sK(),Wde=FS(),Hde=D4(),Kde=oK(),{buildMiddlewareFilter:yu}=vu(),lE=require("util"),le=be(),Gde=C4(),Yde=s4(),Jde=q2(),sl=VS(),il=Symbol("mongoose#Model#collection"),ol=Symbol("mongoose#Model#db"),{arrayAtomicsBackupSymbol:Hw,arrayAtomicsSymbol:Qde,modelSymbol:wK}=de(),rp=Symbol("mongoose#Model#subclassed"),{VERSION_INC:hE,VERSION_WHERE:aK,VERSION_ALL:Xde}=no,Zde=Object.assign({},Qw,{bson:!0});function W(e,t,r){if(t instanceof Gw)throw TypeError("2nd argument to `Model` constructor must be a POJO or string, **not** a schema. Make sure you're calling `mongoose.model()`, not `mongoose.Model()`.");if(typeof e==="string")throw TypeError("First argument to `Model` constructor must be an object, **not** a string. Make sure you're calling `mongoose.model()`, not `mongoose.Model()`.");no.call(this,e,t,r)}Object.setPrototypeOf(W.prototype,no.prototype);W.prototype.$isMongooseModelPrototype=!0;W.prototype.db;W.useConnection=function(t){if(typeof t?.model!=="function"||typeof t.collection!=="function"||typeof t.base?.version!=="string")throw new we("`useConnection()` requires a Mongoose connection.");if(this.db?.base?.version&&this.db?.base?.version!==t.base?.version)throw new we(`The connection passed to \`useConnection()\` has a different version of Mongoose (${t.base?.version}) than the model you are using (${this.db?.base?.version}).`);if(this.db)delete this.db.models[this.modelName],delete this.prototype.db,delete this.prototype[ol],delete this.prototype.collection,delete this.prototype.$collection,delete this.prototype[il];this.db=t;let r=t.collection(this.collection.collectionName,t.options);return this.prototype.collection=r,this.prototype.$collection=r,this.prototype[il]=r,this.prototype.db=t,this.prototype[ol]=t,this.collection=r,this.$__collection=r,t.models[this.modelName]=this,this};W.prototype.collection;W.prototype.$__collection;W.prototype.modelName;W.prototype.$where;W.prototype.baseModelName;W.events;W._middleware;/*!
1016
+ * ignore
1017
+ */function Yw(e,t){if(e.$where==null)return;for(let r of Object.keys(e.$where))t[r]=e.$where[r]}/*!
1018
+ * ignore
1019
+ */function epe(e,t){let r={};if(_K(e.$__schema,t),typeof t.writeConcern<"u"){if(r.writeConcern={},"w"in t.writeConcern)r.writeConcern.w=t.writeConcern.w;if("j"in t.writeConcern)r.writeConcern.j=t.writeConcern.j;if("wtimeout"in t.writeConcern)r.writeConcern.wtimeout=t.writeConcern.wtimeout}else{if("w"in t)r.w=t.w;if("j"in t)r.j=t.j;if("wtimeout"in t)r.wtimeout=t.wtimeout}if("checkKeys"in t)r.checkKeys=t.checkKeys;let n=e.$session(),s=e[ol].base.transactionAsyncLocalStorage?.getStore();if(n!=null)r.session=n;else if(!Object.hasOwn(t,"session")&&s?.session!=null)r.session=s.session;return r}/*!
1020
+ * ignore
1021
+ */W.prototype.$__save=async function(t){try{if(t&&typeof t==="object"&&"validateBeforeSave"in t?!!t.validateBeforeSave:this.$__schema.options.validateBeforeSave){let c=t!=null&&typeof t==="object"&&Object.hasOwn(t,"validateModifiedOnly")?{validateModifiedOnly:t.validateModifiedOnly}:null;await this.$validate(c),this.$op="save"}await this._execDocumentPreHooks("save",t,[t])}catch(o){await this._execDocumentPostHooks("save",t,o);return}let r=null,n=null;try{let o=epe(this,t);if(this.$isNew){let u=this.$__hasOnlyPrimitiveValues(),a=u?this.$__toObjectShallow():this.toObject(Zde);if((a||{})._id===void 0)throw new we("document must have an _id before saving");this.$__version(!0,a),this.$__reset(),Qh(this,!1,u),this.$__.inserting=!0,r=await this[il].insertOne(a,o).catch((c)=>{throw Qh(this,!0,u),c})}else{this.$__.inserting=!1;let u=Array.isArray(t.pathsToSave)?t.pathsToSave:null,a=u!=null?new Set(u):null,c=this.$__delta(u,a),l=u!=null?c!=null?c[2]:this.$__dirty():null,f=u!=null?Object.keys(this.$__.activePaths.getStatePaths("default")).filter((h)=>!gde(h,a,u)):null;if(c){n=this.$__where(c[0]),Yw(this,n);let h=c[1];if(this.$__schema.options.minimize)for(let d of Object.values(h)){if(d==null)continue;for(let p of Object.keys(d)){if(d[p]==null||typeof d[p]!=="object")continue;if(!le.isPOJO(d[p]))continue;if(Gde(d[p]),le.hasOwnKeys(d[p])===!1)delete d[p],h.$unset=h.$unset||{},h.$unset[p]=1}}this.$__.modifiedPaths=this.modifiedPaths(),this.$__reset(),tpe(this,l,f),Qh(this,!1),r=await this[il].updateOne(n,h,o).catch((d)=>{throw this.$__undoReset(),d})}else{if(n=this.$__where(),Yw(this,n),this.$__.version)this.$__version(n,c);Sde(this.$__schema,o),r=await this.constructor.collection.findOne(n,{...o,projection:{_id:1}}).then((h)=>({matchedCount:!h?0:1}))}}}catch(o){let u=this.$__schema._transformDuplicateKeyError(o);await this._execDocumentPostHooks("save",t,u);return}let s=0;if((t!=null?t.writeConcern!=null?t.writeConcern.w:t.w:0)!==0){if(r!=null)if(Array.isArray(r))s=r.length;else if(r.matchedCount!=null)s=r.matchedCount;else s=r;if(this.$__.version&&!this.$__.inserting){let u=hE===(hE&this.$__.version);this.$__.version=void 0;let a=this.$__schema.options.versionKey,c=this.$__getValue(a)||0;if(s<=0){this.$__undoReset();let l=this.$__.$versionError||new pK(this,c,this.$__.modifiedPaths);await this._execDocumentPostHooks("save",t,l);return}if(u)this.$__setValue(a,c+1)}if(r!=null&&s<=0){this.$__undoReset();let u=new fde(n,this.constructor.modelName,s,r);await this._execDocumentPostHooks("save",t,u);return}}this.$__.saving=void 0,this.$__.savedState={},this.$emit("save",this,s),this.constructor.emit("save",this,s),await this._execDocumentPostHooks("save",t)};/*!
1022
+ * Restores $__.activePaths state and any atomics for paths that failed
1023
+ * to save.
1024
+ *
1025
+ * @param {Document} doc
1026
+ * @param {object[]} unsavedDirty
1027
+ * @param {string[]} unsavedDefaultPaths
1028
+ */function tpe(e,t,r){if(t==null)return;for(let n of t)if(e.$__.activePaths.modify(n.path),n.value?.[Hw])n.value[Qde]=n.value[Hw],n.value[Hw]=null;for(let n of r)e.$__.activePaths.default(n)}/*!
1029
+ * ignore
1030
+ */function rpe(e,t,r){let n=e.$__schema.options.versionKey;if(!n)return null;let s=e.$__getValue(n)||0;return new pK(e,s,t.concat(r))}W.prototype.save=async function(t){if(typeof t==="function"||typeof arguments[1]==="function")throw new we("Model.prototype.save() no longer accepts a callback");let r;if(this.$op="save",this.$__.saving)r=new mde(this);else this.$__.saving=!0;if(t=new pde(t),Object.hasOwn(t,"session"))this.$session(t.session);if(this.$__.timestamps!=null)t.timestamps=this.$__.timestamps;if(!this.$isNew)this.$__.$versionError=rpe(this,this.modifiedPaths(),Object.keys(this.$__.activePaths.getStatePaths("default")));if(r)throw this.$__handleReject(r),r;this.$__.saveOptions=t;let n=this;return cde(async function(){try{await n.$__save(t)}catch(i){throw n.$__handleReject(i),i}finally{n.$__.saving=null,n.$__.saveOptions=null,n.$__.$versionError=null,n.$op=null}return n},()=>({operation:"save",collection:n.constructor.collection.name,database:n.constructor.db?.name,serverAddress:n.constructor.db?.host,serverPort:n.constructor.db?.port,args:{options:t}}))};W.prototype.$save=W.prototype.save;W.prototype.$__version=function(e,t){let r=this.$__schema.options.versionKey;if(e===!0){if(r)Wde(t,r,0),this.$__setValue(r,0);return}if(r===!1)return;if(!this.$__isSelected(r))return;if(aK===(aK&this.$__.version)){let n=this.$__getValue(r);if(n!=null)e[r]=n}if(hE===(hE&this.$__.version))if(np(t.$set,r,null)!=null)++t.$set[r];else t.$inc=t.$inc||{},t.$inc[r]=1};W.prototype.increment=function(){return this.$__.version=Xde,this};W.prototype.$__where=function(t){if(t||(t={}),!t._id)t._id=this._doc._id;if(this._doc._id===void 0)throw new we("No _id found on document!");return t};W.prototype.deleteOne=function(t){if(typeof t==="function"||typeof arguments[1]==="function")throw new we("Model.prototype.deleteOne() no longer accepts a callback");if(!t)t={};if(Object.hasOwn(t,"session"))this.$session(t.session);let r=this,n=this.$__where(),s=r.constructor.deleteOne();if(this.$session()!=null){if(!("session"in s.options))s.options.session=this.$session()}let i=yu(t,"pre"),o=yu(t,"post");return s.pre(async function(){let a=await r.constructor._middleware.execPre("deleteOne",r,[r,t],{filter:i});if(a[0]!==r||a[1]!==t)throw new we("Document deleteOne pre hooks cannot overwrite arguments");if(s.deleteOne(n,t),r.$where!=null)this.where(r.$where);return a}),s.pre(function(){return Promise.all(r.$getAllSubdocs().map((a)=>a.constructor._middleware.execPre("deleteOne",a,[a],{filter:i})))}),s.pre(function(){if(r.$__.isDeleted)throw new mu.skipWrappedFunction}),s.post(function(){return Promise.all(r.$getAllSubdocs().map((a)=>a.constructor._middleware.execPost("deleteOne",a,[a],{filter:o})))}),s.post(function(){return r.constructor._middleware.execPost("deleteOne",r,[r],{filter:o})}),s.transform(function(a){if(a?.deletedCount>0)r.$isDeleted(!0);return a}),s};W.prototype.$model=function(t){if(arguments.length===0)return this.constructor;return this[ol].model(t)};W.prototype.model=W.prototype.$model;W.exists=function(t,r){if(Le(this,"exists"),typeof arguments[2]==="function")throw new we("Model.exists() no longer accepts a callback");return this.findOne(t).select({_id:1}).sort(null).lean().setOptions(r)};W.discriminator=function(e,t,r){let n;if(typeof e==="function"){if(n=e,e=le.getFunctionName(n),!(n.prototype instanceof W))throw new we("The provided class "+e+" must extend Model")}r=r||{};let s=le.isPOJO(r)?r.value:r,i=typeof r.clone==="boolean"?r.clone:!0,o=typeof r.mergePlugins==="boolean"?r.mergePlugins:!0,u=typeof r.overwriteModels==="boolean"?r.overwriteModels:!1;if(Le(this,"discriminator"),le.isObject(t)&&!t.instanceOfSchema)t=new Gw(t);if(t instanceof Gw&&i)t=t.clone();if(t=Fde(this,e,t,s,o,r.mergeHooks,u),Ide(this.db.models,e)&&!t.options.overwriteModels&&!u)throw new dde(e);t.$isRootDiscriminator=!0,t.$globalPluginsApplied=!0,n=this.db.model(n||e,t,this.$__collection.name),this.discriminators[e]=n;let a=this.discriminators[e];if(Object.setPrototypeOf(a.prototype,this.prototype),Object.defineProperty(a,"baseModelName",{value:this.modelName,configurable:!0,writable:!1}),mK(a,t),gK(a,t),this[rp]!=null)for(let c of this[rp])c.discriminators=c.discriminators||{},c.discriminators[e]=n.__subclass(n.db,t,c.collection.name);return a};function Le(e,t){if(e==null||e===global)throw new we("`Model."+t+"()` cannot run without a model as `this`. Make sure you are calling `MyModel."+t+"()` where `MyModel` is a Mongoose model.");else if(e[wK]==null)throw new we("`Model."+t+"()` cannot run without a model as `this`. Make sure you are not calling `new Model."+t+"()`")}/*!
1031
+ * Give the constructor the ability to emit events.
1032
+ */for(let e in Kw.prototype)W[e]=Kw.prototype[e];W.init=function(){if(Le(this,"init"),typeof arguments[0]==="function")throw new we("Model.init() no longer accepts a callback");if(this.schema.emit("init",this),this.$init!=null)return this.$init;let t=this.db,r=async()=>{if(!le.getOption("autoIndex",this.schema.options,t.config,t.base.options))return;return await this.ensureIndexes({_automatic:!0})},n=async()=>{if(!le.getOption("autoSearchIndex",this.schema.options,t.config,t.base.options))return;return await this.createSearchIndexes()},s=async()=>{let u=le.getOption("autoCreate",this.schema.options,t.config);if(u==null)await t._waitForConnect(!0),u=le.getOption("autoCreate",this.schema.options,t.config,t.base.options);if(!u)return;return await this.createCollection()};this.$init=s().then(()=>r()).then(()=>n());let i=this.$init.catch,o=this;return this.$init.catch=function(){return o.$caught=!0,i.apply(o.$init,arguments)},this.$init};W.createCollection=async function(t){if(Le(this,"createCollection"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.createCollection() no longer accepts a callback");let r=yu(t,"pre"),n=yu(t,"post");if(t?.middleware!=null){let{middleware:c,...l}=t;t=l}[t]=await this.hooks.execPre("createCollection",this,[t],{filter:r}).catch((c)=>{if(c instanceof mu.skipWrappedFunction)return[c];throw c});let s=this?.schema?.options?.collectionOptions;if(s!=null)t=Object.assign({},s,t);let i=this?.schema?.options?.collation;if(i!=null)t=Object.assign({collation:i},t);let o=this?.schema?.options?.capped;if(o!=null){if(typeof o==="number")t=Object.assign({capped:!0,size:o},t);else if(typeof o==="object")t=Object.assign({capped:!0},o,t)}let u=this?.schema?.options?.timeseries;if(u!=null){if(t=Object.assign({timeseries:u},t),t.expireAfterSeconds!=null);else if(t.expires!=null)le.expires(t);else if(this.schema.options.expireAfterSeconds!=null)t.expireAfterSeconds=this.schema.options.expireAfterSeconds;else if(this.schema.options.expires!=null)t.expires=this.schema.options.expires,le.expires(t)}let a=this?.schema?.options?.clusteredIndex;if(a!=null)t=Object.assign({clusteredIndex:{...a,unique:!0}},t);try{if(!(t instanceof mu.skipWrappedFunction))await this.db.createCollection(this.$__collection.collectionName,t)}catch(c){if(c!=null&&(c.name!=="MongoServerError"||c.code!==48))await this.hooks.execPost("createCollection",this,[null],{error:c,filter:n})}return await this.hooks.execPost("createCollection",this,[this.$__collection],{filter:n}),this.$__collection};W.syncIndexes=async function(t){if(Le(this,"syncIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.syncIndexes() no longer accepts a callback");if(t?.autoCreate??this.schema.options?.autoCreate??this.db.config.autoCreate??this.db.base?.options?.autoCreate??!0)try{await this.createCollection()}catch(i){if(i!=null&&(i.name!=="MongoServerError"||i.code!==48))throw i}let n=await this.diffIndexes({indexOptionsToCreate:!0}),s=await this.cleanIndexes({...t,toDrop:n.toDrop});return await this.createIndexes({...t,toCreate:n.toCreate}),s};W.createSearchIndex=async function(t){return Le(this,"createSearchIndex"),await this.$__collection.createSearchIndex(t)};W.updateSearchIndex=async function(t,r){return Le(this,"updateSearchIndex"),await this.$__collection.updateSearchIndex(t,r)};W.dropSearchIndex=async function(t){return Le(this,"dropSearchIndex"),await this.$__collection.dropSearchIndex(t)};W.listSearchIndexes=async function(t){return Le(this,"listSearchIndexes"),await(await this.$__collection.listSearchIndexes(t)).toArray()};W.diffIndexes=async function(t){if(typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.syncIndexes() no longer accepts a callback");let r=this,n=await r.listIndexes().catch((a)=>{if(a.codeName=="NamespaceNotFound")return;throw a});if(n===void 0)n=[];n=kde(r,n);let s=r.schema,i=qde(r,s.indexes()),o=spe(s,i,n),u=npe(s,i,n,o,t);return{toDrop:o,toCreate:u}};function npe(e,t,r,n,s){let i=[],o=s?.indexOptionsToCreate??!1;for(let[u,a]of t){let c=!1,l=Zw(e,hc(a));for(let f of r){if(Xw(f))continue;if(AK(u,l,f)&&!n.includes(f.name)){c=!0;break}}if(!c)if(o)i.push([u,a]);else i.push(u)}return i}function spe(e,t,r){let n=[];for(let s of r){let i=!1;if(Xw(s))continue;if(xde(s,e.options))continue;for(let[o,u]of t){let a=Zw(e,hc(u));if(yK(o,a,e.options),AK(o,a,s)){i=!0;break}}if(i)continue;n.push(s.name)}return n}W.cleanIndexes=async function(t){if(Le(this,"cleanIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.cleanIndexes() no longer accepts a callback");let r=this;if(Array.isArray(t?.toDrop))return await cK(t.toDrop,r,t);let n=await r.diffIndexes();return await cK(n.toDrop,r,t)};async function cK(e,t,r){if(e.length===0)return[];let n=t.$__collection;if(r?.hideIndexes)await Promise.all(e.map((s)=>t.db.db.command({collMod:n.collectionName,index:{name:s,hidden:!0}})));else await Promise.all(e.map((s)=>n.dropIndex(s)));return e}W.listIndexes=async function(){if(Le(this,"listIndexes"),typeof arguments[0]==="function")throw new we("Model.listIndexes() no longer accepts a callback");if(this.$__collection.buffer)await new Promise((t)=>{this.$__collection.addQueue(t)});return this.$__collection.listIndexes().toArray()};W.ensureIndexes=async function(t){if(Le(this,"ensureIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.ensureIndexes() no longer accepts a callback");await new Promise((r,n)=>{ipe(this,t,(s)=>{if(s!=null)return n(s);r()})})};W.createIndexes=async function(t){if(Le(this,"createIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new we("Model.createIndexes() no longer accepts a callback");return this.ensureIndexes(t)};/*!
1033
+ * ignore
1034
+ */function ipe(e,t,r){let n=Array.isArray(t?.toCreate)?t.toCreate:e.schema.indexes(),s;t=t||{};let i=function(h){if(h&&!e.$caught)e.emit("error",h);e.emit("index",h||s),r&&r(h||s)};for(let h of n)if(Xw(h))le.warn('mongoose: Cannot specify a custom index on `_id` for model name "'+e.modelName+'", MongoDB does not allow overwriting the default `_id` index. See https://bit.ly/mongodb-id-index');let o=[];for(let h of n){let d=h[0];if(h[1].name==null){for(let m of o)if(m[1].name==null&&vde(m[0],d)){le.warn("mongoose: Duplicate schema index on "+JSON.stringify(d)+' for model "'+e.modelName+'". This is often due to declaring an index using both "index: true" and "schema.index()". MongoDB will not create the duplicate index and options on the duplicate definition (such as expireAfterSeconds or unique) will not be applied. Please remove the duplicate index definition.');break}}o.push(h)}if(!n.length){uK(function(){i()});return}let u=function(h,d,p,m){e.emit("index-single-done",h,d,p,m)},a=function(h,d){e.emit("index-single-start",h,d)},c=e.schema._baseSchema,l=c?c.indexes():[];uK(function(){if(t._automatic&&!e.collection.collection)e.collection.addQueue(f,[]);else f()});function f(){if(t._automatic){if(e.schema.options.autoIndex===!1||e.schema.options.autoIndex==null&&e.db.config.autoIndex===!1)return i()}let h=n.shift();if(!h)return i();if(t._automatic&&h[1]._autoIndex===!1)return f();if(l.find((_)=>le.deepEqual(_,h)))return f();let d=hc(h[0]),p=hc(h[1]);delete p._autoIndex,Zw(e.schema,p),_K(e.schema,p),yK(d,p,e.schema.options),a(d,p);let m=null;try{m=e.collection.createIndex(d,p)}catch(_){if(!s)s=_;if(!e.$caught)e.emit("error",_);u(_,d,p),f();return}m.then((_)=>{u(null,d,p,_),f()},(_)=>{if(!s)s=_;if(!e.$caught)e.emit("error",_);u(_,d,p),f()})}}W.createSearchIndexes=async function(){Le(this,"createSearchIndexes");let t=[];for(let r of this.schema._searchIndexes)t.push(await this.createSearchIndex(r));return t};W.schema;W.db;W.collection;W.$__collection;W.base;W.discriminators;W.translateAliases=function(t,r){Le(this,"translateAliases");let n=(s,i)=>{let o,u=[],a=s.split("."),c=this.schema;for(let f in a){let h=a[f];if(c?.aliases[h]){if(o=c.aliases[h],r&&o in t)throw new we(`Provided object has both field "${h}" and its alias "${o}"`);u.push(o)}else o=h,u.push(h);if(c?.paths[o])c=c.paths[o].schema;else c=null}let l=u.join(".");if(t instanceof Map)t.set(l,i);else t[l]=i;if(l!==s)if(t instanceof Map)t.delete(s);else delete t[s];return t};if(typeof t==="object"){if(t instanceof Map)for(let s of new Map(t))t=n(s[0],s[1]);else for(let s of Object.keys(t))if(t=n(s,t[s]),s[0]==="$")if(Array.isArray(t[s]))for(let i in t[s])t[s][i]=this.translateAliases(t[s][i]);else this.translateAliases(t[s]);return t}else return t};W.deleteOne=function(t,r){if(Le(this,"deleteOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.prototype.deleteOne() no longer accepts a callback");let n=new this.Query({},{},this,this.$__collection);return n.setOptions(r),n.deleteOne(t)};W.deleteMany=function(t,r){if(Le(this,"deleteMany"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.deleteMany() no longer accepts a callback");let n=new this.Query({},{},this,this.$__collection);return n.setOptions(r),n.deleteMany(t)};W.find=function(t,r,n){if(Le(this,"find"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new we("Model.find() no longer accepts a callback");let s=new this.Query({},{},this,this.$__collection);return s.select(r),s.setOptions(n),s.find(t)};W.findAndCount=async function(t,r,n){if(Le(this,"findAndCount"),n==null)throw new we("Model.findAndCount() requires an `options` argument with `sort` and `limit`");let s=this.find(t,r,n);if(n.sort==null&&!this.schema.options.defaultSort)throw new we("Model.findAndCount() requires `options.sort`");if(le.isEmptyObject(s.options.sort))throw new we("Model.findAndCount() does not allow an empty `options.sort`, like `sort: null`. Omit `options.sort` to use the schema's `defaultSort`.");if(n.limit==null)throw new we("Model.findAndCount() requires `options.limit`");let i=s.clone().countDocuments().skip(0).limit(null);return Promise.all([s.exec(),i.exec()])};W.findById=function(t,r,n){if(Le(this,"findById"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.findById() no longer accepts a callback");return this.findOne({_id:t},r,n)};W.findOne=function(t,r,n){if(Le(this,"findOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.findOne() no longer accepts a callback");let s=new this.Query({},{},this,this.$__collection);return s.select(r),s.setOptions(n),s.findOne(t)};W.estimatedDocumentCount=function(t){return Le(this,"estimatedDocumentCount"),new this.Query({},{},this,this.$__collection).estimatedDocumentCount(t)};W.countDocuments=function(t,r){if(Le(this,"countDocuments"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.countDocuments() no longer accepts a callback");let n=new this.Query({},{},this,this.$__collection);if(r!=null)n.setOptions(r);return n.countDocuments(t)};W.distinct=function(t,r,n){if(Le(this,"distinct"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.distinct() no longer accepts a callback");let s=new this.Query({},{},this,this.$__collection);if(n!=null)s.setOptions(n);return s.distinct(t,r)};W.where=function(t,r){Le(this,"where");let n=new this.Query({},{},this,this.$__collection).find({});return n.where.apply(n,arguments)};W.$where=function(){Le(this,"$where");let t=new this.Query({},{},this,this.$__collection).find({});return t.$where.apply(t,arguments)};W.findOneAndUpdate=function(e,t,r){if(Le(this,"findOneAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new we("Model.findOneAndUpdate() no longer accepts a callback");let n;if(r)n=r.fields||r.projection;let s=new this.Query({},{},this,this.$__collection);return s.select(n),s.findOneAndUpdate(e,t,r)};W.findByIdAndUpdate=function(e,t,r){if(Le(this,"findByIdAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new we("Model.findByIdAndUpdate() no longer accepts a callback");if(e instanceof no)e=e._doc._id;return this.findOneAndUpdate.call(this,{_id:e},t,r)};W.findOneAndDelete=function(e,t){if(Le(this,"findOneAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.findOneAndDelete() no longer accepts a callback");let r;if(t)r=t.select,t.select=void 0;let n=new this.Query({},{},this,this.$__collection);return n.select(r),n.findOneAndDelete(e,t)};W.findByIdAndDelete=function(e,t){if(Le(this,"findByIdAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new we("Model.findByIdAndDelete() no longer accepts a callback");return this.findOneAndDelete({_id:e},t)};W.findOneAndReplace=function(e,t,r){if(Le(this,"findOneAndReplace"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new we("Model.findOneAndReplace() no longer accepts a callback");let n;if(r)n=r.select,r.select=void 0;let s=new this.Query({},{},this,this.$__collection);return s.select(n),s.findOneAndReplace(e,t,r)};W.create=async function(t,r){if(typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.create() no longer accepts a callback");Le(this,"create");let n,s=this.schema.options.discriminatorKey;if(Array.isArray(t))n=t,r=r!=null&&typeof r==="object"?r:{};else{let u=arguments[arguments.length-1];if(r={},typeof u==="function"||typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.create() no longer accepts a callback");else if(n=[...arguments],n.length>1&&!u)n.pop();if(n.length===2&&n[0]!=null&&n[1]!=null&&n[0].session==null&&u&&Rde(u.session)==="ClientSession"&&!this.schema.path("session"))le.warn("WARNING: to pass a `session` to `Model.create()` in Mongoose, you **must** pass an array as the first argument. See: https://mongoosejs.com/docs/api/model.html#Model.create()")}if(n.length===0)return Array.isArray(t)?[]:null;let i=[],o=typeof r.aggregateErrors==="boolean"?!r.aggregateErrors:!0;if(delete r.aggregateErrors,r.session&&!r.ordered&&n.length>1)throw new we("Cannot call `create()` with a session and multiple documents unless `ordered: true` is set");if(!Array.isArray(t)&&n.length===1){let u=t,a=this.discriminators&&t[s]!=null?Yh(this.discriminators,t[s])||Jh(this.discriminators,t[s]):this;if(a==null)throw new we(`Discriminator "${t[s]}" not found for model "${this.modelName}"`);if(!(u instanceof a))u=new a(u);return await u.$save(r),u}if(r.ordered){for(let u=0;u<n.length;u++)try{let a=n[u],c=this.discriminators&&a[s]!=null?Yh(this.discriminators,a[s])||Jh(this.discriminators,a[s]):this;if(c==null)throw new we(`Discriminator "${a[s]}" not found for model "${this.modelName}"`);let l=a;if(!(l instanceof c))l=new c(l);await l.$save(r),i.push(l)}catch(a){if(!o)i.push(a);else throw a}return i}else if(!o)i=await Promise.allSettled(n.map(async(u)=>{let a=this.discriminators&&u[s]!=null?Yh(this.discriminators,u[s])||Jh(this.discriminators,u[s]):this;if(a==null)throw new we(`Discriminator "${u[s]}" not found for model "${this.modelName}"`);let c=u;if(!(c instanceof a))c=new a(c);return await c.$save(r),c})),i=i.map((u)=>u.status==="fulfilled"?u.value:u.reason);else{let u=null;if(i=await Promise.all(n.map(async(a)=>{let c=this.discriminators&&a[s]!=null?Yh(this.discriminators,a[s])||Jh(this.discriminators,a[s]):this;if(c==null)throw new we(`Discriminator "${a[s]}" not found for model "${this.modelName}"`);try{let l=a;if(!(l instanceof c))l=new c(l);return await l.$save(r),l}catch(l){if(!u)u=l}})),u)throw u}return i};W.insertOne=async function(t,r){if(Le(this,"insertOne"),t==null||typeof t!=="object")throw new dK(t,"doc","insertOne");let n=this.schema.options.discriminatorKey,s=this.discriminators&&t[n]!=null?Yh(this.discriminators,t[n])||Jh(this.discriminators,t[n]):this;if(s==null)throw new we(`Discriminator "${t[n]}" not found for model "${this.modelName}"`);if(!(t instanceof s))t=new s(t);return await t.$save(r)};W.watch=function(e,t){Le(this,"watch"),t=t||{};let r=t?.hydrate!==void 0?le.omit(t,["hydrate"]):{...t};t.model=this,e=e||[],Vde(e,this.schema,"fullDocument");let n=this.db._waitForConnect().then(()=>this.$__collection.watch(e,r));return new ade(n,e,t)};W.startSession=function(){return Le(this,"startSession"),this.db.startSession.apply(this.db,arguments)};W.insertMany=async function(t,r){if(Le(this,"insertMany"),typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.insertMany() no longer accepts a callback");let n=this;return lde(function(){return ope.call(n,t,r)},()=>({operation:"insertMany",collection:n.collection.name,database:n.db?.name,serverAddress:n.db?.host,serverPort:n.db?.port,args:{docs:t,options:r}}))};async function ope(e,t){t=t||{};let r=this._middleware.hasHooks("insertMany"),n=r?yu(t,"pre"):null,s=r?yu(t,"post"):null;if(r)try{[e]=await this._middleware.execPre("insertMany",this,[e],{filter:n})}catch(S){await this._middleware.execPost("insertMany",this,[e],{error:S,filter:s})}let i=this,o=t.limit||1000,u=!!t.rawResult,a=t.ordered==null?!0:!!t.ordered,c=!!t.throwOnValidationError,l=!!t.lean,f=this.db.base.transactionAsyncLocalStorage?.getStore();if(!Object.hasOwn(t,"session")&&f?.session!=null)t={...t,session:f.session};if(!Array.isArray(e))e=[e];let h=[],d=a?null:Array(e.length),p=t.session;function m(S,B){if(l)return S;let q=!1;if(!(S instanceof i)){if(S!=null&&typeof S!=="object")return Promise.reject(new dK(S,"arr."+B,"insertMany"));S=new i(S),q=!0}if(p!=null)S.$session(p);return S.$validate(q?{_skipParallelValidateCheck:!0}:null).then(()=>S).catch((I)=>{if(a===!1){I.index=B,h.push(I),d[B]=I;return}throw I})}let _=await Lde(e,m,o),y={},E=[],C=l?E:[],D=i.schema.options.versionKey?i.schema.paths[i.schema.options.versionKey]?.splitPath():null,A=t.timestamps;for(let S=0;S<_.length;++S){let B=_[S];if(B==null)continue;if(y[E.length]=S,E.push(B),l)continue;if(D)B.$__setValue(D,0);if(A!==!1&&B.initializeTimestamps&&(!B.$__||B.$__.timestamps!==!1))B.initializeTimestamps(A);C.push(B.$__hasOnlyPrimitiveValues()?B.$__toObjectShallow():B.toObject(Qw))}if(h.length>0&&a===!1)h.sort((S,B)=>S.index-B.index);if(E.length===0){if(c)throw new cE(h,d,null,"insertMany");if(u){let S={acknowledged:!0,insertedCount:0,insertedIds:{}};return sl(S,h,h),S}return[]}let P;try{P=await this.$__collection.insertMany(C,t)}catch(S){if(S.writeErrors==null&&S.result?.result?.writeErrors!=null)S.writeErrors=S.result.result.writeErrors;let B=S?.writeErrors,q=new Set((S?.writeErrors||[]).map((Oe)=>Oe.index));if(S.writeErrors!=null)for(let Oe=0;Oe<S.writeErrors.length;++Oe){let Ne=S.writeErrors[Oe],ae=y[Ne.index];if(Ne.err!=null)Ne.err.index=ae;if(!a)d[ae]=S.writeErrors[Oe]}if(!a){for(let Oe=0;Oe<d.length;++Oe)if(d[Oe]===void 0)d[Oe]=_[Oe];S.results=d}let I=-1;if(S.insertedDocs=E.filter((Oe,Ne)=>{let ae=!B||q.has(Ne);if(a){if(I>-1)return Ne<I;if(ae)I=Ne}return!ae}).map(function(Ne){if(l)return Ne;return Ne.$__reset(!0),Qh(Ne,!1),Ne}),u&&a===!1)sl(S,h,d);if(r)await this._middleware.execPost("insertMany",this,[e],{error:S,filter:s});else throw S}if(!l)for(let S of E){let B=S.$__hasOnlyPrimitiveValues();S.$__reset(!0,B),Qh(S,!1,B)}if(a===!1&&c&&h.length>0){for(let S=0;S<d.length;++S)if(d[S]===void 0)d[S]=_[S];throw new cE(h,d,P,"insertMany")}if(u){if(a===!1){for(let S=0;S<d.length;++S)if(d[S]===void 0)d[S]=_[S];sl(P,h,d)}return P}if(t.populate!=null)return this.populate(E,t.populate).catch((S)=>{if(S!=null)S.insertedDocs=E;throw S});if(r){let[S]=await this._middleware.execPost("insertMany",this,[E],{filter:s});return S}return E}/*!
1035
+ * @param {Document} doc The document to set `$isNew` on.
1036
+ * @param {boolean} val The value to set `$isNew` to.
1037
+ * @param {boolean} [hasOnlyPrimitiveValues] Skip getting subdocs for performance if we know there are none.
1038
+ * @api private
1039
+ */function Qh(e,t,r){if(e.$isNew=t,e.$emit("isNew",t),e.constructor.emit("isNew",t),r)return;let n=e.$getAllSubdocs({useCache:!0});for(let s of n)s.$isNew=t,s.$emit("isNew",t)}W.bulkWrite=async function(t,r){if(Le(this,"bulkWrite"),typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.bulkWrite() no longer accepts a callback");let n=this;return hde(function(){return upe.call(n,t,r)},()=>({operation:"bulkWrite",collection:n.collection.name,database:n.db?.name,serverAddress:n.db?.host,serverPort:n.db?.port,args:{ops:t,options:r}}))};async function upe(e,t){t=t||{};let r=yu(t,"pre"),n=yu(t,"post");try{[e,t]=await this.hooks.execPre("bulkWrite",this,[e,t],{filter:r})}catch(a){if(a instanceof mu.skipWrappedFunction)e=a;else await this.hooks.execPost("bulkWrite",this,[null],{error:a,filter:n})}if(e instanceof mu.skipWrappedFunction)return e.args[0];let s=t.ordered==null?!0:t.ordered;if(e.length===0){let c=new(this.base.driver.get()).BulkWriteResult(Ww(),!1);return c.n=0,sl(c,[],[]),c}let i=t?._skipCastBulkWrite?[]:e.map((a)=>Tde(this,a,t)),o=this.db.base.transactionAsyncLocalStorage?.getStore();if((!t||!Object.hasOwn(t,"session"))&&o?.session!=null)t={...t,session:o.session};let u=null;if(s){await new Promise((a,c)=>{Nde(i,(l,f)=>l(f),(l)=>{if(l)return c(l);a()})});try{u=await this.$__collection.bulkWrite(e,t)}catch(a){await this.hooks.execPost("bulkWrite",this,[null],{error:a,filter:n})}}else{let a=[],c=[],l=[];if(i.length>0)a=await Promise.all(e.map((p,m)=>{if(m>=i.length)return m;return new Promise((_)=>{i[m]((y)=>{if(y==null)_(m);else c.push({index:m,error:y}),l[m]=y;_()})})})),a=a.filter((p)=>p!=null);else a=e.map((p,m)=>m);c=c.sort((p,m)=>p.index-m.index).map((p)=>p.error);let f=a.sort((p,m)=>p-m).map((p)=>e[p]);if(f.length===0){if(t.throwOnValidationError&&c.length)throw new cE(c,l,u,"bulkWrite");let m=new(this.base.driver.get()).BulkWriteResult(Ww(),!1);return m.result=Ww(),sl(m,c,l),m}let h;[u,h]=await this.$__collection.bulkWrite(f,t).then((p)=>[p,null]).catch((p)=>[null,p]);let d={};if(h?.writeErrors)for(let p of h.writeErrors)d[p.err.index]=p;for(let p=0;p<a.length;++p)l[a[p]]=d[p]??null;if(h){if(c.length>0)sl(h,c,l);await this.hooks.execPost("bulkWrite",this,[null],{error:h,filter:n})}if(c.length>0)if(t.throwOnValidationError)throw new cE(c,l,u,"bulkWrite");else sl(u,c,l)}return await this.hooks.execPost("bulkWrite",this,[u],{filter:n}),u}W.bulkSave=async function(t,r){if(r=r||{},r.timestamps!=null)for(let h of t)h.$__.saveOptions=h.$__.saveOptions||{},h.$__.saveOptions.timestamps=r.timestamps;else for(let h of t)if(h.$__.timestamps!=null)h.$__.saveOptions=h.$__.saveOptions||{},h.$__.saveOptions.timestamps=h.$__.timestamps;if(Object.hasOwn(r,"session"))for(let h of t)h.$session(r.session);await Promise.all(t.map((h)=>ape(h,r)));let n=[],s=this.buildBulkWriteOperations(t,r,n),i={skipValidation:!0,_skipCastBulkWrite:!0,...r},{bulkWriteResult:o,bulkWriteError:u}=await this.bulkWrite(s,i).then((h)=>({bulkWriteResult:h,bulkWriteError:null}),(h)=>({bulkWriteResult:null,bulkWriteError:h}));if(u!=null&&u.name!=="MongoBulkWriteError")throw u;let a=o?.matchedCount??0,c=o?.insertedCount??0;if(s.length>0&&a+c<s.length&&!u)throw new Yde(this.modelName,t,o);let l=u?.writeErrors||[],f=t;if(l.length>0)if(r.ordered!==!1)f=t.slice(0,n[l[0].index]);else{let h=t.length>=25?{}:null;if(h!=null)for(let d of l)h[n[d.index]]=!0;f=t.filter((d,p)=>h==null?!l.some((m)=>n[m.index]===p):!h[p])}if(await Promise.all(f.map((h)=>cpe(h,r))),u!=null)throw u;return o};async function ape(e,t){let r=yu(t,"pre"),[n]=await e.schema.s.hooks.execPre("save",e,[t],{filter:r});if(n!==t)throw new we('Cannot overwrite options in pre("save") hook on bulkSave()')}async function cpe(e,t){let r=e.$isNew;if(r)Qh(e,!1);if(e.$__reset(),!r)e._applyVersionIncrement();let n=yu(t,"post");return e.schema.s.hooks.execPost("save",e,[e],{filter:n})}W.applyDefaults=function e(t){if(t==null)return t;if(sp(t)){yde(t,t.$__.fields,t.$__.exclude);for(let r of t.$getAllSubdocs())e(r,r.$__.fields,r.$__.exclude);return t}return _de(t,this.schema),t};W.applyVirtuals=function(t,r){if(t==null)return t;if(sp(t))return t;return bde(this.schema,t,r),t};W.applyTimestamps=function(t,r){if(t==null)return t;if(sp(t))return t;return Cde(this.schema,t,r),t};W.castObject=function(t,r){r=r||{};let n={},s=this.schema,i=s.options.discriminatorKey;if(s.discriminators!=null&&t!=null&&t[i]!=null)s=EK(s,t[i])||s;let o=Object.keys(s.paths);for(let a of o){if(!s.path(a)?.$isMongooseArray)continue;let l=np(t,a);SK(o,l,a)}let u=null;for(let a of o){let c=s.path(a);if(c==null)continue;let l=np(t,a,void 0);if(l==null)continue;let f=a.indexOf(".")===-1?[a]:a.split("."),h=n;for(let d=0;d<f.length-1;++d){if(h[f[d]]==null)h[f[d]]=isNaN(f[d+1])?{}:[];h=h[f[d]]}if(c.$isMongooseDocumentArray){let d=c.options?.castNonArrays??c.constructor.options.castNonArrays;if(!Array.isArray(l)){if(!d){if(!r.ignoreCastErrors)u=u||new aE,u.addError(a,new Jde(a,l))}else h[f[f.length-1]]=[W.castObject.call(c.Constructor,l)];continue}}if(c.$isSingleNested||c.$isMongooseDocumentArrayElement){try{l=W.castObject.call(c.Constructor,l)}catch(d){if(!r.ignoreCastErrors)u=u||new aE,u.addError(a,d);continue}h[f[f.length-1]]=l;continue}try{l=c.cast(l),h[f[f.length-1]]=l}catch(d){if(!r.ignoreCastErrors)u=u||new aE,u.addError(a,d);continue}}if(u!=null){if(this.modelName!=null)for(let a of Object.keys(u.errors)){let c=u.errors[a];if(typeof c.setModel==="function")c.setModel(this)}throw u}return n};W.buildBulkWriteOperations=function(t,r,n){if(!Array.isArray(t))throw new we(`bulkSave expects an array of documents to be passed, received \`${t}\` instead`);return i(),t.map((o,u)=>{if(!r.skipValidation){if(!(o instanceof no))throw new we(`documents.${u} was not a mongoose document, documents must be an array of mongoose documents (instanceof mongoose.Document).`);if(r.validateBeforeSave==null||r.validateBeforeSave){let f=o.$__validateSync();if(f!=null)throw f}}if(o.isNew){let f=o.$__schema.options.versionKey;if(f)o.$__setValue(f,0);let h={insertOne:{document:o}};return le.injectTimestampsOption(h.insertOne,r.timestamps),n?.push(u),h}let c=o.$__delta();if(c!=null&&!le.isEmptyObject(c[0])){let f=o.$__where(c[0]),h=c[1];Yw(o,f);let d=this.schema.options.shardKey;if(d){let m=Object.keys(d),_=m.length;for(let y=0;y<_;++y)f[m[y]]=o[m[y]]}o.$__version(f,c);let p={updateOne:{filter:f,update:h}};return le.injectTimestampsOption(p.updateOne,r.timestamps),n?.push(u),p}return null}).filter((o)=>o!==null);function i(){if(r=r||{},r.skipValidation==null)r.skipValidation=!1}};W.hydrate=function(t,r,n){if(Le(this,"hydrate"),n?.virtuals&&n?.hydratedPopulatedDocs===!1)throw new we("Cannot set `hydratedPopulatedDocs` option to false if `virtuals` option is truthy because `virtuals: true` also sets populated virtuals");if(r!=null){if(sp(t))t=t.toObject(Qw);r=Ude(r),t=Ode(t,r)}let s=od().createModel(this,t,r,r,n);return s.$init(t,n),s};W.updateMany=function(t,r,n){if(Le(this,"updateMany"),r==null)throw new we("updateMany `update` parameter cannot be nullish");return eC(this,"updateMany",t,r,n)};W.updateOne=function(t,r,n){return Le(this,"updateOne"),eC(this,"updateOne",t,r,n)};W.replaceOne=function(t,r,n){Le(this,"replaceOne");let s=this?.schema?.options?.versionKey||null;if(s&&!r[s])r[s]=0;return eC(this,"replaceOne",t,r,n)};function eC(e,t,r,n,s){let i=new e.Query({},{},e,e.collection);if(r instanceof no)r=r.toObject();else r=hc(r);s=typeof s==="function"?s:hc(s);let o=e?.schema?.options?.versionKey??null;return Bde(n,s,o),i[t](r,n,s)}W.aggregate=function(t,r){if(Le(this,"aggregate"),typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.aggregate() no longer accepts a callback");let n=new ude(t||[]);if(n.model(this),r!=null)n.option(r);return n};W.validate=async function(t,r,n){if(arguments.length<3||arguments.length===3&&typeof arguments[2]==="function")n=t;if(typeof n==="function"||typeof arguments[3]==="function")throw new we("Model.validate() no longer accepts a callback");let s=this.schema,i=s.options.discriminatorKey;if(s.discriminators!=null&&t!=null&&t[i]!=null)s=EK(s,t[i])||s;let o=Object.keys(s.paths);if(r!=null){let c=typeof r==="string"?new Set(r.split(" ")):Array.isArray(r)?new Set(r):new Set(o);o=o.filter((l)=>{if(r.pathsToSkip){if(Array.isArray(r.pathsToSkip)){if(r.pathsToSkip.find((d)=>d==l))return!1}else if(typeof r.pathsToSkip=="string"){if(r.pathsToSkip.indexOf(" ")!==-1&&r.pathsToSkip.split(" ").includes(l))return!1;else if(r.pathsToSkip===l)return!1}}let f=l.split("."),h=f[0];for(let d of f.slice(1)){if(c.has(h))return!0;h+="."+d}return c.has(l)})}for(let c of o){let l=s.path(c);if(!l?.$isMongooseArray||l.$isMongooseDocumentArray)continue;let f=np(t,c);SK(o,f,c)}let u=null;o=new Set(o);try{t=this.castObject(t)}catch(c){u=c;for(let l of Object.keys(u.errors||{}))o.delete(l)}let a=[];for(let c of o){let l=s.path(c);if(l==null)continue;let f=np(t,c,void 0);a.push(l.doValidate(f,n,{path:c}).catch((h)=>{u=u||new aE,u.addError(c,h)}))}if(await Promise.all(a),u!=null)throw u;return t};Object.defineProperty(W,"~standard",{configurable:!0,get(){return{version:1,vendor:"mongoose",validate:(e,t)=>this.validate(e,t?.libraryOptions).then((r)=>({value:r}),(r)=>({issues:Mde(r)}))}}});W.populate=async function(t,r){if(Le(this,"populate"),typeof r==="function"||typeof arguments[2]==="function")throw new we("Model.populate() no longer accepts a callback");if(r=le.populate(r),r.length===0)return t;if(r.find((n)=>n.ordered))for(let n of r)await lK(this,t,n);else{let n=[];for(let s of r)n.push(lK(this,t,s));await Promise.all(n)}return t};/*!
1040
+ * Populates `docs` for a single `populateOptions` instance.
1041
+ */var lpe=/\s?-_id\s?/,hpe=/\s?-_id\s?/g;async function lK(e,t,r){if(r.strictPopulate==null){if(r._localModel?.schema._userProvidedOptions.strictPopulate!=null)r.strictPopulate=r._localModel.schema._userProvidedOptions.strictPopulate;else if(r._localModel!=null&&e.base.options.strictPopulate!=null)r.strictPopulate=e.base.options.strictPopulate;else if(e.base.options.strictPopulate!=null)r.strictPopulate=e.base.options.strictPopulate}if(!Array.isArray(t))t=[t];if(t.length===0||t.every(le.isNullOrUndefined))return;let n=$de(e,t,r);if(n instanceof Error)throw n;let s=n.length,i=[];function o(f){return f!==void 0}let u=!1,a=[];for(let f=0;f<s;++f){let h=n[f],d=h.options.select,p=le.array.flatten(h.ids,o);p=le.array.unique(p);let m={};if(m.sort=h&&h.options&&h.options.options&&h.options.options.sort||void 0,m.excludeId=lpe.test(d)||d&&d._id===0,h.options&&h.options.options&&h.options.options.lean&&h.options.options.lean.transform)h.options.options._leanTransform=h.options.options.lean.transform,h.options.options.lean=!0;if(p.length===0||p.every(le.isNullOrUndefined)){fK(e,[],h,m);continue}if(u=!0,typeof r.foreignField==="string")h.foreignField.clear(),h.foreignField.add(r.foreignField);if(m.excludeId)if(typeof d==="string")d=d.replace(hpe," ");else if(Array.isArray(d))d=d.filter((E)=>E!=="-_id");else{let{_id:E,...C}=d;d=C}if(h.options.options?.limit!=null)m.originalLimit=h.options.options.limit;else if(h.options.limit!=null)m.originalLimit=h.options.limit;let _=Kde(h,p,d,m);if(_!=null){a.push(..._);continue}let y=Pde(p,h.match,h.foreignField,h.model,h.options.skipInvalidIds);a.push([h,y,d,m])}if(!u){if(n.length!==0)return;if(r.populate!=null){let f=le.populate(r.populate).map((h)=>Object.assign({},h,{path:r.path+"."+h.path}));return e.populate(t,f)}return}let c=new Map,l=[];if(r.ordered)for(let f=0;f<a.length;f++){let h=a[f],{docs:d,deferredPopulates:p}=await hK.apply(null,h);if(l.push(d),!h[0]._assignFromOwnResults)i=i.concat(d);if(p.length>0)c.set(f,p)}else{let f=[];for(let d of a)f.push(hK.apply(null,d));let h=await Promise.all(f);for(let d=0;d<h.length;d++){let{docs:p,deferredPopulates:m}=h[d];if(l.push(p),!a[d][0]._assignFromOwnResults)i=i.concat(p);if(m.length>0)c.set(d,m)}}for(let f=0;f<a.length;f++){let h=a[f],d=h[0],p=h[3],m=d._assignFromOwnResults?l[f]:i;for(let _ of m)d.options._childDocs.push(_);fK(e,m,d,p)}if(c.size>0)for(let f=0;f<a.length;f++){let d=a[f][0];if(!Array.isArray(d.match))continue;let p=c.get(f);if(!p||p.length===0)continue;let m=[];for(let _ of d.docs){let y=sp(_)?_.get(d.options.path):le.getValue(d.options.path,_);if(Array.isArray(y))m.push(...y);else if(y!=null)m.push(y)}if(m.length>0)for(let _ of p)await d.model.populate(m,_)}for(let f=0;f<a.length;f++){let h=a[f][0];zde(h.foreignField,h.options,h._assignFromOwnResults?l[f]:i)}for(let f=0;f<a.length;f++){let h=a[f][0];if(h.options?.options?._leanTransform){let d=h._assignFromOwnResults?l[f]:i;for(let p of d)h.options.options._leanTransform(p)}}}/*!
1042
+ * ignore
1043
+ */function hK(e,t,r){if(t==null)return Promise.resolve({docs:[],deferredPopulates:[]});let n=hc(e.options.populate),s={};if(e.options.skip!==void 0)s.skip=e.options.skip;if(e.options.limit!==void 0)s.limit=e.options.limit;if(e.options.perDocumentLimit!==void 0)s.perDocumentLimit=e.options.perDocumentLimit;if(Object.assign(s,e.options.options),s.readPreference==null&&e.options._inheritedReadPreference!=null)s.readPreference=e.options._inheritedReadPreference;if(s.readConcern==null&&e.options._inheritedReadConcern!=null)s.readConcern=e.options._inheritedReadConcern;if(e.count)delete s.skip,s.sort??={};if(s.perDocumentLimit!=null)s.limit=s.perDocumentLimit,delete s.perDocumentLimit;else if(s.limit!=null)s.limit=s.limit*e.ids.length;if(Array.isArray(e.match))s._deferPopulate=!0;let i=e.model.find(t,r,s);for(let u of e.foreignField)if(u!=="_id"&&i.selectedInclusively()&&!jde(i._fields,u))i.select(u);if(e.count)for(let u of e.foreignField)i.select(u);let o=n&&Array.isArray(e.match);if(n){if(e.model.baseModelName!=null)if(Array.isArray(n))n.forEach((a)=>{a.strictPopulate=!1});else if(typeof n==="string")n={path:n,strictPopulate:!1};else n.strictPopulate=!1;let u=e.options._fullPath||e.options.path;if(Array.isArray(n)){for(let a of n)if(a._fullPath=u+"."+a.path,o&&a._localModel==null)a._localModel=e.model}else if(typeof n==="object"){if(n._fullPath=u+"."+n.path,o&&n._localModel==null)n._localModel=e.model}}if(n&&!o)i.populate(n);return i.exec().then((u)=>{for(let c of u)OK.set(c,e.model);let a=[];if(i._deferredPopulate)a.push(...i._deferredPopulate),delete i._deferredPopulate;if(o)n=le.populate(n),Hde(i,n),a.push(n);return{docs:u,deferredPopulates:a}})}/*!
1044
+ * ignore
1045
+ */function fK(e,t,r,n){let{options:s,isVirtual:i,justOne:o}=r,u,a=s&&s.options&&s.options.lean||!1,c=t.length,l={},f={},h,d,p=hc(r.allIds);for(let m=0;m<c;m++){if(d=t[m],d==null)continue;for(let _ of r.foreignField){if(u=le.getValue(_,d),Array.isArray(u)){u=le.array.unique(le.array.flatten(u));for(let y of u){if(y instanceof no)y=y._doc._id;if(h=String(y),f[h])if(Array.isArray(f[h]))f[h].push(d),l[h].push(m);else f[h]=[f[h],d],l[h]=[l[h],m];else if(i&&!o)f[h]=[d],l[h]=[m];else f[h]=d,l[h]=m}}else{if(u instanceof no)u=u._doc._id;if(h=String(u),f[h]){if(Array.isArray(f[h]))f[h].push(d),l[h].push(m);else if(i||f[h].constructor!==d.constructor||(f[h]instanceof no?String(f[h]._doc._id):String(f[h]._id))!==(d instanceof no?String(d._doc._id):String(d._id)))f[h]=[f[h],d],l[h]=[l[h],m]}else f[h]=d,l[h]=m}if(!a)d.$__.wasPopulated=d.$__.wasPopulated||{value:u}}}Dde({originalModel:e,rawIds:r.isVirtual?p:r.allIds,allIds:p,unpopulatedValues:r.unpopulatedValues,foreignField:r.foreignField,rawDocs:f,rawOrder:l,docs:r.docs,path:s.path,options:n,justOne:r.justOne,isVirtual:r.isVirtual,allOptions:r,populatedModel:r.model,lean:a,virtual:r.virtual,count:r.count,match:r.match})}W.compile=function(t,r,n,s,i){if(r.options.versionKey!==!1&&!r.paths[r.options.versionKey]){let f={};f[r.options.versionKey]=Number,r.add(f)}let u;if(typeof t==="function"&&t.prototype instanceof W)u=t,t=u.name,r.loadClass(u,!1),u.prototype.$isMongooseModelPrototype=!0;else u=function f(h,d,p){if(f.hooks.execPreSync("createModel",h),!(this instanceof f))return new f(h,d,p);let m=f.schema.options.discriminatorKey;if(f.discriminators==null||h==null||h[m]==null){W.call(this,h,d,p);return}let _=Yh(f.discriminators,h[m])||Jh(f.discriminators,h[m]);if(_!=null)return new _(h,d,p);W.call(this,h,d,p)};if(u.hooks=r.s.hooks.clone(),u.base=i,u.modelName=t,!(u.prototype instanceof W))Object.setPrototypeOf(u,W),Object.setPrototypeOf(u.prototype,W.prototype);u.model=function(h){return this.db.model(h)},u.db=s,u.prototype.db=s,u.prototype[ol]=s,u.discriminators=u.prototype.discriminators=void 0,u[wK]=!0,u.events=new Kw,r._preCompile();let c={schemaUserProvidedOptions:r._userProvidedOptions||{},capped:r.options.capped,Promise:u.base.Promise,modelName:t};if(r.options.autoCreate!==void 0)c.autoCreate=r.options.autoCreate;let l=s.collection(n,c);return u.prototype.collection=l,u.prototype.$collection=l,u.prototype[il]=l,u.prototype.$__setSchema(r),mK(u,r),gK(u,r),Ade(u,r),wde(u,r.s.hooks,r.statics),u.schema=u.prototype.$__schema,u.collection=l,u.$__collection=l,u.Query=function(){nl.apply(this,arguments)},Object.setPrototypeOf(u.Query.prototype,nl.prototype),u.Query.base=nl.base,u.Query.prototype.constructor=nl,u._applyQueryMiddleware(),fpe(u,r.query),u};W.clientEncryption=function(){let t=this.base.driver.get().ClientEncryption;if(!t)throw new we("The mongodb driver must be used to obtain a ClientEncryption object.");let r=this.collection?.conn?.client;if(!r)return null;let n=r.options.autoEncryption;if(!n)return null;let{keyVaultNamespace:s,keyVaultClient:i,kmsProviders:o,credentialProviders:u,proxyOptions:a,tlsOptions:c}=n;return new t(i??r,{keyVaultNamespace:s,kmsProviders:o,credentialProviders:u,proxyOptions:a,tlsOptions:c})};W.$__updateConnection=function(t){this.db=t,this.prototype.db=t,this.prototype[ol]=t;let r=t.collection(this.collection.collectionName,this.collection.opts);this.prototype.collection=r,this.prototype.$collection=r,this.prototype[il]=r,this.collection=r,this.$__collection=r};function fpe(e,t){for(let r in t)e.Query.prototype[r]=t[r]}W.__subclass=function(t,r,n){let s=this,i=function l(f,h,d){if(!(this instanceof l))return new l(f,h,d);s.call(this,f,h,d)};if(Object.setPrototypeOf(i,s),Object.setPrototypeOf(i.prototype,s.prototype),i.db=t,i.prototype.db=t,i.prototype[ol]=t,s[rp]=s[rp]||[],s[rp].push(i),s.discriminators!=null){i.discriminators={};for(let l of Object.keys(s.discriminators))i.discriminators[l]=s.discriminators[l].__subclass(s.db,s.discriminators[l].schema,n)}let o=r&&typeof r!=="string"?r:s.prototype.$__schema,u=o.options||{},a=o._userProvidedOptions||{};if(!n)n=s.prototype.$__schema.get("collection")||le.toCollectionName(s.modelName,this.base.pluralize());let c={schemaUserProvidedOptions:a,capped:o&&u.capped};return i.prototype.collection=t.collection(n,c),i.prototype.$collection=i.prototype.collection,i.prototype[il]=i.prototype.collection,i.collection=i.prototype.collection,i.$__collection=i.collection,i.init().catch(()=>{}),i};W.recompileSchema=function(){if(this.prototype.$__setSchema(this.schema),this.schema._applyDiscriminators!=null)for(let t of this.schema._applyDiscriminators.keys())this.discriminator(t,this.schema._applyDiscriminators.get(t));delete this.schema._defaultToObjectOptionsMap,Ede(this.schema,new WeakSet,!0),this.schema._preCompile()};W.inspect=function(){return`Model { ${this.modelName} }`};W.namespace=function(){return this.db.name+"."+this.collection.collectionName};if(lE.inspect.custom)W[lE.inspect.custom]=W.inspect;/*!
1046
+ * Applies query middleware from this model's schema to this model's
1047
+ * Query constructor.
1048
+ */W._applyQueryMiddleware=function(){let t=this.Query,r=this.schema.s.hooks.filter((n)=>{let s=dpe(n);if(n.name==="validate")return!!s.query;if(n.name==="deleteOne"||n.name==="updateOne")return!!s.query||le.hasOwnKeys(s)===!1;if(n.query!=null||n.document!=null)return!!n.query;return!0});t.prototype._queryMiddleware=r};function dpe(e){let t={};if(Object.hasOwn(e,"query"))t.query=e.query;if(Object.hasOwn(e,"document"))t.document=e.document;return t}/*!
1049
+ * Module exports.
1050
+ */bK.exports=CK=W});var TK=g(function(ip,DK){DK.exports=ype;ip.pluralization=[[/human$/gi,"humans"],[/(m|wom)an$/gi,"$1en"],[/(pe)rson$/gi,"$1ople"],[/(child)$/gi,"$1ren"],[/^(ox)$/gi,"$1en"],[/(ax|test)is$/gi,"$1es"],[/(octop|cact|foc|fung|nucle)us$/gi,"$1i"],[/(alias|status|virus)$/gi,"$1es"],[/(bu)s$/gi,"$1ses"],[/(buffal|tomat|potat)o$/gi,"$1oes"],[/([ti])um$/gi,"$1a"],[/sis$/gi,"ses"],[/(?:([^f])fe|([lr])f)$/gi,"$1$2ves"],[/(hive)$/gi,"$1s"],[/([^aeiouy]|qu)y$/gi,"$1ies"],[/(x|ch|ss|sh)$/gi,"$1es"],[/(matr|vert|ind)ix|ex$/gi,"$1ices"],[/([m|l])ouse$/gi,"$1ice"],[/(kn|w|l)ife$/gi,"$1ives"],[/(quiz)$/gi,"$1zes"],[/^goose$/i,"geese"],[/s$/gi,"s"],[/([^a-z])$/,"$1"],[/$/gi,"s"]];var ppe=ip.pluralization;ip.uncountables=["advice","energy","excretion","digestion","cooperation","health","justice","labour","machinery","equipment","information","pollution","sewage","paper","money","species","series","rain","rice","fish","sheep","moose","deer","news","expertise","status","media"];var mpe=ip.uncountables;function ype(e){let t;if(e=e.toLowerCase(),!~mpe.indexOf(e)){if(t=ppe.filter(function(r){return e.match(r[0])}),t[0])return e.replace(t[0][0],t[0][1])}return e}});var NK=g(function(F6e,FK){/*!
1051
+ * Module requirements
1052
+ */var PK=ze(),fE=require("util"),MK=KA();class fc extends PK{constructor(){super("");this.errors={}}toString(){return MK(this)}inspect(){return Object.assign(Error(this.message),this)}addError(e,t){if(t instanceof fc){let{errors:r}=t;for(let n of Object.keys(r))this.addError(n,r[n]);return}this.errors[e]=t,this.message=MK(this)}}if(fE.inspect.custom)fc.prototype[fE.inspect.custom]=fc.prototype.inspect;Object.defineProperty(fc.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}});Object.defineProperty(fc.prototype,"name",{value:"SetOptionError"});class BK extends PK{constructor(e){super(`"${e}" is not a valid option to set`)}}fc.SetOptionInnerError=BK;/*!
1053
+ * Module exports
1054
+ */FK.exports=fc});var IK=g(function(){var dE=be();if(typeof jest<"u"&&!process.env.SUPPRESS_JEST_WARNINGS){if(typeof window<"u")dE.warn("Mongoose: looks like you're trying to test a Mongoose app with Jest's default jsdom test environment. Please make sure you read Mongoose's docs on configuring Jest to test Node.js apps: https://mongoosejs.com/docs/jest.html. Set the SUPPRESS_JEST_WARNINGS to true to hide this warning.");if(typeof setTimeout.clock?.Date==="function")dE.warn("Mongoose: looks like you're trying to test a Mongoose app with Jest's mock timers enabled. Please make sure you read Mongoose's docs on configuring Jest to test Node.js apps: https://mongoosejs.com/docs/jest.html. Set the SUPPRESS_JEST_WARNINGS to true to hide this warning.")}});var LK=g(function(qK,jK){/*!
1055
+ * Module dependencies.
1056
+ */var gpe=su(),_pe=require("events").EventEmitter,Xh=kc(),ai=Kc(),Epe=Mr(),_u=Od(),Ape=_g(),Zh=S_(),pE=GV(),Ope=Ah(),Spe=z_(),RK=Mw(),wpe=wS(),Cpe=WO(),tC=w_(),bpe=TK(),gu=be(),$K=KS(),Dpe=Jc(),Tpe=ww(),Mpe=nh().trusted,Ppe=fw(),Bpe=Zn(),Fpe=iu(),Qu=ze(),Ju=NK(),Npe=Dw(),vK=Symbol.for("mongoose:default"),xK=Symbol("mongoose:defaultConnection");IK();var Ipe=/^[0-9A-Fa-f]{24}$/,{AsyncLocalStorage:kK}=require("async_hooks");function se(e){if(this.connections=[],this.nextConnectionId=0,this.models={},this.events=new _pe,this.__driver=tC.get(),this.options=Object.assign({pluralization:!0,autoIndex:!0,autoCreate:!0,autoSearchIndex:!1},e),(gu.getOption("createInitialConnection",this.options)??!0)&&this.__driver!=null)rC(this);if(this.options.pluralization)this._pluralize=bpe;if(!e?.[vK]){let r=this;this.Schema=function(){return this.base=r,ai.apply(this,arguments)},this.Schema.prototype=Object.create(ai.prototype),Object.assign(this.Schema,ai),this.Schema.base=this,this.Schema.Types=Object.assign({},ai.Types)}else for(let r of["Schema","model"])this[r]=se.prototype[r];if(this.Schema.prototype.base=this,e?.transactionAsyncLocalStorage)this.transactionAsyncLocalStorage=new kK;Object.defineProperty(this,"plugins",{configurable:!1,enumerable:!0,writable:!1,value:Object.values(Cpe).map((r)=>[r,{deduplicate:!0}])})}se.prototype.cast=Dpe;se.prototype.STATES=Zh;se.prototype.ConnectionStates=Zh;se.prototype.driver=tC;se.prototype.setDriver=function(t){let r=this instanceof se?this:as;if(r.__driver===t)return r;if(r.connections&&r.connections.find((o)=>o.readyState!==Zh.disconnected))throw new Qu("Cannot modify Mongoose driver if a connection is already open. Call `mongoose.disconnect()` before modifying the driver");if(r.__driver=t,Array.isArray(t.plugins)){for(let o of t.plugins)if(typeof o==="function")r.plugin(o)}if(t.SchemaTypes!=null)Object.assign(as.Schema.Types,t.SchemaTypes);let s=t.Connection,i=r.connections[0];if(r.connections=[new s(r)],r.connections[0].models=r.models,i==null)return r;for(let o of Object.values(r.models)){if(o.db!==i)continue;o.$__updateConnection(r.connections[0])}return r};se.prototype.set=function(t,r){let n=this instanceof se?this:as;if(t==null){let o=new Ju;throw o.addError(String(t),new Ju.SetOptionInnerError(String(t))),o}if(arguments.length===1&&typeof t!=="object"){if(pE.indexOf(t)===-1){let o=new Ju;throw o.addError(t,new Ju.SetOptionInnerError(t)),o}return n.options[t]}let s={};if(arguments.length===2)s={[t]:r};if(arguments.length===1&&typeof t==="object")s=t;let i=void 0;for(let[o,u]of Object.entries(s)){if(pE.indexOf(o)===-1){if(!i)i=new Ju;i.addError(o,new Ju.SetOptionInnerError(o));continue}if(n.options[o]=u,o==="objectIdGetter")if(u)Object.defineProperty(n.Types.ObjectId.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}});else delete n.Types.ObjectId.prototype._id;else if(o==="transactionAsyncLocalStorage"){if(u&&!n.transactionAsyncLocalStorage)n.transactionAsyncLocalStorage=new kK;else if(!u&&n.transactionAsyncLocalStorage)delete n.transactionAsyncLocalStorage}else if(o==="createInitialConnection"){if(u&&!n.connection)rC(n);else if(u===!1&&n.connection?.[xK]){if(n.connection.readyState===Zh.disconnected&&gu.hasOwnKeys(n.connection.models)===!1)n.connections.shift()}}else if(o==="returnOriginal"){if(n.options.returnDocument!=null)throw new Qu("Cannot set `returnOriginal` when `returnDocument` is already set. Use `returnDocument` instead.");gu.warn("Mongoose: the `returnOriginal` option for `mongoose.set()` is deprecated. Use `mongoose.set('returnDocument', "+(u===!0?"'before'":"'after'")+")` instead.")}else if(o==="returnDocument"){if(n.options.returnOriginal!=null)throw new Qu("Cannot set `returnDocument` when `returnOriginal` is already set. Use `returnDocument` instead of `returnOriginal`.")}}if(i)throw i;return n};se.prototype.get=se.prototype.set;se.prototype.createConnection=function(t,r){let n=this instanceof se?this:as,i=new n.__driver.Connection(n);if(n.connections.push(i),n.nextConnectionId++,n.events.emit("createConnection",i),arguments.length>0)i.openUri(t,{...r,_fireAndForget:!0});return i};se.prototype.connect=async function(t,r){if(typeof r==="function"||arguments.length>=3&&typeof arguments[2]==="function")throw new Qu("Mongoose.prototype.connect() no longer accepts a callback");let n=this instanceof se?this:as;if(n.connection==null)rC(n);return n.connection.openUri(t,r).then(()=>n)};se.prototype.disconnect=async function(){if(arguments.length>=1&&typeof arguments[0]==="function")throw new Qu("Mongoose.prototype.disconnect() no longer accepts a callback");let t=this instanceof se?this:as;if(t.connections.length<=0)return;await Promise.all(t.connections.map((n)=>n.close()))};se.prototype.startSession=function(){let t=this instanceof se?this:as;return t.connection.startSession.apply(t.connection,arguments)};se.prototype.pluralize=function(t){let r=this instanceof se?this:as;if(arguments.length>0)r._pluralize=t;return r._pluralize};se.prototype.model=function(t,r,n,s){let i=this instanceof se?this:as;if(typeof r==="string")n=r,r=!1;if(arguments.length===1){let c=Fpe(i.models,t);if(!c)throw new i.Error.MissingSchemaError(t);return c}if(gu.isObject(r)&&!(r instanceof ai))r=new ai(r);if(r&&!(r instanceof ai))throw new i.Error("The 2nd parameter to `mongoose.model()` should be a schema or a POJO");s=s||{};let o=r;if(r){if(i.get("cloneSchemas"))r=r.clone();i._applyPlugins(r)}let u=Object.hasOwn(i.options,"overwriteModels")?i.options.overwriteModels:s.overwriteModels;if(Object.hasOwn(i.models,t)&&s.cache!==!1&&u!==!0){if(o?.instanceOfSchema&&o!==i.models[t].schema)throw new i.Error.OverwriteModelError(t);if(n&&n!==i.models[t].collection.name){let c=i.models[t];return r=c.prototype.schema,c.__subclass(i.connection,r,n)}return i.models[t]}if(r==null)throw new i.Error.MissingSchemaError(t);let a=i._model(t,r,n,s);return i.connection.models[t]=a,i.models[t]=a,a};/*!
1057
+ * ignore
1058
+ */se.prototype._model=function(t,r,n,s){let i=this instanceof se?this:as,o;if(typeof t==="function"){if(o=t,t=o.name,!(o.prototype instanceof RK))throw new i.Error("The provided class "+t+" must extend Model")}if(t==="__proto__")throw new i.Error('Model name "__proto__" is not allowed');if(r){if(i.get("cloneSchemas"))r=r.clone();i._applyPlugins(r)}if(r==null||!("pluralization"in r.options))r.options.pluralization=i.options.pluralization;if(!n)n=r.get("collection")||gu.toCollectionName(t,i.pluralize());Npe(r);let u=s.connection||i.connection;if(o=i.Model.compile(o||t,r,n,u,i),o.init().catch(function(){}),u.emit("model",o),r._applyDiscriminators!=null)for(let a of r._applyDiscriminators.keys()){let{schema:c,options:l}=r._applyDiscriminators.get(a);o.discriminator(a,c,l)}return o};se.prototype.deleteModel=function(t){let r=this instanceof se?this:as;return r.connection.deleteModel(t),delete r.models[t],r};se.prototype.modelNames=function(){let t=this instanceof se?this:as;return Object.keys(t.models)};se.prototype._applyPlugins=function(t,r){let n=this instanceof se?this:as;r=r||{},r.applyPluginsToDiscriminators=n.options?.applyPluginsToDiscriminators||!1,r.applyPluginsToChildSchemas=typeof n.options?.applyPluginsToChildSchemas==="boolean"?n.options.applyPluginsToChildSchemas:!0,wpe(t,n.plugins,r,"$globalPluginsApplied")};se.prototype.plugin=function(t,r){let n=this instanceof se?this:as;return n.plugins.push([t,r]),n};se.prototype.__defineGetter__("connection",function(){return this.connections[0]});se.prototype.__defineSetter__("connection",function(e){if(e instanceof this.__driver.Connection)this.connections[0]=e,this.models=e.models});se.prototype.connections;se.prototype.nextConnectionId;se.prototype.Aggregate=Tpe;se.prototype.BaseCollection=f6();Object.defineProperty(se.prototype,"Collection",{get:function(){return this.__driver.Collection},set:function(e){this.__driver.Collection=e}});Object.defineProperty(se.prototype,"Connection",{get:function(){return this.__driver.Connection},set:function(e){if(e===this.__driver.Connection)return;this.__driver.Connection=e}});se.prototype.BaseConnection=HS();se.prototype.version=$K.version;se.prototype.Mongoose=se;se.prototype.Schema=ai;se.prototype.SchemaType=Epe;se.prototype.SchemaTypes=ai.Types;se.prototype.VirtualType=Ape;se.prototype.Types=Ope;se.prototype.Query=Spe;se.prototype.Model=RK;se.prototype.Document=gpe;se.prototype.ObjectId=_u.ObjectId;se.prototype.isValidObjectId=function(t){return(this instanceof se?this:as).Types.ObjectId.isValid(t)};se.prototype.isObjectIdOrHexString=function(t){return Bpe(t,"ObjectId")||typeof t==="string"&&Ipe.test(t)};se.prototype.syncIndexes=function(t){return(this instanceof se?this:as).connection.syncIndexes(t)};se.prototype.Decimal128=_u.Decimal128;se.prototype.Mixed=_u.Mixed;se.prototype.Date=_u.Date;se.prototype.Number=_u.Number;se.prototype.Error=Qu;se.prototype.MongooseError=Qu;se.prototype.now=function(){return new Date};se.prototype.CastError=Qu.CastError;se.prototype.SchemaTypeOptions=js();se.prototype.mongo=null;se.prototype.mquery=hw();se.prototype.sanitizeFilter=Ppe;se.prototype.trusted=Mpe;se.prototype.skipMiddlewareFunction=Xh.skipWrappedFunction;se.prototype.overwriteMiddlewareResult=Xh.overwriteResult;se.prototype.overwriteMiddlewareArguments=Xh.overwriteArguments;se.prototype.omitUndefined=mO();/*!
1059
+ * Create a new default connection (`mongoose.connection`) for a Mongoose instance.
1060
+ * No-op if there is already a default connection.
1061
+ */function rC(e){if(e.connection)return;let t=e.createConnection();t[xK]=!0,t.models=e.models}var as=jK.exports=qK=new se({[vK]:!0})});var zK=g(function(R6e,VK){/*!
1062
+ * Module dependencies.
1063
+ */var UK=HV();w_().set(UK);var op=LK();op.setDriver(UK);op.Mongoose.prototype.mongo=Oa();VK.exports=op});var WK=g(function($6e,$e){var Y=zK();$e.exports=Y;$e.exports.default=Y;$e.exports.mongoose=Y;$e.exports.cast=Y.cast;$e.exports.STATES=Y.STATES;$e.exports.setDriver=Y.setDriver;$e.exports.set=Y.set;$e.exports.get=Y.get;$e.exports.createConnection=Y.createConnection;$e.exports.connect=Y.connect;$e.exports.disconnect=Y.disconnect;$e.exports.startSession=Y.startSession;$e.exports.pluralize=Y.pluralize;$e.exports.model=Y.model;$e.exports.deleteModel=Y.deleteModel;$e.exports.modelNames=Y.modelNames;$e.exports.plugin=Y.plugin;$e.exports.connections=Y.connections;$e.exports.version=Y.version;$e.exports.Aggregate=Y.Aggregate;$e.exports.Mongoose=Y.Mongoose;$e.exports.Schema=Y.Schema;$e.exports.SchemaType=Y.SchemaType;$e.exports.SchemaTypes=Y.SchemaTypes;$e.exports.VirtualType=Y.VirtualType;$e.exports.Types=Y.Types;$e.exports.Query=Y.Query;$e.exports.Model=Y.Model;$e.exports.Document=Y.Document;$e.exports.ObjectId=Y.ObjectId;$e.exports.isValidObjectId=Y.isValidObjectId;$e.exports.isObjectIdOrHexString=Y.isObjectIdOrHexString;$e.exports.syncIndexes=Y.syncIndexes;$e.exports.Decimal128=Y.Decimal128;$e.exports.Mixed=Y.Mixed;$e.exports.Date=Y.Date;$e.exports.Number=Y.Number;$e.exports.Error=Y.Error;$e.exports.MongooseError=Y.MongooseError;$e.exports.now=Y.now;$e.exports.CastError=Y.CastError;$e.exports.SchemaTypeOptions=Y.SchemaTypeOptions;$e.exports.mongo=Y.mongo;$e.exports.mquery=Y.mquery;$e.exports.sanitizeFilter=Y.sanitizeFilter;$e.exports.trusted=Y.trusted;$e.exports.skipMiddlewareFunction=Y.skipMiddlewareFunction;$e.exports.overwriteMiddlewareResult=Y.overwriteMiddlewareResult});var vpe={};FC(vpe,{createMongoModelClient:()=>$pe});module.exports=BC(vpe);var Rpe={};FC(Rpe,{DuplicateError:()=>mE,InvalidConfigError:()=>KK,NoxiumError:()=>ef,RequiredConfigError:()=>HK,ValidationError:()=>yE});var so=aG(WK(),1);class ef extends Error{code;constructor(e,t){super(e);if(this.name=new.target.name,t!==void 0)this.code=t;Object.setPrototypeOf(this,new.target.prototype)}}class mE extends ef{column;value;constructor(e,t){super(`Duplicate unique value: ${e} = ${t}`,"DUPLICATE_ENTRY");this.column=e,this.value=t}}class yE extends ef{column;constructor(e){super(`Missing required field: ${e}`,"VALIDATION_ERROR");this.column=e}}class HK extends ef{constructor(){super(`File konfigurasi wajib \`noxium.config.ts\` tidak ditemukan.
1064
+ Silakan buat file tersebut di direktori root proyek Anda (misalnya: \`noxium.config.ts\`).
1065
+
1066
+ // noxium.config.ts
1067
+ export default function getConfig() {
1068
+ return {
1069
+ database: {
1070
+ type: "sqlite", // default minimal pakai SQLite
1071
+ sqlite: {
1072
+ path: "./data.db", // file database lokal
1073
+ },
1074
+ },
1075
+ };
1076
+ }
1077
+ `,"REQUIRED_CONFIG")}}class KK extends ef{constructor(e){super(e,"INVALID_CONFIG")}}var gE=(e)=>{if(!e)return"";if(typeof e==="string")return e;if(typeof e==="object"&&e!==null&&"_id"in e)return String(e._id);return String(e)},up=(e,t)=>{if(!e)return e;let r={...e,id:gE(e._id??e.id)};if(t)for(let[n,s]of Object.entries(t)){let i=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)){let o={id:gE(i._id??i.id)};for(let u of s)if(u in i)o[u]=i[u];r[n]=o,r.ownerId=o.id}else if(i)r[n]=gE(i)}else if(r.owner&&typeof r.owner==="object")r.owner=gE(r.owner._id??r.owner.id);return r};function $pe(e,t,r){if(so.default.connection.readyState===0)so.default.connect(r.mongo.uri,{dbName:r.mongo.dbName??"test"});let n={};for(let[u,a]of Object.entries(t.fields)){let c={};if(a.type==="ref"){if(c.type=so.Schema.Types.ObjectId,a.ref)c.ref=a.ref}else if(a.type===Date)c.type=Date;else if(a.type===Number)c.type=Number;else if(a.type===Boolean)c.type=Boolean;else c.type=String;if(a.required)c.required=!0;if(a.unique)c.unique=!0;if(a.default!==void 0)c.default=a.default;if(a.lowercase)c.lowercase=!0;if(a.trim)c.trim=!0;n[u]=c}let s=new so.Schema(n,{timestamps:t.timestamps!==!1});if(t.ttl)s.index({[t.ttl.field]:1},{expireAfterSeconds:t.ttl.seconds});let i=so.default.models[e]||so.default.model(e,s),o=async(u)=>{if(!t.hooks?.afterFind||u.length===0)return;await t.hooks.afterFind(u)};return{async insert(u){try{let a=await i.create(u);return up(a.toObject())}catch(a){if(a?.code===11000){let c=a.keyValue??a.keyPattern??{},l=Object.keys(c)[0]??"unknown";throw new mE(l,c[l])}if(a?.errors){let c=Object.keys(a.errors)[0]??"unknown";throw new yE(c)}throw a}},async update(u,a){if(!a)return null;let c={};if(typeof u==="object"&&u!==null){let f=Object.entries(u).filter(([,h])=>h!==void 0);if(f.length===0)return null;for(let[h,d]of f)if(h==="id")c._id=so.default.Types.ObjectId.isValid(String(d))?new so.default.Types.ObjectId(String(d)):d;else c[h]=d}else c._id=so.default.Types.ObjectId.isValid(String(u))?new so.default.Types.ObjectId(String(u)):u;let l=await i.findOneAndUpdate(c,{$set:a},{new:!0}).lean();return l?up(l):null},async findAll(u){let a=i.find({});if(u?.populate)for(let[l,f]of Object.entries(u.populate))a=a.populate(l,f.join(" "));let c=await a.lean();return await o(c),c.map((l)=>up(l,u?.populate))},async findUnique(u,a){let c=i.findOne(u);if(a?.populate)for(let[f,h]of Object.entries(a.populate))c=c.populate(f,h.join(" "));let l=await c.lean();if(!l)return null;return await o([l]),up(l,a?.populate)},async findMany(u={},a){let c=i.find(u);if(a?.populate)for(let[f,h]of Object.entries(a.populate))c=c.populate(f,h.join(" "));let l=await c.lean();return await o(l),l.map((f)=>up(f,a?.populate))},async deleteMany(u){let a=await i.deleteMany(u);return Number(a.deletedCount??0)}}}
1078
+
1079
+ //# debugId=949DF91588395C9464756E2164756E21
1080
+ //# sourceMappingURL=mongo.cjs.map