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.
- package/README.md +167 -14
- package/build.ts +65 -0
- package/dist/drivers/mongo.cjs +1080 -0
- package/dist/drivers/mongo.cjs.map +456 -0
- package/dist/drivers/mongo.d.ts +4 -0
- package/dist/drivers/mongo.d.ts.map +1 -0
- package/dist/drivers/mongo.mjs +1081 -0
- package/dist/drivers/mongo.mjs.map +456 -0
- package/dist/drivers/sqlite.cjs +18 -0
- package/dist/drivers/sqlite.cjs.map +11 -0
- package/dist/drivers/sqlite.d.ts +4 -0
- package/dist/drivers/sqlite.d.ts.map +1 -0
- package/dist/drivers/sqlite.mjs +19 -0
- package/dist/drivers/sqlite.mjs.map +11 -0
- package/dist/error.cjs +18 -0
- package/dist/error.cjs.map +10 -0
- package/dist/error.d.ts +20 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.mjs +19 -0
- package/dist/error.mjs.map +10 -0
- package/dist/noxium.cjs +1080 -0
- package/dist/noxium.cjs.map +473 -0
- package/dist/noxium.d.ts +21 -0
- package/dist/noxium.d.ts.map +1 -0
- package/dist/noxium.mjs +1081 -0
- package/dist/noxium.mjs.map +473 -0
- package/dist/schema.cjs +4 -0
- package/dist/schema.cjs.map +9 -0
- package/dist/schema.d.ts +84 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.mjs +4 -0
- package/dist/schema.mjs.map +9 -0
- package/package.json +24 -26
- package/dist/cjs/createClient.cjs +0 -54
- package/dist/cjs/drivers/mongo.cjs +0 -61
- package/dist/cjs/drivers/sqlite.cjs +0 -74
- package/dist/cjs/error.cjs +0 -46
- package/dist/cjs/noxium.cjs +0 -39
- package/dist/cjs/schema.cjs +0 -2
- package/dist/esm/createClient.js +0 -52
- package/dist/esm/drivers/mongo.js +0 -59
- package/dist/esm/drivers/sqlite.js +0 -72
- package/dist/esm/error.js +0 -41
- package/dist/esm/noxium.js +0 -37
- package/dist/esm/schema.js +0 -1
package/dist/noxium.cjs
ADDED
|
@@ -0,0 +1,1080 @@
|
|
|
1
|
+
var cY=Object.create;var{getPrototypeOf:lY,defineProperty:pf,getOwnPropertyNames:ZC,getOwnPropertyDescriptor:hY}=Object,x_=Object.prototype.hasOwnProperty;function eb(e){return this[e]}var fY,dY,v_=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?fY??=new WeakMap:dY??=new WeakMap,s=i.get(e);if(s)return s}r=e!=null?cY(lY(e)):{};let o=t||!e||!e.__esModule||!x_.call(e,"default")?pf(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let u of ZC(e))if(!x_.call(o,u))pf(o,u,{get:eb.bind(e,u),enumerable:!0})}if(n)i.set(e,o);return o},Ap=(e)=>{var t=(XC??=new WeakMap).get(e),r;if(t)return t;if(t=pf({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of ZC(e))if(!x_.call(t,n))pf(t,n,{get:eb.bind(e,n),enumerable:!(r=hY(e,n))||r.enumerable})}return XC.set(e,t),t},XC,g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var pY=(e)=>e;function mY(e,t){this[e]=pY.bind(null,t)}var wp=(e,t)=>{for(var r in t)pf(e,r,{get:t[r],enumerable:!0,configurable:!0,set:mY.bind(t,r)})};var oo=g(function(Op){Op.getBooleanOption=(e,t)=>{let r=!1;if(t in e&&typeof(r=e[t])!=="boolean")throw TypeError(`Expected the "${t}" option to be a boolean`);return r};Op.cppdb=Symbol();Op.inspect=Symbol.for("nodejs.util.inspect.custom")});var k_=g(function(C0e,tb){class Sp extends Error{constructor(e,t){if(typeof t!=="string")throw TypeError("Expected second argument to be a string");super(""+e);if(this.code=t,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,Sp)}}Object.defineProperty(Sp.prototype,"name",{value:"SqliteError",writable:!0,enumerable:!1,configurable:!0});tb.exports=Sp});var rb=g(function(na){var{cppdb:uo}=oo();na.prepare=function(t){return this[uo].prepare(t,this,!1,!1)};na.exec=function(t){return this[uo].exec(t),this};na.close=function(){return this[uo].close(),this};na.loadExtension=function(...t){return this[uo].loadExtension(...t),this};na.defaultSafeIntegers=function(...t){return this[uo].defaultSafeIntegers(...t),this};na.unsafeMode=function(...t){return this[uo].unsafeMode(...t),this};na.getters={name:{get:function(){return this[uo].name},enumerable:!0},open:{get:function(){return this[uo].open},enumerable:!0},inTransaction:{get:function(){return this[uo].inTransaction},enumerable:!0},readonly:{get:function(){return this[uo].readonly},enumerable:!0},memory:{get:function(){return this[uo].memory},enumerable:!0}}});var sb=g(function(D0e,ib){var{cppdb:yY}=oo(),nb=new WeakMap;ib.exports=function(t){if(typeof t!=="function")throw TypeError("Expected first argument to be a function");let r=this[yY],n=gY(r,this),{apply:i}=Function.prototype,s={default:{value:Cp(i,t,r,n.default)},deferred:{value:Cp(i,t,r,n.deferred)},immediate:{value:Cp(i,t,r,n.immediate)},exclusive:{value:Cp(i,t,r,n.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(s.default.value,s),Object.defineProperties(s.deferred.value,s),Object.defineProperties(s.immediate.value,s),Object.defineProperties(s.exclusive.value,s),s.default.value};var gY=(e,t)=>{let r=nb.get(e);if(!r){let n={commit:e.prepare("COMMIT",t,!1,!1),rollback:e.prepare("ROLLBACK",t,!1,!1),savepoint:e.prepare("SAVEPOINT `\t_bs3.\t`",t,!1,!1),release:e.prepare("RELEASE `\t_bs3.\t`",t,!1,!1),rollbackTo:e.prepare("ROLLBACK TO `\t_bs3.\t`",t,!1,!1)};nb.set(e,r={default:Object.assign({begin:e.prepare("BEGIN",t,!1,!1)},n),deferred:Object.assign({begin:e.prepare("BEGIN DEFERRED",t,!1,!1)},n),immediate:Object.assign({begin:e.prepare("BEGIN IMMEDIATE",t,!1,!1)},n),exclusive:Object.assign({begin:e.prepare("BEGIN EXCLUSIVE",t,!1,!1)},n)})}return r},Cp=(e,t,r,{begin:n,commit:i,rollback:s,savepoint:o,release:u,rollbackTo:a})=>function(){let l,f,h;if(r.inTransaction)l=o,f=u,h=a;else l=n,f=i,h=s;l.run();try{let d=e.call(t,this,arguments);if(d&&typeof d.then==="function")throw TypeError("Transaction function cannot return a promise");return f.run(),d}catch(d){if(r.inTransaction){if(h.run(),h!==s)f.run()}throw d}}});var ub=g(function(T0e,ob){var{getBooleanOption:EY,cppdb:_Y}=oo();ob.exports=function(t,r){if(r==null)r={};if(typeof t!=="string")throw TypeError("Expected first argument to be a string");if(typeof r!=="object")throw TypeError("Expected second argument to be an options object");let n=EY(r,"simple"),i=this[_Y].prepare(`PRAGMA ${t}`,this,!0,!1);return n?i.pluck().get():i.all()}});var cb=g(function(M0e,ab){var{cppdb:AY}=oo();ab.exports=function(t){if(typeof t!=="string")throw TypeError("Expected first argument to be a string");return this[AY].prepare(`EXPLAIN ${t}`,this,!1,!0).all()}});var pb=g(function(P0e,db){var hb=require("fs"),fb=require("path"),{promisify:wY}=require("util"),{cppdb:OY}=oo(),lb=wY(hb.access);db.exports=async function(t,r){if(r==null)r={};if(typeof t!=="string")throw TypeError("Expected first argument to be a string");if(typeof r!=="object")throw TypeError("Expected second argument to be an options object");t=t.trim();let n="attached"in r?r.attached:"main",i="progress"in r?r.progress:null;if(!t)throw TypeError("Backup filename cannot be an empty string");if(t===":memory:")throw TypeError('Invalid backup filename ":memory:"');if(typeof n!=="string")throw TypeError('Expected the "attached" option to be a string');if(!n)throw TypeError('The "attached" option cannot be an empty string');if(i!=null&&typeof i!=="function")throw TypeError('Expected the "progress" option to be a function');await lb(fb.dirname(t)).catch(()=>{throw TypeError("Cannot save backup because the directory does not exist")});let s=await lb(t).then(()=>!1,()=>!0);return SY(this[OY].backup(this,n,t,s),i||null)};var SY=(e,t)=>{let r=0,n=!0;return new Promise((i,s)=>{setImmediate(function o(){try{let u=e.transfer(r);if(!u.remainingPages){e.close(),i(u);return}if(n)n=!1,r=100;if(t){let a=t(u);if(a!==void 0)if(typeof a==="number"&&a===a)r=Math.max(0,Math.min(2147483647,Math.round(a)));else throw TypeError("Expected progress callback to return a number or undefined")}setImmediate(o)}catch(u){e.close(),s(u)}})})}});var yb=g(function(B0e,mb){var{cppdb:CY}=oo();mb.exports=function(t){if(t==null)t={};if(typeof t!=="object")throw TypeError("Expected first argument to be an options object");let r="attached"in t?t.attached:"main";if(typeof r!=="string")throw TypeError('Expected the "attached" option to be a string');if(!r)throw TypeError('The "attached" option cannot be an empty string');return this[CY].serialize(r)}});var Eb=g(function(F0e,gb){var{getBooleanOption:bp,cppdb:bY}=oo();gb.exports=function(t,r,n){if(r==null)r={};if(typeof r==="function")n=r,r={};if(typeof t!=="string")throw TypeError("Expected first argument to be a string");if(typeof n!=="function")throw TypeError("Expected last argument to be a function");if(typeof r!=="object")throw TypeError("Expected second argument to be an options object");if(!t)throw TypeError("User-defined function name cannot be an empty string");let i="safeIntegers"in r?+bp(r,"safeIntegers"):2,s=bp(r,"deterministic"),o=bp(r,"directOnly"),u=bp(r,"varargs"),a=-1;if(!u){if(a=n.length,!Number.isInteger(a)||a<0)throw TypeError("Expected function.length to be a positive integer");if(a>100)throw RangeError("User-defined functions cannot have more than 100 arguments")}return this[bY].function(n,t,a,i,s,o),this}});var wb=g(function(N0e,Ab){var{getBooleanOption:Dp,cppdb:DY}=oo();Ab.exports=function(t,r){if(typeof t!=="string")throw TypeError("Expected first argument to be a string");if(typeof r!=="object"||r===null)throw TypeError("Expected second argument to be an options object");if(!t)throw TypeError("User-defined function name cannot be an empty string");let n="start"in r?r.start:null,i=q_(r,"step",!0),s=q_(r,"inverse",!1),o=q_(r,"result",!1),u="safeIntegers"in r?+Dp(r,"safeIntegers"):2,a=Dp(r,"deterministic"),c=Dp(r,"directOnly"),l=Dp(r,"varargs"),f=-1;if(!l){if(f=Math.max(_b(i),s?_b(s):0),f>0)f-=1;if(f>100)throw RangeError("User-defined functions cannot have more than 100 arguments")}return this[DY].aggregate(n,i,s,o,t,f,u,a,c),this};var q_=(e,t,r)=>{let n=t in e?e[t]:null;if(typeof n==="function")return n;if(n!=null)throw TypeError(`Expected the "${t}" option to be a function`);if(r)throw TypeError(`Missing required option "${t}"`);return null},_b=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw TypeError("Expected function.length to be a positive integer")}});var Db=g(function(I0e,bb){var{cppdb:TY}=oo();bb.exports=function(t,r){if(typeof t!=="string")throw TypeError("Expected first argument to be a string");if(!t)throw TypeError("Virtual table module name cannot be an empty string");let n=!1;if(typeof r==="object"&&r!==null)n=!0,r=RY(Cb(r,"used",t));else{if(typeof r!=="function")throw TypeError("Expected second argument to be a function or a table definition object");r=MY(r)}return this[TY].table(r,t,n),this};function MY(e){return function(r,n,i,...s){let o={module:r,database:n,table:i},u=IY.call(e,o,s);if(typeof u!=="object"||u===null)throw TypeError(`Virtual table module "${r}" did not return a table definition object`);return Cb(u,"returned",r)}}function Cb(e,t,r){if(!mf.call(e,"rows"))throw TypeError(`Virtual table module "${r}" ${t} a table definition without a "rows" property`);if(!mf.call(e,"columns"))throw TypeError(`Virtual table module "${r}" ${t} a table definition without a "columns" property`);let n=e.rows;if(typeof n!=="function"||Object.getPrototypeOf(n)!==$Y)throw TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let i=e.columns;if(!Array.isArray(i)||!Sb(i=[...i]))throw TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(i.length!==new Set(i).size)throw TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate column names`);if(!i.length)throw RangeError(`Virtual table module "${r}" ${t} a table definition with zero columns`);let s;if(mf.call(e,"parameters")){if(s=e.parameters,!Array.isArray(s)||!Sb(s=[...s]))throw TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else s=NY(n);if(s.length!==new Set(s).size)throw TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate parameter names`);if(s.length>32)throw RangeError(`Virtual table module "${r}" ${t} a table definition with more than the maximum number of 32 parameters`);for(let c of s)if(i.includes(c))throw TypeError(`Virtual table module "${r}" ${t} a table definition with column "${c}" which was ambiguously defined as both a column and parameter`);let o=2;if(mf.call(e,"safeIntegers")){let c=e.safeIntegers;if(typeof c!=="boolean")throw TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);o=+c}let u=!1;if(mf.call(e,"directOnly")){if(u=e.directOnly,typeof u!=="boolean")throw TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`)}return[`CREATE TABLE x(${[...s.map(Ob).map((c)=>`${c} HIDDEN`),...i.map(Ob)].join(", ")});`,PY(n,new Map(i.map((c,l)=>[c,s.length+l])),r),s,o,u]}function PY(e,t,r){return function*(...i){let s=i.map((o)=>Buffer.isBuffer(o)?Buffer.from(o):o);for(let o=0;o<t.size;++o)s.push(null);for(let o of e(...i))if(Array.isArray(o))BY(o,s,t.size,r),yield s;else if(typeof o==="object"&&o!==null)FY(o,s,t,r),yield s;else throw TypeError(`Virtual table module "${r}" yielded something that isn't a valid row object`)}}function BY(e,t,r,n){if(e.length!==r)throw TypeError(`Virtual table module "${n}" yielded a row with an incorrect number of columns`);let i=t.length-r;for(let s=0;s<r;++s)t[s+i]=e[s]}function FY(e,t,r,n){let i=0;for(let s of Object.keys(e)){let o=r.get(s);if(o===void 0)throw TypeError(`Virtual table module "${n}" yielded a row with an undeclared column "${s}"`);t[o]=e[s],i+=1}if(i!==r.size)throw TypeError(`Virtual table module "${n}" yielded a row with missing columns`)}function NY({length:e}){if(!Number.isInteger(e)||e<0)throw TypeError("Expected function.length to be a positive integer");let t=[];for(let r=0;r<e;++r)t.push(`$${r+1}`);return t}var{hasOwnProperty:mf}=Object.prototype,{apply:IY}=Function.prototype,$Y=Object.getPrototypeOf(function*(){}),Ob=(e)=>`"${e.replace(/"/g,'""')}"`,RY=(e)=>()=>e,Sb=(e)=>{for(let t=0;t<e.length;++t)if(typeof e[t]!=="string")return!1;return!0}});var Mb=g(function($0e,Tb){var xY=function(){};Tb.exports=function(t,r){return Object.assign(new xY,this)}});var Nb=g(function(R0e,Fb){var Pb=require("fs"),Bb=require("path"),ia=oo(),vY=k_();Fb.exports=function(t,r){function n(s,o){if(new.target==null)return new n(s,o);let u,a;if(Buffer.isBuffer(s))u=s,s=":memory:";else if(typeof s==="number"){if(!Number.isInteger(s)||s<0||s>2147483647)throw TypeError("Expected the file descriptor to be a non-negative 32-bit integer");a=s,s=`fd:${a}`}if(s==null)s="";if(o==null)o={};if(typeof s!=="string")throw TypeError("Expected first argument to be a string");if(typeof o!=="object")throw TypeError("Expected second argument to be an options object");if("readOnly"in o)throw TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in o)throw TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let c=s.trim(),l=c===""||c===":memory:",f=ia.getBooleanOption(o,"readonly"),h=ia.getBooleanOption(o,"fileMustExist"),d="timeout"in o?o.timeout:5000,p="verbose"in o?o.verbose:null,m="nativeBinding"in o?o.nativeBinding:null,E="journalFd"in o?o.journalFd:void 0;if(f&&l&&!u)throw TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(d)||d<0)throw TypeError('Expected the "timeout" option to be a positive integer');if(d>2147483647)throw RangeError('Option "timeout" cannot be greater than 2147483647');if(p!=null&&typeof p!=="function")throw TypeError('Expected the "verbose" option to be a function');if(a!==void 0&&E===void 0)throw TypeError('The "journalFd" option is required when opening a database from a file descriptor');if(a===void 0&&E!==void 0)throw TypeError('The "journalFd" option can only be used when opening a database from a file descriptor');if(E!==void 0&&!(Number.isInteger(E)&&E>=0&&E<=2147483647))throw TypeError('Expected the "journalFd" option to be a non-negative 32-bit integer');if(!r&&"nativeBinding"in o)throw TypeError('The "nativeBinding" option is only supported by the default better-sqlite3 entrypoint');if(r&&m!=null&&typeof m!=="string"&&typeof m!=="object")throw TypeError('Expected the "nativeBinding" option to be a string or addon object');let y=t(m);if(!y.isInitialized)y.initialize(vY,kY,qY,jY,LY),y.isInitialized=!0;if(a===void 0&&!l&&!c.startsWith("file:")&&!Pb.existsSync(Bb.dirname(c)))throw TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[ia.cppdb]:{value:new y.Database(c,s,l,f,h,d,p||null,u||null,a??null,E??null)},...i.getters})}let i=rb();return n.prototype.prepare=i.prepare,n.prototype.transaction=sb(),n.prototype.pragma=ub(),n.prototype.explain=cb(),n.prototype.backup=pb(),n.prototype.serialize=yb(),n.prototype.function=Eb(),n.prototype.aggregate=wb(),n.prototype.table=Db(),n.prototype.loadExtension=i.loadExtension,n.prototype.exec=i.exec,n.prototype.close=i.close,n.prototype.defaultSafeIntegers=i.defaultSafeIntegers,n.prototype.unsafeMode=i.unsafeMode,n.prototype[ia.inspect]=Mb(),n};function kY(...e){return e}function qY(e,...t){let r=e.length;for(let n=0;n<t.length;++n)e[r+n]=t[n]}function jY(...e){if(!e.includes("__proto__")){let t=e.map((n,i)=>`v${i}`).join(","),r=e.map((n,i)=>`${JSON.stringify(n)}:v${i}`).join(",");return Function(`return (${t}) => ({${r}})`)()}return(...t)=>{let r={};for(let n=0;n<e.length;++n)r[e[n]]=t[n];return r}}function LY(e){return{value:e,done:!1}}});var $b=g(function(j_){var __dirname="/home/runner/work/noxium/noxium/node_modules/better-sqlite3/lib",oa=require("fs"),sa=require("path"),UY=["linux","darwin","win32"],VY=["x64","arm64"],Tp;function zY(e){if(typeof e==="string")return(typeof __non_webpack_require__==="function"?__non_webpack_require__:require)(sa.resolve(e).replace(/(\.node)?$/,".node"));if(typeof e==="object"&&e!==null)return e;if(Tp)return Tp;let t=sa.join(__dirname,"..","build","Debug","better_sqlite3.node");if(!oa.existsSync(t))t=sa.join(__dirname,"..","build","Release","better_sqlite3.node");if(oa.existsSync(t))return Tp=require(t);return Tp=require(Ib()||t)}function Ib(){if(UY.includes(process.platform)&&VY.includes(process.arch)){let e=`${WY()?"linuxmusl":process.platform}-${process.arch}`,t=sa.join(__dirname,"..","prebuilds",`${e}.node`);if(oa.existsSync(t))return t}return null}function WY(){if(process.platform!=="linux")return!1;try{let r=oa.readFileSync("/proc/self/maps","latin1");if(/\/ld-musl-[^/\s]*\.so/.test(r))return!0;if(/\/(?:ld-linux[^/\s]*|libc)\.so\.\d/.test(r))return!1}catch{}let{report:e}=process,t=e.excludeNetwork;e.excludeNetwork=!0;try{return!e.getReport().header.glibcVersionRuntime}finally{e.excludeNetwork=t}}j_.getBinding=zY;j_.getPrebuildPath=Ib});var Rb=g(function(v0e,L_){L_.exports=Nb()($b().getBinding,!0);L_.exports.SqliteError=k_()});var r3=g(function(_t){var HY=(()=>{let e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get;return(t)=>e.call(t)})();function Al(e){return HY(e)==="Uint8Array"}function G_(e){return typeof e==="object"&&e!=null&&Symbol.toStringTag in e&&(e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer")}function Bp(e){return e instanceof RegExp||Object.prototype.toString.call(e)==="[object RegExp]"}function Ip(e){return typeof e==="object"&&e!=null&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Map"}function Fp(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Yi(e,t){return JSON.stringify(e,(r,n)=>{if(typeof n==="bigint")return{$numberLong:`${n}`};else if(Ip(n))return Object.fromEntries(n);return n})}function KY(e){if(e!=null&&typeof e==="object"&&"stylize"in e&&typeof e.stylize==="function")return e.stylize}var Of=7,$p=Symbol.for("@@mdb.bson.version"),Sf=2147483647,Cf=-2147483648,e9=Math.pow(2,63)-1,t9=-Math.pow(2,63),r9=Math.pow(2,53),n9=-Math.pow(2,53),Y_=1,i9=2,_f=3,Ef=4,Q_=5,GY=6,s9=7,o9=8,u9=9,J_=10,Np=11,YY=12,X_=13,a9=14,Pp=15,Af=16,c9=17,Z_=18,l9=19,h9=255,f9=127,QY=0,e3=4,d9=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 v 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 wl extends v{get name(){return"BSONVersionError"}constructor(){super(`Unsupported BSON version, bson types must be from bson ${Of}.x.x`)}}class wf extends v{get name(){return"BSONRuntimeError"}constructor(e){super(e)}}class co extends v{get name(){return"BSONOffsetError"}offset;constructor(e,t,r){super(`${e}. offset: ${t}`,r);this.offset=t}}var xb,vb;function p9(e,t,r,n){if(n){xb??=new TextDecoder("utf8",{fatal:!0});try{return xb.decode(e.subarray(t,r))}catch(i){throw new v("Invalid UTF-8 string in BSON document",{cause:i})}}return vb??=new TextDecoder("utf8",{fatal:!1}),vb.decode(e.subarray(t,r))}function m9(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 i=[];for(let s=t;s<r;s++){let o=e[s];if(o>127)return null;i.push(o)}return String.fromCharCode(...i)}function JY(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,i=r;n<t.length;n++,i++){let s=t.charCodeAt(n);if(s>127)return null;e[i]=s}return t.length}function XY(e){return ls.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}function ZY(e){return crypto.getRandomValues(ls.allocate(e))}var eQ=(()=>{let{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues==="function")return ZY;else return XY})(),ls={isUint8Array:Al,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 v("Cannot create Buffer from the passed potentialBuffer.")},allocate(e){return Buffer.alloc(e)},allocateUnsafe(e){return Buffer.allocUnsafe(e)},compare(e,t){return ls.toLocalBufferType(e).compare(t)},concat(e){return Buffer.concat(e)},copy(e,t,r,n,i){return ls.toLocalBufferType(e).copy(t,r??0,n??0,i??e.length)},equals(e,t){return ls.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 ls.toLocalBufferType(e).toString("base64")},fromISO88591(e){return Buffer.from(e,"binary")},toISO88591(e){return ls.toLocalBufferType(e).toString("binary")},fromHex(e){return Buffer.from(e,"hex")},toHex(e){return ls.toLocalBufferType(e).toString("hex")},toUTF8(e,t,r,n){let i=r-t<=20?m9(e,t,r):null;if(i!=null)return i;let s=ls.toLocalBufferType(e).toString("utf8",t,r);if(n){for(let o=0;o<s.length;o++)if(s.charCodeAt(o)===65533){p9(e,t,r,!0);break}}return s},utf8ByteLength(e){return Buffer.byteLength(e,"utf8")},encodeUTF8Into(e,t,r){let n=JY(e,t,r);if(n!=null)return n;return ls.toLocalBufferType(e).write(t,r,void 0,"utf8")},randomBytes:eQ,swap32(e){return ls.toLocalBufferType(e).swap32()}};function tQ(){let{navigator:e}=globalThis;return typeof e==="object"&&e.product==="ReactNative"}function rQ(e){if(e<0)throw RangeError(`The argument 'byteLength' is invalid. Received ${e}`);return Sc.fromNumberArray(Array.from({length:e},()=>Math.floor(Math.random()*256)))}var nQ=(()=>{let{crypto:e}=globalThis;if(e!=null&&typeof e.getRandomValues==="function")return(t)=>e.getRandomValues(Sc.allocate(t));else{if(tQ()){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 rQ}})(),kb=/(\d|[a-f])/i,Sc={isUint8Array:Al,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 v("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 Sc.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 Sc.allocate(0);let t=0;for(let i of e)t+=i.length;let r=Sc.allocate(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r},copy(e,t,r,n,i){if(i!==void 0&&i<0)throw RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${i}`);if(i=i??e.length,n!==void 0&&(n<0||n>i))throw RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${i}. 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 s=e.subarray(n,i),o=Math.min(s.length,t.length-r);if(o<=0)return 0;return t.set(s.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(Sc.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 i=t[n],s=t[n+1];if(!kb.test(i))break;if(!kb.test(s))break;let o=Number.parseInt(`${i}${s}`,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 i=r-t<=20?m9(e,t,r):null;if(i!=null)return i;return p9(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:nQ,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],i=e[t+2],s=e[t+3];e[t]=s,e[t+1]=i,e[t+2]=n,e[t+3]=r}return e}},iQ=typeof Buffer==="function"&&Buffer.prototype?._isBuffer!==!0,x=iQ?ls:Sc,Cc=Symbol.for("@@mdb.bson.type");class ai{get[Cc](){return this._bsontype}get[$p](){return Of}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return this.inspect(e,t,r)}}var El=new Float64Array(1),Et=new Uint8Array(El.buffer,0,8);El[0]=-1;var U_=Et[7]===0,Oe={isBigEndian:U_,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:U_?(e,t)=>(Et[7]=e[t],Et[6]=e[t+1],Et[5]=e[t+2],Et[4]=e[t+3],Et[3]=e[t+4],Et[2]=e[t+5],Et[1]=e[t+6],Et[0]=e[t+7],El[0]):(e,t)=>(Et[0]=e[t],Et[1]=e[t+1],Et[2]=e[t+2],Et[3]=e[t+3],Et[4]=e[t+4],Et[5]=e[t+5],Et[6]=e[t+6],Et[7]=e[t+7],El[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,i=Number(r&n);e[t]=i,i>>=8,e[t+1]=i,i>>=8,e[t+2]=i,i>>=8,e[t+3]=i;let s=Number(r>>32n&n);return e[t+4]=s,s>>=8,e[t+5]=s,s>>=8,e[t+6]=s,s>>=8,e[t+7]=s,8},setFloat64LE:U_?(e,t,r)=>(El[0]=r,e[t]=Et[7],e[t+1]=Et[6],e[t+2]=Et[5],e[t+3]=Et[4],e[t+4]=Et[3],e[t+5]=Et[2],e[t+6]=Et[1],e[t+7]=Et[0],8):(e,t,r)=>(El[0]=r,e[t]=Et[0],e[t+1]=Et[1],e[t+2]=Et[2],e[t+3]=Et[3],e[t+4]=Et[4],e[t+5]=Et[5],e[t+6]=Et[6],e[t+7]=Et[7],8)};class je extends ai{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)&&!G_(e)&&!Array.isArray(e))throw new v("Binary can only be constructed from Uint8Array or number[]");if(this.sub_type=(t??je.BSON_BINARY_SUBTYPE_DEFAULT)&255,e==null)this.buffer=x.allocate(je.BUFFER_SIZE),this.position=0;else this.buffer=Array.isArray(e)?x.fromNumberArray(e):x.toLocalBufferType(e),this.position=this.buffer.byteLength}put(e){if(typeof e==="string"&&e.length!==1)throw new v("only accepts single character String");else if(typeof e!=="number"&&e.length!==1)throw new v("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 v("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=x.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=x.allocate(this.buffer.byteLength+e.length);r.set(this.buffer,0),this.buffer=r}if(ArrayBuffer.isView(e))this.buffer.set(x.toLocalBufferType(e),t),this.position=t+e.byteLength>this.position?t+e.length:this.position;else if(typeof e==="string")throw new v("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 x.toBase64(this.buffer.subarray(0,this.position))}toString(e){if(e==="hex")return x.toHex(this.buffer.subarray(0,this.position));if(e==="base64")return x.toBase64(this.buffer.subarray(0,this.position));if(e==="utf8"||e==="utf-8")return x.toUTF8(this.buffer,0,this.position,!1);return x.toUTF8(this.buffer,0,this.position,!1)}toExtendedJSON(e){if(e=e||{},this.sub_type===je.SUBTYPE_VECTOR)Ou(this);let t=x.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 v(`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(x.fromHex(e),t)}static createFromBase64(e,t){return new je(x.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=x.fromBase64(e.$binary);else if(typeof e.$binary!=="string")n=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=x.fromBase64(e.$binary.base64)}else if("$uuid"in e)n=4,r=bn.bytesFromString(e.$uuid);if(!r)throw new v(`Unexpected Binary Extended JSON format ${JSON.stringify(e)}`);return n===e3?new bn(r):new je(r,n)}inspect(e,t,r){r??=Yi;let n=x.toBase64(this.buffer.subarray(0,this.position)),i=r(n,t),s=r(this.sub_type,t);return`Binary.createFromBase64(${i}, ${s})`}toInt8Array(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new v("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.Int8)throw new v("Binary datatype field is not Int8");return Ou(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 v("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.Float32)throw new v("Binary datatype field is not Float32");Ou(this);let e=new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset+2,this.buffer.byteOffset+this.position));if(Oe.isBigEndian)x.swap32(e);return new Float32Array(e.buffer)}toPackedBits(){if(this.sub_type!==je.SUBTYPE_VECTOR)throw new v("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.PackedBit)throw new v("Binary datatype field is not packed bit");return Ou(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 v("Binary sub_type is not Vector");if(this.buffer[0]!==je.VECTOR_TYPE.PackedBit)throw new v("Binary datatype field is not packed bit");Ou(this);let t=(this.length()-2)*8-this.buffer[1],r=new Int8Array(t);for(let n=0;n<r.length;n++){let i=n/8|0,s=this.buffer[i+2],o=7-n%8,u=s>>o&1;r[n]=u}return r}static fromInt8Array(e){let t=x.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 Ou(n),n}static fromFloat32Array(e){let t=x.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),Oe.isBigEndian)x.swap32(new Uint8Array(t.buffer,2));let n=new this(t,this.SUBTYPE_VECTOR);return Ou(n),n}static fromPackedBits(e,t=0){let r=x.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 Ou(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 i=0;i<e.length;i++){let s=i>>>3,o=e[i];if(o!==0&&o!==1)throw new v(`Invalid bit value at ${i}: must be 0 or 1, found ${e[i]}`);if(o===0)continue;let u=7-i%8;r[s+2]|=o<<u}return new this(r,je.SUBTYPE_VECTOR)}}function Ou(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 v("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 v("Invalid Vector: Float32 vector must contain a multiple of 4 bytes")}if(r===je.VECTOR_TYPE.PackedBit&&n!==0&&t===2)throw new v("Invalid Vector: padding must be zero for packed bit vectors that are empty");if(r===je.VECTOR_TYPE.PackedBit&&n>7)throw new v(`Invalid Vector: padding must be a value between 0 and 7. found: ${n}`)}var V_=16,sQ=/^[0-9A-F]{32}$/i,oQ=/^[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=x.toLocalBufferType(new Uint8Array(e.buffer));else if(ArrayBuffer.isView(e)&&e.byteLength===V_)t=x.toLocalBufferType(e);else if(typeof e==="string")t=bn.bytesFromString(e);else throw new v("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,e3)}get id(){return this.buffer}set id(e){this.buffer=e}toHexString(e=!0){if(e)return[x.toHex(this.buffer.subarray(0,4)),x.toHex(this.buffer.subarray(4,6)),x.toHex(this.buffer.subarray(6,8)),x.toHex(this.buffer.subarray(8,10)),x.toHex(this.buffer.subarray(10,16))].join("-");return x.toHex(this.buffer)}toString(e){if(e==="hex")return x.toHex(this.id);if(e==="base64")return x.toBase64(this.id);return this.toHexString()}toJSON(){return this.toHexString()}equals(e){if(!e)return!1;if(e instanceof bn)return x.equals(e.id,this.id);try{return x.equals(new bn(e).id,this.id)}catch{return!1}}toBinary(){return new je(this.id,je.SUBTYPE_UUID)}static generate(){let e=x.randomBytes(V_);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(Al(e))return e.byteLength===V_;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(x.fromBase64(e))}static bytesFromString(e){if(!bn.isValidUUIDString(e))throw new v("UUID string representation must be 32 hex digits or canonical hyphenated representation");return x.fromHex(e.replace(/-/g,""))}static isValidUUIDString(e){return sQ.test(e)||oQ.test(e)}inspect(e,t,r){return r??=Yi,`new UUID(${r(this.toHexString(),t)})`}}class Cu extends ai{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 Cu(e.$code,e.$scope)}inspect(e,t,r){r??=Yi;let n=r(this.code,t),i=n.includes(`
|
|
2
|
+
`);if(this.scope!=null)n+=`,${i?`
|
|
3
|
+
`:" "}${r(this.scope,t)}`;let s=i&&this.scope===null;return`new Code(${i?`
|
|
4
|
+
`:""}${n}${s?`
|
|
5
|
+
`:""})`}}function y9(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 Bo extends ai{get _bsontype(){return"DBRef"}collection;oid;db;fields;constructor(e,t,r,n){super();let i=e.split(".");if(i.length===2)r=i.shift(),e=i.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 Bo(e.$ref,e.$id,e.$db,t)}inspect(e,t,r){r??=Yi;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===Yi?`new ObjectId(${n[1]})`:n[1],`new DBRef(${n.join(", ")})`}}function g9(e){if(e==="")return e;let t=0,r=e[t]==="-",n=e[t]==="+";if(n||r)t+=1;let i=!1;for(;t<e.length&&e[t]==="0";++t)i=!0;if(!i)return n?e.slice(1):e;return`${r?"-":""}${e.length===t?"0":e.slice(t)}`}function uQ(e,t){t=t??10;let r="0123456789abcdefghijklmnopqrstuvwxyz".slice(0,t);return new RegExp(`[^-+${r}]`,"i").test(e)?!1:e}var cs=void 0;try{cs=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 qb=65536,aQ=16777216,_l=qb*qb,E9=_l*_l,jb=E9/2,Lb={},Ub={},cQ=20,lQ=/^(\+?0|(\+|-)?[1-9][0-9]*)$/;class M extends ai{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),i=typeof t==="number"?t:0,s=typeof e==="string"?M.fromString(e,n):typeof e==="bigint"?M.fromBigInt(e,n):{low:e|0,high:i|0,unsigned:n};this.low=s.low,this.high=s.high,this.unsigned=s.unsigned}static TWO_PWR_24=M.fromInt(aQ);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,i;if(t){if(e>>>=0,i=0<=e&&e<256){if(n=Ub[e],n)return n}if(r=M.fromBits(e,(e|0)<0?-1:0,!0),i)Ub[e]=r;return r}else{if(e|=0,i=-128<=e&&e<128){if(n=Lb[e],n)return n}if(r=M.fromBits(e,e<0?-1:0,!1),i)Lb[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>=E9)return M.MAX_UNSIGNED_VALUE}else{if(e<=-jb)return M.MIN_VALUE;if(e+1>=jb)return M.MAX_VALUE}if(e<0)return M.fromNumber(-e,t).neg();return M.fromBits(e%_l|0,e/_l|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 v("empty string");if(r<2||36<r)throw new v("radix");let n;if((n=e.indexOf("-"))>0)throw new v("interior hyphen");else if(n===0)return M._fromString(e.substring(1),t,r).neg();let i=M.fromNumber(Math.pow(r,8)),s=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));s=s.mul(c).add(M.fromNumber(a))}else s=s.mul(i),s=s.add(M.fromNumber(a))}return s.unsigned=t,s}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 v(`Input: '${e}' contains leading and/or trailing whitespace`);if(!uQ(e,r))throw new v(`Input: '${e}' contains invalid characters for radix: ${r}`);let i=g9(e),s=M._fromString(i,n,r);if(s.toString(r).toLowerCase()!==i.toLowerCase())throw new v(`Input: ${e} is not representable as ${s.unsigned?"an unsigned":"a signed"} 64-bit Long ${r!=null?`with radix: ${r}`:""}`);return s}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,i=this.low&65535,s=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+=i+a,f+=h>>>16,h&=65535,f+=n+u,l+=f>>>16,f&=65535,l+=r+o,c+=l>>>16,l&=65535,c+=t+s,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 v("division by zero");if(cs){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;let i=(this.unsigned?cs.div_u:cs.div_s)(this.low,this.high,e.low,e.high);return M.fromBits(i,cs.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 i=Math.ceil(Math.log(t)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),o=M.fromNumber(t),u=o.mul(e);while(u.isNegative()||u.gt(r))t-=s,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(cs){let t=(this.unsigned?cs.rem_u:cs.rem_s)(this.low,this.high,e.low,e.high);return M.fromBits(t,cs.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(cs){let d=cs.mul(this.low,this.high,e.low,e.high);return M.fromBits(d,cs.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,i=this.low&65535,s=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+=i*a,f+=h>>>16,h&=65535,f+=n*a,l+=f>>>16,f&=65535,f+=i*u,l+=f>>>16,f&=65535,l+=r*a,c+=l>>>16,l&=65535,l+=n*u,c+=l>>>16,l&=65535,l+=i*o,c+=l>>>16,l&=65535,c+=t*a+r*u+n*o+i*s,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)*_l+(this.low>>>0);return this.high*_l+(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 v("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(M.MIN_VALUE)){let i=M.fromNumber(e),s=this.div(i),o=s.mul(i).sub(this);return s.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 i=r.div(t),o=(r.sub(i.mul(t)).toInt()>>>0).toString(e);if(r=i,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>cQ)throw new v("$numberLong string is too long");if(!lQ.test(e.$numberLong))throw new v(`$numberLong string "${e.$numberLong}" is in an invalid format`);if(r){let s=BigInt(e.$numberLong);return BigInt.asIntN(64,s)}let i=M.fromString(e.$numberLong);if(n)return i.toNumber();return i}inspect(e,t,r){r??=Yi;let n=r(this.toString(),t),i=this.unsigned?`, ${r(this.unsigned,t)}`:"";return`new Long(${n}${i})`}}var hQ=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,fQ=/^(\+|-)?(Infinity|inf)$/i,dQ=/^(\+|-)?NaN$/i,gl=6111,yf=-6176,Vb=6176,zb=34,z_=x.fromNumberArray([124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),Wb=x.fromNumberArray([248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),Hb=x.fromNumberArray([120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse()),pQ=/^([-+])?(\d+)?$/,mQ=31,Kb=16383,yQ=30,gQ=31;function Gb(e){return!isNaN(parseInt(e,10))}function EQ(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 _Q(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),i=t.shiftRightUnsigned(32),s=new M(t.getLowBits(),0),o=r.multiply(i),u=r.multiply(s),a=n.multiply(i),c=n.multiply(s);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 AQ(e,t){let r=e.high>>>0,n=t.high>>>0;if(r<n)return!0;else if(r===n){let i=e.low>>>0,s=t.low>>>0;if(i<s)return!0}return!1}function ao(e,t){throw new v(`"${e}" is not a valid Decimal128 string - ${t}`)}class vn extends ai{get _bsontype(){return"Decimal128"}bytes;constructor(e){super();if(typeof e==="string")this.bytes=vn.fromString(e).bytes;else if(e instanceof Uint8Array||Al(e)){if(e.byteLength!==16)throw new v("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new v("Decimal128 must take a Buffer or string")}static fromString(e){return vn._fromString(e,{allowRounding:!1})}static fromStringWithRounding(e){return vn._fromString(e,{allowRounding:!0})}static _fromString(e,t){let r=!1,n=!1,i=!1,s=!1,o=0,u=0,a=0,c=0,l=0,f=[0],h=0,d=0,p=0,m=0,E=new M(0,0),y=new M(0,0),_=0,O=0;if(e.length>=7000)throw new v(""+e+" not a valid Decimal128 string");let b=e.match(hQ),A=e.match(fQ),P=e.match(dQ);if(!b&&!A&&!P||e.length===0)throw new v(""+e+" not a valid Decimal128 string");if(b){let I=b[2],we=b[4],Ne=b[5],ae=b[6];if(we&&ae===void 0)ao(e,"missing exponent power");if(we&&I===void 0)ao(e,"missing exponent base");if(we===void 0&&(Ne||ae))ao(e,"missing e before exponent")}if(e[O]==="+"||e[O]==="-")n=!0,r=e[O++]==="-";if(!Gb(e[O])&&e[O]!=="."){if(e[O]==="i"||e[O]==="I")return new vn(r?Wb:Hb);else if(e[O]==="N")return new vn(z_)}while(Gb(e[O])||e[O]==="."){if(e[O]==="."){if(i)ao(e,"contains multiple periods");i=!0,O=O+1;continue}if(h<zb){if(e[O]!=="0"||s){if(!s)l=u;s=!0,f[d++]=parseInt(e[O],10),h=h+1}}if(s)a=a+1;if(i)c=c+1;u=u+1,O=O+1}if(i&&!u)throw new v(""+e+" not a valid Decimal128 string");if(e[O]==="e"||e[O]==="E"){let I=e.substr(++O).match(pQ);if(!I||!I[2])return new vn(z_);m=parseInt(I[0],10),O=O+I[0].length}if(e[O])return new vn(z_);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(i)]==="0")o=o-1;if(m<=c&&c>m+16384)m=yf;else m=m-c;while(m>gl){if(p=p+1,p>=zb){if(o===0){m=gl;break}ao(e,"overflow")}m=m-1}if(t.allowRounding){while(m<yf||h<a){if(p===0&&o<h){m=yf,o=0;break}if(h<a)a=a-1;else p=p-1;if(m<gl)m=m+1;else{if(f.join("").match(/^0+$/)){m=gl;break}ao(e,"overflow")}}if(p+1<o){let I=u;if(i)l=l+1,I=I+1;if(n)l=l+1,I=I+1;let we=parseInt(e[l+p+1],10),Ne=0;if(we>=5){if(Ne=1,we===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<gl)m=m+1,f[ae]=1;else return new vn(r?Wb:Hb)}else break}}}else{while(m<yf||h<a){if(p===0){if(o===0){m=yf;break}ao(e,"exponent underflow")}if(h<a){if(e[a-1+Number(n)+Number(i)]!=="0"&&o!==0)ao(e,"inexact rounding");a=a-1}else{if(f[p]!==0)ao(e,"inexact rounding");p=p-1}if(m<gl)m=m+1;else ao(e,"overflow")}if(p+1<o){if(i)l=l+1;if(n)l=l+1;if(parseInt(e[l+p+1],10)!==0)ao(e,"inexact rounding")}}if(E=M.fromNumber(0),y=M.fromNumber(0),o===0)E=M.fromNumber(0),y=M.fromNumber(0);else if(p<17){let I=0;y=M.fromNumber(f[I++]),E=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;E=M.fromNumber(f[I++]);for(;I<=p-17;I++)E=E.multiply(M.fromNumber(10)),E=E.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=_Q(E,M.fromString("100000000000000000"));if(S.low=S.low.add(y),AQ(S.low,y))S.high=S.high.add(M.fromNumber(1));_=m+Vb;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(_).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(_&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=x.allocateUnsafe(16);return O=0,q[O++]=B.low.low&255,q[O++]=B.low.low>>8&255,q[O++]=B.low.low>>16&255,q[O++]=B.low.low>>24&255,q[O++]=B.low.high&255,q[O++]=B.low.high>>8&255,q[O++]=B.low.high>>16&255,q[O++]=B.low.high>>24&255,q[O++]=B.high.low&255,q[O++]=B.high.low>>8&255,q[O++]=B.high.low>>16&255,q[O++]=B.high.low>>24&255,q[O++]=B.high.high&255,q[O++]=B.high.high>>8&255,q[O++]=B.high.high>>16&255,q[O++]=B.high.high>>24&255,new vn(q)}toString(){let e,t=0,r=Array(36);for(let O=0;O<r.length;O++)r[O]=0;let n=0,i=!1,s,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 E=p>>26&mQ;if(E>>3===3)if(E===yQ)return c.join("")+"Infinity";else if(E===gQ)return"NaN";else e=p>>15&Kb,s=8+(p>>14&1);else s=p>>14&7,e=p>>17&Kb;let y=e-Vb;if(o.parts[0]=(p&16383)+((s&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)i=!0;else for(a=3;a>=0;a--){let O=0,b=EQ(o);if(o=b.quotient,O=b.rem.low,!O)continue;for(u=8;u>=0;u--)r[a*9+u]=O%10,O=Math.floor(O/10)}if(i)t=1,r[n]=0;else{t=36;while(!r[n])t=t-1,n=n+1}let _=t-1+y;if(_>=34||_<=-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 O=0;O<t;O++)c.push(`${r[n++]}`);if(c.push("E"),_>0)c.push(`+${_}`);else c.push(`${_}`)}else if(y>=0)for(let O=0;O<t;O++)c.push(`${r[n++]}`);else{let O=t+y;if(O>0)for(let b=0;b<O;b++)c.push(`${r[n++]}`);else c.push("0");c.push(".");while(O++<0)c.push("0");for(let b=0;b<t-Math.max(O-1,0);b++)c.push(`${r[n++]}`)}return c.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(e){return vn.fromString(e.$numberDecimal)}inspect(e,t,r){return r??=Yi,`new Decimal128(${r(this.toString(),t)})`}}class hs extends ai{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 hs(NaN);if(e==="Infinity")return new hs(1/0);if(e==="-Infinity")return new hs(-1/0);if(!Number.isFinite(t))throw new v(`Input: ${e} is not representable as a Double`);if(e.trim()!==e)throw new v(`Input: '${e}' contains whitespace`);if(e==="")throw new v("Input is an empty string");if(/[^-0-9.+eE]/.test(e))throw new v(`Input: '${e}' is not in decimal or exponential notation`);return new hs(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 hs(r)}inspect(e,t,r){return r??=Yi,`new Double(${r(this.value,t)})`}}class bu extends ai{get _bsontype(){return"Int32"}value;constructor(e){super();if(e instanceof Number)e=e.valueOf();this.value=+e|0}static fromString(e){let t=g9(e),r=Number(e);if(Sf<r)throw new v(`Input: '${e}' is larger than the maximum value for Int32`);else if(Cf>r)throw new v(`Input: '${e}' is smaller than the minimum value for Int32`);else if(!Number.isSafeInteger(r))throw new v(`Input: '${e}' is not a safe integer`);else if(r.toString()!==t)throw new v(`Input: '${e}' is not a valid Int32 string`);return new bu(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 bu(e.$numberInt)}inspect(e,t,r){return r??=Yi,`new Int32(${r(this.value,t)})`}}class bc extends ai{get _bsontype(){return"MaxKey"}toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new bc}inspect(){return"new MaxKey()"}}class Dc extends ai{get _bsontype(){return"MinKey"}toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new Dc}inspect(){return"new MinKey()"}}var gf=new WeakMap,Gi=[];for(let e=0;e<256;e++)Gi.push(e.toString(16).padStart(2,"0"));var Rp=new Int8Array(103);for(let e=48;e<=57;e++)Rp[e]=e-48;for(let e=65;e<=70;e++)Rp[e]=e-55;for(let e=97;e<=102;e++)Rp[e]=e-87;class Wt extends ai{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=Rp;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 v("Argument passed in must have an id that is of type string or Buffer");if("toHexString"in e&&typeof e.toHexString==="function")r=x.fromHex(e.toHexString());else r=e.id}else r=e;if(r==null){let n=Math.floor(Date.now()/1000),i=Wt.getInc(),s=Wt.PROCESS_UNIQUE??=x.randomBytes(5);this.i0=n>>>8&16777215,this.i1=(n&255)<<16|s[0]<<8|s[1],this.i2=s[2]<<16|s[3]<<8|s[4],this.i3=i&16777215}else if(ArrayBuffer.isView(r)&&r.byteLength===12)this.setFromBytes(r instanceof Uint8Array?r:x.toLocalBufferType(r));else if(typeof r==="string")if(Wt.validateHexString(r)){if(this.setFromHex(r),Wt.cacheHexString)gf.set(this,r)}else throw new v("input must be a 24 character hex string, 12 byte Uint8Array, or an integer");else throw new v("Argument passed in does not match the accepted types")}get id(){let e=x.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:x.toLocalBufferType(e);if(this.setFromBytes(t),Wt.cacheHexString)gf.set(this,x.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 s=gf.get(this);if(s)return s}let e=this.i0,t=this.i1,r=this.i2,n=this.i3,i=Gi[e>>>16&255]+Gi[e>>>8&255]+Gi[e&255]+Gi[t>>>16&255]+Gi[t>>>8&255]+Gi[t&255]+Gi[r>>>16&255]+Gi[r>>>8&255]+Gi[r&255]+Gi[n>>>16&255]+Gi[n>>>8&255]+Gi[n&255];if(Wt.cacheHexString)gf.set(this,i);return i}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=x.allocateUnsafe(12);Oe.setInt32BE(r,0,e);let n=this.PROCESS_UNIQUE??=x.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 x.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=x.allocate(12);for(let r=11;r>=4;r--)t[r]=0;return Oe.setInt32BE(t,0,e),new Wt(t)}static createFromHexString(e){if(e?.length!==24)throw new v("hex string must be 24 characters");return new Wt(x.fromHex(e))}static createFromBase64(e){if(e?.length!==16)throw new v("base64 string must be 16 characters");return new Wt(x.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&&gf.has(this)}inspect(e,t,r){return r??=Yi,`new ObjectId(${r(this.toHexString(),t)})`}}function wQ(e,t,r){let n=[{object:e,ignoreUndefined:r??!1,exit:!1}],i=new Set,s=0;while(n.length>0){let o=n.pop();if(o.exit){i.delete(o.object);continue}let{object:u,ignoreUndefined:a}=o;i.add(u),o.exit=!0,n.push(o),s+=5;let c=Array.isArray(u),l=!c&&(u instanceof Map||Ip(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++)s+=W_(d.toString(),h[d],t,!0,a,n,i)}else if(l)for(let[h,d]of f)s+=W_(h,d,t,!1,a,n,i);else for(let h of Object.keys(f))s+=W_(h,f[h],t,!1,a,n,i)}return s}function W_(e,t,r=!1,n=!1,i=!1,s,o){if(typeof t?.toBSON==="function")t=t.toBSON();switch(typeof t){case"string":return 1+x.utf8ByteLength(e)+1+4+x.utf8ByteLength(t)+1;case"number":if(Math.floor(t)===t&&t>=n9&&t<=r9)if(!Object.is(t,-0)&&t>=Cf&&t<=Sf)return x.utf8ByteLength(e)+1+5;else return x.utf8ByteLength(e)+1+9;else return x.utf8ByteLength(e)+1+9;case"undefined":if(n||!i)return x.utf8ByteLength(e)+1+1;return 0;case"boolean":return x.utf8ByteLength(e)+1+2;case"object":if(t!=null&&typeof t._bsontype==="string"&&t[$p]!==Of)throw new wl;else if(t==null||t._bsontype==="MinKey"||t._bsontype==="MaxKey")return x.utf8ByteLength(e)+1+1;else if(t._bsontype==="ObjectId")return x.utf8ByteLength(e)+1+13;else if(t instanceof Date||Fp(t))return x.utf8ByteLength(e)+1+9;else if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||G_(t))return x.utf8ByteLength(e)+1+6+t.byteLength;else if(t._bsontype==="Long"||t._bsontype==="Double"||t._bsontype==="Timestamp")return x.utf8ByteLength(e)+1+9;else if(t._bsontype==="Decimal128")return x.utf8ByteLength(e)+1+17;else if(t._bsontype==="Int32")return x.utf8ByteLength(e)+1+5;else if(t._bsontype==="Code")if(t.scope!=null&&typeof t.scope==="object"){if(o.has(t.scope))throw new v("Cannot convert circular structure to BSON");return s.push({object:t.scope,ignoreUndefined:i,exit:!1}),x.utf8ByteLength(e)+1+1+4+4+x.utf8ByteLength(t.code.toString())+1}else return x.utf8ByteLength(e)+1+1+4+x.utf8ByteLength(t.code.toString())+1;else if(t._bsontype==="Binary"){let u=t;if(u.sub_type===je.SUBTYPE_BYTE_ARRAY)return x.utf8ByteLength(e)+1+(u.position+1+4+1+4);else return x.utf8ByteLength(e)+1+(u.position+1+4+1)}else if(t._bsontype==="BSONSymbol")return x.utf8ByteLength(e)+1+x.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 s.push({object:u,ignoreUndefined:!0,exit:!1}),x.utf8ByteLength(e)+1+1}else if(t instanceof RegExp||Bp(t))return x.utf8ByteLength(e)+1+1+x.utf8ByteLength(t.source)+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;else if(t._bsontype==="BSONRegExp")return x.utf8ByteLength(e)+1+1+x.utf8ByteLength(t.pattern)+1+x.utf8ByteLength(t.options)+1;else{if(o.has(t))throw new v("Cannot convert circular structure to BSON");return s.push({object:t,ignoreUndefined:i,exit:!1}),x.utf8ByteLength(e)+1+1}case"function":if(r)return x.utf8ByteLength(e)+1+1+4+x.utf8ByteLength(t.toString())+1;return 0;case"bigint":return x.utf8ByteLength(e)+1+9;case"symbol":return 0;default:throw new v(`Unrecognized JS type: ${typeof t}`)}}function OQ(e){return e.split("").sort().join("")}class fs extends ai{get _bsontype(){return"BSONRegExp"}pattern;options;constructor(e,t){super();if(this.pattern=e,this.options=OQ(t??""),this.pattern.indexOf("\x00")!==-1)throw new v(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);if(this.options.indexOf("\x00")!==-1)throw new v(`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 v(`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 fs(e.$regex,fs.parseOptions(e.$options));if("$regularExpression"in e)return new fs(e.$regularExpression.pattern,fs.parseOptions(e.$regularExpression.options));throw new v(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(e)}`)}inspect(e,t,r){let n=KY(t)??((o)=>o);r??=Yi;let i=n(r(this.pattern),"regexp"),s=n(r(this.options),"regexp");return`new BSONRegExp(${i}, ${s})`}}class Tc extends ai{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 Tc(e.$symbol)}inspect(e,t,r){return r??=Yi,`new BSONSymbol(${r(this.value,t)})`}}var SQ=M;class lo extends SQ{get _bsontype(){return"Timestamp"}get[Cc](){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 v("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 v("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 v("Timestamp constructed from { t, i } must provide a positive t");if(r<0||Number.isNaN(r))throw new v("Timestamp constructed from { t, i } must provide a positive i");if(t>4294967295)throw new v("Timestamp constructed from { t, i } must provide t equal or less than uint32 max");if(r>4294967295)throw new v("Timestamp constructed from { t, i } must provide i equal or less than uint32 max");super(r,t,!0)}else throw new v("A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }")}toJSON(){return{$timestamp:this.toString()}}static fromInt(e){return new lo(M.fromInt(e,!0))}static fromNumber(e){return new lo(M.fromNumber(e,!0))}static fromBits(e,t){return new lo({i:e,t})}static fromString(e,t){return new lo(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 lo({t:r,i:t})}inspect(e,t,r){r??=Yi;let n=r(this.t,t),i=r(this.i,t);return`new Timestamp({ t: ${n}, i: ${i} })`}}var CQ=M.fromNumber(r9),bQ=M.fromNumber(n9);function _9(e,t,r){t=t==null?{}:t;let n=t&&t.index?t.index:0,i=Oe.getInt32LE(e,n);if(i<5)throw new v(`bson size must be >= 5, is ${i}`);if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new v(`buffer length ${e.length} must be >= bson size ${i}`);if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new v(`buffer length ${e.length} must === bson size ${i}`);if(i+n>e.byteLength)throw new v(`(bson size ${i} + options.index ${n} must be <= buffer length ${e.byteLength})`);if(e[n+i-1]!==0)throw new v("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return DQ(e,n,t,r)}var Yb=/^\$ref$|^\$id$|^\$db$/;function Qb(e,t,r){if(t==="__proto__")Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0});else e[t]=r}function Jb(e){if(y9(e)){let{$ref:t,$id:r,$db:n,...i}=e;return new Bo(t,r,n,i)}return e}function DQ(e,t,r,n=!1){r={...r};let i=r.fieldsAsRaw==null?null:r.fieldsAsRaw,s=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 v("Must either request bigint or Long for int64 deserialization");if(l&&!a)throw new v("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 v("UTF-8 validation setting cannot be empty");if(typeof q[0]!=="boolean")throw new v("Invalid UTF-8 validation option, must specify boolean values");if(d=q[0],!q.every((I)=>I===d))throw new v("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 E=t;if(e.length<5)throw new v("corrupt bson message < 5 bytes long");let y=Oe.getInt32LE(e,t);if(t+=4,y<5||y>e.length)throw new v("corrupt bson message");let _=n?[]:{},O=0,b=n?!1:null,A=null,P=_,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=_,S=n;else P=A.holdingDocument,S=A.isArray;let De=G.holdingDocument;switch(G.elementType){case _f:if(G.isPossibleDBRef)De=Jb(De);break;case Ef:break;case Pp:De=new Cu(G.functionString,G.holdingDocument);break;default:throw new v("Unexpected element type in frame stack")}Qb(P,G.propertyName,De);continue}else{if(A.elementType===Ef)throw new v("corrupted array bson");throw new v("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 v("Bad BSON Document: illegal CString");let we=S?A!==null?A.arrayIndex++:O++:x.toUTF8(e,t,I,!1),Ne;if(A!==null)Ne=A.validationSetting;else if(h||p?.has(we))Ne=d;else Ne=!d;if(A!==null){if(A.isPossibleDBRef!==!1&&typeof we==="string"&&we[0]==="$")A.isPossibleDBRef=Yb.test(we)}else if(b!==!1&&we[0]==="$")b=Yb.test(we);let ae,ir=!1;if(t=I+1,q===i9){let G=Oe.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new v("bad string length in bson");ae=x.toUTF8(e,t,t+G-1,Ne),t=t+G}else if(q===s9)ae=new Wt(e,t),t=t+12;else if(q===Af&&c===!1)ae=new bu(Oe.getInt32LE(e,t)),t+=4;else if(q===Af)ae=Oe.getInt32LE(e,t),t+=4;else if(q===Y_){if(ae=Oe.getFloat64LE(e,t),t+=8,c===!1)ae=new hs(ae)}else if(q===u9){let G=Oe.getInt32LE(e,t),De=Oe.getInt32LE(e,t+4);t+=8,ae=new Date(new M(G,De).toNumber())}else if(q===o9){if(e[t]!==0&&e[t]!==1)throw new v("illegal boolean type value");ae=e[t++]===1}else if(q===_f){let G=Oe.getInt32LE(e,t);if(G<5||G>e.length-t)throw new v("bad embedded document length in bson");if(s||(A?.raw??!1))ae=e.subarray(t,t+G),t=t+G;else{ir=!0;let De={holdingDocument:{},elementType:_f,propertyName:we,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===Ef){let G=Oe.getInt32LE(e,t);if(G<5||G>e.length-t)throw new v("bad embedded array length in bson");let De=t+G,gt=!!(i&&i[we])||(A?.raw??!1);ir=!0;let wi={holdingDocument:[],elementType:Ef,propertyName:we,functionString:null,lastIndex:De,isArray:!0,arrayIndex:0,raw:gt,isPossibleDBRef:!1,validationSetting:Ne,prev:A};A=wi,P=wi.holdingDocument,S=!0,t=t+4}else if(q===GY)ae=void 0;else if(q===J_)ae=null;else if(q===Z_)if(l)ae=Oe.getBigInt64LE(e,t),t+=8;else{let G=Oe.getInt32LE(e,t),De=Oe.getInt32LE(e,t+4);t+=8;let gt=new M(G,De);if(a&&c===!0)ae=gt.lessThanOrEqual(CQ)&>.greaterThanOrEqual(bQ)?gt.toNumber():gt;else ae=gt}else if(q===l9){let G=x.allocateUnsafe(16);for(let De=0;De<16;De++)G[De]=e[t+De];t=t+16,ae=new vn(G)}else if(q===Q_){let G=Oe.getInt32LE(e,t);t+=4;let De=G,gt=e[t++];if(G<0)throw new v("Negative binary type element size found");if(G>e.byteLength)throw new v("Binary type size larger than document size");if(gt===je.SUBTYPE_BYTE_ARRAY){if(G=Oe.getInt32LE(e,t),t+=4,G<0)throw new v("Negative binary type element size found for subtype 0x02");if(G>De-4)throw new v("Binary type with subtype 0x02 contains too long binary size");if(G<De-4)throw new v("Binary type with subtype 0x02 contains too short binary size")}if(u&&c)ae=x.toLocalBufferType(e.subarray(t,t+G));else if(ae=new je(e.subarray(t,t+G),gt),gt===e3&&bn.isValid(ae))ae=ae.toUUID();t=t+G}else if(q===Np&&o===!1){I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new v("Bad BSON Document: illegal CString");let G=x.toUTF8(e,t,I,!1);t=I+1,I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new v("Bad BSON Document: illegal CString");let De=x.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===Np&&o===!0){I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new v("Bad BSON Document: illegal CString");let G=x.toUTF8(e,t,I,!1);t=I+1,I=t;while(e[I]!==0&&I<e.length)I++;if(I>=e.length)throw new v("Bad BSON Document: illegal CString");let De=x.toUTF8(e,t,I,!1);t=I+1,ae=new fs(G,De)}else if(q===a9){let G=Oe.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new v("bad string length in bson");let De=x.toUTF8(e,t,t+G-1,Ne);ae=c?De:new Tc(De),t=t+G}else if(q===c9)ae=new lo({i:Oe.getUint32LE(e,t),t:Oe.getUint32LE(e,t+4)}),t+=8;else if(q===h9)ae=new Dc;else if(q===f9)ae=new bc;else if(q===X_){let G=Oe.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new v("bad string length in bson");let De=x.toUTF8(e,t,t+G-1,Ne);ae=new Cu(De),t=t+G}else if(q===Pp){let G=Oe.getInt32LE(e,t);if(t+=4,G<13)throw new v("code_w_scope total size shorter minimum expected length");let De=Oe.getInt32LE(e,t);if(t+=4,De<=0||De>e.length-t||e[t+De-1]!==0)throw new v("bad string length in bson");let gt=x.toUTF8(e,t,t+De-1,Ne);t=t+De;let wi=t,Qe=Oe.getInt32LE(e,t);if(Qe<5||Qe>e.length-t)throw new v("bad scope document size in code_w_scope");if(G<8+Qe+De)throw new v("code_w_scope total size is too short, truncating scope");if(G>8+Qe+De)throw new v("code_w_scope total size is too long, clips outer document");ir=!0;let xn={holdingDocument:{},elementType:Pp,propertyName:we,functionString:gt,lastIndex:wi+Qe,isArray:!1,arrayIndex:0,raw:!1,isPossibleDBRef:null,validationSetting:Ne,prev:A};A=xn,P=xn.holdingDocument,S=!1,t=t+4}else if(q===YY){let G=Oe.getInt32LE(e,t);if(t+=4,G<=0||G>e.length-t||e[t+G-1]!==0)throw new v("bad string length in bson");let De=x.toUTF8(e,t,t+G-1,Ne);t=t+G;let gt=x.allocateUnsafe(12);for(let Qe=0;Qe<12;Qe++)gt[Qe]=e[t+Qe];let wi=new Wt(gt);t=t+12,ae=new Bo(De,wi)}else throw new v(`Detected unknown BSON type ${q.toString(16)} for fieldname "${we}"`);if(!ir)Qb(P,we,ae)}if(A!==null)throw new v("corrupted bson, more objects expected based on the current document size");let B=_;if(y!==t-E){if(n)throw new v("corrupt array bson");throw new v("corrupt object bson")}if(!b)return B;return Jb(B)}var t3=/\x00/,TQ=new Set(["$db","$ref","$id","$clusterTime"]);function MQ(e,t,r,n){e[n++]=i9;let i=x.encodeUTF8Into(e,t,n);n=n+i+1,e[n-1]=0;let s=x.encodeUTF8Into(e,r,n+4);return Oe.setInt32LE(e,n,s+1),n=n+4+s,e[n++]=0,n}function PQ(e,t,r,n){let s=!Object.is(r,-0)&&Number.isSafeInteger(r)&&r<=Sf&&r>=Cf?Af:Y_;e[n++]=s;let o=x.encodeUTF8Into(e,t,n);if(n=n+o,e[n++]=0,s===Af)n+=Oe.setInt32LE(e,n,r);else n+=Oe.setFloat64LE(e,n,r);return n}function BQ(e,t,r,n){e[n++]=Z_;let i=x.encodeUTF8Into(e,t,n);return n+=i,e[n++]=0,n+=Oe.setBigInt64LE(e,n,r),n}function Xb(e,t,r,n){e[n++]=J_;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,n}function FQ(e,t,r,n){e[n++]=o9;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,e[n++]=r?1:0,n}function NQ(e,t,r,n){e[n++]=u9;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let s=M.fromNumber(r.getTime()),o=s.getLowBits(),u=s.getHighBits();return n+=Oe.setInt32LE(e,n,o),n+=Oe.setInt32LE(e,n,u),n}function IQ(e,t,r,n){e[n++]=Np;let i=x.encodeUTF8Into(e,t,n);if(n=n+i,e[n++]=0,r.source&&r.source.match(t3)!=null)throw new v("value "+r.source+" must not contain null bytes");if(n=n+x.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 $Q(e,t,r,n){e[n++]=Np;let i=x.encodeUTF8Into(e,t,n);if(n=n+i,e[n++]=0,r.pattern.match(t3)!=null)throw new v("pattern "+r.pattern+" must not contain null bytes");n=n+x.encodeUTF8Into(e,r.pattern,n),e[n++]=0;let s=r.options.split("").sort().join("");return n=n+x.encodeUTF8Into(e,s,n),e[n++]=0,n}function RQ(e,t,r,n){if(r===null)e[n++]=J_;else if(r[Cc]==="MinKey")e[n++]=h9;else e[n++]=f9;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,n}function xQ(e,t,r,n){e[n++]=s9;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,n+=r.serializeInto(e,n),n}function vQ(e,t,r,n){e[n++]=Q_;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let s=r.length;if(n+=Oe.setInt32LE(e,n,s),e[n++]=QY,s<=16)for(let o=0;o<s;o++)e[n+o]=r[o];else e.set(r,n);return n=n+s,n}function kQ(e,t,r,n){e[n++]=l9;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;for(let s=0;s<16;s++)e[n+s]=r.bytes[s];return n+16}function qQ(e,t,r,n){e[n++]=r[Cc]==="Long"?Z_:c9;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let s=r.getLowBits(),o=r.getHighBits();return n+=Oe.setInt32LE(e,n,s),n+=Oe.setInt32LE(e,n,o),n}function jQ(e,t,r,n){r=r.valueOf(),e[n++]=Af;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,n+=Oe.setInt32LE(e,n,r),n}function LQ(e,t,r,n){e[n++]=Y_;let i=x.encodeUTF8Into(e,t,n);return n=n+i,e[n++]=0,n+=Oe.setFloat64LE(e,n,r.value),n}function UQ(e,t,r,n){e[n++]=X_;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let s=r.toString(),o=x.encodeUTF8Into(e,s,n+4)+1;return Oe.setInt32LE(e,n,o),n=n+4+o-1,e[n++]=0,n}function VQ(e,t,r,n){e[n++]=Q_;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let{buffer:s,position:o}=r;if(r.sub_type===je.SUBTYPE_BYTE_ARRAY)o=o+4;if(n+=Oe.setInt32LE(e,n,o),e[n++]=r.sub_type,r.sub_type===je.SUBTYPE_BYTE_ARRAY)o=o-4,n+=Oe.setInt32LE(e,n,o);if(r.sub_type===je.SUBTYPE_VECTOR)Ou(r);if(o<=16)for(let u=0;u<o;u++)e[n+u]=s[u];else e.set(s,n);return n=n+r.position,n}function zQ(e,t,r,n){e[n++]=a9;let i=x.encodeUTF8Into(e,t,n);n=n+i,e[n++]=0;let s=x.encodeUTF8Into(e,r.value,n+4)+1;return Oe.setInt32LE(e,n,s),n=n+4+s-1,e[n++]=0,n}function Mp(e,t,r,n,i,s){if(Array.isArray(e))return{sourceObject:e,isArray:!0,objectSizeIndex:t,codeSizeIndex:r,iterTarget:e,keys:null,keyIndex:0,mapIterator:null,prev:n,checkKeys:i,ignoreUndefined:s};if(e instanceof Map||Ip(e))return{sourceObject:e,isArray:!1,objectSizeIndex:t,codeSizeIndex:r,iterTarget:e,keys:null,keyIndex:0,mapIterator:e.entries(),prev:n,checkKeys:i,ignoreUndefined:s};let o=e;if(typeof o?.toBSON==="function"){if(o=o.toBSON(),o!=null&&typeof o!=="object")throw new v("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:i,ignoreUndefined:s}}function A9(e,t,r,n,i,s,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 v("serialize does not support an array as the root input");if(typeof t!=="object")throw new v("serialize does not support non-object as the root input");else if("_bsontype"in t&&typeof t._bsontype==="string")throw new v("BSON types cannot be serialized as a document");else if(Fp(t)||Bp(t)||Al(t)||G_(t))throw new v("date, regexp, typedarray, and arraybuffer cannot be BSON documents");o=new Set}o.add(t);let u=Mp(t,n,null,null,r,s),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,Oe.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Oe.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,Oe.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Oe.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,Oe.setInt32LE(e,c.objectSizeIndex,a-c.objectSizeIndex),c.codeSizeIndex!==null)Oe.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]==="$"&&TQ.has(l))){if(t3.test(l))throw new v("key "+l+" must not contain null bytes");if(c.checkKeys){if(l[0]==="$")throw new v("key "+l+" must not start with '$'");else if(l.includes("."))throw new v("key "+l+" must not contain '.'")}}let h=typeof f;if(f===void 0){if(c.isArray||c.ignoreUndefined===!1)a=Xb(e,l,f,a)}else if(f===null)a=Xb(e,l,f,a);else if(h==="string")a=MQ(e,l,f,a);else if(h==="number")a=PQ(e,l,f,a);else if(h==="bigint")a=BQ(e,l,f,a);else if(h==="boolean")a=FQ(e,l,f,a);else if(h==="object"&&f._bsontype==null)if(f instanceof Date||Fp(f))a=NQ(e,l,f,a);else if(f instanceof Uint8Array||Al(f))a=vQ(e,l,f,a);else if(f instanceof RegExp||Bp(f))a=IQ(e,l,f,a);else{if(o.has(f))throw new v("Cannot convert circular structure to BSON");let d=Array.isArray(f);e[a++]=d?Ef:_f,a+=x.encodeUTF8Into(e,l,a),e[a++]=0;let p=a;o.add(f),u=Mp(f,p,null,c,c.checkKeys,c.ignoreUndefined),a+=4}else if(h==="object"){if(f[$p]!==Of)throw new wl;let d=f[Cc];if(d==="ObjectId")a=xQ(e,l,f,a);else if(d==="Decimal128")a=kQ(e,l,f,a);else if(d==="Long"||d==="Timestamp")a=qQ(e,l,f,a);else if(d==="Double")a=LQ(e,l,f,a);else if(d==="Code"){let p=f;if(p.scope&&typeof p.scope==="object"){e[a++]=Pp,a+=x.encodeUTF8Into(e,l,a),e[a++]=0;let m=a;a+=4;let E=p.code,y=x.encodeUTF8Into(e,E,a+4)+1;Oe.setInt32LE(e,a,y),e[a+4+y-1]=0,a=a+y+4;let _=p.scope;if(o.has(_))throw new v("Cannot convert circular structure to BSON");o.add(_),u=Mp(_,a,m,c,c.checkKeys,c.ignoreUndefined),a+=4}else{e[a++]=X_,a+=x.encodeUTF8Into(e,l,a),e[a++]=0;let m=p.code.toString(),E=x.encodeUTF8Into(e,m,a+4)+1;Oe.setInt32LE(e,a,E),a=a+4+E-1,e[a++]=0}}else if(d==="Binary")a=VQ(e,l,f,a);else if(d==="BSONSymbol")a=zQ(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++]=_f,a+=x.encodeUTF8Into(e,l,a),e[a++]=0,o.add(m),u=Mp(m,a,null,c,!1,!0),a+=4}else if(d==="BSONRegExp")a=$Q(e,l,f,a);else if(d==="Int32")a=jQ(e,l,f,a);else if(d==="MinKey"||d==="MaxKey")a=RQ(e,l,f,a);else if(typeof f._bsontype<"u")throw new v(`Unrecognized or invalid _bsontype: ${String(f._bsontype)}`)}else if(h==="function"&&i)a=UQ(e,l,f,a)}return a}function WQ(e){return e!=null&&typeof e==="object"&&"_bsontype"in e&&typeof e._bsontype==="string"}var HQ={$oid:Wt,$binary:je,$uuid:je,$symbol:Tc,$numberInt:bu,$numberDecimal:vn,$numberDouble:hs,$numberLong:M,$minKey:Dc,$maxKey:bc,$regex:fs,$regularExpression:fs,$timestamp:lo};function w9(e,t={}){if(typeof e==="number"){let n=e<=Sf&&e>=Cf,i=e<=e9&&e>=t9;if(t.relaxed||t.legacy)return e;if(Number.isInteger(e)&&!Object.is(e,-0)){if(n)return new bu(e);if(i){if(t.useBigInt64)return BigInt(e);return M.fromNumber(e)}}return new hs(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 i=HQ[r[n]];if(i)return i.fromExtendedJSON(e,t)}if(e.$date!=null){let n=e.$date,i=new Date;if(t.legacy)if(typeof n==="number")i.setTime(n);else if(typeof n==="string")i.setTime(Date.parse(n));else if(typeof n==="bigint")i.setTime(Number(n));else throw new wf(`Unrecognized type for EJSON date: ${typeof n}`);else if(typeof n==="string")i.setTime(Date.parse(n));else if(M.isLong(n))i.setTime(n.toNumber());else if(typeof n==="number"&&t.relaxed)i.setTime(n);else if(typeof n==="bigint")i.setTime(Number(n));else throw new wf(`Unrecognized type for EJSON date: ${typeof n}`);return i}if(e.$code!=null){let n=Object.assign({},e);if(e.$scope)n.$scope=w9(e.$scope);return Cu.fromExtendedJSON(e)}if(y9(e)||e.$dbPointer){let n=e.$ref?e:e.$dbPointer;if(n instanceof Bo)return n;let i=Object.keys(n).filter((o)=>o.startsWith("$")),s=!0;if(i.forEach((o)=>{if(["$ref","$id","$db"].indexOf(o)===-1)s=!1}),s)return Bo.fromExtendedJSON(n)}return e}function KQ(e,t){return e.map((r,n)=>{t.seenObjects.push({propertyName:`index ${n}`,obj:null});try{return Su(r,t)}finally{t.seenObjects.pop()}})}function Zb(e){let t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function Su(e,t){if(e instanceof Map||Ip(e)){let r=Object.create(null);for(let[n,i]of e){if(typeof n!=="string")throw new v("Can only serialize maps with string keys");r[n]=i}return Su(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),i=n.slice(0,r).map((l)=>`${l} -> `).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map((l)=>`${l} -> `).join(""),u=n[n.length-1],a=" ".repeat(i.length+s.length/2),c="-".repeat(o.length+(s.length+u.length)/2-1);throw new v(`Converting circular structure to EJSON:
|
|
6
|
+
${i}${s}${o}${u}
|
|
7
|
+
${a}\\${c}/`)}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return KQ(e,t);if(e===void 0)return t.ignoreUndefined?void 0:null;if(e instanceof Date||Fp(e)){let r=e.getTime(),n=r>-1&&r<253402300800000;if(t.legacy)return t.relaxed&&n?{$date:e.getTime()}:{$date:Zb(e)};return t.relaxed&&n?{$date:Zb(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e==="number"&&(!t.relaxed||!isFinite(e))){if(Number.isInteger(e)&&!Object.is(e,-0)){if(e>=Cf&&e<=Sf)return{$numberInt:e.toString()};if(e>=t9&&e<=e9)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||Bp(e)){let r=e.flags;if(r===void 0){let i=e.toString().match(/[gimuy]*$/);if(i)r=i[0]}return new fs(e.source,r).toExtendedJSON(t)}if(e!=null&&typeof e==="object")return YQ(e,t);return e}var GQ={Binary:(e)=>new je(e.value(),e.sub_type),Code:(e)=>new Cu(e.code,e.scope),DBRef:(e)=>new Bo(e.collection||e.namespace,e.oid,e.db,e.fields),Decimal128:(e)=>new vn(e.bytes),Double:(e)=>new hs(e.value),Int32:(e)=>new bu(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 bc,MinKey:()=>new Dc,ObjectId:(e)=>new Wt(e),BSONRegExp:(e)=>new fs(e.pattern,e.options),BSONSymbol:(e)=>new Tc(e.value),Timestamp:(e)=>lo.fromBits(e.low,e.high)};function YQ(e,t){if(e==null||typeof e!=="object")throw new v("not an object instance");let r=e._bsontype;if(typeof r>"u"){let n={};for(let i of Object.keys(e)){t.seenObjects.push({propertyName:i,obj:null});try{let s=Su(e[i],t);if(i==="__proto__")Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0});else n[i]=s}finally{t.seenObjects.pop()}}return n}else if(e!=null&&typeof e==="object"&&typeof e._bsontype==="string"&&e[$p]!==Of)throw new wl;else if(WQ(e)){let n=e;if(typeof n.toExtendedJSON!=="function"){let i=GQ[e._bsontype];if(!i)throw new v("Unrecognized or invalid _bsontype: "+e._bsontype);n=i(n)}if(r==="Code"&&n.scope)n=new Cu(n.code,Su(n.scope,t));else if(r==="DBRef"&&n.oid)n=new Bo(Su(n.collection,t),Su(n.oid,t),Su(n.db,t),Su(n.fields,t));return n.toExtendedJSON(t)}else throw new v("_bsontype must be a string, but was: "+typeof r)}function O9(e,t){let r={useBigInt64:t?.useBigInt64??!1,relaxed:t?.relaxed??!0,legacy:t?.legacy??!1};return JSON.parse(e,(n,i)=>{if(n.indexOf("\x00")!==-1)throw new v(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(n)}`);return w9(i,r)})}function S9(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 i=Object.assign({relaxed:!0,legacy:!1},n,{seenObjects:[{propertyName:"(root)",obj:null}]}),s=Su(e,i);return JSON.stringify(s,t,r)}function QQ(e,t){return t=t||{},JSON.parse(S9(e,t))}function JQ(e,t){return t=t||{},O9(JSON.stringify(e),t)}var Mc=Object.create(null);Mc.parse=O9;Mc.stringify=S9;Mc.serialize=QQ;Mc.deserialize=JQ;Object.freeze(Mc);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 H_(e,t){try{return Oe.getNonnegativeInt32LE(e,t)}catch(r){throw new co("BSON size cannot be negative",t,{cause:r})}}function K_(e,t){let r=t;for(;e[r];r++);if(r>=e.length-1)throw new co("Null terminator not found",t);return r}function XQ(e,t=0){if(t??=0,e.length<5)throw new co(`Input must be at least 5 bytes, got ${e.length} bytes`,t);let r=H_(e,t);if(r>e.length-t)throw new co(`Parsed documentSize (${r} bytes) does not match input length (${e.length} bytes)`,t);if(e[t+r-1]!==0)throw new co("BSON documents must end in 0x00",t+r);let n=[],i=t+4;while(i<=r+t){let s=e[i];if(i+=1,s===0){if(i-t!==r)throw new co("Invalid 0x00 type byte",i);break}let o=i,u=K_(e,i)-o;i+=u+1;let a;if(s===lr.double||s===lr.long||s===lr.date||s===lr.timestamp)a=8;else if(s===lr.int)a=4;else if(s===lr.objectId)a=12;else if(s===lr.decimal)a=16;else if(s===lr.bool)a=1;else if(s===lr.null||s===lr.undefined||s===lr.maxKey||s===lr.minKey)a=0;else if(s===lr.regex)a=K_(e,K_(e,i)+1)+1-i;else if(s===lr.object||s===lr.array||s===lr.javascriptWithScope)a=H_(e,i);else if(s===lr.string||s===lr.binData||s===lr.dbPointer||s===lr.javascript||s===lr.symbol){if(a=H_(e,i)+4,s===lr.binData)a+=1;if(s===lr.dbPointer)a+=12}else throw new co(`Invalid 0x${s.toString(16).padStart(2,"0")} type byte`,i);if(i+a>t+r-1)throw new co("value reports length larger than document",i);n.push([s,o,u,i,a]),i+=a}return n}var Ol=Object.create(null);Ol.parseToElements=XQ;Ol.ByteUtils=x;Ol.NumberUtils=Oe;Object.freeze(Ol);var C9=17825792,ua=x.allocate(C9);function b9(e){if(ua.length<e)ua=x.allocate(e)}function D9(e,t={}){let r=typeof t.checkKeys==="boolean"?t.checkKeys:!1,n=typeof t.serializeFunctions==="boolean"?t.serializeFunctions:!1,i=typeof t.ignoreUndefined==="boolean"?t.ignoreUndefined:!0,s=typeof t.minInternalBufferSize==="number"?t.minInternalBufferSize:C9;if(ua.length<s)ua=x.allocate(s);let o=A9(ua,e,r,0,n,i,null),u=x.allocateUnsafe(o);return u.set(ua.subarray(0,o),0),u}function T9(e,t,r={}){let n=typeof r.checkKeys==="boolean"?r.checkKeys:!1,i=typeof r.serializeFunctions==="boolean"?r.serializeFunctions:!1,s=typeof r.ignoreUndefined==="boolean"?r.ignoreUndefined:!0,o=typeof r.index==="number"?r.index:0,u=A9(ua,e,n,0,i,s,null);return t.set(ua.subarray(0,u),o),o+u-1}function M9(e,t={}){return _9(x.toLocalBufferType(e),t)}function P9(e,t={}){t=t||{};let r=typeof t.serializeFunctions==="boolean"?t.serializeFunctions:!1,n=typeof t.ignoreUndefined==="boolean"?t.ignoreUndefined:!0;return wQ(e,r,n)}function B9(e,t,r,n,i,s){let o=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},s),u=x.toLocalBufferType(e),a=t;for(let c=0;c<r;c++){let l=Oe.getInt32LE(u,a);o.index=a,n[i+c]=_9(u,o),a=a+l}return a}var ZQ=Object.freeze({__proto__:null,BSONError:v,BSONOffsetError:co,BSONRegExp:fs,BSONRuntimeError:wf,BSONSymbol:Tc,BSONType:d9,BSONValue:ai,BSONVersionError:wl,Binary:je,ByteUtils:x,Code:Cu,DBRef:Bo,Decimal128:vn,Double:hs,EJSON:Mc,Int32:bu,Long:M,MaxKey:bc,MinKey:Dc,NumberUtils:Oe,ObjectId:Wt,Timestamp:lo,UUID:bn,bsonType:Cc,calculateObjectSize:P9,deserialize:M9,deserializeStream:B9,onDemand:Ol,serialize:D9,serializeWithBufferAndIndex:T9,setInternalBufferSize:b9});_t.BSON=ZQ;_t.BSONError=v;_t.BSONOffsetError=co;_t.BSONRegExp=fs;_t.BSONRuntimeError=wf;_t.BSONSymbol=Tc;_t.BSONType=d9;_t.BSONValue=ai;_t.BSONVersionError=wl;_t.Binary=je;_t.ByteUtils=x;_t.Code=Cu;_t.DBRef=Bo;_t.Decimal128=vn;_t.Double=hs;_t.EJSON=Mc;_t.Int32=bu;_t.Long=M;_t.MaxKey=bc;_t.MinKey=Dc;_t.NumberUtils=Oe;_t.ObjectId=Wt;_t.Timestamp=lo;_t.UUID=bn;_t.bsonType=Cc;_t.calculateObjectSize=P9;_t.deserialize=M9;_t.deserializeStream=B9;_t.onDemand=Ol;_t.serialize=D9;_t.serializeWithBufferAndIndex=T9;_t.setInternalBufferSize=b9});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=eJ;ye.pluckBSONSerializeOptions=iJ;ye.resolveBSONOptions=sJ;ye.parseUtf8ValidationOption=oJ;var xp=r3(),hr=r3();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 eJ(e,t){let r=xp.BSON.onDemand.parseToElements(e,t);return Array.isArray(r)?r:[...r]}var F9=(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}`)},tJ=(e,t)=>(F9(e,t,4),xp.NumberUtils.getInt32LE(e,t));ye.readInt32LE=tJ;var rJ=(e,t)=>(F9(e,t,1),e[t]);ye.readUint8=rJ;var nJ=(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=nJ;function iJ(e){let{fieldsAsRaw:t,useBigInt64:r,promoteValues:n,promoteBuffers:i,promoteLongs:s,serializeFunctions:o,ignoreUndefined:u,bsonRegExp:a,raw:c,enableUtf8Validation:l}=e;return{fieldsAsRaw:t,useBigInt64:r,promoteValues:n,promoteBuffers:i,promoteLongs:s,serializeFunctions:o,ignoreUndefined:u,bsonRegExp:a,raw:c,enableUtf8Validation:l}}function sJ(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 oJ(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=uJ;N.needsRetryableWriteLabel=cJ;N.isRetryableWriteError=lJ;N.isRetryableReadError=hJ;N.isNodeShuttingDownError=yJ;N.isStateChangeError=gJ;N.isNetworkTimeoutError=EJ;N.isResumableError=_J;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 uJ(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 aJ(e){return e!=null&&typeof e==="object"&&"errors"in e&&Array.isArray(e.errors)}class Fo 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(aJ(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=Fo;class vp extends Fo{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=vp;class Sl extends Fo{constructor(e,t){super(e,t)}get name(){return"MongoDriverError"}}N.MongoDriverError=Sl;class kn extends Sl{constructor(e,t){super(e,t)}get name(){return"MongoAPIError"}}N.MongoAPIError=kn;class Qi extends Sl{constructor(e,t){super(e,t)}get name(){return"MongoRuntimeError"}}N.MongoRuntimeError=Qi;class I9 extends Qi{constructor(e,t){super(e,t)}get name(){return"MongoStalePrimaryError"}}N.MongoStalePrimaryError=I9;class $9 extends kn{constructor(e="This batch has already been executed, create new batch to execute"){super(e)}get name(){return"MongoBatchReExecutionError"}}N.MongoBatchReExecutionError=$9;class R9 extends Qi{constructor(e){super(e)}get name(){return"MongoDecompressionError"}}N.MongoDecompressionError=R9;class x9 extends kn{constructor(e){super(e)}get name(){return"MongoNotConnectedError"}}N.MongoNotConnectedError=x9;class v9 extends kn{constructor(e){super(e)}get name(){return"MongoTransactionError"}}N.MongoTransactionError=v9;class k9 extends kn{constructor(e="Cannot use a session that has ended"){super(e)}get name(){return"MongoExpiredSessionError"}}N.MongoExpiredSessionError=k9;class q9 extends Qi{constructor(e){super(e)}get name(){return"MongoKerberosError"}}N.MongoKerberosError=q9;class j9 extends Qi{constructor(e,t){super(e,t)}get name(){return"MongoAWSError"}}N.MongoAWSError=j9;class kp extends Qi{constructor(e){super(e)}get name(){return"MongoOIDCError"}}N.MongoOIDCError=kp;class L9 extends kp{constructor(e){super(e)}get name(){return"MongoAzureError"}}N.MongoAzureError=L9;class U9 extends kp{constructor(e){super(e)}get name(){return"MongoGCPError"}}N.MongoGCPError=U9;class V9 extends vp{constructor(e){super(e);this.writeConcernErrors=[],this.writeErrors=new Map}get name(){return"MongoClientBulkWriteError"}}N.MongoClientBulkWriteError=V9;class z9 extends Qi{constructor(e){super(e)}get name(){return"MongoClientBulkWriteCursorError"}}N.MongoClientBulkWriteCursorError=z9;class W9 extends Qi{constructor(e){super(e)}get name(){return"MongoClientBulkWriteExecutionError"}}N.MongoClientBulkWriteExecutionError=W9;class H9 extends Qi{constructor(e){super(e)}get name(){return"MongoChangeStreamError"}}N.MongoChangeStreamError=H9;class K9 extends kn{constructor(e="Tailable cursor does not support this operation"){super(e)}get name(){return"MongoTailableCursorError"}}N.MongoTailableCursorError=K9;class G9 extends Qi{constructor(e){super(e)}get name(){return"MongoGridFSStreamError"}}N.MongoGridFSStreamError=G9;class Y9 extends Qi{constructor(e){super(e)}get name(){return"MongoGridFSChunkError"}}N.MongoGridFSChunkError=Y9;class Q9 extends Qi{constructor(e,t){super(e,t)}get name(){return"MongoUnexpectedServerResponseError"}}N.MongoUnexpectedServerResponseError=Q9;class J9 extends Sl{get name(){return"MongoOperationTimeoutError"}}N.MongoOperationTimeoutError=J9;class X9 extends kn{constructor(e="Cursor is already initialized"){super(e)}get name(){return"MongoCursorInUseError"}}N.MongoCursorInUseError=X9;class Z9 extends kn{constructor(e="Server is closed"){super(e)}get name(){return"MongoServerClosedError"}}N.MongoServerClosedError=Z9;class e7 extends kn{constructor(e){super(e||"Cursor is exhausted")}get name(){return"MongoCursorExhaustedError"}}N.MongoCursorExhaustedError=e7;class t7 extends kn{constructor(e="Topology is closed"){super(e)}get name(){return"MongoTopologyClosedError"}}N.MongoTopologyClosedError=t7;class r7 extends kn{constructor(){super("Operation interrupted because client was closed")}get name(){return"MongoClientClosedError"}}N.MongoClientClosedError=r7;class Pc extends Fo{constructor(e,t){super(e,{cause:t?.cause});this.beforeHandshake=!!t?.beforeHandshake}get name(){return"MongoNetworkError"}}N.MongoNetworkError=Pc;class n7 extends Pc{constructor(e,t){super(e,t)}get name(){return"MongoNetworkTimeoutError"}}N.MongoNetworkTimeoutError=n7;class i7 extends Sl{constructor(e){super(e)}get name(){return"MongoParseError"}}N.MongoParseError=i7;class s7 extends kn{constructor(e,t){super(e,t)}get name(){return"MongoInvalidArgumentError"}}N.MongoInvalidArgumentError=s7;class o7 extends kn{constructor(e){super(e)}get name(){return"MongoCompatibilityError"}}N.MongoCompatibilityError=o7;class u7 extends kn{constructor(e){super(e)}get name(){return"MongoMissingCredentialsError"}}N.MongoMissingCredentialsError=u7;class a7 extends kn{constructor(e,t){super(e,t);this.dependencyName=t.dependencyName}get name(){return"MongoMissingDependencyError"}}N.MongoMissingDependencyError=a7;class n3 extends Fo{constructor(e,t){if(t&&t.error)super(Fo.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=n3;class i3 extends n3{constructor(e,t){super(e,t)}get name(){return"MongoServerSelectionError"}}N.MongoServerSelectionError=i3;class s3 extends vp{constructor(e){super({...e.writeConcernError,...e});this.errInfo=e.writeConcernError.errInfo,this.result=e}get name(){return"MongoWriteConcernError"}}N.MongoWriteConcernError=s3;var c7=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]),N9=c7;function cJ(e){if(e instanceof Pc)return!0;if(e instanceof Fo){if(!e.hasErrorLabel(N.MongoErrorLabel.HandshakeError))return!1}if(e instanceof s3){let n=e.result.writeConcernError.code??Number(e.code);return N9.has(Number.isNaN(n)?0:n)}if(e instanceof Fo)return N9.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 lJ(e){return e.hasErrorLabel(N.MongoErrorLabel.RetryableWriteError)||e.hasErrorLabel(N.MongoErrorLabel.PoolRequestedRetry)}function hJ(e){if(typeof e.code==="number"?c7.has(e.code):!1)return!0;if(e instanceof Pc)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 fJ=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]),dJ=new Set([N.MONGODB_ERROR_CODES.NotWritablePrimary,N.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,N.MONGODB_ERROR_CODES.LegacyNotPrimary]),pJ=new Set([N.MONGODB_ERROR_CODES.InterruptedAtShutdown,N.MONGODB_ERROR_CODES.ShutdownInProgress]);function l7(e){if(typeof e.code==="number")return fJ.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 mJ(e){if(typeof e.code==="number")return dJ.has(e.code);if(l7(e))return!1;return N.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)}function yJ(e){return!!(typeof e.code==="number"&&pJ.has(e.code))}function gJ(e){return l7(e)||mJ(e)}function EJ(e){return!!(e instanceof Pc&&e.message.match(/timed out/))}function _J(e,t){if(e==null||!(e instanceof Fo))return!1;if(e instanceof Pc)return!0;if(e instanceof i3)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 Io=g(function(Du){Object.defineProperty(Du,"__esModule",{value:!0});Du.getKerberos=AJ;Du.getZstdLibrary=OJ;Du.getAwsCredentialProvider=SJ;Du.getGcpMetadata=CJ;Du.getSnappy=bJ;Du.getSocks=DJ;Du.getMongoDBClientEncryption=TJ;var No=require("zlib"),Oi=X();function qp(e){return new Proxy(e?{kModuleError:e}:{},{get:(r,n)=>{if(n==="kModuleError")return e;throw e},set:()=>{throw e}})}function AJ(){let e;try{e=(()=>{throw new Error("Cannot require module "+"kerberos");})()}catch(t){e=qp(new Oi.MongoMissingDependencyError("Optional module `kerberos` not found. Please install it to enable kerberos authentication",{cause:t,dependencyName:"kerberos"}))}return e}function wJ(){if(typeof No.zstdCompress!=="function"||typeof No.zstdDecompress!=="function")return null;return{compress(e,t){let r=t==null?{}:{params:{[No.constants.ZSTD_c_compressionLevel]:t}};return new Promise((n,i)=>{No.zstdCompress(e,r,(s,o)=>{if(s)return i(s);n(o)})})},decompress(e){return new Promise((t,r)=>{No.zstdDecompress(e,(n,i)=>{if(n)return r(n);t(i)})})}}}function OJ(){let e=wJ();if(e!=null)return e;let t;try{t=(()=>{throw new Error("Cannot require module "+"@mongodb-js/zstd");})()}catch(r){t=qp(new Oi.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 SJ(){try{return (()=>{throw new Error("Cannot require module "+"@aws-sdk/credential-providers");})()}catch(e){return qp(new Oi.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 CJ(){try{return (()=>{throw new Error("Cannot require module "+"gcp-metadata");})()}catch(e){return qp(new Oi.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 bJ(){try{return (()=>{throw new Error("Cannot require module "+"snappy");})()}catch(e){return{kModuleError:new Oi.MongoMissingDependencyError("Optional module `snappy` not found. Please install it to enable snappy compression",{cause:e,dependencyName:"snappy"})}}}function DJ(){try{return (()=>{throw new Error("Cannot require module "+"socks");})()}catch(e){return{kModuleError:new Oi.MongoMissingDependencyError("Optional module `socks` not found. Please install it to connections over a SOCKS5 proxy",{cause:e,dependencyName:"socks"})}}}function TJ(){let e=null;try{e=(()=>{throw new Error("Cannot require module "+"mongodb-client-encryption");})()}catch(t){return{kModuleError:new Oi.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 Tu=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 Df=g(function(Dn){Object.defineProperty(Dn,"__esModule",{value:!0});Dn.uncompressibleCommands=Dn.Compressor=void 0;Dn.compress=FJ;Dn.decompress=f7;Dn.compressCommand=NJ;Dn.decompressResponse=IJ;var Lp=require("zlib"),Si=Te(),jp=Br(),Up=Io(),bl=X(),ds=ca(),Cl=Tu();Dn.Compressor=Object.freeze({none:0,snappy:1,zlib:2,zstd:3});Dn.uncompressibleCommands=new Set(["hello",jp.LEGACY_HELLO_COMMAND,jp.LEGACY_HELLO_COMMAND_CAMEL_CASE,"saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);var MJ=3,PJ=(e)=>new Promise((t,r)=>{Lp.inflate(e,(n,i)=>{if(n)return r(n);t(i)})}),BJ=(e,t)=>new Promise((r,n)=>{Lp.deflate(e,t,(i,s)=>{if(i)return n(i);r(s)})}),aa,Bc=null;function h7(){if(Bc==null){let e=Up.getSnappy();if("kModuleError"in e)throw e.kModuleError;Bc=e}return Bc}async function FJ(e,t){let r={};switch(e.agreedCompressor){case"snappy":return Bc??=h7(),await Bc.compress(t);case"zstd":{if(d7(),"kModuleError"in aa)throw aa.kModuleError;return await aa.compress(t,MJ)}case"zlib":{if(e.zlibCompressionLevel)r.level=e.zlibCompressionLevel;return await BJ(t,r)}default:throw new bl.MongoInvalidArgumentError(`Unknown compressor ${e.agreedCompressor} failed to compress`)}}async function f7(e,t){if(e!==Dn.Compressor.snappy&&e!==Dn.Compressor.zstd&&e!==Dn.Compressor.zlib&&e!==Dn.Compressor.none)throw new bl.MongoDecompressionError(`Server sent message compressed using an unsupported compressor. (Received compressor ID ${e})`);switch(e){case Dn.Compressor.snappy:return Bc??=h7(),await Bc.uncompress(t,{asBuffer:!0});case Dn.Compressor.zstd:{if(d7(),"kModuleError"in aa)throw aa.kModuleError;return await aa.decompress(t)}case Dn.Compressor.zlib:return await PJ(t);default:return t}}function d7(){if(!aa)aa=Up.getZstdLibrary()}var bf=16;async function NJ(e,t){let n=await(t.agreedCompressor==="none"||!ds.OpCompressedRequest.canCompress(e)?e:new ds.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0})).toBin();return Si.ByteUtils.concat(n)}async function IJ(e){let t={length:Si.readInt32LE(e,0),requestId:Si.readInt32LE(e,4),responseTo:Si.readInt32LE(e,8),opCode:Si.readInt32LE(e,12)};if(t.opCode!==Cl.OP_COMPRESSED){let u=t.opCode===Cl.OP_MSG?ds.OpMsgResponse:ds.OpReply,a=e.subarray(bf);return new u(e,t,a)}let r={...t,fromCompressed:!0,opCode:Si.readInt32LE(e,bf),length:Si.readInt32LE(e,bf+4)},n=e[bf+8],i=e.slice(bf+9),s=r.opCode===Cl.OP_MSG?ds.OpMsgResponse:ds.OpReply,o=await f7(n,i);if(o.length!==r.length)throw new bl.MongoDecompressionError("Message body and message header must be the same length");return new s(e,r,o)}});var ca=g(function(ci){Object.defineProperty(ci,"__esModule",{value:!0});ci.OpCompressedRequest=ci.OpMsgResponse=ci.OpMsgRequest=ci.DocumentSequence=ci.OpReply=ci.OpQueryRequest=void 0;ci.makeDocumentSequence=WJ;var se=Te(),$o=X(),Dl=Df(),ps=Tu(),Tl=0,$J=2,RJ=4,xJ=8,vJ=16,kJ=32,qJ=64,jJ=128,LJ=1,UJ=2,VJ=4,zJ=8,m7=se.ByteUtils.encodeUTF8Into;class u3{constructor(e,t,r){this.moreToCome=!1;let n=`${e}.$cmd`;if(typeof e!=="string")throw new $o.MongoRuntimeError("Database name must be a string for a query");if(t==null)throw new $o.MongoRuntimeError("A query document must be specified for query");if(n.indexOf("\x00")!==-1)throw new $o.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??u3.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=Tl++}nextRequestId(){return Tl+1}static getRequestId(){return++Tl}toBin(){let e=[],t=null,r=0;if(this.tailable)r|=$J;if(this.secondaryOk)r|=RJ;if(this.oplogReplay)r|=xJ;if(this.noCursorTimeout)r|=vJ;if(this.awaitData)r|=kJ;if(this.exhaust)r|=qJ;if(this.partial)r|=jJ;if(this.batchSize!==this.numberToReturn)this.numberToReturn=this.batchSize;let n=se.ByteUtils.allocate(20+se.ByteUtils.utf8ByteLength(this.ns)+1+4+4);e.push(n);let i=se.BSON.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});if(e.push(i),this.returnFieldSelector&&Object.keys(this.returnFieldSelector).length>0)t=se.BSON.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined}),e.push(t);let s=n.length+i.length+(t?t.length:0),o=4;return n[3]=s>>24&255,n[2]=s>>16&255,n[1]=s>>8&255,n[0]=s&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]=ps.OP_QUERY>>24&255,n[o+2]=ps.OP_QUERY>>16&255,n[o+1]=ps.OP_QUERY>>8&255,n[o]=ps.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+m7(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}}ci.OpQueryRequest=u3;class y7{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=se.readInt32LE(this.data,0),this.cursorId=new se.BSON.Long(se.readInt32LE(this.data,4),se.readInt32LE(this.data,8)),this.startingFrom=se.readInt32LE(this.data,12),this.numberReturned=se.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&LJ)!==0,this.queryFailure=(this.responseFlags&UJ)!==0,this.shardConfigStale=(this.responseFlags&VJ)!==0,this.awaitCapable=(this.responseFlags&zJ)!==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]}}ci.OpReply=y7;var g7=1,E7=2,_7=65536;class Vp{constructor(e,t){this.field=e,this.documents=[],this.chunks=[],this.serializedDocumentsLength=0;let r=se.ByteUtils.allocateUnsafe(5+this.field.length+1);if(r[0]=1,m7(r,`${this.field}\x00`,5),this.chunks.push(r),this.header=r,t)for(let n of t)this.push(n,se.BSON.serialize(n))}push(e,t){if(this.serializedDocumentsLength+=t.length,this.documents.push(e),this.chunks.push(t),this.header)se.NumberUtils.setInt32LE(this.header,1,4+this.field.length+1+this.serializedDocumentsLength);return this.serializedDocumentsLength+this.header.length}toBin(){return se.ByteUtils.concat(this.chunks)}}ci.DocumentSequence=Vp;function WJ(e,t,r){let n=new Vp(e);for(let i=0;i<t.length;i++)n.push(t[i],r[i]);return n}class zp{constructor(e,t,r){if(t==null)throw new $o.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:zp.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|=g7;if(this.moreToCome)t|=E7;if(this.exhaustAllowed)t|=_7;let r=se.ByteUtils.allocate(20);e.push(r);let n=r.length,i=this.command;return n+=this.makeSections(e,i),se.NumberUtils.setInt32LE(r,0,n),se.NumberUtils.setInt32LE(r,4,this.requestId),se.NumberUtils.setInt32LE(r,8,0),se.NumberUtils.setInt32LE(r,12,ps.OP_MSG),se.setUint32LE(r,16,t),e}makeSections(e,t){let r=this.extractDocumentSequences(t),n=se.ByteUtils.allocateUnsafe(1);n[0]=0;let i=this.serializeBson(t);return e.push(n),e.push(i),e.push(r),n.length+i.length+r.length}extractDocumentSequences(e){let t=[];for(let[r,n]of Object.entries(e))if(n instanceof Vp)t.push(n.toBin()),delete e[r];if(t.length>0)return se.ByteUtils.concat(t);return se.ByteUtils.allocate(0)}serializeBson(e){return se.BSON.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}static getRequestId(){return Tl=Tl+1&2147483647,Tl}}ci.OpMsgRequest=zp;class A7{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=se.readInt32LE(r,0),this.checksumPresent=(this.responseFlags&g7)!==0,this.moreToCome=(this.responseFlags&E7)!==0,this.exhaustAllowed=(this.responseFlags&_7)!==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=se.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 $o.MongoRuntimeError("OP_MSG Payload Type 1 detected unsupported protocol")}return this.parsed=!0,this.sections[0]}}ci.OpMsgResponse=A7;var o3=16,p7=9;class w7{constructor(e,t){this.command=e,this.options={zlibCompressionLevel:t.zlibCompressionLevel,agreedCompressor:t.agreedCompressor}}static canCompress(e){let t=e instanceof zp?e.command:e.query,r=Object.keys(t)[0];return!Dl.uncompressibleCommands.has(r)}async toBin(){let e=se.ByteUtils.concat(this.command.toBin()),t=e.slice(o3),r=se.readInt32LE(e,12),n=await Dl.compress(this.options,t),i=se.ByteUtils.allocate(o3);se.NumberUtils.setInt32LE(i,0,o3+p7+n.length),se.NumberUtils.setInt32LE(i,4,this.command.requestId),se.NumberUtils.setInt32LE(i,8,0),se.NumberUtils.setInt32LE(i,12,ps.OP_COMPRESSED);let s=se.ByteUtils.allocate(p7);return se.NumberUtils.setInt32LE(s,0,r),se.NumberUtils.setInt32LE(s,4,t.length),s[8]=Dl.Compressor[this.options.agreedCompressor],[i,s,n]}}ci.OpCompressedRequest=w7});var fo=g(function(ho){Object.defineProperty(ho,"__esModule",{value:!0});ho.ReadConcern=ho.ReadConcernLevel=void 0;ho.ReadConcernLevel=Object.freeze({local:"local",majority:"majority",linearizable:"linearizable",available:"available",snapshot:"snapshot"});class Ml{constructor(e){this.level=ho.ReadConcernLevel[e]??e}static fromOptions(e){if(e==null)return;if(e.readConcern){let{readConcern:t}=e;if(t instanceof Ml)return t;else if(typeof t==="string")return new Ml(t);else if("level"in t&&t.level)return new Ml(t.level)}if(e.level)return new Ml(e.level);return}static get MAJORITY(){return ho.ReadConcernLevel.majority}static get AVAILABLE(){return ho.ReadConcernLevel.available}static get LINEARIZABLE(){return ho.ReadConcernLevel.linearizable}static get SNAPSHOT(){return ho.ReadConcernLevel.snapshot}toJSON(){return{level:this.level}}}ho.ReadConcern=Ml});var Xr=g(function(qn){Object.defineProperty(qn,"__esModule",{value:!0});qn.ReadPreference=qn.ReadPreferenceMode=void 0;var Ci=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 Ci.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 Ci.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 Ci.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 Ci.MongoInvalidArgumentError("Primary read preference cannot be combined with tags");if(this.maxStalenessSeconds)throw new Ci.MongoInvalidArgumentError("Primary read preference cannot be combined with maxStalenessSeconds");if(this.hedge)throw new Ci.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 Ci.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 bi=g(function(li){Object.defineProperty(li,"__esModule",{value:!0});li.ServerType=li.TopologyType=li.STATE_CONNECTED=li.STATE_CONNECTING=li.STATE_CLOSED=li.STATE_CLOSING=void 0;li._advanceClusterTime=HJ;li.STATE_CLOSING="closing";li.STATE_CLOSED="closed";li.STATE_CONNECTING="connecting";li.STATE_CONNECTED="connected";li.TopologyType=Object.freeze({Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown",LoadBalanced:"LoadBalanced"});li.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 hi=g(function(Fc){Object.defineProperty(Fc,"__esModule",{value:!0});Fc.WriteConcern=Fc.WRITE_CONCERN_KEYS=void 0;Fc.throwIfWriteConcernError=KJ;var Wp=St(),O7=X();Fc.WRITE_CONCERN_KEYS=["w","wtimeout","j","journal","fsync"];class Tf{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 Tf)r=e;else r=e.writeConcern;let i={...t instanceof Tf?t:t.writeConcern,...r},{w:s=void 0,wtimeout:o=void 0,j:u=void 0,fsync:a=void 0,journal:c=void 0,wtimeoutMS:l=void 0}=i;if(s!=null||o!=null||l!=null||u!=null||c!=null||a!=null)return new Tf(s,o??l,u??c,a);return}}Fc.WriteConcern=Tf;function KJ(e){if(typeof e==="object"&&e!=null){let t=Wp.MongoDBResponse.is(e)&&e.has("writeConcernError")?e.toObject():!Wp.MongoDBResponse.is(e)&&("writeConcernError"in e)?e:null;if(t!=null)throw new O7.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=GJ;Z.hostMatchesWildcards=YJ;Z.normalizeHintField=QJ;Z.isObject=a3;Z.mergeOptions=XJ;Z.filterOptions=ZJ;Z.isPromiseLike=eX;Z.decorateWithCollation=tX;Z.decorateWithReadConcern=rX;Z.getTopology=nX;Z.ns=iX;Z.makeCounter=sX;Z.uuidV4=oX;Z.maxWireVersion=uX;Z.arrayStrictEqual=aX;Z.errorStrictEqual=cX;Z.makeStateMachine=lX;Z.processTimeMS=N7;Z.calculateDurationInMs=hX;Z.hasAtomicOperators=I7;Z.resolveTimeoutOptions=fX;Z.resolveOptions=dX;Z.isSuperset=$7;Z.isHello=pX;Z.setDifference=mX;Z.isRecord=gX;Z.emitWarning=x7;Z.emitWarningOnce=EX;Z.enumToString=_X;Z.supportsRetryableWrites=AX;Z.shuffle=wX;Z.commandSupportsReadConcern=OX;Z.commandSupportsAfterClusterTime=SX;Z.compareObjectId=CX;Z.parseInteger=v7;Z.parseUnsignedInteger=bX;Z.checkParentDomainMatch=k7;Z.dnsNameToASCII=q7;Z.normalizeDnsName=j7;Z.verifySrvHost=TX;Z.get=MX;Z.isHostMatch=PX;Z.promiseWithResolvers=h3;Z.squashError=BX;Z.once=NX;Z.maybeAddIdToDocuments=IX;Z.fileIsAccessible=$X;Z.csotMin=RX;Z.noop=xX;Z.decorateDecryptionResult=L7;Z.addAbortListener=f3;Z.abortable=vX;var C7=require("fs"),b7=require("http"),D7=require("process"),Pl=require("timers"),T7=require("url"),qr=Te(),Hp=Tu(),la=Br(),Ft=X(),M7=fo(),P7=Xr(),B7=bi(),F7=hi();function GJ(e){return e!=null&&typeof e==="object"&&Symbol.toStringTag in e&&e[Symbol.toStringTag]==="Uint8Array"}function YJ(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 QJ(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 JJ=(e)=>Object.prototype.toString.call(e);function a3(e){return JJ(e)==="[object Object]"}function XJ(e,t){return{...e,...t}}function ZJ(e,t){let r={};for(let n in e)if(t.includes(n))r[n]=e[n];return r}function eX(e){return e!=null&&typeof e==="object"&&"then"in e&&typeof e.then==="function"}function tX(e,t){if(t.collation&&typeof t.collation==="object")e.collation=t.collation}function rX(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 nX(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 iX(e){return Pf.fromString(e)}class Pf{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 c3(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 Pf(t,n===""?void 0:n)}}Z.MongoDBNamespace=Pf;class c3 extends Pf{constructor(e,t){super(e,t);this.collection=t}static fromString(e){return super.fromString(e)}}Z.MongoDBCollectionNamespace=c3;function*sX(e=0){let t=e;while(!0){let r=t;t+=1,yield r}}function oX(){let e=crypto.getRandomValues(new Uint8Array(16));return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function uX(e){if(e){if(e.hello)return e.hello.maxWireVersion;if(e.serverApi?.version)return Hp.MAX_SUPPORTED_WIRE_VERSION;if(e.loadBalanced)return Hp.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 aX(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;return e.length===t.length&&e.every((r,n)=>r===t[n])}function cX(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 lX(e){return function(r,n){let i=e[r.s.state];if(i&&i.indexOf(n)<0)throw new Ft.MongoRuntimeError(`illegal state transition from [${r.s.state}] => [${n}], allowed: [${i}]`);r.emit("stateChanged",r.s.state,n),r.s.state=n}}function N7(){return Math.floor(performance.now())}function hX(e){if(typeof e!=="number")return-1;let t=N7()-e;return t<0?0:t}function I7(e,t){if(Array.isArray(e)){for(let n of e)if(I7(n))return!0;return!1}let r=Object.keys(e);if(t?.ignoreUndefined){let n=!0;for(let i of r)if(e[i]!==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 fX(e,t){let{socketTimeoutMS:r,serverSelectionTimeoutMS:n,waitQueueTimeoutMS:i}=e.s.options;return{socketTimeoutMS:r,serverSelectionTimeoutMS:n,waitQueueTimeoutMS:i,...t,timeoutMS:void 0}}function dX(e,t){let r=Object.assign({},t,qr.resolveBSONOptions(t,e));if(!t?.session?.inTransaction()){let s=M7.ReadConcern.fromOptions(t)??e?.readConcern;if(s)r.readConcern=s;let o=F7.WriteConcern.fromOptions(t)??e?.writeConcern;if(o)r.writeConcern=o}r.timeoutMS=void 0;let i=P7.ReadPreference.fromOptions(t)??e?.readPreference;if(i)r.readPreference=i;return r}function $7(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 pX(e){return e[la.LEGACY_HELLO_COMMAND]||e.hello?!0:!1}function mX(e,t){let r=new Set(e);for(let n of t)r.delete(n);return r}var yX=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function gX(e,t=void 0){if(!a3(e))return!1;let r=e.constructor;if(r&&r.prototype){if(!a3(r.prototype))return!1;if(!yX(r.prototype,"isPrototypeOf"))return!1}if(t){let n=Object.keys(e);return $7(n,t)}return!0}class l3{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=l3;class R7{constructor(){this.buffers=new l3,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 i=e-r,s=Math.min(i,n.byteLength),o=n.subarray(0,s);if(t.set(o,r),r+=s,this.totalByteLength-=s,s<n.byteLength)this.buffers.unshift(n.subarray(s))}return t}}Z.BufferPool=R7;class Mf{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 i=n.hostname,s=n.port,o=decodeURIComponent(i).toLowerCase();if(o.startsWith("[")&&o.endsWith("]"))this.isIPv6=!0,o=o.substring(1,i.length-1);if(this.host=o.toLowerCase(),typeof s==="number")this.port=s;else if(typeof s==="string"&&s!=="")this.port=Number.parseInt(s,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 Mf(e)}static fromHostPort(e,t){if(e.includes(":"))e=`[${e}]`;return Mf.fromString(`${e}:${t}`)}static fromSrvRecord({name:e,port:t}){return Mf.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=Mf;Z.DEFAULT_PK_FACTORY={createPk(){return new qr.ObjectId}};Z.MONGODB_WARNING_CODE="MONGODB DRIVER";function x7(e){return D7.emitWarning(e,{code:Z.MONGODB_WARNING_CODE})}var S7=new Set;function EX(e){if(!S7.has(e))return S7.add(e),x7(e)}function _X(e){return Object.values(e).join(", ")}function AX(e){if(!e)return!1;if(e.loadBalanced)return!0;if(e.description.logicalSessionTimeoutMinutes!=null){if(e.description.type!==B7.ServerType.Standalone)return!0}return!1}function wX(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,i=t%r.length===0?1:r.length-t;while(n>i){let s=Math.floor(Math.random()*n);n-=1;let o=r[n];r[n]=r[s],r[s]=o}return t%r.length===0?r:r.slice(i)}function OX(e){if(e.aggregate||e.count||e.distinct||e.find||e.geoNear)return!0;return!1}function SX(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 CX(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 v7(e){if(typeof e==="number")return Math.trunc(e);let t=Number.parseInt(String(e),10);return Number.isNaN(t)?null:t}function bX(e){let t=v7(e);return t!=null&&t>=0?t:null}function k7(e,t){let r=j7(t),n=/^.*?\./,i=r.split(".").length<3,s=`.${e.replace(n,"")}`,o=i?r:`.${r.replace(n,"")}`;if(!o.startsWith("."))o="."+o;if(i&&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(!s.endsWith(o))throw new Ft.MongoAPIError("Server record does not share hostname with parent URI")}var DX=/[\u0000-\u0020\u007F#%/:<>?@[\\\]^|]/;function q7(e){if(DX.test(e))return null;let t=/^\p{ASCII}*$/u.test(e)?e.toLowerCase():T7.domainToASCII(e);return t===""?null:t}function j7(e){let t=e.endsWith(".")?e.slice(0,-1):e,r=q7(t);if(r==null)throw new Ft.MongoAPIError("Invalid DNS host name");return r}function TX(e,t,r){let{srvAllowedHostsSuffix:n,srvHostValidator:i}=r;if(i!=null){if(!i(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}k7(e,t)}function MX(e,t={}){return new Promise((r,n)=>{let i,s=b7.get(e,t,(o)=>{o.setEncoding("utf8");let u="";o.on("data",(a)=>u+=a),o.on("end",()=>{Pl.clearTimeout(i),r({status:o.statusCode,body:u})})}).on("error",(o)=>{Pl.clearTimeout(i),n(o)}).end();i=Pl.setTimeout(()=>{s.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 PX(e,t){return t&&e.test(t.toLowerCase())?!0:!1}function h3(){let e,t;return{promise:new Promise(function(i,s){e=i,t=s}),resolve:e,reject:t}}function BX(e){return}var FX=(e)=>Promise.resolve(crypto.getRandomValues(new Uint8Array(e)));Z.randomBytes=FX;async function NX(e,t,r){r?.signal?.throwIfAborted();let{promise:n,resolve:i,reject:s}=h3(),o=(c)=>i(c),u=(c)=>s(c),a=f3(r?.signal,function(){s(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 IX(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 $X(e,t){try{return await C7.promises.access(e,t),!0}catch{return!1}}function RX(e,t){if(e===0)return t;if(t===0)return e;return Math.min(e,t)}function xX(){return}function L7(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 i=t[n];if(i&&i._bsontype==="Binary"&&i.sub_type===6){if(!e[la.kDecoratedKeys])Object.defineProperty(e,la.kDecoratedKeys,{value:[],configurable:!0,enumerable:!1,writable:!1});e[la.kDecoratedKeys].push(n);continue}L7(e[n],i,!1)}}Z.kDispose=Symbol.dispose??Symbol("dispose");function f3(e,t){if(e==null)return;return e.addEventListener("abort",t,{once:!0}),{[Z.kDispose]:()=>e.removeEventListener("abort",t)}}async function vX(e,{signal:t}){if(t==null)return await e;let{promise:r,reject:n}=h3(),i=t.aborted?n(t.reason):f3(t,function(){n(this.reason)});try{return await Promise.race([e,r])}finally{i?.[Z.kDispose]()}}});var U7=g(function(Gp){Object.defineProperty(Gp,"__esModule",{value:!0});Gp.OnDemandDocument=void 0;var re=Te(),Bf={type:0,nameOffset:1,nameLength:2,offset:3,length:4};class Kp{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[Bf.nameLength],n=t[Bf.nameOffset];if(e.length!==r)return!1;let i=n+r;for(let s=n,o=0;o<e.length&&s<i;o++,s++)if(this.bson[s]!==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 i={element:n,value:void 0};return this.cache[e]=i,this.indexFound[r]=!0,i}}return this.cache[e]=!1,null}toJSValue(e,t){let r=e[Bf.type],n=e[Bf.offset],i=e[Bf.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+i-1,!1);case re.BSONType.binData:{let s=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>s-4)throw new re.BSONError("Binary type with subtype 0x02 contains too long binary size");if(u<s-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+s),o)}case re.BSONType.date:return new Date(Number(re.NumberUtils.getBigInt64LE(this.bson,n)));case re.BSONType.object:return new Kp(this.bson,n);case re.BSONType.array:return new Kp(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 i=this.toJSValue(n.element,t);if(i==null)if(r===!0)throw new re.BSONError(`BSON element "${e}" is missing`);else return null;n.value=i}return n.value}getNumber(e,t){let r=this.get(e,re.BSONType.bool),n=r==null?null:r?1:0,i=this.get(e,re.BSONType.long),s=i==null?null:Number(i),o=n??s??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)}}Gp.OnDemandDocument=Kp});var St=g(function(po){Object.defineProperty(po,"__esModule",{value:!0});po.ClientBulkWriteCursorResponse=po.ExplainedCursorResponse=po.CursorResponse=po.MongoDBResponse=void 0;po.isErrorResponse=z7;var oe=Te(),Di=X(),Qp=he(),V7=U7(),Yp={type:0,nameOffset:1,nameLength:2,offset:3,length:4};function z7(e,t){for(let r=0;r<t.length;r++){let n=t[r];if(n[Yp.nameLength]===2){let i=n[Yp.nameOffset];if(e[i]===111&&e[i+1]===107){let s=n[Yp.offset],o=n[Yp.length];for(let u=s;u<s+o;u++)if(e[u]!==0)return!1;return!0}}}return!0}class Bl extends V7.OnDemandDocument{get(e,t,r){try{return super.get(e,t,r)}catch(n){throw new Di.MongoUnexpectedServerResponseError(n.message,{cause:n})}}static is(e){return e instanceof Bl}static make(e){let t=oe.parseToElementsToArray(e,0);return z7(e,t)?new Bl(e,0,!1,t):new this(e,0,!1,t)}static{this.empty=new Bl(new Uint8Array([13,0,0,0,16,111,107,0,1,0,0,0,0]))}get isMaxTimeExpiredError(){if(this.ok===0&&this.code===Di.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;if(this.ok===0)return!1;if(this.get("writeConcernError",oe.BSONType.object)?.getNumber("code")===Di.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")===Di.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)}}po.MongoDBResponse=Bl;class Nc extends Bl{constructor(){super(...arguments);this._batch=null,this.iterated=0,this._encryptedBatch=null}static get emptyGetMore(){return new Nc(oe.serialize({ok:1,cursor:{id:0n,nextBatch:[]}}))}static is(e){return e instanceof Nc||e===Nc.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 Di.MongoUnexpectedServerResponseError(e.message,{cause:e})}}get ns(){let e=this.cursor.get("ns",oe.BSONType.string);if(e!=null)return Qp.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 Di.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 Di.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)Qp.decorateDecryptionResult(n,r.toObject(e),!0);return n}}clear(){this.iterated=this.batchSize}}po.CursorResponse=Nc;class W7 extends Nc{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)}}po.ExplainedCursorResponse=W7;class H7 extends Nc{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)}}po.ClientBulkWriteCursorResponse=H7});var d3=g(function(Mu){Object.defineProperty(Mu,"__esModule",{value:!0});Mu.Explain=Mu.ExplainVerbosity=void 0;Mu.decorateWithExplain=kX;Mu.ExplainVerbosity=Object.freeze({queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"});class Jp{constructor(e,t){if(typeof e==="boolean")this.verbosity=e?Mu.ExplainVerbosity.allPlansExecution:Mu.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 Jp(e);let{verbosity:t,maxTimeMS:r}=e;return new Jp(t,r)}}Mu.Explain=Jp;function kX(e,t){let{verbosity:r,maxTimeMS:n}=t,i={explain:e,verbosity:r};if(typeof n==="number")i.maxTimeMS=n;return i}});var vt=g(function(ms){Object.defineProperty(ms,"__esModule",{value:!0});ms.AbstractOperation=ms.Aspect=void 0;ms.defineAspects=qX;var K7=Te(),Fl=Xr();ms.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 G7{constructor(e={}){this.readPreference=this.hasAspect(ms.Aspect.WRITE_OPERATION)?Fl.ReadPreference.primary:Fl.ReadPreference.fromOptions(e)??Fl.ReadPreference.primary,this.bsonOptions=K7.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(ms.Aspect.RETRYABLE)&&this.hasAspect(ms.Aspect.READ_OPERATION)}get canRetryWrite(){return this.hasAspect(ms.Aspect.RETRYABLE)&&this.hasAspect(ms.Aspect.WRITE_OPERATION)}handleOk(e){return e.toObject(this.bsonOptions)}handleError(e){throw e}}ms.AbstractOperation=G7;function qX(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(em){Object.defineProperty(em,"__esModule",{value:!0});em.CommandOperation=void 0;var Y7=Tu(),Q7=X(),Xp=d3(),J7=fo(),ha=he(),Zp=hi(),Ti=vt();class X7 extends Ti.AbstractOperation{constructor(e,t){super(t);this.options=t??{};let r=t?.dbName||t?.authdb;if(r)this.ns=new ha.MongoDBNamespace(r,"$cmd");else this.ns=e?e.s.namespace.withCollection("$cmd"):new ha.MongoDBNamespace("admin","$cmd");if(this.readConcern=J7.ReadConcern.fromOptions(t),this.writeConcern=Zp.WriteConcern.fromOptions(t),this.hasAspect(Ti.Aspect.EXPLAINABLE))this.explain=Xp.Explain.fromOptions(t);else if(t?.explain!=null)throw new Q7.MongoInvalidArgumentError('Option "explain" is not supported on this command')}get canRetryWrite(){if(this.hasAspect(Ti.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&&ha.commandSupportsReadConcern(r)&&!n)Object.assign(r,{readConcern:this.readConcern});if(this.writeConcern&&this.hasAspect(Ti.Aspect.WRITE_OPERATION)&&!n)Zp.WriteConcern.apply(r,this.writeConcern);if(this.options.collation&&typeof this.options.collation==="object"&&!this.hasAspect(Ti.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(Ti.Aspect.SUPPORTS_RAW_DATA)&&ha.maxWireVersion(e)>=Y7.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION)r.rawData=this.options.rawData;if(this.hasAspect(Ti.Aspect.EXPLAINABLE)&&this.explain)return Xp.decorateWithExplain(r,this.explain);return r}}em.CommandOperation=X7});var g3=g(function(Pu){Object.defineProperty(Pu,"__esModule",{value:!0});Pu.DeleteManyOperation=Pu.DeleteOneOperation=Pu.DeleteOperation=void 0;Pu.makeDeleteStatement=y3;var Z7=ca(),e8=St(),fa=X(),t8=fr(),Nt=vt();class Ff extends t8.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=e8.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,i={delete:this.ns.collection,deletes:this.serializedOperations?Z7.makeDocumentSequence("deletes",this.statements,this.serializedOperations):this.statements,ordered:n};if(r.let)i.let=r.let;if(r.comment!==void 0)i.comment=r.comment;return i}}Pu.DeleteOperation=Ff;class p3 extends Ff{constructor(e,t,r){super(e,[y3(t,{...r,limit:1})],r)}handleOk(e){let t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new fa.MongoServerError(t);if(t.writeErrors)throw new fa.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,deletedCount:t.n}}}Pu.DeleteOneOperation=p3;class m3 extends Ff{constructor(e,t,r){super(e,[y3(t,r)],r)}handleOk(e){let t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new fa.MongoServerError(t);if(t.writeErrors)throw new fa.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,deletedCount:t.n}}}Pu.DeleteManyOperation=m3;function y3(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(Ff,[Nt.Aspect.RETRYABLE,Nt.Aspect.WRITE_OPERATION,Nt.Aspect.SUPPORTS_RAW_DATA]);Nt.defineAspects(p3,[Nt.Aspect.RETRYABLE,Nt.Aspect.WRITE_OPERATION,Nt.Aspect.EXPLAINABLE,Nt.Aspect.SKIP_COLLATION,Nt.Aspect.SUPPORTS_RAW_DATA]);Nt.defineAspects(m3,[Nt.Aspect.WRITE_OPERATION,Nt.Aspect.EXPLAINABLE,Nt.Aspect.SKIP_COLLATION,Nt.Aspect.SUPPORTS_RAW_DATA])});var Nl=g(function(mo){Object.defineProperty(mo,"__esModule",{value:!0});mo.DeprioritizedServers=mo.MIN_SECONDARY_WRITE_WIRE_VERSION=void 0;mo.writableServerSelector=LX;mo.sameServerSelector=UX;mo.secondaryWritableServerSelector=VX;mo.readPreferenceServerSelector=A3;var Ro=X(),nm=Xr(),nn=bi(),jX=1e4,r8=90;mo.MIN_SECONDARY_WRITE_WIRE_VERSION=13;class s8{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)}}mo.DeprioritizedServers=s8;function w3(e,t){let r=e.filter((n)=>!t.has(n));return r.length?r:e}function LX(){return function(t,r,n){let i=w3(r.filter(({isWritable:s})=>s),n);return Bu(t,i)}}function UX(e){return function(r,n,i){if(!e)return[];return n.filter((s)=>s.address===e.address&&s.type!==nn.ServerType.Unknown)}}function VX(e,t){if(!t||!e||e&&e<mo.MIN_SECONDARY_WRITE_WIRE_VERSION)return A3(nm.ReadPreference.primary);return A3(t)}function E3(e,t,r){if(e.maxStalenessSeconds==null||e.maxStalenessSeconds<0)return r;let n=e.maxStalenessSeconds,i=(t.heartbeatFrequencyMS+jX)/1000;if(n<i)throw new Ro.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${i} seconds`);if(n<r8)throw new Ro.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${r8} seconds`);if(t.type===nn.TopologyType.ReplicaSetWithPrimary){let s=Array.from(t.servers.values()).filter(rm)[0];return r.filter((o)=>{let a=(o.lastUpdateTime-o.lastWriteDate-(s.lastUpdateTime-s.lastWriteDate)+t.heartbeatFrequencyMS)/1000,c=e.maxStalenessSeconds??0;return a<=c})}if(t.type===nn.TopologyType.ReplicaSetNoPrimary){if(r.length===0)return r;let s=r.reduce((o,u)=>u.lastWriteDate>o.lastWriteDate?u:o);return r.filter((o)=>{let a=(s.lastWriteDate-o.lastWriteDate+t.heartbeatFrequencyMS)/1000,c=e.maxStalenessSeconds??0;return a<=c})}return r}function zX(e,t){return Object.entries(e).every(([r,n])=>t[r]!=null&&t[r]===n)}function _3({tags:e},t){if(e==null||e.length===0)return t;for(let r of e){let n=t.filter((i)=>zX(r,i.tags));if(n.length)return n}return[]}function Bu(e,t){let r=t.reduce((i,s)=>Math.min(s.roundTripTime,i),1/0),n=r+e.localThresholdMS;return t.filter((i)=>i.roundTripTime<=n&&i.roundTripTime>=r)}function rm(e){return e.type===nn.ServerType.RSPrimary}function n8(e){return e.type===nn.ServerType.RSSecondary}function WX(e){return e.type===nn.ServerType.RSSecondary||e.type===nn.ServerType.RSPrimary}function i8(e){return e.type!==nn.ServerType.Unknown}function HX(e){return e.type===nn.ServerType.LoadBalancer}function tm(e){return(t)=>!e.has(t)}function KX(e,t,r,n){let i=e.mode;switch(i){case"primary":return r.filter(rm);case"primaryPreferred":{let s=r.filter(rm),o=s.filter(tm(n));if(o.length)return o;let u=_3(e,E3(e,t,r.filter(n8))),a=u.filter(tm(n));if(a.length)return Bu(t,a);return s.length?s:Bu(t,u)}case"nearest":{let s=w3(_3(e,E3(e,t,r.filter(WX))),n);return Bu(t,s)}case"secondary":case"secondaryPreferred":{let s=_3(e,E3(e,t,r.filter(n8))),o=s.filter(tm(n));if(o.length)return Bu(t,o);if(i===nm.ReadPreference.SECONDARY_PREFERRED){let u=r.filter(rm),a=u.filter(tm(n));if(a.length)return a;return s.length?Bu(t,s):u}return Bu(t,s)}default:{let s=i;throw new Ro.MongoRuntimeError(`unexpected readPreference=${i} (should never happen). Please report a bug in the Node driver Jira project.`)}}}function A3(e){if(!e.isValid())throw new Ro.MongoInvalidArgumentError("Invalid read preference specified");return function(r,n,i){switch(r.type){case"Single":return Bu(r,n.filter(i8));case"ReplicaSetNoPrimary":case"ReplicaSetWithPrimary":return KX(e,r,n,i);case"Sharded":{let s=w3(n,i);return Bu(r,s.filter(i8))}case"Unknown":return[];case"LoadBalanced":return n.filter(HX);default:{let s=r.type;throw new Ro.MongoRuntimeError(`unexpected topology type: ${r.type} (this should never happen). Please file a bug in the Node driver Jira project.`)}}}}});var fi=g(function(ys){Object.defineProperty(ys,"__esModule",{value:!0});ys.LegacyTimeoutContext=ys.CSOTTimeoutContext=ys.TimeoutContext=ys.Timeout=ys.TimeoutError=void 0;var im=require("timers"),Mi=X(),Il=he();class sm 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"}}ys.TimeoutError=sm;class Ji 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,i=t?.rejection;if(r<0)throw new Mi.MongoInvalidArgumentError("Cannot create a Timeout with a negative duration");let s;super((o,u)=>{s=u,e(Il.noop,u)});if(this.ended=null,this.timedOut=!1,this.cleared=!1,this.duration=r,this.start=Math.trunc(performance.now()),i==null&&this.duration>0){if(this.id=im.setTimeout(()=>{this.ended=Math.trunc(performance.now()),this.timedOut=!0,s(new sm(`Expired after ${r}ms`,{duration:r}))},this.duration),typeof this.id.unref==="function"&&n)this.id.unref()}else if(i!=null)this.ended=Math.trunc(performance.now()),this.timedOut=!0,s(i)}clear(){im.clearTimeout(this.id),this.id=void 0,this.timedOut=!1,this.cleared=!0}throwIfExpired(){if(this.timedOut)throw this.then(void 0,Il.squashError),new sm("Timed out",{duration:this.duration})}static expires(e,t){return new Ji(void 0,{duration:e,unref:t})}static reject(e){return new Ji(void 0,{duration:0,unref:!0,rejection:e})}}ys.Timeout=Ji;function GX(e){return e!=null&&typeof e==="object"&&"serverSelectionTimeoutMS"in e&&typeof e.serverSelectionTimeoutMS==="number"&&"waitQueueTimeoutMS"in e&&typeof e.waitQueueTimeoutMS==="number"}class um{static create(e){if(e.session?.timeoutContext!=null)return e.session?.timeoutContext;if(GX(e))return new am(e);else throw new Mi.MongoRuntimeError("Unrecognized options")}}ys.TimeoutContext=um;class om extends um{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 Ji.reject(new Mi.MongoOperationTimeoutError(`Timed out in server selection after ${this.timeoutMS}ms`));if(t!==0&&Il.csotMin(e,t)===t)this._serverSelectionTimeout=Ji.expires(t);else if(e>0&&Number.isFinite(e))this._serverSelectionTimeout=Ji.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 Mi.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 Ji.expires(e);return Ji.reject(new Mi.MongoOperationTimeoutError("Timed out before socket write"))}get timeoutForSocketRead(){let{remainingTimeMS:e}=this;if(!Number.isFinite(e))return null;if(e>0)return Ji.expires(e);return Ji.reject(new Mi.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 Mi.MongoOperationTimeoutError(e??`Expired after ${this.timeoutMS}ms`);return t}clone(){let e=new om({timeoutMS:this.timeoutMS,serverSelectionTimeoutMS:this.serverSelectionTimeoutMS});return e.start=this.start,e}refreshed(){return new om(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}}ys.CSOTTimeoutContext=om;class am extends um{constructor(e){super();this.options=e,this.clearServerSelectionTimeout=!0}csotEnabled(){return!1}get serverSelectionTimeout(){if(this.options.serverSelectionTimeoutMS!=null&&this.options.serverSelectionTimeoutMS>0)return Ji.expires(this.options.serverSelectionTimeoutMS);return null}get connectionCheckoutTimeout(){if(this.options.waitQueueTimeoutMS!=null&&this.options.waitQueueTimeoutMS>0)return Ji.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 am(this.options)}addMaxTimeMSToCommand(e,t){}getSocketTimeoutMS(){return this.options.socketTimeoutMS}}ys.LegacyTimeoutContext=am});var Nf=g(function(Ic){Object.defineProperty(Ic,"__esModule",{value:!0});Ic.AggregateOperation=Ic.DB_AGGREGATE_COLLECTION=void 0;var $l=St(),o8=X(),u8=hi(),a8=fr(),gs=vt();Ic.DB_AGGREGATE_COLLECTION=1;class O3 extends a8.CommandOperation{constructor(e,t,r){super(void 0,{...r,dbName:e.db});if(this.SERVER_COMMAND_RESPONSE_TYPE=$l.CursorResponse,this.options={...r},this.target=e.collection||Ic.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 o8.MongoInvalidArgumentError("Cursor options must be an object");this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?$l.ExplainedCursorResponse:$l.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)u8.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}}Ic.AggregateOperation=O3;gs.defineAspects(O3,[gs.Aspect.READ_OPERATION,gs.Aspect.RETRYABLE,gs.Aspect.EXPLAINABLE,gs.Aspect.CURSOR_CREATING,gs.Aspect.SUPPORTS_RAW_DATA])});var xl=g(function(Rl){Object.defineProperty(Rl,"__esModule",{value:!0});Rl.RunCursorCommandOperation=Rl.RunCommandOperation=void 0;var cm=St(),c8=vt();class S3 extends c8.AbstractOperation{constructor(e,t,r){super(r);this.SERVER_COMMAND_RESPONSE_TYPE=cm.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}}}Rl.RunCommandOperation=S3;class l8 extends S3{constructor(){super(...arguments);this.SERVER_COMMAND_RESPONSE_TYPE=cm.CursorResponse}handleOk(e){return e}}Rl.RunCursorCommandOperation=l8});var sn=g(function(Fu){Object.defineProperty(Fu,"__esModule",{value:!0});Fu.BASE_BACKOFF_MS=void 0;Fu.executeOperation=QX;Fu.autoConnect=y8;Fu.calculateBaseBackoffMS=g8;var f8=require("timers/promises"),d8=Tu(),Ie=X(),lm=Xr(),p8=bi(),da=Nl(),m8=fi(),pa=he(),hm=Nf(),jr=vt(),fm=xl(),YX=Ie.MONGODB_ERROR_CODES.IllegalOperation,h8="This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.";async function QX(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 pa.abortable(y8(e),t.options):e.topology,i=t.session,s;if(i==null)s=Symbol(),i=e.startSession({owner:s,explicit:!1});else if(i.hasEnded)throw new Ie.MongoExpiredSessionError("Use of expired sessions is not permitted");else if(i.snapshotEnabled&&pa.maxWireVersion(n)<d8.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION)throw new Ie.MongoCompatibilityError("Snapshot reads require MongoDB 5.0 or later");else if(i.client!==e)throw new Ie.MongoInvalidArgumentError("ClientSession must be from the same MongoClient");t.session??=i;let o=t.readPreference??lm.ReadPreference.primary,u=!!i?.inTransaction(),a=t.hasAspect(jr.Aspect.READ_OPERATION);if(u&&!o.equals(lm.ReadPreference.primary)&&(a||t.commandName==="runCommand"))throw new Ie.MongoTransactionError(`Read preference in a transaction must be primary, not: ${o.mode}`);if(i?.isPinned&&i.transaction.isCommitted&&!t.bypassPinningCheck)i.unpin();r??=m8.TimeoutContext.create({session:i,serverSelectionTimeoutMS:e.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.s.options.waitQueueTimeoutMS,timeoutMS:t.options.timeoutMS});try{return await XX(t,{topology:n,timeoutContext:r,session:i,readPreference:o})}finally{if(i?.owner!=null&&i.owner===s)await i.endSession()}}async function y8(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}Fu.BASE_BACKOFF_MS=100;var JX=1e4;function g8(e){if(!(e instanceof Ie.MongoServerError))return Fu.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:Fu.BASE_BACKOFF_MS}async function XX(e,{topology:t,timeoutContext:r,session:n,readPreference:i}){let s;if(e.hasAspect(jr.Aspect.MUST_SELECT_SAME_SERVER))s=da.sameServerSelector(e.server?.description);else if(e instanceof hm.AggregateOperation&&e.hasWriteStage)s=da.secondaryWritableServerSelector(t.commonWireVersion,i);else s=i;let o=await t.selectServer(s,{session:n,operationName:e.commandName,timeoutContext:r,signal:e.options.signal,deprioritizedServers:new da.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&&pa.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 da.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 _=await o.command(e,r);return e.handleOk(_)}catch(_){return e.handleError(_)}}catch(_){if(!(_ instanceof Ie.MongoError))throw _;if(m==null)m=_;else if(!_.hasErrorLabel(Ie.MongoErrorLabel.NoWritesPerformed))m=_;if(r.clear(),a&&_.code===YX)throw new Ie.MongoServerError({message:h8,errmsg:h8,originalError:_});if(!E(e,_))throw m;if(_.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)){let O=t.s.options.maxAdaptiveRetries+1;p=Math.min(O,e.maxAttempts??O)}if(y+1>=p)throw m;if(_ instanceof Ie.MongoNetworkError&&e.hasAspect(jr.Aspect.CURSOR_CREATING)&&n!=null&&n.isPinned&&!n.inTransaction())n.unpin({force:!0,forceClear:!0});if(_.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&e.hasAspect(jr.Aspect.CURSOR_CREATING)&&n!=null&&n.isPinned&&!n.inTransaction())n.unpin({force:!0});if(_.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)){let O=g8(_),b=Math.random()*Math.min(JX,O*2**(y+1));if(r.csotEnabled()&&b>r.remainingTimeMS)throw m;await f8.setTimeout(b)}if(t.description.type===p8.TopologyType.Sharded||_.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&t.s.options.enableOverloadRetargeting)d.add(o.description);if(o=await t.selectServer(s,{session:n,operationName:e.commandName,deprioritizedServers:d,signal:e.options.signal}),a&&!pa.supportsRetryableWrites(o)&&!_.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 E(y,_){if(_.hasErrorLabel(Ie.MongoErrorLabel.SystemOverloadedError)&&_.hasErrorLabel(Ie.MongoErrorLabel.RetryableError)){if(y instanceof fm.RunCommandOperation)return t.s.options.retryReads&&t.s.options.retryWrites;if(y instanceof hm.AggregateOperation&&y.hasWriteStage)return t.s.options.retryWrites;let O=u&&t.s.options.retryReads,b=a&&t.s.options.retryWrites;return O||b}if(y instanceof fm.RunCommandOperation)return!1;if(y.hasAspect(jr.Aspect.COMMAND_BATCHING))return y.canRetryWrite&&Ie.isRetryableWriteError(_);return a&&f&&Ie.isRetryableWriteError(_)||u&&l&&Ie.isRetryableReadError(_)}}});var b3=g(function(vl){Object.defineProperty(vl,"__esModule",{value:!0});vl.InsertOneOperation=vl.InsertOperation=void 0;var E8=ca(),_8=St(),dm=X(),A8=he(),w8=fr(),jn=vt();class pm extends w8.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=_8.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,i={insert:this.ns.collection,documents:this.serializedOperations?E8.makeDocumentSequence("documents",this.documents,this.serializedOperations):this.documents,ordered:n};if(typeof r.bypassDocumentValidation==="boolean")i.bypassDocumentValidation=r.bypassDocumentValidation;if(r.comment!==void 0)i.comment=r.comment;return i}}vl.InsertOperation=pm;class C3 extends pm{constructor(e,t,r){super(e.s.namespace,[A8.maybeAddIdToDocuments(e,t,r)],r)}handleOk(e){let t=super.handleOk(e);if(t.code)throw new dm.MongoServerError(t);if(t.writeErrors)throw new dm.MongoServerError(t.writeErrors[0]);return{acknowledged:this.writeConcern?.w!==0,insertedId:this.documents[0]._id}}}vl.InsertOneOperation=C3;jn.defineAspects(pm,[jn.Aspect.RETRYABLE,jn.Aspect.WRITE_OPERATION,jn.Aspect.SUPPORTS_RAW_DATA]);jn.defineAspects(C3,[jn.Aspect.RETRYABLE,jn.Aspect.WRITE_OPERATION,jn.Aspect.SUPPORTS_RAW_DATA])});var ql=g(function(D3){Object.defineProperty(D3,"__esModule",{value:!0});D3.formatSort=cZ;var mm=X();function kl(e=1){let t=`${e}`.toLowerCase();if(ZX(e))return e;switch(t){case"ascending":case"asc":case"1":return 1;case"descending":case"desc":case"-1":return-1;default:throw new mm.MongoInvalidArgumentError(`Invalid sort direction: ${JSON.stringify(e)}`)}}function ZX(e){return typeof e==="object"&&e!=null&&"$meta"in e&&typeof e.$meta==="string"}function eZ(e){if(Array.isArray(e)&&e.length===2)try{return kl(e[1]),!0}catch{return!1}return!1}function tZ(e){return Array.isArray(e)&&Array.isArray(e[0])}function rZ(e){return e instanceof Map&&e.size>0}function nZ(e){return Array.isArray(e)}function iZ(e){return new Map([[`${e[0]}`,kl(e[1])]])}function sZ(e){let t=e.map(([r,n])=>[`${r}`,kl(n)]);return new Map(t)}function oZ(e){let t=e.map((r)=>[`${r}`,1]);return new Map(t)}function uZ(e){let t=Object.entries(e).map(([r,n])=>[`${r}`,kl(n)]);return new Map(t)}function aZ(e){let t=Array.from(e).map(([r,n])=>[`${r}`,kl(n)]);return new Map(t)}function cZ(e,t){if(e==null)return;if(typeof e==="string")return new Map([[e,kl(t)]]);if(typeof e!=="object")throw new mm.MongoInvalidArgumentError(`Invalid sort format: ${JSON.stringify(e)} Sort must be a valid object`);if(!nZ(e)){if(rZ(e))return aZ(e);if(Object.keys(e).length)return uZ(e);return}if(!e.length)return;if(tZ(e))return sZ(e);if(eZ(e))return iZ(e);return oZ(e)}});var B3=g(function(yo){Object.defineProperty(yo,"__esModule",{value:!0});yo.ReplaceOneOperation=yo.UpdateManyOperation=yo.UpdateOneOperation=yo.UpdateOperation=void 0;yo.makeUpdateStatement=ym;var O8=ca(),S8=St(),gr=X(),C8=ql(),jl=he(),b8=fr(),Ue=vt();class Ll extends b8.CommandOperation{constructor(e,t,r,n){super(void 0,r);this.SERVER_COMMAND_RESPONSE_TYPE=S8.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?O8.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}}yo.UpdateOperation=Ll;class T3 extends Ll{constructor(e,t,r,n){super(e,[ym(t,r,{...n,multi:!1})],n);if(!jl.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}}}yo.UpdateOneOperation=T3;class M3 extends Ll{constructor(e,t,r,n){super(e,[ym(t,r,{...n,multi:!0})],n);if(!jl.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}}}yo.UpdateManyOperation=M3;class P3 extends Ll{constructor(e,t,r,n){super(e,[ym(t,r,{...n,multi:!1})],n);if(jl.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}}}yo.ReplaceOneOperation=P3;function ym(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=C8.formatSort(r.sort);return n}Ue.defineAspects(Ll,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(T3,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.EXPLAINABLE,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(M3,[Ue.Aspect.WRITE_OPERATION,Ue.Aspect.EXPLAINABLE,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA]);Ue.defineAspects(P3,[Ue.Aspect.RETRYABLE,Ue.Aspect.WRITE_OPERATION,Ue.Aspect.SKIP_COLLATION,Ue.Aspect.SUPPORTS_RAW_DATA])});var Vl=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=F3;var _m=Te(),Je=X(),xo=g3(),T8=sn(),M8=b3(),Pi=B3(),P8=fi(),Lr=he(),gm=hi();ht.BatchType=Object.freeze({INSERT:1,UPDATE:2,DELETE:3});class B8{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=B8;class Nu{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=Nu.generateIdMap(this.result.upserted),this.insertedIds=Nu.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 $f({errmsg:e,code:Je.MONGODB_ERROR_CODES.WriteConcernTimeout})}}toString(){return`BulkWriteResult(${_m.EJSON.stringify(this.result)})`}isOk(){return this.result.ok===1}}ht.BulkWriteResult=Nu;class $f{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=$f;class Em{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=Em;function F3(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 s={index:0,code:n.code||0,errmsg:n.message,errInfo:n.errInfo,op:e.operations[0]};t.writeErrors.push(new Em(s));return}else if(n.ok===0&&t.ok===0)return;if(N8(e)&&n.n)t.nInserted=t.nInserted+n.n;if(I3(e)&&n.n)t.nRemoved=t.nRemoved+n.n;let i=0;if(Array.isArray(n.upserted)){i=n.upserted.length;for(let s=0;s<n.upserted.length;s++)t.upserted.push({index:n.upserted[s].index+e.originalZeroIndex,_id:n.upserted[s]._id})}else if(n.upserted)i=1,t.upserted.push({index:e.originalZeroIndex,_id:n.upserted});if(N3(e)&&n.n){let s=n.nModified;if(t.nUpserted=t.nUpserted+i,t.nMatched=t.nMatched+(n.n-i),typeof s==="number")t.nModified=t.nModified+s;else t.nModified=0}if(Array.isArray(n.writeErrors))for(let s=0;s<n.writeErrors.length;s++){let o={index:e.originalIndexes[n.writeErrors[s].index],code:n.writeErrors[s].code,errmsg:n.writeErrors[s].errmsg,errInfo:n.writeErrors[s].errInfo,op:e.operations[n.writeErrors[s].index]};t.writeErrors.push(new Em(o))}if(n.writeConcernError)t.writeConcernErrors.push(new $f(n.writeConcernError))}async function D8(e,t){if(e.s.batches.length===0)return new Nu(e.s.bulkResult,e.isOrdered);for(let n of e.s.batches){let i=Lr.resolveOptions(e,{...t,ordered:e.isOrdered});if(i.bypassDocumentValidation!==!0)delete i.bypassDocumentValidation;if(e.s.bypassDocumentValidation===!0)i.bypassDocumentValidation=!0;if(e.s.checkKeys===!1)i.checkKeys=!1;if(e.retryWrites){if(N3(n))e.retryWrites=e.retryWrites&&!n.operations.some((h)=>h.multi);if(I3(n))e.retryWrites=e.retryWrites&&!n.operations.some((h)=>h.limit===0)}let s=e.s.bsonOptions,u=!e.s.usingAutoEncryption&&i.ignoreUndefined===s.ignoreUndefined&&i.serializeFunctions===s.serializeFunctions&&(i.checkKeys??!1)===e.s.checkKeys?n.serializedOperations:void 0,a=N8(n)?new M8.InsertOperation(e.s.namespace,n.operations,i,u):N3(n)?new Pi.UpdateOperation(e.s.namespace,n.operations,i,u):I3(n)?new xo.DeleteOperation(e.s.namespace,n.operations,i,u):null;if(a==null)throw new Je.MongoRuntimeError(`Unknown batchType: ${n.batchType}`);let c=null,l;try{l=await T8.executeOperation(e.s.collection.client,a,i.timeoutContext)}catch(h){c=h}if(n.serializedOperations=[],c!=null)if(c instanceof Je.MongoWriteConcernError){F3(n,e.s.bulkResult,c,l);let h=new Nu(e.s.bulkResult,e.isOrdered);throw new Ul({message:c.result.writeConcernError.errmsg,code:c.result.writeConcernError.code},h)}else throw new Ul(c,new Nu(e.s.bulkResult,e.isOrdered));F3(n,e.s.bulkResult,c,l);let f=new Nu(e.s.bulkResult,e.isOrdered);e.handleWriteError(f)}e.s.batches.length=0;let r=new Nu(e.s.bulkResult,e.isOrdered);return e.handleWriteError(r),r}class Ul extends Je.MongoServerError{constructor(e,t){super(e);if(this.writeErrors=[],e instanceof $f)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=Ul;class $3{constructor(e){this.bulkOperation=e}update(e){let t=If(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Pi.makeUpdateStatement(t.selector,e,{...t,multi:!0}))}updateOne(e){if(!Lr.hasAtomicOperators(e,this.bulkOperation.bsonOptions))throw new Je.MongoInvalidArgumentError("Update document requires atomic operators");let t=If(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Pi.makeUpdateStatement(t.selector,e,{...t,multi:!1}))}replaceOne(e){if(Lr.hasAtomicOperators(e))throw new Je.MongoInvalidArgumentError("Replacement document must not use atomic operators");let t=If(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.UPDATE,Pi.makeUpdateStatement(t.selector,e,{...t,multi:!1}))}deleteOne(){let e=If(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.DELETE,xo.makeDeleteStatement(e.selector,{...e,limit:1}))}delete(){let e=If(this.bulkOperation);return this.bulkOperation.addToOperationsList(ht.BatchType.DELETE,xo.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=$3;class F8{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 i=e.s.namespace,s=!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:gm.WriteConcern.fromOptions(t),maxBsonObjectSize:c,maxBatchSizeBytes:l,maxWriteBatchSize:f,maxKeySize:h,namespace:i,topology:n,options:t,bsonOptions:_m.resolveBSONOptions(t),currentOp:o,executed:s,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 Je.MongoInvalidArgumentError("Bulk find operation must specify a selector");return this.s.currentOp={selector:e},new $3(this)}raw(e){if(e==null||typeof e!=="object")throw new Je.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 Je.MongoInvalidArgumentError("Raw operations are not allowed");let t=Pi.makeUpdateStatement(e.replaceOne.filter,e.replaceOne.replacement,{...e.replaceOne,multi:!1});if(Lr.hasAtomicOperators(t.u))throw new Je.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 Je.MongoInvalidArgumentError("Raw operations are not allowed");let t=Pi.makeUpdateStatement(e.updateOne.filter,e.updateOne.update,{...e.updateOne,multi:!1});if(!Lr.hasAtomicOperators(t.u,this.bsonOptions))throw new Je.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(ht.BatchType.UPDATE,t)}if("updateMany"in e){if("q"in e.updateMany)throw new Je.MongoInvalidArgumentError("Raw operations are not allowed");let t=Pi.makeUpdateStatement(e.updateMany.filter,e.updateMany.update,{...e.updateMany,multi:!0});if(!Lr.hasAtomicOperators(t.u,this.bsonOptions))throw new Je.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(ht.BatchType.UPDATE,t)}}if("deleteOne"in e){if("q"in e.deleteOne)throw new Je.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(ht.BatchType.DELETE,xo.makeDeleteStatement(e.deleteOne.filter,{...e.deleteOne,limit:1}))}if("deleteMany"in e){if("q"in e.deleteMany)throw new Je.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(ht.BatchType.DELETE,xo.makeDeleteStatement(e.deleteMany.filter,{...e.deleteMany,limit:0}))}throw new Je.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 Je.MongoBatchReExecutionError;let t=gm.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 Je.MongoInvalidArgumentError("Invalid BulkOperation, Batch cannot be empty");this.s.executed=!0;let r=Lr.resolveOptions(this.collection,{...this.s.options,...e});if(r.timeoutContext??=P8.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 D8(this,{...r,session:n}));return await D8(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 Ul({message:r,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors},e)}let t=e.getWriteConcernError();if(t)throw new Ul(t,e)}shouldForceServerObjectId(){return this.s.options.forceServerObjectId===!0||this.s.collection.db.options?.forceServerObjectId===!0}}ht.BulkOperationBase=F8;function N8(e){return e.batchType===ht.BatchType.INSERT}function N3(e){return e.batchType===ht.BatchType.UPDATE}function I3(e){return e.batchType===ht.BatchType.DELETE}function If(e){let{currentOp:t}=e.s;if(e.s.currentOp=void 0,!t)t={};return t}});var $8=g(function(fye,I8){var lZ=Vl().BulkWriteResult;I8.exports=lZ});var ma=g(function(dye,R8){/*!
|
|
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 hZ=typeof process<"u"&&typeof process.nextTick==="function"?process.nextTick.bind(process):(e)=>setTimeout(e,0);R8.exports=function(t){return hZ(t)}});var R3=g(function(pye,v8){/*!
|
|
13
|
+
* Module dependencies.
|
|
14
|
+
*/var fZ=require("events").EventEmitter,x8=ma();function xt(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 fZ,t?._hasOpened)this.onOpen()}xt.prototype.name;xt.prototype.collectionName;xt.prototype.conn;xt.prototype.onOpen=function(){this.buffer=!1,x8(()=>this.doQueue())};xt.prototype.onClose=function(){};xt.prototype.addQueue=function(e,t){return this.queue.push([e,t]),this};xt.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};xt.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 x8(function(){e.emitter.emit("queue")}),this};xt.prototype.ensureIndex=function(){throw Error("Collection#ensureIndex unimplemented by driver")};xt.prototype.createIndex=function(){throw Error("Collection#createIndex unimplemented by driver")};xt.prototype.findAndModify=function(){throw Error("Collection#findAndModify unimplemented by driver")};xt.prototype.findOneAndUpdate=function(){throw Error("Collection#findOneAndUpdate unimplemented by driver")};xt.prototype.findOneAndDelete=function(){throw Error("Collection#findOneAndDelete unimplemented by driver")};xt.prototype.findOneAndReplace=function(){throw Error("Collection#findOneAndReplace unimplemented by driver")};xt.prototype.findOne=function(){throw Error("Collection#findOne unimplemented by driver")};xt.prototype.find=function(){throw Error("Collection#find unimplemented by driver")};xt.prototype.insert=function(){throw Error("Collection#insert unimplemented by driver")};xt.prototype.insertOne=function(){throw Error("Collection#insertOne unimplemented by driver")};xt.prototype.insertMany=function(){throw Error("Collection#insertMany unimplemented by driver")};xt.prototype.save=function(){throw Error("Collection#save unimplemented by driver")};xt.prototype.updateOne=function(){throw Error("Collection#updateOne unimplemented by driver")};xt.prototype.updateMany=function(){throw Error("Collection#updateMany unimplemented by driver")};xt.prototype.deleteOne=function(){throw Error("Collection#deleteOne unimplemented by driver")};xt.prototype.deleteMany=function(){throw Error("Collection#deleteMany unimplemented by driver")};xt.prototype.getIndexes=function(){throw Error("Collection#getIndexes unimplemented by driver")};xt.prototype.watch=function(){throw Error("Collection#watch unimplemented by driver")};/*!
|
|
15
|
+
* ignore
|
|
16
|
+
*/xt.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
|
+
*/xt.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
|
+
*/v8.exports=xt});var ze=g(function(mye,k8){/*!
|
|
21
|
+
* ignore
|
|
22
|
+
*/class x3 extends Error{}Object.defineProperty(x3.prototype,"name",{value:"MongooseError"});k8.exports=x3});var U8=g(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});Am.ListDatabasesOperation=void 0;var q8=St(),j8=he(),L8=fr(),zl=vt();class v3 extends L8.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=q8.MongoDBResponse,this.options=t??{},this.ns=new j8.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}}Am.ListDatabasesOperation=v3;zl.defineAspects(v3,[zl.Aspect.READ_OPERATION,zl.Aspect.RETRYABLE])});var q3=g(function(Om){Object.defineProperty(Om,"__esModule",{value:!0});Om.RemoveUserOperation=void 0;var V8=St(),z8=fr(),wm=vt();class k3 extends z8.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=V8.MongoDBResponse,this.options=r,this.username=t}get commandName(){return"dropUser"}buildCommandDocument(e){return{dropUser:this.username}}handleOk(e){return!0}}Om.RemoveUserOperation=k3;wm.defineAspects(k3,[wm.Aspect.WRITE_OPERATION])});var G8=g(function(Sm){Object.defineProperty(Sm,"__esModule",{value:!0});Sm.ValidateCollectionOperation=void 0;var W8=St(),Wl=X(),H8=fr();class K8 extends H8.CommandOperation{constructor(e,t,r){super(e.s.db,r);this.SERVER_COMMAND_RESPONSE_TYPE=W8.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 Wl.MongoUnexpectedServerResponseError("Error with validation data");if(t.result!=null&&t.result.match(/exception|corrupt/)!=null)throw new Wl.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);if(t.valid!=null&&!t.valid)throw new Wl.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);return e}}Sm.ValidateCollectionOperation=K8});var j3=g(function(Cm){Object.defineProperty(Cm,"__esModule",{value:!0});Cm.Admin=void 0;var Y8=Te(),ya=sn(),Q8=U8(),J8=q3(),X8=xl(),Z8=G8(),e5=he();class t5{constructor(e){this.s={db:e}}async command(e,t){return await ya.executeOperation(this.s.db.client,new X8.RunCommandOperation(new e5.MongoDBNamespace("admin"),e,{...Y8.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 ya.executeOperation(this.s.db.client,new J8.RemoveUserOperation(this.s.db,e,{dbName:"admin",...t}))}async validateCollection(e,t={}){return await ya.executeOperation(this.s.db.client,new Z8.ValidateCollectionOperation(this,e,t))}async listDatabases(e){return await ya.executeOperation(this.s.db.client,new Q8.ListDatabasesOperation(this.s.db,{timeoutMS:this.s.db.timeoutMS,...e}))}async replSetGetStatus(e){return await this.command({replSetGetStatus:1},e)}}Cm.Admin=t5});var L3=g(function(Tm){Object.defineProperty(Tm,"__esModule",{value:!0});Tm.OrderedBulkOperation=void 0;var bm=Te(),Dm=X(),ga=Vl();class r5 extends ga.BulkOperationBase{constructor(e,t){super(e,t,!0)}addToOperationsList(e,t){let r,n;if(this.s.usingAutoEncryption)n=bm.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});else{let s=this.s.bsonOptions;r=bm.serialize(t,{checkKeys:this.s.checkKeys,ignoreUndefined:s.ignoreUndefined,serializeFunctions:s.serializeFunctions}),n=r.length}if(n>=this.s.maxBsonObjectSize)throw new Dm.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);if(this.s.currentBatch==null)this.s.currentBatch=new ga.Batch(e,this.s.currentIndex);let i=this.s.maxKeySize;if(this.s.currentBatchSize+1>=this.s.maxWriteBatchSize||this.s.currentBatchSize>0&&this.s.currentBatchSizeBytes+i+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new ga.Batch(e,this.s.currentIndex),this.s.currentBatchSize=0,this.s.currentBatchSizeBytes=0;if(e===ga.BatchType.INSERT)this.s.bulkResult.insertedIds.push({index:this.s.currentIndex,_id:t._id});if(Array.isArray(t))throw new Dm.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+=i+n,this.s.currentIndex+=1,this}}Tm.OrderedBulkOperation=r5});var U3=g(function(Bm){Object.defineProperty(Bm,"__esModule",{value:!0});Bm.UnorderedBulkOperation=void 0;var Mm=Te(),Pm=X(),on=Vl();class n5 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=Mm.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});else{let s=this.s.bsonOptions;r=Mm.serialize(t,{checkKeys:this.s.checkKeys,ignoreUndefined:s.ignoreUndefined,serializeFunctions:s.serializeFunctions}),n=r.length}if(n>=this.s.maxBsonObjectSize)throw new Pm.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 i=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+i+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 Pm.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+=i+n,this}}Bm.UnorderedBulkOperation=n5});var Aa=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=W3;Ye.createStdioLogger=$c;Ye.stringifyWithMaxLen=_a;Ye.defaultLogTransform=o5;var Es=require("process"),i5=require("util"),Nm=Te(),Me=Br(),Bi=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 s5 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 s5([[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 W3(e){let t=Object.values(Ye.SeverityLevel),r=e?.toLowerCase();if(r!=null&&t.includes(r))return r;return null}function $c(e){return{write:(t)=>new Promise((r,n)=>{let i=i5.inspect(t,{compact:!0,breakLength:1/0});e.write(`${i}
|
|
23
|
+
`,"utf-8",(s)=>{if(s)return n(s);r(!0)})})}}function dZ({MONGODB_LOG_PATH:e},{mongodbLogPath:t}){if(typeof t==="string"&&/^stderr$/i.test(t))return{mongodbLogPath:$c(Es.stderr),mongodbLogPathIsStdErr:!0};if(typeof t==="string"&&/^stdout$/i.test(t))return{mongodbLogPath:$c(Es.stdout),mongodbLogPathIsStdErr:!1};if(typeof t==="object"&&typeof t?.write==="function")return{mongodbLogPath:t,mongodbLogPathIsStdErr:!1};if(e&&/^stderr$/i.test(e))return{mongodbLogPath:$c(Es.stderr),mongodbLogPathIsStdErr:!0};if(e&&/^stdout$/i.test(e))return{mongodbLogPath:$c(Es.stdout),mongodbLogPathIsStdErr:!1};return{mongodbLogPath:$c(Es.stderr),mongodbLogPathIsStdErr:!0}}function Hl(e,t,r){return W3(e)??W3(t)??r}function pZ(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 _a(e,t,r={}){let n="",i=0,s=function(u,a){if(i>=t)return;if(u==="")return i+=1,a;if(i+=u.length+4,a==null)return a;switch(typeof a){case"string":i+=a.length+2;break;case"number":case"bigint":i+=String(a).length;break;case"boolean":i+=a?4:5;break;case"object":if(Bi.isUint8Array(a))i+=22+a.byteLength+a.byteLength*0.33+18|0;else if("_bsontype"in a){let c=a;switch(c._bsontype){case"Int32":i+=String(c.value).length;break;case"Double":i+=(c.value|0)===c.value?String(c.value).length+2:String(c.value).length;break;case"Long":i+=c.toString().length;break;case"ObjectId":i+=35;break;case"MaxKey":case"MinKey":i+=13;break;case"Binary":i+=22+a.position+a.position*0.33+18|0;break;case"Timestamp":i+=19+String(c.t).length+5+String(c.i).length+2;break;case"Code":if(c.scope==null)i+=c.code.length+10+2;else i+=c.code.length+10+11;break;case"BSONRegExp":i+=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=Nm.EJSON.stringify(e,s,0,r);else n=Nm.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 mZ(e){let t=e;return t.toLog!==void 0&&typeof t.toLog==="function"}function Fm(e,t,r=Ye.DEFAULT_MAX_DOCUMENT_LENGTH){let{selector:n,operation:i,topologyDescription:s,message:o}=t;return e.selector=_a(n,r),e.operation=i,e.topologyDescription=_a(s,r),e.message=o,e}function V3(e,t){e.commandName=t.commandName,e.requestId=t.requestId,e.driverConnectionId=t.connectionId;let{host:r,port:n}=Bi.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 Xi(e,t){let{host:r,port:n}=Bi.HostAddress.fromString(t.address).toHostPort();return e.serverHost=r,e.serverPort=n,e}function Ea(e,t){return e.topologyId=t.topologyId,e}function z3(e,t){let{awaited:r,connectionId:n}=t;e.awaited=r,e.driverConnectionId=t.connectionId;let{host:i,port:s}=Bi.HostAddress.fromString(n).toHostPort();return e.serverHost=i,e.serverPort=s,e}function o5(e,t=Ye.DEFAULT_MAX_DOCUMENT_LENGTH){let r=Object.create(null);switch(e.name){case Me.SERVER_SELECTION_STARTED:return r=Fm(r,e,t),r;case Me.SERVER_SELECTION_FAILED:return r=Fm(r,e,t),r.failure=e.failure?.message,r;case Me.SERVER_SELECTION_SUCCEEDED:return r=Fm(r,e,t),r.serverHost=e.serverHost,r.serverPort=e.serverPort,r;case Me.WAITING_FOR_SUITABLE_SERVER:return r=Fm(r,e,t),r.remainingTimeMS=e.remainingTimeMS,r;case Me.COMMAND_STARTED:return r=V3(r,e),r.message="Command started",r.command=_a(e.command,t,{relaxed:!0}),r.databaseName=e.databaseName,r;case Me.COMMAND_SUCCEEDED:return r=V3(r,e),r.message="Command succeeded",r.durationMS=e.duration,r.reply=_a(e.reply,t,{relaxed:!0}),r;case Me.COMMAND_FAILED:return r=V3(r,e),r.message="Command failed",r.durationMS=e.duration,r.failure=e.failure?.message??"(redacted)",r;case Me.CONNECTION_POOL_CREATED:if(r=Xi(r,e),r.message="Connection pool created",e.options){let{maxIdleTimeMS:n,minPoolSize:i,maxPoolSize:s,maxConnecting:o,waitQueueTimeoutMS:u}=e.options;r={...r,maxIdleTimeMS:n,minPoolSize:i,maxPoolSize:s,maxConnecting:o,waitQueueTimeoutMS:u}}return r;case Me.CONNECTION_POOL_READY:return r=Xi(r,e),r.message="Connection pool ready",r;case Me.CONNECTION_POOL_CLEARED:if(r=Xi(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=Xi(r,e),r.message="Connection pool closed",r;case Me.CONNECTION_CREATED:return r=Xi(r,e),r.message="Connection created",r.driverConnectionId=e.connectionId,r;case Me.CONNECTION_READY:return r=Xi(r,e),r.message="Connection ready",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case Me.CONNECTION_CLOSED:switch(r=Xi(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=Xi(r,e),r.message="Connection checkout started",r;case Me.CONNECTION_CHECK_OUT_FAILED:switch(r=Xi(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=Xi(r,e),r.message="Connection checked out",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case Me.CONNECTION_CHECKED_IN:return r=Xi(r,e),r.message="Connection checked in",r.driverConnectionId=e.connectionId,r;case Me.SERVER_OPENING:return r=Ea(r,e),r=Xi(r,e),r.message="Starting server monitoring",r;case Me.SERVER_CLOSED:return r=Ea(r,e),r=Xi(r,e),r.message="Stopped server monitoring",r;case Me.SERVER_HEARTBEAT_STARTED:return r=Ea(r,e),r=z3(r,e),r.message="Server heartbeat started",r;case Me.SERVER_HEARTBEAT_SUCCEEDED:return r=Ea(r,e),r=z3(r,e),r.message="Server heartbeat succeeded",r.durationMS=e.duration,r.serverConnectionId=e.serverConnectionId,r.reply=_a(e.reply,t,{relaxed:!0}),r;case Me.SERVER_HEARTBEAT_FAILED:return r=Ea(r,e),r=z3(r,e),r.message="Server heartbeat failed",r.durationMS=e.duration,r.failure=e.failure?.message,r;case Me.TOPOLOGY_OPENING:return r=Ea(r,e),r.message="Starting topology monitoring",r;case Me.TOPOLOGY_CLOSED:return r=Ea(r,e),r.message="Stopped topology monitoring",r;case Me.TOPOLOGY_DESCRIPTION_CHANGED:return r=Ea(r,e),r.message="Topology description changed",r.previousDescription=r.reply=_a(e.previousDescription,t),r.newDescription=r.reply=_a(e.newDescription,t),r;default:for(let[n,i]of Object.entries(e))if(i!=null)r[n]=i}return r}class u5{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]=pZ(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=$c(Es.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(mZ(r))n={...n,...r.toLog()};else n={...n,...o5(r,this.maxDocumentLength)};if(Bi.isPromiseLike(this.pendingLog)){this.pendingLog=this.pendingLog.then(()=>this.logDestination.write(n)).then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this));return}try{let i=this.logDestination.write(n);if(Bi.isPromiseLike(i))this.pendingLog=i.then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this))}catch(i){this.logWriteFailureHandler(i)}}static resolveOptions(e,t){let r=dZ(e,t),n={...e,...t,mongodbLogPath:r.mongodbLogPath,mongodbLogPathIsStdErr:r.mongodbLogPathIsStdErr},i=Hl(n.mongodbLogComponentSeverities?.default,n.MONGODB_LOG_ALL,Ye.SeverityLevel.OFF);return{componentSeverities:{command:Hl(n.mongodbLogComponentSeverities?.command,n.MONGODB_LOG_COMMAND,i),topology:Hl(n.mongodbLogComponentSeverities?.topology,n.MONGODB_LOG_TOPOLOGY,i),serverSelection:Hl(n.mongodbLogComponentSeverities?.serverSelection,n.MONGODB_LOG_SERVER_SELECTION,i),connection:Hl(n.mongodbLogComponentSeverities?.connection,n.MONGODB_LOG_CONNECTION,i),client:Hl(n.mongodbLogComponentSeverities?.client,n.MONGODB_LOG_CLIENT,i),default:i},maxDocumentLength:n.mongodbLogMaxDocumentLength??Bi.parseUnsignedInteger(n.MONGODB_LOG_MAX_DOCUMENT_LENGTH)??1000,logDestination:n.mongodbLogPath,logDestinationIsStdErr:n.mongodbLogPathIsStdErr}}}Ye.MongoLogger=u5});var Zi=g(function(Kl){Object.defineProperty(Kl,"__esModule",{value:!0});Kl.CancellationToken=Kl.TypedEventEmitter=void 0;var a5=require("events"),c5=Aa(),l5=he();class H3 extends a5.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 i={topologyId:t,serverConnectionId:r??null,...n[0]};this.mongoLogger?.debug(this.component,i)}}emitAndLogCommand(e,t,r,n,...i){if(e)this.emit(t,...i);if(n){let s={databaseName:r,...i[0]};this.mongoLogger?.debug(c5.MongoLoggableComponent.COMMAND,s)}}}Kl.TypedEventEmitter=H3;class h5 extends H3{constructor(...e){super(...e);this.on("error",l5.noop)}}Kl.CancellationToken=h5});var G3=g(function($m){Object.defineProperty($m,"__esModule",{value:!0});$m.GetMoreOperation=void 0;var f5=St(),Im=X(),wa=vt();class K3 extends wa.AbstractOperation{constructor(e,t,r,n){super(n);this.SERVER_COMMAND_RESPONSE_TYPE=f5.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 Im.MongoRuntimeError("Unable to iterate cursor with no id");let t=this.ns.collection;if(t==null)throw new Im.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}}$m.GetMoreOperation=K3;wa.defineAspects(K3,[wa.Aspect.READ_OPERATION,wa.Aspect.MUST_SELECT_SAME_SERVER])});var m5=g(function(Rm){Object.defineProperty(Rm,"__esModule",{value:!0});Rm.KillCursorsOperation=void 0;var d5=St(),p5=X(),Gl=vt();class Y3 extends Gl.AbstractOperation{constructor(e,t,r,n){super(n);this.SERVER_COMMAND_RESPONSE_TYPE=d5.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 p5.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){}}Rm.KillCursorsOperation=Y3;Gl.defineAspects(Y3,[Gl.Aspect.MUST_SELECT_SAME_SERVER])});var Q3=g(function(xm){Object.defineProperty(xm,"__esModule",{value:!0});xm.ConnectionPoolMetrics=void 0;class Yl{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===Yl.TXN)this.txnConnections+=1;else if(e===Yl.CURSOR)this.cursorConnections+=1;else this.otherConnections+=1}markUnpinned(e){if(e===Yl.TXN)this.txnConnections-=1;else if(e===Yl.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}}xm.ConnectionPoolMetrics=Yl});var J3=g(function(We){Object.defineProperty(We,"__esModule",{value:!0});We.Transaction=We.TxnState=void 0;We.isTransactionCommand=_Z;var vm=X(),y5=fo(),g5=Xr(),E5=hi();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 yZ={[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]},gZ=new Set([We.TxnState.STARTING_TRANSACTION,We.TxnState.TRANSACTION_IN_PROGRESS]),EZ=new Set([We.TxnState.TRANSACTION_COMMITTED,We.TxnState.TRANSACTION_COMMITTED_EMPTY,We.TxnState.TRANSACTION_ABORTED]);class _5{constructor(e){e=e??{},this.state=We.TxnState.NO_TRANSACTION,this.options={};let t=E5.WriteConcern.fromOptions(e);if(t){if(t.w===0)throw new vm.MongoTransactionError("Transactions do not support unacknowledged write concern");this.options.writeConcern=t}if(e.readConcern)this.options.readConcern=y5.ReadConcern.fromOptions(e);if(e.readPreference)this.options.readPreference=g5.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 gZ.has(this.state)}get isCommitted(){return EZ.has(this.state)}transition(e){let t=yZ[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 vm.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=_5;function _Z(e){return!!(e.commitTransaction||e.abortTransaction)}});var Rf=g(function(go){Object.defineProperty(go,"__esModule",{value:!0});go.ServerSessionPool=go.ServerSession=go.ClientSession=void 0;go.maybeClearPinnedConnection=km;go.applySession=wZ;go.updateSessionFromResponse=OZ;var O5=require("timers/promises"),As=Te(),Sa=Q3(),qm=Br(),V=X(),S5=Zi(),Oa=sn(),Ql=xl(),C5=fo(),Jl=Xr(),Xl=bi(),pe=J3(),Ct=he(),_s=hi();class Z3 extends S5.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 e6))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 i=this.explicit&&r.snapshot!==!0;this.supports={causalConsistency:r.causalConsistency??i},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===Xl.TopologyType.LoadBalanced}pin(e){if(this.pinnedConnection)throw TypeError("Cannot pin multiple connections to the same session");this.pinnedConnection=e,e.emit(qm.PINNED,this.inTransaction()?Sa.ConnectionPoolMetrics.TXN:Sa.ConnectionPoolMetrics.CURSOR)}unpin(e){if(this.loadBalanced)return km(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 Lm(t);this.hasEnded=!0,this.emit("ended",this)}km(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');Xl._advanceClusterTime(this,e)}equals(e){if(!(e instanceof Z3))return!1;if(this.id==null||e.id==null)return!1;return As.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)_s.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...r});else{let i=Object.keys(r);if(i.length>2||!i.includes("wtimeoutMS")&&!i.includes("wTimeoutMS"))_s.WriteConcern.apply(t,{...r,wtimeoutMS:void 0})}if(this.transaction.state===pe.TxnState.TRANSACTION_COMMITTED||this.commitAttempted)if(this.timeoutContext==null)_s.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"});else _s.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 Ql.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Jl.ReadPreference.primary,bypassPinningCheck:!0});n.maxAttempts=this.clientOptions.maxAdaptiveRetries+1;try{await Oa.executeOperation(this.client,n),this.commitAttempted=void 0;return}catch(i){this.commitAttempted=!0;let s=this.clientOptions.maxAdaptiveRetries+1-n.attemptsMade;if(s<=0)throw i;if(i instanceof V.MongoError&&V.isRetryableWriteError(i)){_s.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"}),this.unpin({force:!0});try{let o=new Ql.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Jl.ReadPreference.primary,bypassPinningCheck:!0});o.maxAttempts=s,await Oa.executeOperation(this.client,o);return}catch(o){if(w5(o))o.addErrorLabel(V.MongoErrorLabel.UnknownTransactionCommitResult);if(A5(o))this.unpin({error:o});throw o}}if(w5(i))i.addErrorLabel(V.MongoErrorLabel.UnknownTransactionCommitResult);if(A5(i))this.unpin({error:i});throw i}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)_s.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...r});if(this.transaction.recoveryToken)t.recoveryToken=this.transaction.recoveryToken;let n=new Ql.RunCommandOperation(new Ct.MongoDBNamespace("admin"),t,{session:this,readPreference:Jl.ReadPreference.primary,bypassPinningCheck:!0});try{await Oa.executeOperation(this.client,n),this.unpin();return}catch(i){if(this.unpin(),i.name==="MongoRuntimeError")throw i;if(e?.throwTimeout&&i.name==="MongoOperationTimeoutError")throw i;if(i instanceof V.MongoError&&V.isRetryableWriteError(i))try{await Oa.executeOperation(this.client,n);return}catch(s){if(s.name==="MongoRuntimeError")throw s;if(e?.throwTimeout&&s.name==="MongoOperationTimeoutError")throw s}}finally{if(this.transaction.transition(pe.TxnState.TRANSACTION_ABORTED),this.loadBalanced)km(this,{force:!1})}}toBSON(){throw new V.MongoRuntimeError("ClientSession cannot be serialized to BSON.")}async withTransaction(e,t){let n=!!this.timeoutContext?.csotEnabled(),i=this.timeoutContext?.csotEnabled()?this.timeoutContext.remainingTimeMS:120000,s=Ct.processTimeMS()+i,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>=s)throw X3(a??new V.MongoRuntimeError("Transaction retry did not record an error: should never occur. Please file a bug."),n);await O5.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()>=s)throw X3(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)&&!jm(f)){if(Ct.processTimeMS()>=s)throw X3(f,n);continue t}if(f.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))continue e;throw f}}return u}finally{this.timeoutContext=null}}}go.ClientSession=Z3;function X3(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 AZ=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function A5(e){if(e instanceof V.MongoError){if(V.isRetryableWriteError(e)||e instanceof V.MongoWriteConcernError||jm(e)){if(b5(e))return!0}else if(e.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))return!0}return!1}function w5(e){let t=V.isRetryableWriteError(e);return t||=e instanceof V.MongoWriteConcernError,t||=jm(e),t&&=b5(e),t}function b5(e){let t=e instanceof V.MongoServerError&&e.codeName&&AZ.has(e.codeName);return jm(e)||!t&&e.code!==V.MONGODB_ERROR_CODES.UnsatisfiableWriteConcern&&e.code!==V.MONGODB_ERROR_CODES.UnknownReplWriteConcern}function km(e,t){let r=e.pinnedConnection,n=t?.error;if(e.inTransaction()&&n&&n instanceof V.MongoError&&n.hasErrorLabel(V.MongoErrorLabel.TransientTransactionError))return;let i=e.client.topology;if(r&&i!=null){let o=Array.from(i.s.servers.values())[0];if(t?.error==null||t?.force){if(o.pool.checkIn(r),e.pinnedConnection=void 0,r.emit(qm.UNPINNED,e.transaction.state!==pe.TxnState.NO_TRANSACTION?Sa.ConnectionPoolMetrics.TXN:Sa.ConnectionPoolMetrics.CURSOR),t?.forceClear)o.pool.clear({serviceId:r.serviceId})}}}function jm(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 Lm{constructor(e){if(e!=null){let t=As.ByteUtils.allocateUnsafe(16);t.set(e.id.id.buffer),this.id={id:new As.Binary(t,e.id.id.sub_type)},this.lastUse=e.lastUse,this.txnNumber=e.txnNumber,this.isDirty=e.isDirty;return}this.id={id:new As.Binary(Ct.uuidV4(),As.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}}go.ServerSession=Lm;class e6{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 Lm;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)}}}go.ServerSessionPool=e6;function wZ(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 i=e.inTransaction()||pe.isTransactionCommand(t);if(!!r.willRetryWrite||i)n.txnNumber+=e.txnNumberIncrement,e.txnNumberIncrement=0,t.txnNumber=As.Long.fromNumber(n.txnNumber);if(!i){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:C5.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 OZ(e,t){if(t.$clusterTime)Xl._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 Fi=g(function(un){Object.defineProperty(un,"__esModule",{value:!0});un.CursorTimeoutContext=un.AbstractCursor=un.CursorTimeoutMode=un.CURSOR_FLAGS=void 0;var T5=require("stream"),ws=Te(),bt=X(),M5=Zi(),Um=sn(),P5=G3(),B5=m5(),Vm=fo(),Ca=Xr(),F5=Rf(),Zl=fi(),Kt=he();un.CURSOR_FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];function D5(){this.client.s.activeCursors.delete(this)}un.CursorTimeoutMode=Object.freeze({ITERATION:"iteration",LIFETIME:"cursorLifetime"});class N5 extends M5.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 Ca.ReadPreference?r.readPreference:Ca.ReadPreference.primary,...ws.pluckBSONSerializeOptions(r),tailable:r.tailable,awaitData:r.awaitData};let n=Vm.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(D5))this.once("close",D5)}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 i=this.documents?.shift(this.deserializationOptions);if(i!=null)t.push(i)}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 I5(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===ws.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===ws.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===ws.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 Ca.ReadPreference)this.cursorOptions.readPreference=e;else if(typeof e==="string")this.cursorOptions.readPreference=Ca.ReadPreference.fromString(e);else throw new bt.MongoInvalidArgumentError(`Invalid read preference: ${e}`);return this}withReadConcern(e){this.throwIfInitialized();let t=Vm.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 P5.GetMoreOperation(this.cursorNamespace,this.cursorId,this.selectedServer,e);return await Um.executeOperation(this.cursorClient,t,this.timeoutContext)}async cursorInit(){if(this.cursorOptions.timeoutMS!=null)this.timeoutContext??=new xf(Zl.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 xf(Zl.TimeoutContext.create({serverSelectionTimeoutMS:this.client.s.options.serverSelectionTimeoutMS,timeoutMS:e}),this);else return this.timeoutContext?.refreshed()};await(async(s)=>{try{await s()}finally{this.emitClose()}})(async()=>{let s=this.cursorSession;if(!s)return;try{if(!this.isKilled&&this.cursorId&&!this.cursorId.isZero()&&this.cursorNamespace&&this.selectedServer&&!s.hasEnded){this.isKilled=!0;let o=this.cursorId;this.cursorId=ws.Long.ZERO,await Um.executeOperation(this.cursorClient,new B5.KillCursorsOperation(o,this.cursorNamespace,this.selectedServer,{session:s}),r())}}catch(o){Kt.squashError(o)}finally{if(s.owner===this)await s.endSession({error:t});if(!s.inTransaction())F5.maybeClearPinnedConnection(s,{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=N5;class I5 extends T5.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===ws.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 xf extends Zl.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 xf(this.timeoutContext.refreshed(),this.owner)}addMaxTimeMSToCommand(e,t){this.timeoutContext.addMaxTimeMSToCommand(e,t)}getSocketTimeoutMS(){return this.timeoutContext.getSocketTimeoutMS()}}un.CursorTimeoutContext=xf});var Wm=g(function(zm){Object.defineProperty(zm,"__esModule",{value:!0});zm.ExplainableCursor=void 0;var $5=Fi();class R5 extends $5.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}}}zm.ExplainableCursor=R5});var vf=g(function(Qm){Object.defineProperty(Qm,"__esModule",{value:!0});Qm.AggregationCursor=void 0;var Hm=X(),Km=Nf(),Gm=sn(),x5=he(),Ym=Fi(),v5=Wm();class t6 extends v5.ExplainableCursor{constructor(e,t,r=[],n={}){super(e,t,n);this.pipeline=r,this.aggregateOptions=n;let i=this.pipeline[this.pipeline.length-1];if(this.cursorOptions.timeoutMS!=null&&this.cursorOptions.timeoutMode===Ym.CursorTimeoutMode.ITERATION&&(i?.$merge!=null||i?.$out!=null))throw new Hm.MongoAPIError("Cannot use $out or $merge stage with ITERATION timeoutMode")}clone(){let e=x5.mergeOptions({},this.aggregateOptions);return delete e.session,new t6(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 Km.AggregateOperation(this.namespace,this.pipeline,t),n=await Gm.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 Gm.executeOperation(this.client,new Km.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===Ym.CursorTimeoutMode.ITERATION&&(e.$out!=null||e.$merge!=null))throw new Hm.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})}}Qm.AggregationCursor=t6});var n6=g(function(Jm){Object.defineProperty(Jm,"__esModule",{value:!0});Jm.CountOperation=void 0;var k5=St(),q5=fr(),ba=vt();class r6 extends q5.CommandOperation{constructor(e,t,r){super({s:{namespace:e}},r);this.SERVER_COMMAND_RESPONSE_TYPE=k5.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}}Jm.CountOperation=r6;ba.defineAspects(r6,[ba.Aspect.READ_OPERATION,ba.Aspect.RETRYABLE,ba.Aspect.SUPPORTS_RAW_DATA])});var z5=g(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});Xm.FindOperation=void 0;var e1=St(),j5=X(),L5=ql(),U5=he(),V5=fr(),Os=vt();class i6 extends V5.CommandOperation{constructor(e,t={},r={}){super(void 0,r);if(this.SERVER_COMMAND_RESPONSE_TYPE=e1.CursorResponse,this.options={...r},delete this.options.writeConcern,this.ns=e,typeof t!=="object"||Array.isArray(t))throw new j5.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?e1.ExplainedCursorResponse:e1.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 SZ(this.ns,this.filter,this.options)}}Xm.FindOperation=i6;function SZ(e,t,r){let n={find:e.collection,filter:t};if(r.sort)n.sort=L5.formatSort(r.sort);if(r.projection){let i=r.projection;if(i&&Array.isArray(i))i=i.length?i.reduce((s,o)=>(s[o]=1,s),{}):{_id:1};n.projection=i}if(r.hint)n.hint=U5.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}Os.defineAspects(i6,[Os.Aspect.READ_OPERATION,Os.Aspect.RETRYABLE,Os.Aspect.EXPLAINABLE,Os.Aspect.CURSOR_CREATING,Os.Aspect.SUPPORTS_RAW_DATA])});var o6=g(function(n1){Object.defineProperty(n1,"__esModule",{value:!0});n1.FindCursor=n1.FLAGS=void 0;var W5=St(),Er=X(),H5=n6(),t1=sn(),Zm=z5(),r1=ql(),Da=he(),K5=Wm();n1.FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];class s6 extends K5.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=r1.formatSort(n.sort)}clone(){let e=Da.mergeOptions({},this.findOptions);return delete e.session,new s6(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 Zm.FindOperation(this.namespace,this.cursorFilter,t),n=await t1.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(s){Da.squashError(s)}return W5.CursorResponse.emptyGetMore}let n=Da.noop,{batchSize:i}=this.cursorOptions;if(i!=null&&i>r)this.cursorOptions.batchSize=r,n=()=>{this.cursorOptions.batchSize=i};try{let s=await super.getMore();return this.numReturned=this.numReturned+s.batchSize,s}finally{n?.()}}async count(e){if(Da.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 Er.MongoInvalidArgumentError("Invalid first parameter to count");return await t1.executeOperation(this.client,new H5.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 t1.executeOperation(this.client,new Zm.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 Er.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=r1.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 Er.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 Er.MongoInvalidArgumentError("Argument for maxAwaitTimeMS must be a number");return this.findOptions.maxAwaitTimeMS=e,this}maxTimeMS(e){if(this.throwIfInitialized(),typeof e!=="number")throw new Er.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 Er.MongoTailableCursorError("Tailable cursor does not support sorting");return this.findOptions.sort=r1.formatSort(e,t),this}allowDiskUse(e=!0){if(this.throwIfInitialized(),!this.findOptions.sort)throw new Er.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 Er.MongoTailableCursorError("Tailable cursor does not support limit");if(typeof e!=="number")throw new Er.MongoInvalidArgumentError('Operation "limit" requires an integer');return this.findOptions.limit=e,this}skip(e){if(this.throwIfInitialized(),this.findOptions.tailable)throw new Er.MongoTailableCursorError("Tailable cursor does not support skip");if(typeof e!=="number")throw new Er.MongoInvalidArgumentError('Operation "skip" requires an integer');return this.findOptions.skip=e,this}}n1.FindCursor=s6});var qf=g(function(Ta){Object.defineProperty(Ta,"__esModule",{value:!0});Ta.ListIndexesOperation=Ta.DropIndexOperation=Ta.CreateIndexesOperation=void 0;var i1=St(),G5=he(),s1=fr(),_r=vt(),CZ=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 bZ(e){return typeof e==="number"||e==="2d"||e==="2dsphere"||e==="text"||e==="geoHaystack"}function DZ(e){return Array.isArray(e)&&e.length===2&&bZ(e[1])}function TZ(e){let t=new Map,r=!Array.isArray(e)||DZ(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[i,s]of n)t.set(i,s);else if(G5.isObject(n))for(let[i,s]of Object.entries(n))t.set(i,s);return t}var MZ=new Map([["version","v"],["defaultLanguage","default_language"],["languageOverride","language_override"]]);function PZ(e,t){let r=Object.entries(e).filter(([n])=>n!=="key"&&(t||CZ.has(n)));return Object.fromEntries(r.map(([n,i])=>[MZ.get(n)??n,i]))}class kf extends s1.CommandOperation{constructor(e,t,r,n,i){super(e,i);this.SERVER_COMMAND_RESPONSE_TYPE=i1.MongoDBResponse,this.options={...i},this.options.collation=void 0,this.collectionName=t,this.indexes=r.map((s)=>{let o=s.key instanceof Map?s.key:new Map(Object.entries(s.key)),u=s.name??Array.from(o).flat().join("_");return{...PZ(s,n),name:u,key:o}}),this.ns=e.s.namespace}static fromIndexDescriptionArray(e,t,r,n,i){return new kf(e,t,r,n,i)}static fromIndexSpecification(e,t,r,n,i,s){let o=TZ(r),u={...i,key:o};return new kf(e,t,[u],n,s??i)}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||"")}}Ta.CreateIndexesOperation=kf;class u6 extends s1.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=i1.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}}}Ta.DropIndexOperation=u6;class a6 extends s1.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=i1.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}}Ta.ListIndexesOperation=a6;_r.defineAspects(a6,[_r.Aspect.READ_OPERATION,_r.Aspect.RETRYABLE,_r.Aspect.CURSOR_CREATING,_r.Aspect.SUPPORTS_RAW_DATA]);_r.defineAspects(kf,[_r.Aspect.WRITE_OPERATION,_r.Aspect.SUPPORTS_RAW_DATA]);_r.defineAspects(u6,[_r.Aspect.WRITE_OPERATION,_r.Aspect.SUPPORTS_RAW_DATA])});var l6=g(function(e0){Object.defineProperty(e0,"__esModule",{value:!0});e0.ListIndexesCursor=void 0;var Y5=sn(),Q5=qf(),J5=Fi();class c6 extends J5.AbstractCursor{constructor(e,t){super(e.client,e.s.namespace,{...t});this.parent=e,this.options=t}clone(){return new c6(this.parent,{...this.options,...this.cursorOptions})}async _initialize(e){let t=new Q5.ListIndexesOperation(this.parent,{...this.cursorOptions,...this.options,session:e}),r=await Y5.executeOperation(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}}e0.ListIndexesCursor=c6});var eD=g(function(t0){Object.defineProperty(t0,"__esModule",{value:!0});t0.ListSearchIndexesCursor=void 0;var X5=vf();class Z5 extends X5.AggregationCursor{constructor({fullNamespace:e,client:t},r,n={}){let i=r==null?[{$listSearchIndexes:{}}]:[{$listSearchIndexes:{name:r}}];super(t,e,i,n)}}t0.ListSearchIndexesCursor=Z5});var nD=g(function(r0){Object.defineProperty(r0,"__esModule",{value:!0});r0.DistinctOperation=void 0;var tD=St(),rD=fr(),vo=vt();class h6 extends rD.CommandOperation{constructor(e,t,r,n){super(e,n);this.SERVER_COMMAND_RESPONSE_TYPE=tD.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}}r0.DistinctOperation=h6;vo.defineAspects(h6,[vo.Aspect.READ_OPERATION,vo.Aspect.RETRYABLE,vo.Aspect.EXPLAINABLE,vo.Aspect.SUPPORTS_RAW_DATA])});var oD=g(function(n0){Object.defineProperty(n0,"__esModule",{value:!0});n0.EstimatedDocumentCountOperation=void 0;var iD=St(),sD=fr(),ko=vt();class f6 extends sD.CommandOperation{constructor(e,t={}){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=iD.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}}n0.EstimatedDocumentCountOperation=f6;ko.defineAspects(f6,[ko.Aspect.READ_OPERATION,ko.Aspect.RETRYABLE,ko.Aspect.CURSOR_CREATING,ko.Aspect.SUPPORTS_RAW_DATA])});var d6=g(function(es){Object.defineProperty(es,"__esModule",{value:!0});es.FindOneAndUpdateOperation=es.FindOneAndReplaceOperation=es.FindOneAndDeleteOperation=es.FindAndModifyOperation=es.ReturnDocument=void 0;var uD=St(),Ni=X(),aD=Xr(),cD=ql(),o1=he(),lD=fr(),qo=vt();es.ReturnDocument=Object.freeze({BEFORE:"before",AFTER:"after"});function hD(e,t){if(e.new=t.returnDocument===es.ReturnDocument.AFTER,e.upsert=t.upsert===!0,t.bypassDocumentValidation===!0)e.bypassDocumentValidation=t.bypassDocumentValidation;return e}class u1 extends lD.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=uD.MongoDBResponse,this.options=r,this.readPreference=aD.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 i=cD.formatSort(r.sort);if(i)n.sort=i;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(o1.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}}es.FindAndModifyOperation=u1;class fD extends u1{constructor(e,t,r){if(t==null||typeof t!=="object")throw new Ni.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}}es.FindOneAndDeleteOperation=fD;class dD extends u1{constructor(e,t,r,n){if(t==null||typeof t!=="object")throw new Ni.MongoInvalidArgumentError('Argument "filter" must be an object');if(r==null||typeof r!=="object")throw new Ni.MongoInvalidArgumentError('Argument "replacement" must be an object');if(o1.hasAtomicOperators(r))throw new Ni.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,hD(r,this.options),r}}es.FindOneAndReplaceOperation=dD;class pD extends u1{constructor(e,t,r,n){if(t==null||typeof t!=="object")throw new Ni.MongoInvalidArgumentError('Argument "filter" must be an object');if(r==null||typeof r!=="object")throw new Ni.MongoInvalidArgumentError('Argument "update" must be an object');if(!o1.hasAtomicOperators(r,n))throw new Ni.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,hD(r,this.options),this.options.arrayFilters)r.arrayFilters=this.options.arrayFilters;return r}}es.FindOneAndUpdateOperation=pD;qo.defineAspects(u1,[qo.Aspect.WRITE_OPERATION,qo.Aspect.RETRYABLE,qo.Aspect.EXPLAINABLE,qo.Aspect.SUPPORTS_RAW_DATA])});var m6=g(function(s0){Object.defineProperty(s0,"__esModule",{value:!0});s0.RenameOperation=void 0;var mD=St(),yD=a1(),gD=he(),ED=fr(),i0=vt();class p6 extends ED.CommandOperation{constructor(e,t,r){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=mD.MongoDBResponse,this.collection=e,this.newName=t,this.options=r,this.ns=new gD.MongoDBNamespace("admin","$cmd")}get commandName(){return"renameCollection"}buildCommandDocument(e,t){let r=this.collection.namespace,n=this.collection.s.namespace.withCollection(this.newName).toString(),i=typeof this.options.dropTarget==="boolean"?this.options.dropTarget:!1;return{renameCollection:r,to:n,dropTarget:i}}handleOk(e){return new yD.Collection(this.collection.db,this.newName,this.collection.s.options)}}s0.RenameOperation=p6;i0.defineAspects(p6,[i0.Aspect.WRITE_OPERATION])});var OD=g(function(o0){Object.defineProperty(o0,"__esModule",{value:!0});o0.CreateSearchIndexesOperation=void 0;var _D=St(),AD=vt();class wD extends AD.AbstractOperation{constructor(e,t){super();this.SERVER_COMMAND_RESPONSE_TYPE=_D.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}}}o0.CreateSearchIndexesOperation=wD});var DD=g(function(a0){Object.defineProperty(a0,"__esModule",{value:!0});a0.DropSearchIndexOperation=void 0;var SD=St(),u0=X(),CD=vt();class bD extends CD.AbstractOperation{constructor(e,t){super();this.SERVER_COMMAND_RESPONSE_TYPE=SD.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 u0.MongoServerError&&u0.isNamespaceNotFoundError(e)))throw e}}a0.DropSearchIndexOperation=bD});var BD=g(function(c0){Object.defineProperty(c0,"__esModule",{value:!0});c0.UpdateSearchIndexOperation=void 0;var TD=St(),MD=vt();class PD extends MD.AbstractOperation{constructor(e,t,r){super();this.SERVER_COMMAND_RESPONSE_TYPE=TD.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}}}c0.UpdateSearchIndexOperation=PD});var a1=g(function(f0){Object.defineProperty(f0,"__esModule",{value:!0});f0.Collection=void 0;var FD=Te(),ND=L3(),ID=U3(),$D=f1(),RD=vf(),xD=o6(),vD=l6(),kD=eD(),Ii=X(),qD=n6(),l0=g3(),jD=nD(),LD=oD(),Ve=sn(),c1=d6(),jo=qf(),UD=b3(),VD=m6(),zD=OD(),WD=DD(),HD=BD(),l1=B3(),KD=fo(),h1=Xr(),me=he(),h0=hi();class GD{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:h1.ReadPreference.fromOptions(r),bsonOptions:FD.resolveBSONOptions(r,e),readConcern:KD.ReadConcern.fromOptions(r),writeConcern:h0.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 UD.InsertOneOperation(this,e,me.resolveOptions(this,t)))}async insertMany(e,t){if(!Array.isArray(e))throw new Ii.MongoInvalidArgumentError('Argument "docs" must be an array of documents');t=me.resolveOptions(this,t??{});let r=h0.WriteConcern.fromOptions(t)?.w!==0;try{let n=await this.bulkWrite(e.map((i)=>({insertOne:{document:i}})),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 Ii.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 Ii.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 i of e)n.raw(i);return await n.execute({...t})}async updateOne(e,t,r){return await Ve.executeOperation(this.client,new l1.UpdateOneOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async replaceOne(e,t,r){return await Ve.executeOperation(this.client,new l1.ReplaceOneOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async updateMany(e,t,r){return await Ve.executeOperation(this.client,new l1.UpdateManyOperation(this.s.namespace,e,t,me.resolveOptions(this,r)))}async deleteOne(e={},t={}){return await Ve.executeOperation(this.client,new l0.DeleteOneOperation(this.s.namespace,e,me.resolveOptions(this,t)))}async deleteMany(e={},t={}){return await Ve.executeOperation(this.client,new l0.DeleteManyOperation(this.s.namespace,e,me.resolveOptions(this,t)))}async rename(e,t){return await Ve.executeOperation(this.client,new VD.RenameOperation(this,e,me.resolveOptions(void 0,{...t,readPreference:h1.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),i=await n.next();return await n.close(),i}find(e={},t={}){return new xD.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 Ii.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?jo.CreateIndexesOperation.fromIndexSpecification(this,this.collectionName,e,!1,me.resolveOptions(this,t),void 0):jo.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,jo.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 jo.DropIndexOperation(this,e,{...me.resolveOptions(this,t),readPreference:h1.ReadPreference.primary}))}async dropIndexes(e){try{return await Ve.executeOperation(this.client,new jo.DropIndexOperation(this,"*",me.resolveOptions(this,e))),!0}catch(t){if(t instanceof Ii.MongoServerError&&Ii.isNamespaceNotFoundError(t))return!1;throw t}}listIndexes(e){return new vD.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:i})=>i).toArray());return r.every((i)=>n.has(i))}async indexInformation(e){return await this.indexes({...e,full:e?.full??!1})}async estimatedDocumentCount(e){return await Ve.executeOperation(this.client,new LD.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),i=await n.next();return await n.close(),i?.n??0}async distinct(e,t={},r={}){return await Ve.executeOperation(this.client,new jD.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:i,key:s})=>[i,Object.entries(s)]))}async findOneAndDelete(e,t){return await Ve.executeOperation(this.client,new c1.FindOneAndDeleteOperation(this,e,me.resolveOptions(this,t)))}async findOneAndReplace(e,t,r){return await Ve.executeOperation(this.client,new c1.FindOneAndReplaceOperation(this,e,t,me.resolveOptions(this,r)))}async findOneAndUpdate(e,t,r){return await Ve.executeOperation(this.client,new c1.FindOneAndUpdateOperation(this,e,t,me.resolveOptions(this,r)))}aggregate(e=[],t){if(!Array.isArray(e))throw new Ii.MongoInvalidArgumentError('Argument "pipeline" must be an array of aggregation stages');return new RD.AggregationCursor(this.client,this.s.namespace,e,me.resolveOptions(this,t))}watch(e=[],t={}){if(!Array.isArray(e))t=e,e=[];return new $D.ChangeStream(this,e,me.resolveOptions(this,t))}initializeUnorderedBulkOp(e){return new ID.UnorderedBulkOperation(this,me.resolveOptions(this,e))}initializeOrderedBulkOp(e){return new ND.OrderedBulkOperation(this,me.resolveOptions(this,e))}async count(e={},t={}){return await Ve.executeOperation(this.client,new qD.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 kD.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 zD.CreateSearchIndexesOperation(this,e))}async dropSearchIndex(e){return await Ve.executeOperation(this.client,new WD.DropSearchIndexOperation(this,e))}async updateSearchIndex(e,t){return await Ve.executeOperation(this.client,new HD.UpdateSearchIndexOperation(this,e,t))}}f0.Collection=GD});var g6=g(function(m0){Object.defineProperty(m0,"__esModule",{value:!0});m0.ChangeStreamCursor=void 0;var d1=f1(),d0=Br(),YD=Nf(),QD=sn(),p0=he(),JD=Fi();class y6 extends JD.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(d1.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 y6(this.client,this.namespace,this.pipeline,{...this.cursorOptions})}async _initialize(e){let t=new YD.AggregateOperation(this.namespace,this.pipeline,{...this.cursorOptions,...this.changeStreamCursorOptions,session:e}),r=await QD.executeOperation(e.client,t,this.timeoutContext),n=t.server;if(this.maxWireVersion=p0.maxWireVersion(n),this.startAtOperationTime==null&&this.changeStreamCursorOptions.resumeAfter==null&&this.changeStreamCursorOptions.startAfter==null)this.startAtOperationTime=r.operationTime;return this._processBatch(r),this.emit(d0.INIT,r),this.emit(d0.RESPONSE),{server:n,session:e,response:r}}async getMore(){let e=await super.getMore();return this.maxWireVersion=p0.maxWireVersion(this.server),this._processBatch(e),this.emit(d1.ChangeStream.MORE,e),this.emit(d1.ChangeStream.RESPONSE),e}}m0.ChangeStreamCursor=y6});var ZD=g(function(y0){Object.defineProperty(y0,"__esModule",{value:!0});y0.ListCollectionsOperation=void 0;var p1=St(),XD=fr(),Lo=vt();class E6 extends XD.CommandOperation{constructor(e,t,r){super(e,r);if(this.SERVER_COMMAND_RESPONSE_TYPE=p1.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?p1.ExplainedCursorResponse:p1.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}}y0.ListCollectionsOperation=E6;Lo.defineAspects(E6,[Lo.Aspect.READ_OPERATION,Lo.Aspect.RETRYABLE,Lo.Aspect.CURSOR_CREATING,Lo.Aspect.SUPPORTS_RAW_DATA])});var A6=g(function(g0){Object.defineProperty(g0,"__esModule",{value:!0});g0.ListCollectionsCursor=void 0;var eT=sn(),tT=ZD(),rT=Fi();class _6 extends rT.AbstractCursor{constructor(e,t,r){super(e.client,e.s.namespace,{...r});this.parent=e,this.filter=t,this.options=r}clone(){return new _6(this.parent,this.filter,{...this.options,...this.cursorOptions})}async _initialize(e){let t=new tT.ListCollectionsOperation(this.parent,this.filter,{...this.cursorOptions,...this.options,session:e,signal:this.signal}),r=await eT.executeOperation(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}}g0.ListCollectionsCursor=_6});var aT=g(function(_0){Object.defineProperty(_0,"__esModule",{value:!0});_0.RunCommandCursor=void 0;var Ss=X(),E0=sn(),nT=G3(),iT=xl(),sT=he(),oT=Fi();class uT extends oT.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 Ss.MongoAPIError("Clone not supported, create a new cursor with db.runCursorCommand")}withReadConcern(e){throw new Ss.MongoAPIError("RunCommandCursor does not support readConcern it must be attached to the command being run")}addCursorFlag(e,t){throw new Ss.MongoAPIError("RunCommandCursor does not support cursor flags, they must be attached to the command being run")}maxTimeMS(e){throw new Ss.MongoAPIError("maxTimeMS must be configured on the command document directly, to configure getMore.maxTimeMS use cursor.setMaxTimeMS()")}batchSize(e){throw new Ss.MongoAPIError("batchSize must be configured on the command document directly, to configure getMore.batchSize use cursor.setBatchSize()")}constructor(e,t,r={}){super(e.client,sT.ns(e.namespace),r);this.getMoreOptions={},this.db=e,this.command=Object.freeze({...t})}async _initialize(e){let t=new iT.RunCursorCommandOperation(this.db.s.namespace,this.command,{...this.cursorOptions,session:e,readPreference:this.cursorOptions.readPreference}),r=await E0.executeOperation(this.client,t,this.timeoutContext);return{server:t.server,session:e,response:r}}async getMore(){if(!this.session)throw new Ss.MongoRuntimeError("Unexpected null session. A cursor creating command should have set this");let e=new nT.GetMoreOperation(this.namespace,this.id,this.server,{...this.cursorOptions,session:this.session,...this.getMoreOptions});return await E0.executeOperation(this.client,e,this.timeoutContext)}}_0.RunCommandCursor=uT});var yT=g(function(Lf){Object.defineProperty(Lf,"__esModule",{value:!0});Lf.CreateCollectionOperation=void 0;Lf.createCollections=NZ;var A0=Tu(),cT=St(),lT=a1(),hT=X(),fT=fi(),dT=he(),pT=fr(),m1=sn(),mT=qf(),w0=vt(),BZ=new Set(["w","wtimeout","timeoutMS","j","fsync","pkFactory","raw","readPreference","session","readConcern","writeConcern","raw","fieldsAsRaw","useBigInt64","promoteLongs","promoteValues","promoteBuffers","bsonRegExp","serializeFunctions","ignoreUndefined","enableUtf8Validation"]),FZ="Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.";class jf extends pT.CommandOperation{constructor(e,t,r={}){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=cT.MongoDBResponse,this.options=r,this.db=e,this.name=t}get commandName(){return"create"}buildCommandDocument(e,t){let r=([n,i])=>i!=null&&typeof i!=="function"&&!BZ.has(n);return{create:this.name,...Object.fromEntries(Object.entries(this.options).filter(r))}}handleOk(e){return new lT.Collection(this.db,this.name,this.options)}}Lf.CreateCollectionOperation=jf;async function NZ(e,t,r){let n=fT.TimeoutContext.create({session:r.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:r.timeoutMS}),i=r.encryptedFields??e.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${e.databaseName}.${t}`];if(i){class o extends jf{buildCommandDocument(c,l){if(!c.description.loadBalanced&&dT.maxWireVersion(c)<A0.MIN_SUPPORTED_QE_WIRE_VERSION)throw new hT.MongoCompatibilityError(`${FZ} The minimum server version required is ${A0.MIN_SUPPORTED_QE_SERVER_VERSION}`);return super.buildCommandDocument(c,l)}}let u=i.escCollection??`enxcol_.${t}.esc`,a=i.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 m1.executeOperation(e.client,l,n)}if(!r.encryptedFields)r={...r,encryptedFields:i}}let s=await m1.executeOperation(e.client,new jf(e,t,r),n);if(i){let o=mT.CreateIndexesOperation.fromIndexSpecification(e,t,{__safeContent__:1},!1,{session:r.session},void 0);await m1.executeOperation(e.client,o,n)}return s}w0.defineAspects(jf,[w0.Aspect.WRITE_OPERATION])});var wT=g(function(Rc){Object.defineProperty(Rc,"__esModule",{value:!0});Rc.DropDatabaseOperation=Rc.DropCollectionOperation=void 0;Rc.dropCollections=IZ;var gT=Pa(),S0=St(),ET=Fi(),_T=X(),AT=fi(),C0=fr(),O0=sn(),Ma=vt();class Uf extends C0.CommandOperation{constructor(e,t,r={}){super(e,r);this.SERVER_COMMAND_RESPONSE_TYPE=S0.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 gT.MongoServerError&&_T.isNamespaceNotFoundError(e)))throw e;return!1}}Rc.DropCollectionOperation=Uf;async function IZ(e,t,r){let n=AT.TimeoutContext.create({session:r.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:r.timeoutMS}),i=e.client.s.options.autoEncryption?.encryptedFieldsMap,s=r.encryptedFields??i?.[`${e.databaseName}.${t}`];if(!s&&i)s=(await e.listCollections({name:t},{nameOnly:!1,session:r.session,timeoutContext:new ET.CursorTimeoutContext(n,Symbol())}).toArray())?.[0]?.options?.encryptedFields;if(s){let o=s.escCollection||`enxcol_.${t}.esc`,u=s.ecocCollection||`enxcol_.${t}.ecoc`;for(let a of[o,u]){let c=new Uf(e,a,r);await O0.executeOperation(e.client,c,n)}}return await O0.executeOperation(e.client,new Uf(e,t,r),n)}class w6 extends C0.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=S0.MongoDBResponse,this.options=t}get commandName(){return"dropDatabase"}buildCommandDocument(e,t){return{dropDatabase:1}}handleOk(e){return!0}}Rc.DropDatabaseOperation=w6;Ma.defineAspects(Uf,[Ma.Aspect.WRITE_OPERATION]);Ma.defineAspects(w6,[Ma.Aspect.WRITE_OPERATION])});var TT=g(function(D0){Object.defineProperty(D0,"__esModule",{value:!0});D0.ProfilingLevelOperation=void 0;var OT=Te(),ST=St(),b0=X(),CT=fr();class bT extends ST.MongoDBResponse{get was(){return this.get("was",OT.BSONType.int,!0)}}class DT extends CT.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=bT,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 b0.MongoUnexpectedServerResponseError(`Illegal profiling level value ${t}`)}else throw new b0.MongoUnexpectedServerResponseError("Error with profile command")}}D0.ProfilingLevelOperation=DT});var O6=g(function(Uo){Object.defineProperty(Uo,"__esModule",{value:!0});Uo.SetProfilingLevelOperation=Uo.ProfilingLevel=void 0;var MT=St(),PT=X(),BT=he(),FT=fr(),$Z=new Set(["off","slow_only","all"]);Uo.ProfilingLevel=Object.freeze({off:"off",slowOnly:"slow_only",all:"all"});class NT extends FT.CommandOperation{constructor(e,t,r){super(e,r);switch(this.SERVER_COMMAND_RESPONSE_TYPE=MT.MongoDBResponse,this.options=r,t){case Uo.ProfilingLevel.off:this.profile=0;break;case Uo.ProfilingLevel.slowOnly:this.profile=1;break;case Uo.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(!$Z.has(t))throw new PT.MongoInvalidArgumentError(`Profiling level must be one of "${BT.enumToString(Uo.ProfilingLevel)}"`);return{profile:this.profile}}handleOk(e){return this.level}}Uo.SetProfilingLevelOperation=NT});var RT=g(function(M0){Object.defineProperty(M0,"__esModule",{value:!0});M0.DbStatsOperation=void 0;var IT=St(),$T=fr(),T0=vt();class S6 extends $T.CommandOperation{constructor(e,t){super(e,t);this.SERVER_COMMAND_RESPONSE_TYPE=IT.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}}M0.DbStatsOperation=S6;T0.defineAspects(S6,[T0.Aspect.READ_OPERATION])});var R0=g(function($0){Object.defineProperty($0,"__esModule",{value:!0});$0.Db=void 0;var xT=j3(),P0=Te(),vT=f1(),B0=a1(),Cs=Br(),kT=vf(),qT=A6(),jT=aT(),F0=X(),LT=yT(),N0=wT(),Ln=sn(),UT=qf(),VT=TT(),zT=q3(),WT=m6(),HT=xl(),KT=O6(),GT=RT(),YT=fo(),I0=Xr(),rt=he(),QT=hi(),RZ=["writeConcern","readPreference","readPreferenceTags","native_parser","forceServerObjectId","pkFactory","serializeFunctions","raw","authSource","ignoreUndefined","readConcern","retryMiliSeconds","numberOfRetries","useBigInt64","promoteBuffers","promoteLongs","bsonRegExp","enableUtf8Validation","promoteValues","compression","retryWrites"];class JT{static{this.SYSTEM_NAMESPACE_COLLECTION=Cs.SYSTEM_NAMESPACE_COLLECTION}static{this.SYSTEM_INDEX_COLLECTION=Cs.SYSTEM_INDEX_COLLECTION}static{this.SYSTEM_PROFILE_COLLECTION=Cs.SYSTEM_PROFILE_COLLECTION}static{this.SYSTEM_USER_COLLECTION=Cs.SYSTEM_USER_COLLECTION}static{this.SYSTEM_COMMAND_COLLECTION=Cs.SYSTEM_COMMAND_COLLECTION}static{this.SYSTEM_JS_COLLECTION=Cs.SYSTEM_JS_COLLECTION}constructor(e,t,r){if(r=r??{},r=rt.filterOptions(r,RZ),typeof t==="string"&&t.includes("."))throw new F0.MongoInvalidArgumentError("Database names cannot contain the character '.'");this.s={options:r,readPreference:I0.ReadPreference.fromOptions(r),bsonOptions:P0.resolveBSONOptions(r,e),pkFactory:r?.pkFactory??rt.DEFAULT_PK_FACTORY,readConcern:YT.ReadConcern.fromOptions(r),writeConcern:QT.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 LT.createCollections(this,e,t)}async command(e,t){return await Ln.executeOperation(this.client,new HT.RunCommandOperation(this.s.namespace,e,rt.resolveOptions(void 0,{...P0.resolveBSONOptions(t),timeoutMS:t?.timeoutMS??this.timeoutMS,session:t?.session,readPreference:t?.readPreference,signal:t?.signal})))}aggregate(e=[],t){return new kT.AggregationCursor(this.client,this.s.namespace,e,rt.resolveOptions(this,t))}admin(){return new xT.Admin(this)}collection(e,t={}){if(typeof t==="function")throw new F0.MongoInvalidArgumentError("The callback form of this helper has been removed.");return new B0.Collection(this,e,rt.resolveOptions(this,t))}async stats(e){return await Ln.executeOperation(this.client,new GT.DbStatsOperation(this,rt.resolveOptions(this,e)))}listCollections(e={},t={}){return new qT.ListCollectionsCursor(this,e,rt.resolveOptions(this,t))}async renameCollection(e,t,r){return await Ln.executeOperation(this.client,new WT.RenameOperation(this.collection(e),t,rt.resolveOptions(void 0,{...r,readPreference:I0.ReadPreference.primary})))}async dropCollection(e,t){return t=rt.resolveOptions(this,t),await N0.dropCollections(this,e,t)}async dropDatabase(e){return await Ln.executeOperation(this.client,new N0.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 B0.Collection(this,r,this.s.options))}async createIndex(e,t,r){return(await Ln.executeOperation(this.client,UT.CreateIndexesOperation.fromIndexSpecification(this,e,t,!1,r??{},void 0)))[0]}async removeUser(e,t){return await Ln.executeOperation(this.client,new zT.RemoveUserOperation(this,e,rt.resolveOptions(this,t)))}async setProfilingLevel(e,t){return await Ln.executeOperation(this.client,new KT.SetProfilingLevelOperation(this,e,rt.resolveOptions(this,t)))}async profilingLevel(e){return await Ln.executeOperation(this.client,new VT.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 vT.ChangeStream(this,e,rt.resolveOptions(this,t))}runCursorCommand(e,t){return new jT.RunCommandCursor(this,e,{...t})}}$0.Db=JT});var Ba=g(function(y1){Object.defineProperty(y1,"__esModule",{value:!0});y1.AuthProvider=y1.AuthContext=void 0;var XT=X();class ZT{constructor(e,t,r){this.reauthenticating=!1,this.connection=e,this.credentials=t,this.options=r}}y1.AuthContext=ZT;class eM{async prepare(e,t){return e}async reauth(e){if(e.reauthenticating)throw new XT.MongoRuntimeError("Reauthentication already in progress.");try{e.reauthenticating=!0,await this.auth(e)}finally{e.reauthenticating=!1}}}y1.AuthProvider=eM});var v0=g(function(Eo){Object.defineProperty(Eo,"__esModule",{value:!0});Eo.GSSAPI=Eo.GSSAPICanonicalizationValue=void 0;Eo.performGSSAPICanonicalizeHostName=oM;Eo.resolveCname=b6;var g1=require("dns"),tM=Io(),x0=X(),rM=he(),nM=Ba();Eo.GSSAPICanonicalizationValue=Object.freeze({on:!0,off:!1,none:"none",forward:"forward",forwardAndReverse:"forwardAndReverse"});async function C6(e,t){return await e.command(rM.ns("$external.$cmd"),t)}var Vf;class iM extends nM.AuthProvider{async auth(e){let{connection:t,credentials:r}=e;if(r==null)throw new x0.MongoMissingCredentialsError("Credentials required for GSSAPI authentication");let{username:n}=r,i=await xZ(e),s=await i.step(""),o=await C6(t,vZ(s)),u=await sM(i,10,o.payload),a=await C6(t,kZ(u,o.conversationId)),c=await qZ(i,n,a.payload);await C6(t,{saslContinue:1,conversationId:a.conversationId,payload:c})}}Eo.GSSAPI=iM;async function xZ({options:{hostAddress:e,runtime:t},credentials:r}){if(!e||typeof e.host!=="string"||!r)throw new x0.MongoInvalidArgumentError("Connection must have host and port and credentials defined.");let{os:n}=await t;if(jZ(),"kModuleError"in Vf)throw Vf.kModuleError;let{initializeClient:i}=Vf,{username:s,password:o}=r,u=r.mechanismProperties,a=u.SERVICE_NAME??"mongodb",c=await oM(e.host,u),l={};if(o!=null)Object.assign(l,{user:s,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 i(h,l)}function vZ(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}function kZ(e,t){return{saslContinue:1,conversationId:t,payload:e}}async function sM(e,t,r){try{return await e.step(r)||""}catch(n){if(t===0)throw n;return await sM(e,t-1,r)}}async function qZ(e,t,r){let n=await e.unwrap(r);return await e.wrap(n||"",{user:t})}async function oM(e,t){let r=t.CANONICALIZE_HOST_NAME;if(!r||r===Eo.GSSAPICanonicalizationValue.none)return e;if(r===Eo.GSSAPICanonicalizationValue.on||r===Eo.GSSAPICanonicalizationValue.forwardAndReverse){let{address:n}=await g1.promises.lookup(e);try{let i=await g1.promises.resolve(n,"PTR");return i.length>0?i[0]:e}catch{return await b6(e)}}else return await b6(e)}async function b6(e){try{let t=await g1.promises.resolve(e,"CNAME");return t.length>0?t[0]:e}catch{return e}}function jZ(){if(!Vf)Vf=tM.getKerberos()}});var zo=g(function(Vo){Object.defineProperty(Vo,"__esModule",{value:!0});Vo.AUTH_MECHS_AUTH_SRC_EXTERNAL=Vo.AuthMechanism=void 0;Vo.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"});Vo.AUTH_MECHS_AUTH_SRC_EXTERNAL=new Set([Vo.AuthMechanism.MONGODB_GSSAPI,Vo.AuthMechanism.MONGODB_AWS,Vo.AuthMechanism.MONGODB_OIDC,Vo.AuthMechanism.MONGODB_X509])});var q0=g(function(xc){Object.defineProperty(xc,"__esModule",{value:!0});xc.MongoCredentials=xc.DEFAULT_ALLOWED_HOSTS=void 0;var kt=X(),cM=v0(),Dt=zo();function LZ(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 uM=["test","azure","gcp","k8s"],aM="Auth mechanism property ALLOWED_HOSTS must be an array of strings.";xc.DEFAULT_ALLOWED_HOSTS=["*.mongodb.net","*.mongodb-qa.net","*.mongodb-dev.net","*.mongodbgov.net","localhost","127.0.0.1","::1","*.mongo.com"];var UZ="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure or gcp.";class k0{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:xc.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 k0({username:this.username,password:this.password,source:this.source,mechanism:LZ(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(UZ);if(this.mechanismProperties.ENVIRONMENT&&!uM.includes(this.mechanismProperties.ENVIRONMENT))throw new kt.MongoInvalidArgumentError(`Currently only a ENVIRONMENT in ${uM.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(aM);for(let r of t)if(typeof r!=="string")throw new kt.MongoInvalidArgumentError(aM)}}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(cM.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 k0({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"})}}xc.MongoCredentials=k0});var lM=g(function(o2e,VZ){VZ.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 D6=g(function(vc){Object.defineProperty(vc,"__esModule",{value:!0});vc.LimitedSizeDocument=void 0;vc.isDriverInfoEqual=WZ;vc.makeClientMetadata=HZ;vc.getFAASEnv=dM;var E1=require("process"),Ur=Te(),j0=X(),fM=he(),zZ=lM().version;function WZ(e,t){let r=(n,i)=>(n||=void 0,i||=void 0,n===i);return r(e.name,t.name)&&r(e.platform,t.platform)&&r(e.version,t.version)}class L0{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})}}vc.LimitedSizeDocument=L0;async function HZ(e,{appName:t="",runtime:r}){let{os:n}=await r,i=new L0(512);if(t.length>0){let c=Ur.ByteUtils.utf8ByteLength(t)<=128?t:Ur.ByteUtils.toUTF8(Ur.ByteUtils.fromUTF8(t),0,128,!1);i.ifItFitsItSits("application",{name:c})}let s={name:"nodejs",version:zZ};for(let{name:c="",version:l=""}of e){if(c.length>0)s.name=`${s.name}|${c}`;if(l.length>0)s.version=`${s.version}|${l}`}if(!i.ifItFitsItSits("driver",s))throw new j0.MongoInvalidArgumentError("Unable to include driverInfo name and version, metadata cannot exceed 512 bytes");let o=YZ();for(let{platform:c=""}of e)if(c.length>0)o=`${o}|${c}`;if(!i.ifItFitsItSits("platform",o))throw new j0.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(!i.ifItFitsItSits("os",u))for(let c of u.keys()){if(u.delete(c),u.size===0)break;if(i.ifItFitsItSits("os",u))break}let a=dM();if(a!=null){if(!i.ifItFitsItSits("env",a))for(let c of a.keys()){if(a.delete(c),a.size===0)break;if(i.ifItFitsItSits("env",a))break}}return await GZ(i.toObject())}var hM;async function KZ(){hM??=fM.fileIsAccessible("/.dockerenv");let e=await hM,{KUBERNETES_SERVICE_HOST:t=""}=E1.env,r=t.length>0?!0:!1,n={};if(e)n.runtime="docker";if(r)n.orchestrator="kubernetes";return n}async function GZ(e){let t=await KZ();if(Object.keys(t).length===0)return e;let r=new L0(512),n={...e?.env,container:t};for(let[i,s]of Object.entries(e))if(i!=="env")r.ifItFitsItSits(i,s);else if(!r.ifItFitsItSits("env",n))r.ifItFitsItSits("env",s);if(!("env"in e))r.ifItFitsItSits("env",n);return r.toObject()}function dM(){let{AWS_EXECUTION_ENV:e="",AWS_LAMBDA_RUNTIME_API:t="",FUNCTIONS_WORKER_RUNTIME:r="",K_SERVICE:n="",FUNCTION_NAME:i="",VERCEL:s="",AWS_LAMBDA_FUNCTION_MEMORY_SIZE:o="",AWS_REGION:u="",FUNCTION_MEMORY_MB:a="",FUNCTION_REGION:c="",FUNCTION_TIMEOUT_SEC:l="",VERCEL_REGION:f=""}=E1.env,h=e.startsWith("AWS_Lambda_")||t.length>0,d=r.length>0,p=n.length>0||i.length>0,m=s.length>0,E=new Map;if(m&&!(d||p)){if(f.length>0)E.set("region",f);return E.set("name","vercel"),E}if(h&&!(d||p||m)){if(u.length>0)E.set("region",u);if(o.length>0&&Number.isInteger(+o))E.set("memory_mb",new Ur.Int32(o));return E.set("name","aws.lambda"),E}if(d&&!(p||h||m))return E.set("name","azure.func"),E;if(p&&!(d||h||m)){if(c.length>0)E.set("region",c);if(a.length>0&&Number.isInteger(+a))E.set("memory_mb",new Ur.Int32(a));if(l.length>0&&Number.isInteger(+l))E.set("timeout_sec",new Ur.Int32(l));return E.set("name","gcp.func"),E}return null}function YZ(){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 ${E1.version}, ${e}`}});var V0=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 _1(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 mM(e){if(e>0&&e%1===0.5&&(e&1)===0||e<0&&e%1===-0.5&&(e&1)===1)return zf(Math.floor(e));return zf(Math.round(e))}function U0(e){return zf(Math.trunc(e))}function pM(e){return e<0?-1:1}function QZ(e,t){let r=e%t;if(pM(t)!==pM(r))return r+t;return r}function zf(e){return e===0?0:e}function A1(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 i=2**e,s=2**(e-1);return(o,u={})=>{let a=_1(o,u);if(a=zf(a),u.enforceRange){if(!Number.isFinite(a))throw er(TypeError,"is not a finite number",u);if(a=U0(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=mM(a),a;if(!Number.isFinite(a)||a===0)return 0;if(a=U0(a),a>=r&&a<=n)return a;if(a=QZ(a,i),!t&&a>=s)return a-i;return a}}function yM(e,{unsigned:t}){let r=Number.MAX_SAFE_INTEGER,n=t?0:Number.MIN_SAFE_INTEGER,i=t?BigInt.asUintN:BigInt.asIntN;return(s,o={})=>{let u=_1(s,o);if(u=zf(u),o.enforceRange){if(!Number.isFinite(u))throw er(TypeError,"is not a finite number",o);if(u=U0(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=mM(u),u;if(!Number.isFinite(u)||u===0)return 0;let a=BigInt(U0(u));return a=i(e,a),Number(a)}}ut.any=(e)=>e;ut.undefined=()=>{return};ut.boolean=(e)=>Boolean(e);ut.byte=A1(8,{unsigned:!1});ut.octet=A1(8,{unsigned:!0});ut.short=A1(16,{unsigned:!1});ut["unsigned short"]=A1(16,{unsigned:!0});ut.long=A1(32,{unsigned:!1});ut["unsigned long"]=A1(32,{unsigned:!0});ut["long long"]=yM(64,{unsigned:!1});ut["unsigned long long"]=yM(64,{unsigned:!0});ut.double=(e,t={})=>{let r=_1(e,t);if(!Number.isFinite(r))throw er(TypeError,"is not a finite floating-point value",t);return r};ut["unrestricted double"]=(e,t={})=>_1(e,t);ut.float=(e,t={})=>{let r=_1(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=_1(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 JZ=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get,XZ=Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,"byteLength").get;function gM(e){try{return JZ.call(e),!0}catch{return!1}}function T6(e){try{return XZ.call(e),!0}catch{return!1}}var ZZ=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"resizable").get,eee=Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,"growable").get;function EM(e){try{return ZZ.call(e)}catch{return!1}}function _M(e){try{return eee.call(e)}catch{return!1}}function AM(e){try{return new Uint8Array(e),!1}catch{return!0}}ut.ArrayBuffer=(e,t={})=>{if(!gM(e))throw er(TypeError,"is not an ArrayBuffer",t);if(!t.allowResizable&&EM(e))throw er(TypeError,"is a resizable ArrayBuffer",t);if(AM(e))throw er(TypeError,"is a detached ArrayBuffer",t);return e};ut.SharedArrayBuffer=(e,t={})=>{if(!T6(e))throw er(TypeError,"is not a SharedArrayBuffer",t);if(!t.allowResizable&&_M(e))throw er(TypeError,"is a growable SharedArrayBuffer",t);return e};var tee=Object.getOwnPropertyDescriptor(DataView.prototype,"byteLength").get;ut.DataView=(e,t={})=>{try{tee.call(e)}catch{throw er(TypeError,"is not a DataView",t)}return ut.ArrayBufferView(e,t)};var ree=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,i={})=>{if(!ArrayBuffer.isView(n)||ree.call(n)!==t)throw er(TypeError,`is not ${r} ${t} object`,i);return ut.ArrayBufferView(n,i)}});ut.ArrayBufferView=(e,t={})=>{if(!ArrayBuffer.isView(e))throw er(TypeError,"is not a view on an ArrayBuffer or SharedArrayBuffer",t);if(!t.allowShared&&T6(e.buffer))throw er(TypeError,"is a view on a SharedArrayBuffer, which is not allowed",t);if(!t.allowResizable){if(EM(e.buffer))throw er(TypeError,"is a view on a resizable ArrayBuffer, which is not allowed",t);else if(_M(e.buffer))throw er(TypeError,"is a view on a growable SharedArrayBuffer, which is not allowed",t)}if(AM(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(gM(e))return ut.ArrayBuffer(e,t);else if(t.allowShared&&T6(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 W0=g(function(TM,MM){function wM(e){return typeof e==="object"&&e!==null||typeof e==="function"}var nee=Function.call.bind(Function.call);function iee(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 see(e,t){let r=CM(e);return Object.defineProperties(Object.create(r["%Object.prototype%"]),Object.getOwnPropertyDescriptors(t))}var OM=Symbol("wrapper"),SM=Symbol("impl"),w1=Symbol("SameObject caches"),z0=Symbol.for("[webidl2js] constructor registry"),oee=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);function CM(e){if(Object.hasOwn(e,z0))return e[z0];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%"]=oee}return e[z0]=t,t}function uee(e,t,r){if(!e[w1])e[w1]=Object.create(null);if(t in e[w1])return e[w1][t];return e[w1][t]=r(),e[w1][t]}function bM(e){return e?e[OM]:null}function DM(e){return e?e[SM]:null}function aee(e){let t=bM(e);return t?t:e}function cee(e){let t=DM(e);return t?t:e}var lee=Symbol("internal");function hee(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 fee=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get;function dee(e){try{return fee.call(e),!0}catch{return!1}}function pee([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 mee(e,t,r,n,i){if(i===void 0){let o=Reflect.getPrototypeOf(e);if(o!==null)return Reflect.set(o,t,r,n);i={writable:!0,enumerable:!0,configurable:!0,value:void 0}}if(yee(i)){if(!i.writable)return!1;if(!wM(n))return!1;let o=Reflect.getOwnPropertyDescriptor(n,t);if(o!==void 0){if(gee(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 s=i.set;if(s===void 0)return!1;return nee(s,n,r),!0}function yee(e){return Object.hasOwn(e,"value")||Object.hasOwn(e,"writable")}function gee(e){return Object.hasOwn(e,"get")||Object.hasOwn(e,"set")}var Eee=Symbol("supports property index"),_ee=Symbol("supported property indices"),Aee=Symbol("supports property name"),wee=Symbol("supported property names"),Oee=Symbol("indexed property get"),See=Symbol("indexed property set new"),Cee=Symbol("indexed property set existing"),bee=Symbol("named property get"),Dee=Symbol("named property set new"),Tee=Symbol("named property set existing"),Mee=Symbol("named property delete"),Pee=Symbol("async iterator get the next iteration result"),Bee=Symbol("async iterator return steps"),Fee=Symbol("async iterator initialization steps"),Nee=Symbol("async iterator end of iteration");MM.exports=TM={isObject:wM,define:iee,newObjectInRealm:see,wrapperSymbol:OM,implSymbol:SM,getSameObject:uee,ctorRegistrySymbol:z0,initCtorRegistry:CM,wrapperForImpl:bM,implForWrapper:DM,tryWrapperForImpl:aee,tryImplForWrapper:cee,iterInternalSymbol:lee,isArrayBuffer:dee,isArrayIndexPropName:hee,supportsPropertyIndex:Eee,supportedPropertyIndices:_ee,supportsPropertyName:Aee,supportedPropertyNames:wee,indexedGet:Oee,indexedSetNew:See,indexedSetExisting:Cee,namedGet:bee,namedSetNew:Dee,namedSetExisting:Tee,namedDelete:Mee,asyncIteratorNext:Pee,asyncIteratorReturn:Bee,asyncIteratorInit:Fee,asyncIteratorEOI:Nee,iteratorResult:pee,ordinarySetWithOwnDescriptor:mee}});var xM=g(function(c2e,RM){var Iee=/^xn--/,$ee=/[^\0-\x7F]/,Ree=/[\x2E\u3002\uFF0E\uFF61]/g,xee={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Wo=Math.floor,M6=String.fromCharCode;function Fa(e){throw RangeError(xee[e])}function vee(e,t){let r=[],n=e.length;while(n--)r[n]=t(e[n]);return r}function BM(e,t){let r=e.split("@"),n="";if(r.length>1)n=r[0]+"@",e=r[1];e=e.replace(Ree,".");let i=e.split("."),s=vee(i,t).join(".");return n+s}function FM(e){let t=[],r=0,n=e.length;while(r<n){let i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){let s=e.charCodeAt(r++);if((s&64512)==56320)t.push(((i&1023)<<10)+(s&1023)+65536);else t.push(i),r--}else t.push(i)}return t}var kee=(e)=>String.fromCodePoint(...e),qee=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},PM=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},NM=function(e,t,r){let n=0;e=r?Wo(e/700):e>>1,e+=Wo(e/t);for(;e>455;n+=36)e=Wo(e/35);return Wo(n+36*e/(e+38))},IM=function(e){let t=[],r=e.length,n=0,i=128,s=72,o=e.lastIndexOf("-");if(o<0)o=0;for(let u=0;u<o;++u){if(e.charCodeAt(u)>=128)Fa("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)Fa("invalid-input");let h=qee(e.charCodeAt(u++));if(h>=36)Fa("invalid-input");if(h>Wo((2147483647-n)/l))Fa("overflow");n+=h*l;let d=f<=s?1:f>=s+26?26:f-s;if(h<d)break;let p=36-d;if(l>Wo(2147483647/p))Fa("overflow");l*=p}let c=t.length+1;if(s=NM(n-a,c,a==0),Wo(n/c)>2147483647-i)Fa("overflow");i+=Wo(n/c),n%=c,t.splice(n++,0,i)}return String.fromCodePoint(...t)},$M=function(e){let t=[];e=FM(e);let r=e.length,n=128,i=0,s=72;for(let a of e)if(a<128)t.push(M6(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>Wo((2147483647-i)/c))Fa("overflow");i+=(a-n)*c,n=a;for(let l of e){if(l<n&&++i>2147483647)Fa("overflow");if(l===n){let f=i;for(let h=36;;h+=36){let d=h<=s?1:h>=s+26?26:h-s;if(f<d)break;let p=f-d,m=36-d;t.push(M6(PM(d+p%m,0))),f=Wo(p/m)}t.push(M6(PM(f,0))),s=NM(i,c,u===o),i=0,++u}}++i,++n}return t.join("")},jee=function(e){return BM(e,function(t){return Iee.test(t)?IM(t.slice(4).toLowerCase()):t})},Lee=function(e){return BM(e,function(t){return $ee.test(t)?"xn--"+$M(t):t})},Uee={version:"2.3.1",ucs2:{decode:FM,encode:kee},decode:IM,encode:$M,toASCII:Lee,toUnicode:jee};RM.exports=Uee});var kM=g(function(l2e,vM){var Vee=/[\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,zee=/[\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,Wee=/[\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,Hee=/[\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,Kee=/[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,Gee=/[\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,Yee=/^[\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,Qee=/[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,Jee=/[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,Xee=/[\u0600-\u0605\u0660-\u0669\u066B\u066C\u06DD\u0890\u0891\u08E2\u{10D30}-\u{10D39}\u{10D40}-\u{10D49}\u{10E60}-\u{10E7E}]/u,Zee=/^[\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,ete=/[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;vM.exports={combiningMarks:Vee,combiningClassVirama:zee,validZWNJ:Wee,bidiDomain:Hee,bidiS1LTR:Kee,bidiS1RTL:Gee,bidiS2:Yee,bidiS3:Qee,bidiS4EN:Jee,bidiS4AN:Xee,bidiS5:Zee,bidiS6:ete}});var qM=g(function(h2e,tte){tte.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 LM=g(function(f2e,jM){jM.exports.STATUS_MAPPING={mapped:1,valid:2,disallowed:3,deviation:6,ignored:7}});var WM=g(function(d2e,zM){var O1=xM(),sr=kM(),P6=qM(),{STATUS_MAPPING:Na}=LM();function B6(e){return/[^\x00-\x7F]/u.test(e)}function UM(e){let t=0,r=P6.length-1;while(t<=r){let n=Math.floor((t+r)/2),i=P6[n],s=Array.isArray(i[0])?i[0][0]:i[0],o=Array.isArray(i[0])?i[0][1]:i[0];if(s<=e&&o>=e)return i.slice(1);else if(s>e)r=n-1;else t=n+1}return null}function rte(e,{transitionalProcessing:t}){let r="";for(let n of e){let[i,s]=UM(n.codePointAt(0));switch(i){case Na.disallowed:r+=n;break;case Na.ignored:break;case Na.mapped:if(t&&n==="ẞ")r+="ss";else r+=s;break;case Na.deviation:if(t)r+=s;else r+=n;break;case Na.valid:r+=n;break}}return r}function nte(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,transitionalProcessing:i,useSTD3ASCIIRules:s,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(sr.combiningMarks.test(u[0]))return!1;for(let a of u){let c=a.codePointAt(0),[l]=UM(c);if(i){if(l!==Na.valid)return!1}else if(l!==Na.valid&&l!==Na.deviation)return!1;if(s&&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(sr.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(sr.validZWNJ.test(h.join(""))){a=c+1;continue}}}return!1}}if(r&&o){let a;if(sr.bidiS1LTR.test(u[0]))a=!1;else if(sr.bidiS1RTL.test(u[0]))a=!0;else return!1;if(a){if(!sr.bidiS2.test(e)||!sr.bidiS3.test(e)||sr.bidiS4EN.test(e)&&sr.bidiS4AN.test(e))return!1}else if(!sr.bidiS5.test(e)||!sr.bidiS6.test(e))return!1}return!0}function ite(e){let t=e.map((r)=>{if(r.startsWith("xn--"))try{return O1.decode(r.substring(4))}catch{return""}return r}).join(".");return sr.bidiDomain.test(t)}function VM(e,t){let r=rte(e,t);r=r.normalize("NFC");let n=r.split("."),i=ite(n),s=!1;for(let[o,u]of n.entries()){let a=u,c=t.transitionalProcessing;if(a.startsWith("xn--")){if(B6(a)){s=!0;continue}try{a=O1.decode(a.substring(4))}catch{if(!t.ignoreInvalidPunycode){s=!0;continue}}if(n[o]=a,a===""||!B6(a))s=!0;c=!1}if(s)continue;if(!nte(a,{...t,transitionalProcessing:c,isBidi:i}))s=!0}return{string:n.join("."),error:s}}function ste(e,{checkHyphens:t=!1,checkBidi:r=!1,checkJoiners:n=!1,useSTD3ASCIIRules:i=!1,verifyDNSLength:s=!1,transitionalProcessing:o=!1,ignoreInvalidPunycode:u=!1}={}){let a=VM(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,useSTD3ASCIIRules:i,transitionalProcessing:o,ignoreInvalidPunycode:u}),c=a.string.split(".");if(c=c.map((l)=>{if(B6(l))try{return`xn--${O1.encode(l)}`}catch{a.error=!0}return l}),s){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 ote(e,{checkHyphens:t=!1,checkBidi:r=!1,checkJoiners:n=!1,useSTD3ASCIIRules:i=!1,transitionalProcessing:s=!1,ignoreInvalidPunycode:o=!1}={}){let u=VM(e,{checkHyphens:t,checkBidi:r,checkJoiners:n,useSTD3ASCIIRules:i,transitionalProcessing:s,ignoreInvalidPunycode:o});return{domain:u.string,error:u.error}}zM.exports={toASCII:ste,toUnicode:ote}});var N6=g(function(p2e,KM){function F6(e){return e>=48&&e<=57}function HM(e){return e>=65&&e<=90||e>=97&&e<=122}function ute(e){return HM(e)||F6(e)}function ate(e){return F6(e)||e>=65&&e<=70||e>=97&&e<=102}KM.exports={isASCIIDigit:F6,isASCIIAlpha:HM,isASCIIAlphanumeric:ute,isASCIIHex:ate}});var H0=g(function(m2e,GM){var cte=new TextEncoder,lte=new TextDecoder("utf-8",{ignoreBOM:!0});function hte(e){return cte.encode(e)}function fte(e){return lte.decode(e)}GM.exports={utf8Encode:hte,utf8DecodeWithoutBOM:fte}});var K0=g(function(y2e,tP){var{isASCIIHex:YM}=N6(),{utf8Encode:QM}=H0();function at(e){return e.codePointAt(0)}function dte(e){let t=e.toString(16).toUpperCase();if(t.length===1)t=`0${t}`;return`%${t}`}function JM(e){let t=new Uint8Array(e.byteLength),r=0;for(let n=0;n<e.byteLength;++n){let i=e[n];if(i!==37)t[r++]=i;else if(i===37&&(!YM(e[n+1])||!YM(e[n+2])))t[r++]=i;else{let s=parseInt(String.fromCodePoint(e[n+1],e[n+2]),16);t[r++]=s,n+=2}}return t.slice(0,r)}function pte(e){let t=QM(e);return JM(t)}function I6(e){return e<=31||e>126}var mte=new Set([at(" "),at('"'),at("<"),at(">"),at("`")]);function yte(e){return I6(e)||mte.has(e)}var gte=new Set([at(" "),at('"'),at("#"),at("<"),at(">")]);function $6(e){return I6(e)||gte.has(e)}function Ete(e){return $6(e)||e===at("'")}var _te=new Set([at("?"),at("`"),at("{"),at("}"),at("^")]);function XM(e){return $6(e)||_te.has(e)}var Ate=new Set([at("/"),at(":"),at(";"),at("="),at("@"),at("["),at("\\"),at("]"),at("|")]);function ZM(e){return XM(e)||Ate.has(e)}var wte=new Set([at("$"),at("%"),at("&"),at("+"),at(",")]);function Ote(e){return ZM(e)||wte.has(e)}var Ste=new Set([at("!"),at("'"),at("("),at(")"),at("~")]);function Cte(e){return Ote(e)||Ste.has(e)}function eP(e,t){let r=QM(e),n="";for(let i of r)if(!t(i))n+=String.fromCharCode(i);else n+=dte(i);return n}function bte(e,t){return eP(String.fromCodePoint(e),t)}function Dte(e,t,r=!1){let n="";for(let i of e)if(r&&i===" ")n+="+";else n+=eP(i,t);return n}tP.exports={isC0ControlPercentEncode:I6,isFragmentPercentEncode:yte,isQueryPercentEncode:$6,isSpecialQueryPercentEncode:Ete,isPathPercentEncode:XM,isUserinfoPercentEncode:ZM,isURLEncodedPercentEncode:Cte,percentDecodeString:pte,percentDecodeBytes:JM,utf8PercentEncodeString:Dte,utf8PercentEncodeCodePoint:bte}});var j6=g(function(g2e,di){var sP=WM(),ft=N6(),{utf8DecodeWithoutBOM:Tte}=H0(),{percentDecodeString:Mte,utf8PercentEncodeCodePoint:Y0,utf8PercentEncodeString:Q0,isC0ControlPercentEncode:oP,isFragmentPercentEncode:Pte,isQueryPercentEncode:Bte,isSpecialQueryPercentEncode:Fte,isPathPercentEncode:Nte,isUserinfoPercentEncode:v6}=K0();function K(e){return e.codePointAt(0)}var uP={ftp:21,file:null,http:80,https:443,ws:80,wss:443},qe=Symbol("failure");function rP(e){return[...e].length}function nP(e,t){let r=e[t];return isNaN(r)?void 0:String.fromCodePoint(r)}function iP(e){return e==="."||e.toLowerCase()==="%2e"}function Ite(e){return e=e.toLowerCase(),e===".."||e==="%2e."||e===".%2e"||e==="%2e%2e"}function $te(e,t){return ft.isASCIIAlpha(e)&&(t===K(":")||t===K("|"))}function aP(e){return e.length===2&&ft.isASCIIAlpha(e.codePointAt(0))&&(e[1]===":"||e[1]==="|")}function Rte(e){return e.length===2&&ft.isASCIIAlpha(e.codePointAt(0))&&e[1]===":"}function cP(e){return e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function xte(e){return cP(e)||e.search(/[\u0000-\u001F]|%|\u007F/u)!==-1}function G0(e){return uP[e]!==void 0}function Tn(e){return G0(e.scheme)}function R6(e){return!G0(e.scheme)}function lP(e){return uP[e]}function hP(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 vte(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 s of t){let o=hP(s);if(o===qe)return qe;r.push(o)}for(let s=0;s<r.length-1;++s)if(r[s]>255)return qe;if(r[r.length-1]>=256**(5-r.length))return qe;let n=r.pop(),i=0;for(let s of r)n+=s*256**(3-i),++i;return n}function kte(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 qte(e){let t=[0,0,0,0,0,0,0,0],r=0,n=null,i=0;if(e=Array.from(e,(s)=>s.codePointAt(0)),e[i]===K(":")){if(e[i+1]!==K(":"))return qe;i+=2,++r,n=r}while(i<e.length){if(r===8)return qe;if(e[i]===K(":")){if(n!==null)return qe;++i,++r,n=r;continue}let s=0,o=0;while(o<4&&ft.isASCIIHex(e[i]))s=s*16+parseInt(nP(e,i),16),++i,++o;if(e[i]===K(".")){if(o===0)return qe;if(i-=o,r>6)return qe;let u=0;while(e[i]!==void 0){let a=null;if(u>0)if(e[i]===K(".")&&u<4)++i;else return qe;if(!ft.isASCIIDigit(e[i]))return qe;while(ft.isASCIIDigit(e[i])){let c=parseInt(nP(e,i));if(a===null)a=c;else if(a===0)return qe;else a=a*10+c;if(a>255)return qe;++i}if(t[r]=t[r]*256+a,++u,u===2||u===4)++r}if(u!==4)return qe;break}else if(e[i]===K(":")){if(++i,e[i]===void 0)return qe}else if(e[i]!==void 0)return qe;t[r]=s,++r}if(n!==null){let s=r-n;r=7;while(r!==0&&s>0){let o=t[n+s-1];t[n+s-1]=t[r],t[r]=o,--r,--s}}else if(n===null&&r!==8)return qe;return t}function jte(e){let t="",r=Vte(e),n=!1;for(let i=0;i<=7;++i){if(n&&e[i]===0)continue;else if(n)n=!1;if(r===i){t+=i===0?"::":":",n=!0;continue}if(t+=e[i].toString(16),i!==7)t+=":"}return t}function x6(e,t=!1){if(e[0]==="["){if(e[e.length-1]!=="]")return qe;return qte(e.substring(1,e.length-1))}if(t)return Ute(e);let r=Tte(Mte(e)),n=zte(r);if(n===qe)return qe;if(Lte(n))return vte(n);return n}function Lte(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(hP(r)!==qe)return!0;if(/^[0-9]+$/u.test(r))return!0;return!1}function Ute(e){if(cP(e))return qe;return Q0(e,oP)}function Vte(e){let t=null,r=1,n=null,i=0;for(let s=0;s<e.length;++s)if(e[s]!==0){if(i>r)t=n,r=i;n=null,i=0}else{if(n===null)n=s;++i}if(i>r)return n;return t}function k6(e){if(typeof e==="number")return kte(e);if(e instanceof Array)return`[${jte(e)}]`;return e}function zte(e,t=!1){let r=sP.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(xte(r))return qe}return r}function Wte(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 Hte(e){return e.replace(/\u0009|\u000A|\u000D/ug,"")}function fP(e){let{path:t}=e;if(t.length===0)return;if(e.scheme==="file"&&t.length===1&&Gte(t[0]))return;t.pop()}function dP(e){return e.username!==""||e.password!==""}function Kte(e){return e.host===null||e.host===""||e.scheme==="file"}function Wf(e){return typeof e.path==="string"}function Gte(e){return/^[A-Za-z]:$/u.test(e)}function Ar(e,t,r,n,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=r||"utf-8",this.stateOverride=i,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=Wte(this.input);if(o!==this.input)this.parseError=!0;this.input=o}let s=Hte(this.input);if(s!==this.input)this.parseError=!0;this.input=s,this.state=i||"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)&&!G0(this.buffer))return!1;if(!Tn(this.url)&&G0(this.buffer))return!1;if((dP(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===lP(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||Wf(this.base)&&t!==K("#"))return qe;else if(Wf(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=rP(this.buffer);for(let i=0;i<n;++i){let s=this.buffer.codePointAt(i);if(s===K(":")&&!this.passwordTokenSeen){this.passwordTokenSeen=!0;continue}let o=Y0(s,v6);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-=rP(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=x6(this.buffer,R6(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===""&&(dP(this.url)||this.url.port!==null))return this.parseError=!0,qe;let n=x6(this.buffer,R6(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===lP(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 Yte=new Set([K("/"),K("\\"),K("?"),K("#")]);function pP(e,t){let r=e.length-t;return r>=2&&$te(e[t],e[t+1])&&(r===2||Yte.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,!pP(this.input,this.pointer))fP(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(!pP(this.input,this.pointer)&&Rte(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&&aP(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=x6(this.buffer,R6(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(Ite(this.buffer)){if(fP(this.url),t!==K("/")&&!(Tn(this.url)&&t===K("\\")))this.url.path.push("")}else if(iP(this.buffer)&&t!==K("/")&&!(Tn(this.url)&&t===K("\\")))this.url.path.push("");else if(!iP(this.buffer)){if(this.url.scheme==="file"&&this.url.path.length===0&&aP(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+=Y0(t,Nte)}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+=Y0(t,oP)}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)?Fte:Bte;if(this.url.query+=Q0(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+=Y0(t,Pte)}return!0};function Qte(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+=k6(e.host),e.port!==null)r+=`:${e.port}`}if(e.host===null&&!Wf(e)&&e.path.length>1&&e.path[0]==="")r+="/.";if(r+=q6(e),e.query!==null)r+=`?${e.query}`;if(!t&&e.fragment!==null)r+=`#${e.fragment}`;return r}function Jte(e){let t=`${e.scheme}://`;if(t+=k6(e.host),e.port!==null)t+=`:${e.port}`;return t}function q6(e){if(Wf(e))return e.path;let t="";for(let r of e.path)t+=`/${r}`;return t}di.exports.serializeURL=Qte;di.exports.serializePath=q6;di.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":{let t=di.exports.parseURL(q6(e));if(t===null)return"null";if(t.scheme!=="http"&&t.scheme!=="https")return"null";return di.exports.serializeURLOrigin(t)}case"ftp":case"http":case"https":case"ws":case"wss":return Jte({scheme:e.scheme,host:e.host,port:e.port});case"file":return"null";default:return"null"}};di.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};di.exports.setTheUsername=function(e,t){e.username=Q0(t,v6)};di.exports.setThePassword=function(e,t){e.password=Q0(t,v6)};di.exports.serializeHost=k6;di.exports.cannotHaveAUsernamePasswordPort=Kte;di.exports.hasAnOpaquePath=Wf;di.exports.serializeInteger=function(e){return String(e)};di.exports.parseURL=function(e,t){if(t===void 0)t={};return di.exports.basicURLParse(e,{baseURL:t.baseURL,encodingOverride:t.encodingOverride})}});var L6=g(function(E2e,wP){var{utf8Encode:Xte,utf8DecodeWithoutBOM:mP}=H0(),{percentDecodeBytes:yP,utf8PercentEncodeString:gP,isURLEncodedPercentEncode:EP}=K0();function _P(e){return e.codePointAt(0)}function Zte(e){let t=rre(e,_P("&")),r=[];for(let n of t){if(n.length===0)continue;let i,s,o=n.indexOf(_P("="));if(o>=0)i=n.slice(0,o),s=n.slice(o+1);else i=n,s=new Uint8Array(0);i=AP(i,43,32),s=AP(s,43,32);let u=mP(yP(i)),a=mP(yP(s));r.push([u,a])}return r}function ere(e){return Zte(Xte(e))}function tre(e){let t="";for(let[r,n]of e.entries()){let i=gP(n[0],EP,!0),s=gP(n[1],EP,!0);if(r!==0)t+="&";t+=`${i}=${s}`}return t}function rre(e,t){let r=[],n=0,i=e.indexOf(t);while(i>=0)r.push(e.slice(n,i)),n=i+1,i=e.indexOf(t,n);if(n!==e.length)r.push(e.slice(n));return r}function AP(e,t,r){let n=e.indexOf(t);while(n>=0)e[n]=r,n=e.indexOf(t,n+1);return e}wP.exports={parseUrlencodedString:ere,serializeUrlencoded:tre}});var SP=g(function(OP){var J0=V0(),Ia=W0();OP.convert=(e,t,{context:r="The provided value"}={})=>{if(typeof t!=="function")throw new e.TypeError(r+" is not a function");function n(...i){let s=Ia.tryWrapperForImpl(this),o;for(let u=0;u<i.length;u++)i[u]=Ia.tryWrapperForImpl(i[u]);return o=Reflect.apply(t,s,i),o=J0.any(o,{context:r,globals:e}),o}return n.construct=(...i)=>{for(let o=0;o<i.length;o++)i[o]=Ia.tryWrapperForImpl(i[o]);let s=Reflect.construct(t,i);return s=J0.any(s,{context:r,globals:e}),s},n[Ia.wrapperSymbol]=t,n.objectReference=t,n}});var bP=g(function(CP){var S1=L6();CP.implementation=class{constructor(t,r,{doNotStripQMark:n=!1}){let i=r[0];if(this._list=[],this._url=null,!n&&typeof i==="string"&&i[0]==="?")i=i.slice(1);if(Array.isArray(i))for(let s of i){if(s.length!==2)throw TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");this._list.push([s[0],s[1]])}else if(typeof i==="object"&&Object.getPrototypeOf(i)===null)for(let s of Object.keys(i)){let o=i[s];this._list.push([s,o])}else this._list=S1.parseUrlencodedString(i)}_updateSteps(){if(this._url!==null){let t=S1.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,i=0;while(i<this._list.length)if(this._list[i][0]===t)if(n)this._list.splice(i,1);else n=!0,this._list[i][1]=r,i++;else i++;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 S1.serializeUrlencoded(this._list)}}});var U6=g(function(At){var qt=V0(),Pe=W0(),TP=SP(),DP=Pe.newObjectInRealm,Fr=Pe.implSymbol,MP=Pe.ctorRegistrySymbol;At.is=(e)=>Pe.isObject(e)&&Object.hasOwn(e,Fr)&&e[Fr]instanceof $a.implementation;At.isImpl=(e)=>Pe.isObject(e)&&e instanceof $a.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 i=e[MP]["URLSearchParams Iterator"],s=Object.create(i);return Object.defineProperty(s,Pe.iterInternalSymbol,{value:{target:t,kind:r,index:0},configurable:!0}),s};function PP(e,t){let r;if(t!==void 0)r=t.prototype;if(!Pe.isObject(r))r=e[MP].URLSearchParams.prototype;return Object.create(r)}At.create=(e,t,r)=>{let n=PP(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 $a.implementation(t,r,n),configurable:!0}),e[Fr][Pe.wrapperSymbol]=e,$a.init)$a.init(e[Fr]);return e};At.new=(e,t)=>{let r=PP(e,t);if(At._internalSetup(r,e),Object.defineProperty(r,Fr,{value:Object.create($a.implementation.prototype),configurable:!0}),r[Fr][Pe.wrapperSymbol]=r,$a.init)$a.init(r[Fr]);return r[Fr]};var nre=new Set(["Window","Worker"]);At.install=(e,t)=>{if(!t.some((i)=>nre.has(i)))return;let r=Pe.initCtorRegistry(e);class n{constructor(){let i=[];{let s=arguments[0];if(s!==void 0)if(Pe.isObject(s))if(s[Symbol.iterator]!==void 0)if(!Pe.isObject(s))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");else{let o=[],u=s;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)}s=o}else if(!Pe.isObject(s))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(s)){let a=Object.getOwnPropertyDescriptor(s,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=s[u];l=qt.USVString(l,{context:"Failed to construct 'URLSearchParams': parameter 1 record's value",globals:e}),o[c]=l}}s=o}else s=qt.USVString(s,{context:"Failed to construct 'URLSearchParams': parameter 1",globals:e});else s="";i.push(s)}return At.setup(Object.create(new.target.prototype),e,i)}append(i,s){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(i){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))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(s[Fr].delete(...o))}get(i){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))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 s[Fr].get(...o)}getAll(i){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))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(s[Fr].getAll(...o))}has(i){let s=this!==null&&this!==void 0?this:e;if(!At.is(s))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 s[Fr].has(...o)}set(i,s){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 i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");return Pe.tryWrapperForImpl(i[Fr].sort())}toString(){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");return i[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(i){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.");i=TP.convert(e,i,{context:"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"});let s=arguments[1],o=Array.from(this[Fr]),u=0;while(u<o.length){let[a,c]=o[u].map(Pe.tryWrapperForImpl);i.call(s,c,a,this),o=Array.from(this[Fr]),u++}}get size(){let i=this!==null&&this!==void 0?this:e;if(!At.is(i))throw new e.TypeError("'get size' called on an object that is not a valid instance of URLSearchParams.");return i[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 i=this&&this[Pe.iterInternalSymbol];if(!i)throw new e.TypeError("next() called on a value that is not a URLSearchParams iterator object");let{target:s,kind:o,index:u}=i,a=Array.from(s[Fr]),c=a.length;if(u>=c)return DP(e,{value:void 0,done:!0});let l=a[u];return i.index=u+1,DP(e,Pe.iteratorResult(l.map(Pe.tryWrapperForImpl),o))}}),Object.defineProperty(e,"URLSearchParams",{configurable:!0,writable:!0,value:n})};var $a=bP()});var NP=g(function(FP){var _e=j6(),X0=L6(),BP=U6();FP.implementation=class e{constructor(t,[r,n]){let i=null;if(n!==void 0){if(i=_e.basicURLParse(n),i===null)throw TypeError(`Invalid base URL: ${n}`)}let s=_e.basicURLParse(r,{baseURL:i});if(s===null)throw TypeError(`Invalid URL: ${r}`);let o=s.query!==null?s.query:"";this._url=s,this._query=BP.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=_e.basicURLParse(r),n===null)return!1}if(_e.basicURLParse(t,{baseURL:n})===null)return!1;return!0}get href(){return _e.serializeURL(this._url)}set href(t){let r=_e.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=X0.parseUrlencodedString(n)}get origin(){return _e.serializeURLOrigin(this._url)}get protocol(){return`${this._url.scheme}:`}set protocol(t){_e.basicURLParse(`${t}:`,{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(t){if(_e.cannotHaveAUsernamePasswordPort(this._url))return;_e.setTheUsername(this._url,t)}get password(){return this._url.password}set password(t){if(_e.cannotHaveAUsernamePasswordPort(this._url))return;_e.setThePassword(this._url,t)}get host(){let t=this._url;if(t.host===null)return"";if(t.port===null)return _e.serializeHost(t.host);return`${_e.serializeHost(t.host)}:${_e.serializeInteger(t.port)}`}set host(t){if(_e.hasAnOpaquePath(this._url))return;_e.basicURLParse(t,{url:this._url,stateOverride:"host"})}get hostname(){if(this._url.host===null)return"";return _e.serializeHost(this._url.host)}set hostname(t){if(_e.hasAnOpaquePath(this._url))return;_e.basicURLParse(t,{url:this._url,stateOverride:"hostname"})}get port(){if(this._url.port===null)return"";return _e.serializeInteger(this._url.port)}set port(t){if(_e.cannotHaveAUsernamePasswordPort(this._url))return;if(t==="")this._url.port=null;else _e.basicURLParse(t,{url:this._url,stateOverride:"port"})}get pathname(){return _e.serializePath(this._url)}set pathname(t){if(_e.hasAnOpaquePath(this._url))return;this._url.path=[],_e.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="",_e.basicURLParse(n,{url:r,stateOverride:"query"}),this._query._list=X0.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="",_e.basicURLParse(r,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}});var $P=g(function(He){var Tt=V0(),Gt=W0(),wt=Gt.implSymbol,ire=Gt.ctorRegistrySymbol;He.is=(e)=>Gt.isObject(e)&&Object.hasOwn(e,wt)&&e[wt]instanceof Ho.implementation;He.isImpl=(e)=>Gt.isObject(e)&&e instanceof Ho.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 IP(e,t){let r;if(t!==void 0)r=t.prototype;if(!Gt.isObject(r))r=e[ire].URL.prototype;return Object.create(r)}He.create=(e,t,r)=>{let n=IP(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,wt,{value:new Ho.implementation(t,r,n),configurable:!0}),e[wt][Gt.wrapperSymbol]=e,Ho.init)Ho.init(e[wt]);return e};He.new=(e,t)=>{let r=IP(e,t);if(He._internalSetup(r,e),Object.defineProperty(r,wt,{value:Object.create(Ho.implementation.prototype),configurable:!0}),r[wt][Gt.wrapperSymbol]=r,Ho.init)Ho.init(r[wt]);return r[wt]};var sre=new Set(["Window","Worker"]);He.install=(e,t)=>{if(!t.some((i)=>sre.has(i)))return;let r=Gt.initCtorRegistry(e);class n{constructor(i){if(arguments.length<1)throw new e.TypeError(`Failed to construct 'URL': 1 argument required, but only ${arguments.length} present.`);let s=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to construct 'URL': parameter 1",globals:e}),s.push(o)}{let o=arguments[1];if(o!==void 0)o=Tt.USVString(o,{context:"Failed to construct 'URL': parameter 2",globals:e});s.push(o)}return He.setup(Object.create(new.target.prototype),e,s)}toJSON(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'toJSON' called on an object that is not a valid instance of URL.");return i[wt].toJSON()}get href(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get href' called on an object that is not a valid instance of URL.");return i[wt].href}set href(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set href' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'href' property on 'URL': The provided value",globals:e}),s[wt].href=i}toString(){let i=this;if(!He.is(i))throw new e.TypeError("'toString' called on an object that is not a valid instance of URL.");return i[wt].href}get origin(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get origin' called on an object that is not a valid instance of URL.");return i[wt].origin}get protocol(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get protocol' called on an object that is not a valid instance of URL.");return i[wt].protocol}set protocol(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set protocol' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'protocol' property on 'URL': The provided value",globals:e}),s[wt].protocol=i}get username(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get username' called on an object that is not a valid instance of URL.");return i[wt].username}set username(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set username' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'username' property on 'URL': The provided value",globals:e}),s[wt].username=i}get password(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get password' called on an object that is not a valid instance of URL.");return i[wt].password}set password(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set password' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'password' property on 'URL': The provided value",globals:e}),s[wt].password=i}get host(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get host' called on an object that is not a valid instance of URL.");return i[wt].host}set host(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set host' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'host' property on 'URL': The provided value",globals:e}),s[wt].host=i}get hostname(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get hostname' called on an object that is not a valid instance of URL.");return i[wt].hostname}set hostname(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set hostname' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'hostname' property on 'URL': The provided value",globals:e}),s[wt].hostname=i}get port(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get port' called on an object that is not a valid instance of URL.");return i[wt].port}set port(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set port' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'port' property on 'URL': The provided value",globals:e}),s[wt].port=i}get pathname(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get pathname' called on an object that is not a valid instance of URL.");return i[wt].pathname}set pathname(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set pathname' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'pathname' property on 'URL': The provided value",globals:e}),s[wt].pathname=i}get search(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get search' called on an object that is not a valid instance of URL.");return i[wt].search}set search(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set search' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'search' property on 'URL': The provided value",globals:e}),s[wt].search=i}get searchParams(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))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(i[wt].searchParams))}get hash(){let i=this!==null&&this!==void 0?this:e;if(!He.is(i))throw new e.TypeError("'get hash' called on an object that is not a valid instance of URL.");return i[wt].hash}set hash(i){let s=this!==null&&this!==void 0?this:e;if(!He.is(s))throw new e.TypeError("'set hash' called on an object that is not a valid instance of URL.");i=Tt.USVString(i,{context:"Failed to set the 'hash' property on 'URL': The provided value",globals:e}),s[wt].hash=i}static parse(i){if(arguments.length<1)throw new e.TypeError(`Failed to execute 'parse' on 'URL': 1 argument required, but only ${arguments.length} present.`);let s=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to execute 'parse' on 'URL': parameter 1",globals:e}),s.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});s.push(o)}return Gt.tryWrapperForImpl(Ho.implementation.parse(e,...s))}static canParse(i){if(arguments.length<1)throw new e.TypeError(`Failed to execute 'canParse' on 'URL': 1 argument required, but only ${arguments.length} present.`);let s=[];{let o=arguments[0];o=Tt.USVString(o,{context:"Failed to execute 'canParse' on 'URL': parameter 1",globals:e}),s.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});s.push(o)}return Ho.implementation.canParse(...s)}}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 Ho=NP()});var RP=g(function(V6){var ore=$P(),ure=U6();V6.URL=ore;V6.URLSearchParams=ure});var xP=g(function(Un){var{URL:are,URLSearchParams:cre}=RP(),wr=j6(),Z0=K0(),ey={Array,Object,Promise,String,TypeError};are.install(ey,["Window"]);cre.install(ey,["Window"]);Un.URL=ey.URL;Un.URLSearchParams=ey.URLSearchParams;Un.parseURL=wr.parseURL;Un.basicURLParse=wr.basicURLParse;Un.serializeURL=wr.serializeURL;Un.serializePath=wr.serializePath;Un.serializeHost=wr.serializeHost;Un.serializeInteger=wr.serializeInteger;Un.serializeURLOrigin=wr.serializeURLOrigin;Un.setTheUsername=wr.setTheUsername;Un.setThePassword=wr.setThePassword;Un.cannotHaveAUsernamePasswordPort=wr.cannotHaveAUsernamePasswordPort;Un.hasAnOpaquePath=wr.hasAnOpaquePath;Un.percentDecodeString=Z0.percentDecodeString;Un.percentDecodeBytes=Z0.percentDecodeBytes});var kP=g(function(Ko){var lre=Ko&&Ko.__createBinding||(Object.create?function(e,t,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(t,r);if(!i||("get"in i?!t.__esModule:i.writable||i.configurable))i={enumerable:!0,get:function(){return t[r]}};Object.defineProperty(e,n,i)}:function(e,t,r,n){if(n===void 0)n=r;e[n]=t[r]}),hre=Ko&&Ko.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fre=Ko&&Ko.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i))n[n.length]=i;return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null){for(var n=e(t),i=0;i<n.length;i++)if(n[i]!=="default")lre(r,t,n[i])}return hre(r,t),r}}();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.redactValidConnectionString=dre;Ko.redactConnectionString=pre;var vP=fre(z6());function dre(e,t){let r=e.clone(),n=t?.replacementString??"_credentials_",i=t?.redactUsernames??!0;if((r.username||r.password)&&i)r.username=n,r.password="";else if(r.password)r.password=n;if(r.searchParams.has("authMechanismProperties")){let s=new vP.CommaAndColonSeparatedRecord(r.searchParams.get("authMechanismProperties"));if(s.get("AWS_SESSION_TOKEN"))s.set("AWS_SESSION_TOKEN",n),r.searchParams.set("authMechanismProperties",s.toString())}if(r.searchParams.has("tlsCertificateKeyFilePassword"))r.searchParams.set("tlsCertificateKeyFilePassword",n);if(r.searchParams.has("proxyUsername")&&i)r.searchParams.set("proxyUsername",n);if(r.searchParams.has("proxyPassword"))r.searchParams.set("proxyPassword",n);return r}function pre(e,t){let r=t?.replacementString??"<credentials>",n=t?.redactUsernames??!0,i;try{i=new vP.default(e)}catch{}if(i)return t={...t,replacementString:"___credentials___"},i.redact(t).toString().replace(/___credentials___/g,r);let s=r,o=[(u)=>u.replace(n?/(\/\/)(.*)(@)/g:/(\/\/[^@]*:)(.*)(@)/g,`$1${s}$3`),(u)=>u.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi,`$1${s}`),(u)=>u.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi,`$1${s}`),(u)=>n?u.replace(/(proxyUsername=)([^&]+)/gi,`$1${s}`):u,(u)=>u.replace(/(proxyPassword=)([^&]+)/gi,`$1${s}`)];for(let u of o)e=u(e);return e}});var z6=g(function(Iu){Object.defineProperty(Iu,"__esModule",{value:!0});Iu.CommaAndColonSeparatedRecord=Iu.ConnectionString=Iu.redactConnectionString=void 0;var qP=xP(),ty=kP();Object.defineProperty(Iu,"redactConnectionString",{enumerable:!0,get:function(){return ty.redactConnectionString}});var Hf="__this_is_a_placeholder__";function mre(e){return e.startsWith("mongodb://")||e.startsWith("mongodb+srv://")}var yre=/^(?<protocol>[^/]+):\/\/(?:(?<username>[^:@]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;class W6 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 gre(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 W6.prototype._normalizeKey.call(this,r)}}}class jP extends qP.URL{}class _o extends Error{get name(){return"MongoParseError"}}class Kf extends jP{_hosts;constructor(e,t={}){let{looseValidation:r}=t;if(!r&&!mre(e))throw new _o('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');let n=e.match(yre);if(!n)throw new _o("Invalid connection string");let{protocol:i,username:s,password:o,hosts:u,rest:a}=n.groups??{};if(!r){if(!i||!u)throw new _o("Protocol and host list are required in the uri");try{decodeURIComponent(s??""),decodeURIComponent(o??"")}catch(f){throw new _o(f.message)}let l=/[:/?#[\]@]/gi;if(s?.match(l))throw new _o(`Username contains unescaped characters ${s}`);if(!s||!o){let f=e.replace(`${i}://`,"");if(f.startsWith("@")||f.startsWith(":"))throw new _o("URI contained empty userinfo section")}if(o?.match(l))throw new _o("Password contains unescaped characters");if(a?.match(/^[^/?]*@/))throw new _o("Invalid connection string")}let c="";if(typeof s==="string")c+=s;if(typeof o==="string")c+=`:${o}`;if(c)c+="@";try{super(`${i.toLowerCase()}://${c}${Hf}${a}`)}catch(l){if(r)new Kf(e,{...t,looseValidation:!1});if(typeof l.message==="string")l.message=l.message.replace(Hf,()=>u);throw l}if(this._hosts=u.split(","),!r){if(this.isSRV&&this.hosts.length!==1)throw new _o("mongodb+srv URI cannot have multiple service names");if(this.isSRV&&this.hosts.some((l)=>l.includes(":")))throw new _o("mongodb+srv URI cannot have port number")}if(!this.pathname)this.pathname="/";Object.setPrototypeOf(this.searchParams,gre(this.searchParams.constructor).prototype)}get host(){return Hf}set host(e){throw Error("No single host for connection string")}get hostname(){return Hf}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(Hf,()=>this.hosts.join(","))}clone(){return new Kf(this.toString(),{looseValidation:!0})}redact(e){return ty.redactValidConnectionString(this,e)}typedSearchParams(){return this.searchParams}[Symbol.for("nodejs.util.inspect.custom")](){let{href:e,origin:t,protocol:r,username:n,password:i,hosts:s,pathname:o,search:u,searchParams:a,hash:c}=this;return{href:e,origin:t,protocol:r,username:n,password:i,hosts:s,pathname:o,search:u,searchParams:a,hash:c}}}Iu.ConnectionString=Kf;class LP extends W6{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(",")}}Iu.CommaAndColonSeparatedRecord=LP;Iu.default=Kf});var C1=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 UP=X();class Ra extends UP.MongoError{constructor(e,t={}){super(e,t)}get name(){return"MongoCryptError"}}Vn.MongoCryptError=Ra;var Ere=(e)=>new Ra(e.message,{cause:e});Vn.defaultErrorWrapper=Ere;class VP extends Ra{constructor(e){super(e)}get name(){return"MongoCryptInvalidArgumentError"}}Vn.MongoCryptInvalidArgumentError=VP;class zP extends Ra{constructor(e,{cause:t}){super(`Unable to complete creating data keys: ${t.message}`,{cause:t});this.encryptedFields=e}get name(){return"MongoCryptCreateDataKeyError"}}Vn.MongoCryptCreateDataKeyError=zP;class WP extends Ra{constructor(e,{cause:t}){super(`Unable to create collection: ${t.message}`,{cause:t});this.encryptedFields=e}get name(){return"MongoCryptCreateEncryptedCollectionError"}}Vn.MongoCryptCreateEncryptedCollectionError=WP;class HP extends Ra{constructor(e,t){super(e);this.body=t}get name(){return"MongoCryptAzureKMSRequestError"}}Vn.MongoCryptAzureKMSRequestError=HP;class KP extends Ra{get name(){return"MongoCryptKMSRequestNetworkTimeoutError"}}Vn.MongoCryptKMSRequestNetworkTimeoutError=KP});var H6=g(function(ry){Object.defineProperty(ry,"__esModule",{value:!0});ry.AWSSDKCredentialProvider=void 0;var GP=require("process"),YP=Io(),QP=X();class xa{constructor(e){if(e)this._provider=e}static get awsSDK(){return xa._awsSDK??=YP.getAwsCredentialProvider(),xa._awsSDK}get provider(){if("kModuleError"in xa.awsSDK)throw xa.awsSDK.kModuleError;if(this._provider)return this._provider;let{AWS_STS_REGIONAL_ENDPOINTS:e="",AWS_REGION:t=""}=GP.env;e=e.toLowerCase(),t=t.toLowerCase();let r=t.length!==0&&e.length!==0,i=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&&i?xa.awsSDK.fromNodeProviderChain({clientConfig:{region:t}}):xa.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 QP.MongoAWSError(e.message,{cause:e})}}}ry.AWSSDKCredentialProvider=xa});var XP=g(function(K6){Object.defineProperty(K6,"__esModule",{value:!0});K6.loadAWSCredentials=_re;var JP=H6();async function _re(e,t){let r=new JP.AWSSDKCredentialProvider(t),{SecretAccessKey:n="",AccessKeyId:i="",Token:s}=await r.getCredentials(),o={secretAccessKey:n,accessKeyId:i};return s!=null&&(o.sessionToken=s),{...e,aws:o}}});var Y6=g(function($i){Object.defineProperty($i,"__esModule",{value:!0});$i.tokenCache=$i.AzureCredentialCache=$i.AZURE_BASE_URL=void 0;$i.addAzureParams=tB;$i.prepareRequest=rB;$i.fetchAzureKMSToken=nB;$i.loadAzureCredentials=Ore;var ZP=X(),eB=he(),bs=C1(),Are=6000;$i.AZURE_BASE_URL="http://169.254.169.254/metadata/identity/oauth2/token?";class G6{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()<=Are}resetCache(){this.cachedToken=null}_getToken(){return nB()}}$i.AzureCredentialCache=G6;$i.tokenCache=new G6;async function wre(e){let{status:t,body:r}=e,n=(()=>{try{return JSON.parse(r)}catch{throw new bs.MongoCryptAzureKMSRequestError("Malformed JSON body in GET request.")}})();if(t!==200)throw new bs.MongoCryptAzureKMSRequestError("Unable to complete request.",n);if(!n.access_token)throw new bs.MongoCryptAzureKMSRequestError("Malformed response body - missing field `access_token`.");if(!n.expires_in)throw new bs.MongoCryptAzureKMSRequestError("Malformed response body - missing field `expires_in`.");let i=Number(n.expires_in)*1000;if(Number.isNaN(i))throw new bs.MongoCryptAzureKMSRequestError("Malformed response body - unable to parse int from `expires_in` field.");return{accessToken:n.access_token,expiresOnTimestamp:Date.now()+i}}function tB(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 rB(e){let t=new URL(e.url?.toString()??$i.AZURE_BASE_URL);return tB(t,"https://vault.azure.net"),{headers:{...e.headers,"Content-Type":"application/json",Metadata:!0},url:t}}async function nB(e={}){let{headers:t,url:r}=rB(e);try{let n=await eB.get(r,{headers:t});return await wre(n)}catch(n){if(n instanceof ZP.MongoNetworkTimeoutError)throw new bs.MongoCryptAzureKMSRequestError(`[Azure KMS] ${n.message}`);throw n}}async function Ore(e){let t=await $i.tokenCache.getToken();return{...e,azure:t}}});var sB=g(function(Q6){Object.defineProperty(Q6,"__esModule",{value:!0});Q6.loadGCPCredentials=Sre;var iB=Io();async function Sre(e){let t=iB.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 J6=g(function(iy){Object.defineProperty(iy,"__esModule",{value:!0});iy.isEmptyCredentials=ny;iy.refreshKMSCredentials=Cre;var oB=XP(),uB=Y6(),aB=sB();function ny(e,t){let r=t[e];if(r==null)return!1;return typeof r==="object"&&Object.keys(r).length===0}async function Cre(e,t){let r=e;if(ny("aws",e))r=await oB.loadAWSCredentials(r,t?.aws);if(ny("gcp",e))r=await aB.loadGCPCredentials(r);if(ny("azure",e))r=await uB.loadAzureCredentials(r);return r}});var X6=g(function(ay){Object.defineProperty(ay,"__esModule",{value:!0});ay.StateMachine=void 0;var sy=require("fs/promises"),lB=require("net"),hB=require("process"),fB=require("tls"),an=Te(),oy=Fi(),dB=Io(),uy=X(),va=fi(),Vr=he(),pB=cy(),zn=C1(),Gf=null;function bre(){if(Gf==null){let e=dB.getSocks();if("kModuleError"in e)throw e.kModuleError;Gf=e}return Gf}var kc=0,mB=1,yB=2,gB=3,EB=7,_B=4,AB=5,wB=6,Dre=443,Tre=new Map([[kc,"MONGOCRYPT_CTX_ERROR"],[mB,"MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],[yB,"MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],[gB,"MONGOCRYPT_CTX_NEED_MONGO_KEYS"],[EB,"MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS"],[_B,"MONGOCRYPT_CTX_NEED_KMS"],[AB,"MONGOCRYPT_CTX_READY"],[wB,"MONGOCRYPT_CTX_DONE"]]),Mre=["tlsInsecure","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames"];function cB(e){if(hB.env.MONGODB_CRYPT_DEBUG)console.error(e)}var Pre;class OB{constructor(e,t=an.pluckBSONSerializeOptions(e)){this.options=e,this.bsonOptions=t}async execute(e,t,r){let{_keyVaultNamespace:n,_keyVaultClient:i,_metaDataClient:s,_mongocryptdClient:o,_mongocryptdManager:u}=e,a=null,c=()=>t.status,l=()=>t.state;while(l()!==wB&&l()!==kc)switch(r.signal?.throwIfAborted(),cB(`[context#${t.id}] ${Tre.get(l())||l()}`),l()){case mB:{let f=an.deserialize(t.nextMongoOperation());if(!s)throw new zn.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined");let h=this.fetchCollectionInfo(s,t.ns,f,r);for await(let d of h)if(t.addMongoOperationResponse(an.serialize(d)),l()===kc)break;if(l()===kc)break;t.finishMongoOperation();break}case yB:{let f=t.nextMongoOperation();if(l()===kc)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 gB:{let f=t.nextMongoOperation(),h=await this.fetchKeys(i,n,f,r);if(h.length===0)a=Pre??=an.serialize({v:[]});for(let d of h)t.addMongoOperationResponse(an.serialize(d));t.finishMongoOperation();break}case EB:{let f=await e.askForKMSCredentials();t.provideKMSProviders(an.serialize(f));break}case _B:{await Promise.all(this.requests(t,r)),t.finishKMSRequests();break}case AB:{let f=t.finalize();if(l()===kc){let h=c().message||"Finalization error";throw new zn.MongoCryptError(h)}a=f;break}default:throw new zn.MongoCryptError(`Unknown state: ${l()}`)}if(l()===kc||a==null){let f=c().message;if(!f)cB("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):Dre,i={host:r[0],servername:r[0],port:n,...pB.autoSelectSocketOptions(this.options.socketOptions||{})},s=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,E=h[m];if(E){let y=this.validateTlsOptions(m,E);if(y)throw y;try{await this.setTlsOptions(E,i)}catch(_){throw l(_)}}}let d,p;try{if(t?.signal?.throwIfAborted(),this.options.kmsConnectCallback){let b=t?.timeoutContext?.csotEnabled()?t.timeoutContext.getRemainingTimeMSOrThrow(`KMS request timed out after ${t.timeoutContext.timeoutMS}ms`):void 0,A=Number.isFinite(b)?b:void 0,P=new AbortController,S=Vr.addAbortListener(t?.signal,function(){P.abort(this.reason)}),B=this.options.kmsConnectCallback({host:i.host,port:i.port,timeoutMS:A,signal:P.signal});B.then((I)=>{if(P.signal.aborted)I.destroy()},()=>null);let q=A?va.Timeout.expires(A):void 0;try{i.socket=q?await Promise.race([B,q]):await B}catch(I){if(va.TimeoutError.is(I)){let we=new uy.MongoOperationTimeoutError("KMS request timed out");throw P.abort(we),we}throw l(I)}finally{q?.clear(),S?.[Vr.kDispose]()}}else if(this.options.proxyOptions&&this.options.proxyOptions.proxyHost){u=new lB.Socket;let{promise:b,reject:A,resolve:P}=Vr.promiseWithResolvers();u.once("error",(B)=>A(l(B))).once("close",()=>A(f())).once("connect",()=>P());let S={...i,host:this.options.proxyOptions.proxyHost,port:this.options.proxyOptions.proxyPort||1080};u.connect(S),await b;try{Gf??=bre(),i.socket=(await Gf.SocksClient.createConnection({existing_socket:u,command:"connect",destination:{host:i.host,port:i.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=fB.connect(i,()=>{a.write(s)});let{promise:m,reject:E,resolve:y}=Vr.promiseWithResolvers();d=Vr.addAbortListener(t?.signal,function(){c(),E(this.reason)}),a.once("error",(b)=>E(l(b))).once("close",()=>E(f())).on("data",(b)=>{o.append(b);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 _=t?.timeoutContext?.csotEnabled()?t.timeoutContext.getRemainingTimeMSOrThrow(`KMS request timed out after ${t.timeoutContext.timeoutMS}ms`):void 0,O=Number.isFinite(_)?_:void 0;p=O?va.Timeout.expires(O):void 0,await(p?Promise.race([m,p]):m)}catch(m){if(va.TimeoutError.is(m))throw new uy.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 Mre)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 sy.readFile(e.tlsCertificateKeyFile);t.cert=t.key=r}if(e.tlsCAFile)t.ca=await sy.readFile(e.tlsCAFile);if(e.tlsCertificateKeyFilePassword)t.passphrase=e.tlsCertificateKeyFilePassword}fetchCollectionInfo(e,t,r,n){let{db:i}=Vr.MongoDBCollectionNamespace.fromString(t);return e.db(i).listCollections(r,{promoteLongs:!1,promoteValues:!1,timeoutContext:n?.timeoutContext&&new oy.CursorTimeoutContext(n?.timeoutContext,Symbol()),signal:n?.signal,nameOnly:!1})}async markCommand(e,t,r,n){let{db:i}=Vr.MongoDBCollectionNamespace.fromString(t),s={promoteLongs:!1,promoteValues:!1},o=an.deserialize(r,s),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(i).command(o,{...s,...u});return an.serialize(a,this.bsonOptions)}fetchKeys(e,t,r,n){let{db:i,collection:s}=Vr.MongoDBCollectionNamespace.fromString(t),o={timeoutContext:void 0,signal:void 0};if(n?.timeoutContext!=null)o.timeoutContext=new oy.CursorTimeoutContext(n.timeoutContext,Symbol());if(n?.signal!=null)o.signal=n.signal;return e.db(i).collection(s,{readConcern:{level:"majority"}}).find(an.deserialize(r),o).toArray()}}ay.StateMachine=OB});var cy=g(function(Qf){Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ClientEncryption=void 0;Qf.autoSelectSocketOptions=Yf;var It=Te(),SB=Io(),Go=fi(),jt=he(),zr=C1(),ly=J6(),ka=X6();class hy{static getMongoCrypt(){let e=SB.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&&!ly.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 i=hy.getMongoCrypt();this._mongoCrypt=new i(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 i=It.serialize({provider:e,...t.masterKey}),s=this._mongoCrypt.makeDataKeyContext(i,{keyAltNames:r,keyMaterial:n}),o=new ka.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:Yf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),u=t?.timeoutContext??Go.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})),a=It.deserialize(await o.execute(this,s,{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),i=this._mongoCrypt.makeRewrapManyDataKeyContext(n,r),s=new ka.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:Yf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),o=Go.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})),{v:u}=It.deserialize(await s.execute(this,i,{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),i=[{$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},i,{writeConcern:{w:"majority"},returnDocument:"before",timeoutMS:this._timeoutMS})}async createEncryptedCollection(e,t,r){let{provider:n,masterKey:i,createCollectionOptions:{encryptedFields:{...s},...o}}=r,u=this._timeoutMS!=null?Go.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0;if(Array.isArray(s.fields)){let a=s.fields.map(async(f)=>f==null||typeof f!=="object"||f.keyId!=null?f:{...f,keyId:await this.createDataKey(n,{masterKey:i,timeoutContext:u?.csotEnabled()?u?.clone():void 0})}),c=await Promise.allSettled(a);s.fields=c.map((f,h)=>f.status==="fulfilled"?f.value:s.fields[h]);let l=c.find((f)=>f.status==="rejected");if(l!=null)throw new zr.MongoCryptCreateDataKeyError(s,{cause:l.reason})}try{return{collection:await e.createCollection(t,{...o,encryptedFields:s,timeoutMS:u?.csotEnabled()?u?.getRemainingTimeMSOrThrow():void 0}),encryptedFields:s}}catch(a){throw new zr.MongoCryptCreateEncryptedCollectionError(s,{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 ka.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:Yf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),i=this._timeoutMS!=null?Go.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:s}=It.deserialize(await n.execute(this,r,{timeoutContext:i}));return s}async askForKMSCredentials(){return await ly.refreshKMSCredentials(this._kmsProviders,this._credentialProviders)}static get libmongocryptVersion(){return hy.getMongoCrypt().libmongocryptVersion}async _encrypt(e,t,r){let{algorithm:n,keyId:i,keyAltName:s,contentionFactor:o,queryType:u,rangeOptions:a,stringOptions:c,textOptions:l}=r,f={expressionMode:t,algorithm:n};if(i)f.keyId=i.buffer;if(s){if(i)throw new zr.MongoCryptInvalidArgumentError('"options" cannot contain both "keyId" and "keyAltName"');if(typeof s!=="string")throw new zr.MongoCryptInvalidArgumentError(`"options.keyAltName" must be of type string, but was of type ${typeof s}`);f.keyAltName=It.serialize({keyAltName:s})}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 ka.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:Yf(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}),m=this._mongoCrypt.makeExplicitEncryptionContext(d,f),E=this._timeoutMS!=null?Go.TimeoutContext.create(jt.resolveTimeoutOptions(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:y}=It.deserialize(await p.execute(this,m,{timeoutContext:E}));return y}}Qf.ClientEncryption=hy;function Yf(e){let t={};if("autoSelectFamily"in e)t.autoSelectFamily=e.autoSelectFamily;if("autoSelectFamilyAttemptTimeout"in e)t.autoSelectFamilyAttemptTimeout=e.autoSelectFamilyAttemptTimeout;return t}});var bB=g(function(fy){Object.defineProperty(fy,"__esModule",{value:!0});fy.MongocryptdManager=void 0;var CB=X();class Z6{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:Z6.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 CB.MongoNetworkTimeoutError&&!this.bypassSpawn))throw r}return await this.spawn(),await e()}}fy.MongocryptdManager=Z6});var eA=g(function(T1){var DB;Object.defineProperty(T1,"__esModule",{value:!0});T1.AutoEncrypter=T1.AutoEncryptionLoggerLevel=void 0;var dy=require("net"),Wn=Te(),TB=Br(),MB=Io(),b1=X(),PB=qc(),BB=he(),D1=cy(),qa=C1(),FB=bB(),py=J6(),my=X6();T1.AutoEncryptionLoggerLevel=Object.freeze({FatalError:0,Error:1,Warning:2,Info:3,Trace:4});class yy{static{DB=TB.kDecorateResult}static getMongoCrypt(){let e=MB.getMongoDBClientEncryption();if("kModuleError"in e)throw e.kModuleError;return e.MongoCrypt}constructor(e,t){if(this[DB]=!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 qa.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&&!py.isEmptyCredentials("aws",this._kmsProviders))throw new qa.MongoCryptInvalidArgumentError("Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching");let r={errorWrapper:qa.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=yy.getMongoCrypt();if(this._mongocrypt=new n(r),this._contextCounter=0,t.extraOptions&&t.extraOptions.cryptSharedLibRequired&&!this.cryptSharedLibVersionInfo)throw new qa.MongoCryptInvalidArgumentError("`cryptSharedLibRequired` set but no crypt_shared library loaded");if(!this._bypassMongocryptdAndCryptShared&&!this.cryptSharedLibVersionInfo){this._mongocryptdManager=new FB.MongocryptdManager(t.extraOptions);let i={serverSelectionTimeoutMS:1e4};if((t.extraOptions==null||typeof t.extraOptions.mongocryptdURI!=="string")&&!dy.getDefaultAutoSelectFamily)i.family=4;if(dy.getDefaultAutoSelectFamily)Object.assign(i,D1.autoSelectSocketOptions(this._client.s?.options??{}));this._mongocryptdClient=new PB.MongoClient(this._mongocryptdManager.uri,i)}}async init(){if(this._bypassMongocryptdAndCryptShared||this.cryptSharedLibVersionInfo)return;if(!this._mongocryptdManager)throw new b1.MongoRuntimeError("Reached impossible state: mongocryptdManager is undefined when neither bypassSpawn nor the shared lib are specified.");if(!this._mongocryptdClient)throw new b1.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 b1.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),i=this._mongocrypt.makeEncryptionContext(BB.MongoDBCollectionNamespace.fromString(e).db,n);i.id=this._contextCounter++,i.ns=e,i.document=t;let s=new my.StateMachine({promoteValues:!1,promoteLongs:!1,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:D1.autoSelectSocketOptions(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback});return Wn.deserialize(await s.execute(this,i,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 my.StateMachine({...t,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:D1.autoSelectSocketOptions(this._client.s.options),kmsConnectCallback:this._kmsConnectCallback}).execute(this,r,t)}async askForKMSCredentials(){return await py.refreshKMSCredentials(this._kmsProviders,this._credentialProviders)}get cryptSharedLibVersionInfo(){return this._mongocrypt.cryptSharedLibVersionInfo}static get libmongocryptVersion(){return yy.getMongoCrypt().libmongocryptVersion}}T1.AutoEncrypter=yy});var vB=g(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});Ey.Encrypter=void 0;var NB=eA(),IB=Br(),$B=Io(),gy=X(),RB=qc();class xB{constructor(e,t,r){if(typeof r.autoEncryption!=="object")throw new gy.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 NB.AutoEncrypter(e,r.autoEncryption)}getInternalClient(e,t,r){let n=this.internalClient;if(n==null){let i={};for(let s of[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]){if(["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].includes(s))continue;Reflect.set(i,s,Reflect.get(r,s))}i.minPoolSize=0,n=new RB.MongoClient(t,i),this.internalClient=n;for(let s of IB.MONGO_CLIENT_EVENTS)for(let o of e.listeners(s))n.on(s,o);e.on("newListener",(s,o)=>{n?.on(s,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=$B.getMongoDBClientEncryption();if("kModuleError"in e)throw new gy.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"})}}Ey.Encrypter=xB});var kB=g(function(Jf){Object.defineProperty(Jf,"__esModule",{value:!0});Jf.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME=void 0;Jf.resolveRuntimeAdapters=Bre;Jf.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME="allowedDriverRequire";async function Bre(e){return{os:e.runtimeAdapters?.os??await import("os")}}});var sA=g(function(Ds){Object.defineProperty(Ds,"__esModule",{value:!0});Ds.SENSITIVE_COMMANDS=Ds.CommandFailedEvent=Ds.CommandSucceededEvent=Ds.CommandStartedEvent=void 0;var Yo=Br(),Ay=he(),_y=ca();class LB{constructor(e,t,r){this.name=Yo.COMMAND_STARTED;let n=nA(t),i=tA(n),{address:s,connectionId:o,serviceId:u}=iA(e);if(Ds.SENSITIVE_COMMANDS.has(i))this.commandObj={},this.commandObj[i]=!0;this.address=s,this.connectionId=o,this.serviceId=u,this.requestId=t.requestId,this.databaseName=t.databaseName,this.commandName=i,this.command=rA(i,n,n),this.serverConnectionId=r}get hasServiceId(){return!!this.serviceId}}Ds.CommandStartedEvent=LB;class UB{constructor(e,t,r,n,i){this.name=Yo.COMMAND_SUCCEEDED;let s=nA(t),o=tA(s),{address:u,connectionId:a,serviceId:c}=iA(e);this.address=u,this.connectionId=a,this.serviceId=c,this.requestId=t.requestId,this.commandName=o,this.duration=Ay.calculateDurationInMs(n),this.reply=rA(o,s,Ire(r)),this.serverConnectionId=i,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}}Ds.CommandSucceededEvent=UB;class VB{constructor(e,t,r,n,i){this.name=Yo.COMMAND_FAILED;let s=nA(t),o=tA(s),{address:u,connectionId:a,serviceId:c}=iA(e);this.address=u,this.connectionId=a,this.serviceId=c,this.requestId=t.requestId,this.commandName=o,this.duration=Ay.calculateDurationInMs(n),this.failure=rA(o,s,r),this.serverConnectionId=i,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}}Ds.CommandFailedEvent=VB;Ds.SENSITIVE_COMMANDS=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]);var Fre=new Set(["hello",Yo.LEGACY_HELLO_COMMAND,Yo.LEGACY_HELLO_COMMAND_CAMEL_CASE]),tA=(e)=>Object.keys(e)[0],Nre=(e)=>e.ns.split(".")[1],rA=(e,t,r)=>Ds.SENSITIVE_COMMANDS.has(e)||Fre.has(e)&&t.speculativeAuthenticate?{}:r,qB={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"},jB={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldSelector:"projection"};function nA(e){if(e instanceof _y.OpMsgRequest){let n={...e.command};for(let i of Object.keys(n))if(n[i]instanceof _y.DocumentSequence)n[i]=n[i].documents;return n}if(e.query?.$query){let n;if(e.ns==="admin.$cmd")n=Object.assign({},e.query.$query);else n={find:Nre(e)},Object.keys(qB).forEach((i)=>{if(e.query[i]!=null)n[qB[i]]={...e.query[i]}});return Object.keys(jB).forEach((i)=>{let s=i;if(e[s]!=null)n[jB[s]]=e[s]}),n}let t={},r={...e};if(e.query)t={...e.query},r.query=t;return e.query?t:r}function Ire(e){if(!e)return e;return e.result?e.result:e}function iA(e){let t;if("id"in e)t=e.id;return{address:e.address,serviceId:e.serviceId,connectionId:t}}});var Xf=g(function(M1){Object.defineProperty(M1,"__esModule",{value:!0});M1.ServerDescription=void 0;M1.parseServerType=HB;M1.compareTopologyVersion=KB;var Ts=Te(),zB=X(),Ms=he(),Ke=bi(),$re=new Set([Ke.ServerType.RSPrimary,Ke.ServerType.Standalone,Ke.ServerType.Mongos,Ke.ServerType.LoadBalancer]),Rre=new Set([Ke.ServerType.RSPrimary,Ke.ServerType.RSSecondary,Ke.ServerType.Mongos,Ke.ServerType.Standalone,Ke.ServerType.LoadBalancer]);class WB{constructor(e,t,r={}){if(e==null||e==="")throw new zB.MongoRuntimeError("ServerDescription must be provided with a non-empty address");this.address=typeof e==="string"?Ms.HostAddress.fromString(e).toString():e.toString(),this.type=HB(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=Ms.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 Ms.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 Rre.has(this.type)}get isWritable(){return $re.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||KB(this.topologyVersion,e?.topologyVersion)===0,r=this.electionId!=null&&e?.electionId!=null?Ms.compareObjectId(this.electionId,e.electionId)===0:this.electionId===e?.electionId;return e!=null&&e.iscryptd===this.iscryptd&&Ms.errorStrictEqual(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&Ms.arrayStrictEqual(this.hosts,e.hosts)&&xre(this.tags,e.tags)&&this.setName===e.setName&&this.setVersion===e.setVersion&&r&&this.primary===e.primary&&this.logicalSessionTimeoutMinutes===e.logicalSessionTimeoutMinutes&&t}}M1.ServerDescription=WB;function HB(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 xre(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((i)=>t[i]===e[i])}function KB(e,t){if(e==null||t==null)return-1;if(!e.processId.equals(t.processId))return-1;let r=typeof e.counter==="bigint"?Ts.Long.fromBigInt(e.counter):Ts.Long.isLong(e.counter)?e.counter:Ts.Long.fromNumber(e.counter),n=typeof t.counter==="bigint"?Ts.Long.fromBigInt(t.counter):Ts.Long.isLong(t.counter)?t.counter:Ts.Long.fromNumber(t.counter);return r.compare(n)}});var XB=g(function(wy){Object.defineProperty(wy,"__esModule",{value:!0});wy.StreamDescription=void 0;var GB=Te(),YB=bi(),QB=Xf(),vre=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","logicalSessionTimeoutMinutes"];class JB{constructor(e,t){this.hello=null,this.address=e,this.type=YB.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=QB.parseServerType(e),"connectionId"in e)this.serverConnectionId=this.parseServerConnectionID(e.connectionId);else this.serverConnectionId=null;for(let t of vre){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 GB.Long.isLong(e)?e.toBigInt():BigInt(e)}}wy.StreamDescription=JB});var ZB=g(function(oA){Object.defineProperty(oA,"__esModule",{value:!0});oA.onData=kre;var Qo=he();function kre(e,{timeoutContext:t,signal:r}){r?.throwIfAborted();let n=new Qo.List,i=new Qo.List,s=null,o=!1,u={next(){let d=n.shift();if(d!=null)return Promise.resolve({value:d,done:!1});if(s!=null){let y=Promise.reject(s);return s=null,y}if(o)return h();let{promise:p,resolve:m,reject:E}=Qo.promiseWithResolvers();return i.push({resolve:m,reject:E}),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=Qo.addAbortListener(r,function(){f(this.reason)}),c=t?.timeoutForSocketRead;return c?.throwIfExpired(),c?.then(void 0,f),u;function l(d){let p=i.shift();if(p!=null)p.resolve({value:d,done:!1});else n.push(d)}function f(d){let p=i.shift();if(p!=null)p.reject(d);else s=d;h()}function h(){e.off("data",l),e.off("error",f),a?.[Qo.kDispose](),o=!0,c?.clear();let d={value:void 0,done:o};for(let p of i)p.resolve(d);return Promise.resolve(d)}}});var uA=g(function(Oy){Object.defineProperty(Oy,"__esModule",{value:!0});Oy.TopologyDescription=void 0;var sF=Te(),La=Tu(),ja=X(),P1=he(),ue=bi(),Hn=Xf(),qre=La.MIN_SUPPORTED_SERVER_VERSION,jre=La.MAX_SUPPORTED_SERVER_VERSION,eF=La.MIN_SUPPORTED_WIRE_VERSION,tF=La.MAX_SUPPORTED_WIRE_VERSION,Lre=new Set([ue.ServerType.Mongos,ue.ServerType.Unknown]),rF=new Set([ue.ServerType.Mongos,ue.ServerType.Standalone]),nF=new Set([ue.ServerType.RSSecondary,ue.ServerType.RSArbiter,ue.ServerType.RSOther]);class Zf{constructor(e,t=null,r=null,n=null,i=null,s=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=i??null,this.maxSetVersion=n??null,this.commonWireVersion=s??0;for(let u of this.servers.values()){if(u.type===ue.ServerType.Unknown||u.type===ue.ServerType.LoadBalancer)continue;if(u.minWireVersion>tF)this.compatible=!1,this.compatibilityError=`Server at ${u.address} requires wire version ${u.minWireVersion}, but this version of the driver only supports up to ${tF} (MongoDB ${jre})`;if(u.maxWireVersion<eF){this.compatible=!1,this.compatibilityError=`Server at ${u.address} reports wire version ${u.maxWireVersion}, but this version of the driver requires at least ${eF} (MongoDB ${qre}).`;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()),i=new Set(r),s=new Set;for(let u of n)if(i.delete(u),!r.has(u))s.add(u);if(i.size===0&&s.size===0)return this;let o=new Map(this.servers);for(let u of s)o.delete(u);if(i.size>0){if(t===0)for(let u of i)o.set(u,new Hn.ServerDescription(u));else if(o.size<t){let u=P1.shuffle(i,t-o.size);for(let a of u)o.set(a,new Hn.ServerDescription(a))}}return new Zf(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:i,maxElectionId:s,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 Zf(ue.TopologyType.Single,a,n,i,s,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=Ure(u);if(r===ue.TopologyType.Sharded){if(!Lre.has(u))a.delete(t)}if(r===ue.TopologyType.ReplicaSetNoPrimary){if(rF.has(u))a.delete(t);if(u===ue.ServerType.RSPrimary){let c=iF(a,e,n,i,s);r=c[0],n=c[1],i=c[2],s=c[3]}else if(nF.has(u)){let c=zre(a,e,n);r=c[0],n=c[1]}}if(r===ue.TopologyType.ReplicaSetWithPrimary)if(rF.has(u))a.delete(t),r=jc(a);else if(u===ue.ServerType.RSPrimary){let c=iF(a,e,n,i,s);r=c[0],n=c[1],i=c[2],s=c[3]}else if(nF.has(u))r=Vre(a,e,n);else r=jc(a);return new Zf(r,a,n,i,s,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 sF.EJSON.serialize(this)}}Oy.TopologyDescription=Zf;function Ure(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 iF(e,t,r=null,n=null,i=null){let s=(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),[jc(e),r,n,i];if(t.maxWireVersion>=17){let a=P1.compareObjectId(i,t.electionId),c=a===0,l=a===-1,f=(n??-1)<=(t.setVersion??-1);if(l||c&&f)i=t.electionId,n=t.setVersion;else return e.set(t.address,new Hn.ServerDescription(t.address,void 0,{error:new ja.MongoStalePrimaryError(s(t,n,i))})),[jc(e),r,n,i]}else{let a=t.electionId?t.electionId:null;if(t.setVersion&&a){if(n&&i){if(n>t.setVersion||P1.compareObjectId(i,a)>0)return e.set(t.address,new Hn.ServerDescription(t.address,void 0,{error:new ja.MongoStalePrimaryError(s(t,n,i))})),[jc(e),r,n,i]}i=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 ja.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)}),[jc(e),r,n,i]}function Vre(e,t,r=null){if(r==null)throw new ja.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 jc(e)}function zre(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((i)=>{if(!e.has(i))e.set(i,new Hn.ServerDescription(i))}),t.me&&t.address!==t.me)e.delete(t.address);return[n,r]}function jc(e){for(let t of e.values())if(t.type===ue.ServerType.RSPrimary)return ue.TopologyType.ReplicaSetWithPrimary;return ue.TopologyType.ReplicaSetNoPrimary}});var aF=g(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});Cy.getReadPreference=Wre;Cy.isSharded=Hre;var oF=X(),B1=Xr(),Sy=bi(),uF=uA();function Wre(e){let t=e?.readPreference??B1.ReadPreference.primary;if(typeof t==="string")t=B1.ReadPreference.fromString(t);if(!(t instanceof B1.ReadPreference))throw new oF.MongoInvalidArgumentError('Option "readPreference" must be a ReadPreference instance');return t}function Hre(e){if(e==null)return!1;if(e.description&&e.description.type===Sy.ServerType.Mongos)return!0;if(e.description&&e.description instanceof uF.TopologyDescription)return Array.from(e.description.servers.values()).some((r)=>r.type===Sy.ServerType.Mongos);return!1}});var My=g(function($u){Object.defineProperty($u,"__esModule",{value:!0});$u.CryptoConnection=$u.SizedMessageTransform=$u.Connection=void 0;$u.hasSessionSupport=Kre;var cF=require("stream"),Ty=require("timers"),$1=Te(),Kn=Br(),$e=X(),by=Aa(),lF=Zi(),hF=Xr(),fF=bi(),F1=Rf(),Dy=fi(),Yt=he(),N1=sA(),Ua=ca(),dF=XB(),pF=Df(),mF=ZB(),Ps=St(),I1=aF();function Kre(e){return e.description.logicalSessionTimeoutMinutes!=null}function Gre(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 $1.ByteUtils.toHex(Yt.uuidV4())}class Jo extends lF.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=Gre(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 dF.StreamDescription(this.address,t),this.generation=t.generation,this.lastUseTime=Yt.processTimeMS(),this.messageStream=this.socket.on("error",this.onSocketError.bind(this)).pipe(new aA({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(by.MongoLoggableComponent.COMMAND,by.SeverityLevel.DEBUG))??!1}markAvailable(){this.lastUseTime=Yt.processTimeMS()}onSocketError(e){this.onError(new $e.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 $e.MongoNetworkError(e))}onTimeout(){this.delayedTimeoutId=Ty.setTimeout(()=>{let e=`connection ${this.id} to ${this.address} timed out`,t=this.hello==null;this.cleanup(new $e.MongoNetworkTimeoutError(e,{beforeHandshake:t}))},1).unref()}destroy(){if(this.closed)return;this.removeAllListeners(Jo.PINNED),this.removeAllListeners(Jo.UNPINNED);let e=`connection ${this.id} to ${this.address} closed`;this.cleanup(new $e.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(Jo.CLOSE)}prepareCommand(e,t,r){let n={...t},i=I1.getReadPreference(r),s=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&&s){if(s.clusterTime&&o&&s.clusterTime.clusterTime.greaterThan(o.clusterTime))o=s.clusterTime;let c=F1.applySession(s,n,r);if(c)throw c}else if(s?.explicit)throw new $e.MongoCompatibilityError("Current topology does not support sessions");if(o)n.$clusterTime=o;if(this.description.type!==fF.ServerType.Standalone){if(!I1.isSharded(this)&&!this.description.loadBalanced&&this.supportsOpMsg&&r.directConnection===!0&&i?.mode==="primary")n.$readPreference=hF.ReadPreference.primaryPreferred.toJSON();else if(I1.isSharded(this)&&!this.supportsOpMsg&&i?.mode!=="primary")n={$query:n,$readPreference:i.toJSON()};else if(i?.mode!=="primary")n.$readPreference=i.toJSON()}let u={numberToSkip:0,numberToReturn:-1,checkKeys:!1,secondaryOk:i.secondaryOk(),...r};return r.timeoutContext?.addMaxTimeMSToCommand(n,r),this.supportsOpMsg?new Ua.OpMsgRequest(e,n,u):new Ua.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 Ps.MongoDBResponse.empty;return}if(this.throwIfAborted(),t.timeoutContext?.csotEnabled()&&t.timeoutContext.minRoundTripTime!=null&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new $e.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining");for await(let i of this.readMany(t)){this.socket.setTimeout(0);let s=i.parse();yield(r??Ps.MongoDBResponse).make(s),this.throwIfAborted(),this.socket.setTimeout(n)}}finally{this.socket.setTimeout(0)}}async*sendCommand(e,t,r,n){r?.signal?.throwIfAborted();let i=this.prepareCommand(e.db,t,r),s=0;if(this.shouldEmitAndLogCommand)s=Yt.processTimeMS(),this.emitAndLogCommand(this.monitorCommands,Jo.COMMAND_STARTED,i.databaseName,this.established,new N1.CommandStartedEvent(this,i,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(i,r,n)){if(a=void 0,r.session!=null)F1.updateSessionFromResponse(r.session,u);if(u.$clusterTime)this.clusterTime=u.$clusterTime,this.emit(Jo.CLUSTER_TIME_RECEIVED,u.$clusterTime);if(u.ok===0){if(r.timeoutContext?.csotEnabled()&&u.isMaxTimeExpiredError)throw new $e.MongoOperationTimeoutError("Server reported a timeout error",{cause:new $e.MongoServerError(a??=u.toObject(o))});throw new $e.MongoServerError(a??=u.toObject(o))}if(this.shouldEmitAndLogCommand)this.emitAndLogCommand(this.monitorCommands,Jo.COMMAND_SUCCEEDED,i.databaseName,this.established,new N1.CommandSucceededEvent(this,i,i.moreToCome?{ok:1}:a??=u.toObject(o),s,this.description.serverConnectionId));if(n==null)yield a??=u.toObject(o);else yield u;this.throwIfAborted()}}catch(c){if(r.session!=null&&!(c instanceof $e.MongoServerError))F1.updateSessionFromResponse(r.session,Ps.MongoDBResponse.empty);if(this.shouldEmitAndLogCommand)this.emitAndLogCommand(this.monitorCommands,Jo.COMMAND_FAILED,i.databaseName,this.established,new N1.CommandFailedEvent(this,i,c,s,this.description.serverConnectionId));throw c}}async command(e,t,r={},n){this.throwIfAborted(),r.signal?.throwIfAborted();for await(let i of this.sendCommand(e,t,r,n)){if(r.timeoutContext?.csotEnabled()){if(Ps.MongoDBResponse.is(i)){if(i.isMaxTimeExpiredError)throw new $e.MongoOperationTimeoutError("Server reported a timeout error",{cause:new $e.MongoServerError(i.toObject())})}else if(Array.isArray(i?.writeErrors)&&i.writeErrors.some((s)=>s?.code===$e.MONGODB_ERROR_CODES.MaxTimeMSExpired)||i?.writeConcernError?.code===$e.MONGODB_ERROR_CODES.MaxTimeMSExpired)throw new $e.MongoOperationTimeoutError("Server reported a timeout error",{cause:new $e.MongoServerError(i)})}return i}throw new $e.MongoUnexpectedServerResponseError("Unable to get response from server")}exhaustCommand(e,t,r,n){(async()=>{this.throwIfAborted();for await(let s of this.sendCommand(e,t,r))n(void 0,s),this.throwIfAborted();throw new $e.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"||!Ua.OpCompressedRequest.canCompress(e)?e:new Ua.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0}),n=$1.ByteUtils.concat(await r.toBin());if(t.timeoutContext?.csotEnabled()){if(t.timeoutContext.minRoundTripTime!=null&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new $e.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining")}try{if(this.socket.write(n))return}catch(u){let a=new $e.MongoNetworkError("unexpected error writing to socket",{cause:u});throw this.onError(a),a}let i=Yt.once(this.socket,"drain",t),s=t?.timeoutContext?.timeoutForSocketWrite,o=s?Promise.race([i,s]):i;try{return await o}catch(u){if(Dy.TimeoutError.is(u)){let a=new $e.MongoOperationTimeoutError("Timed out at socket write");throw this.onError(a),a}else if(u===t.signal?.reason)this.onError(u);throw u}finally{s?.clear()}}async*readMany(e){try{this.dataEvents=mF.onData(this.messageStream,e),this.messageStream.resume();for await(let t of this.dataEvents){let r=await pF.decompressResponse(t);if(yield r,!r.moreToCome)return}}catch(t){if(Dy.TimeoutError.is(t)){let r=new $e.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()}}}$u.Connection=Jo;class aA extends cF.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)Ty.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 $e.MongoParseError(`Message size cannot be negative: ${n}`));if(n>this.bufferPool.length)break;let i=this.bufferPool.read(n);if(!this.push(i))return r(new $e.MongoRuntimeError("SizedMessageTransform does not support backpressure"))}r()}}$u.SizedMessageTransform=aA;class yF extends Jo{constructor(e,t){super(e,t);this.autoEncrypter=t.autoEncrypter}async command(e,t,r,n){let{autoEncrypter:i}=this;if(!i)throw new $e.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 i.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??Ps.MongoDBResponse),l=await i.decrypt(c.toBytes(),r),f=n?.make(l)??$1.deserialize(l,r);if(i[Kn.kDecorateResult]){if(n==null)Yt.decorateDecryptionResult(f,c.toObject(),!0);else if(f instanceof Ps.CursorResponse)f.encryptedResponse=c}return f}}$u.CryptoConnection=yF});var lA=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=Yre;Mn.makeConnection=wF;Mn.performInitialHandshake=OF;Mn.prepareHandshakeDocument=SF;Mn.makeSocket=By;var Fy=require("net"),gF=require("tls"),Ny=Br(),EF=Io(),Be=X(),R1=he(),_F=Ba(),Va=zo(),Py=My(),Bs=Tu();function AF(e){e.addErrorLabel(Be.MongoErrorLabel.SystemOverloadedError),e.addErrorLabel(Be.MongoErrorLabel.RetryableError)}async function Yre(e){let t=null;try{let r=await By(e);return t=wF(e,r),await OF(t,e),t}catch(r){throw t?.destroy(),r}}function wF(e,t){let r=e.connectionType??Py.Connection;if(e.autoEncrypter)r=Py.CryptoConnection;return new r(t,e)}function Qre(e,t){let r=Number(e.maxWireVersion),n=Number(e.minWireVersion),i=!Number.isNaN(r)&&r>=Bs.MIN_SUPPORTED_WIRE_VERSION,s=!Number.isNaN(n)&&n<=Bs.MAX_SUPPORTED_WIRE_VERSION;if(i){if(s)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 ${Bs.MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${Bs.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 ${Bs.MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${Bs.MIN_SUPPORTED_SERVER_VERSION})`;return new Be.MongoCompatibilityError(o)}async function OF(e,t){let r=t.credentials;if(r){if(r.mechanism!==Va.AuthMechanism.MONGODB_DEFAULT&&!t.authProviders.getOrCreateProvider(r.mechanism,r.mechanismProperties))throw new Be.MongoInvalidArgumentError(`AuthMechanism '${r.mechanism}' not supported`)}let n=new _F.AuthContext(e,r,t);e.authContext=n;let i=await SF(n),s={...t,raw:!1};if(typeof t.connectTimeoutMS==="number")s.socketTimeoutMS=t.connectTimeoutMS;let o=new Date().getTime(),u=await c(i,s);if(!("isWritablePrimary"in u))u.isWritablePrimary=u[Ny.LEGACY_HELLO_COMMAND];if(u.helloOk)e.helloOk=!0;let a=Qre(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(R1.ns("admin.$cmd"),l,f)}catch(h){if(h instanceof Be.MongoError)h.addErrorLabel(Be.MongoErrorLabel.HandshakeError);if(h instanceof Be.MongoNetworkError)AF(h);throw h}}}async function SF(e){let t=e.options,r=t.compressors?t.compressors:[],{serverApi:n}=e.connection,i=await t.metadata,s={[n?.version||t.loadBalanced===!0?"hello":Ny.LEGACY_HELLO_COMMAND]:1,backpressure:"2",helloOk:!0,client:i,compression:r};if(t.loadBalanced===!0)s.loadBalanced=!0;let o=e.credentials;if(o){if(o.mechanism===Va.AuthMechanism.MONGODB_DEFAULT&&o.username){s.saslSupportedMechs=`${o.source}.${o.username}`;let a=e.options.authProviders.getOrCreateProvider(Va.AuthMechanism.MONGODB_SCRAM_SHA256,o.mechanismProperties);if(!a)throw new Be.MongoInvalidArgumentError(`No AuthProvider for ${Va.AuthMechanism.MONGODB_SCRAM_SHA256} defined.`);return await a.prepare(s,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(s,e)}return s}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 cA(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 Jre(e){let t=cA(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&&!Fy.isIP(t.host))t.servername=t.host;return t}async function By(e){let t=e.tls??!1,r=e.connectTimeoutMS??30000,n=e.existingSocket,i=e.keepAliveInitialDelay??Mn.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS,s=e.noDelay??!0,o;if(e.proxyHost!=null)return await Zre({...e,connectTimeoutMS:r});if(t){let f=gF.connect(Jre(e));if(typeof f.disableRenegotiation==="function")f.disableRenegotiation();o=f}else if(n)o=n;else o=Fy.createConnection(cA(e));o.setKeepAlive(!0,i),o.setNoDelay(s),o.setTimeout(r);let u=null,{promise:a,resolve:c,reject:l}=R1.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 AF(f),o.destroy(),f}finally{if(o.setTimeout(0),u!=null)e.cancellationToken?.removeListener("cancel",u)}}var ed=null;function Xre(){if(ed==null){let e=EF.getSocks();if("kModuleError"in e)throw e.kModuleError;ed=e}return ed}async function Zre(e){let t=R1.HostAddress.fromHostPort(e.proxyHost??"",e.proxyPort??1080),r=await By({...e,hostAddress:t,tls:!1,proxyHost:void 0}),n=cA(e);if(typeof n.host!=="string"||typeof n.port!=="number")throw new Be.MongoInvalidArgumentError("Can only make Socks5 connections to TCP hosts");ed??=Xre();let i;try{i=(await ed.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(s){throw new Be.MongoNetworkError(Be.MongoError.buildErrorMessage(s),{cause:s})}return await By({...e,existingSocket:i,proxyHost:void 0})}});var Iy=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 CF{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=CF;class bF{constructor(e,t){this.name=cn.SERVER_OPENING,this.topologyId=e,this.address=t}}Wr.ServerOpeningEvent=bF;class DF{constructor(e,t){this.name=cn.SERVER_CLOSED,this.topologyId=e,this.address=t}}Wr.ServerClosedEvent=DF;class TF{constructor(e,t,r){this.name=cn.TOPOLOGY_DESCRIPTION_CHANGED,this.topologyId=e,this.previousDescription=t,this.newDescription=r}}Wr.TopologyDescriptionChangedEvent=TF;class MF{constructor(e){this.name=cn.TOPOLOGY_OPENING,this.topologyId=e}}Wr.TopologyOpeningEvent=MF;class PF{constructor(e){this.name=cn.TOPOLOGY_CLOSED,this.topologyId=e}}Wr.TopologyClosedEvent=PF;class BF{constructor(e,t){this.name=cn.SERVER_HEARTBEAT_STARTED,this.connectionId=e,this.awaited=t}}Wr.ServerHeartbeatStartedEvent=BF;class FF{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=FF;class NF{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=NF});var hA=g(function(Qt){Object.defineProperty(Qt,"__esModule",{value:!0});Qt.ConnectionPoolClearedEvent=Qt.ConnectionCheckedInEvent=Qt.ConnectionCheckedOutEvent=Qt.ConnectionCheckOutFailedEvent=Qt.ConnectionCheckOutStartedEvent=Qt.ConnectionClosedEvent=Qt.ConnectionReadyEvent=Qt.ConnectionCreatedEvent=Qt.ConnectionPoolClosedEvent=Qt.ConnectionPoolReadyEvent=Qt.ConnectionPoolCreatedEvent=Qt.ConnectionPoolMonitoringEvent=void 0;var Or=Br(),x1=he();class ts{constructor(e){this.time=new Date,this.address=e.address}}Qt.ConnectionPoolMonitoringEvent=ts;class IF extends ts{constructor(e){super(e);this.name=Or.CONNECTION_POOL_CREATED;let{maxConnecting:t,maxPoolSize:r,minPoolSize:n,maxIdleTimeMS:i,waitQueueTimeoutMS:s}=e.options;this.options={maxConnecting:t,maxPoolSize:r,minPoolSize:n,maxIdleTimeMS:i,waitQueueTimeoutMS:s}}}Qt.ConnectionPoolCreatedEvent=IF;class $F extends ts{constructor(e){super(e);this.name=Or.CONNECTION_POOL_READY}}Qt.ConnectionPoolReadyEvent=$F;class RF extends ts{constructor(e){super(e);this.name=Or.CONNECTION_POOL_CLOSED}}Qt.ConnectionPoolClosedEvent=RF;class xF extends ts{constructor(e,t){super(e);this.name=Or.CONNECTION_CREATED,this.connectionId=t.id}}Qt.ConnectionCreatedEvent=xF;class vF extends ts{constructor(e,t,r){super(e);this.name=Or.CONNECTION_READY,this.durationMS=x1.processTimeMS()-r,this.connectionId=t.id}}Qt.ConnectionReadyEvent=vF;class kF extends ts{constructor(e,t,r,n){super(e);this.name=Or.CONNECTION_CLOSED,this.connectionId=t.id,this.reason=r,this.serviceId=t.serviceId,this.error=n??null}}Qt.ConnectionClosedEvent=kF;class qF extends ts{constructor(e){super(e);this.name=Or.CONNECTION_CHECK_OUT_STARTED}}Qt.ConnectionCheckOutStartedEvent=qF;class jF extends ts{constructor(e,t,r,n){super(e);this.name=Or.CONNECTION_CHECK_OUT_FAILED,this.durationMS=x1.processTimeMS()-r,this.reason=t,this.error=n}}Qt.ConnectionCheckOutFailedEvent=jF;class LF extends ts{constructor(e,t,r){super(e);this.name=Or.CONNECTION_CHECKED_OUT,this.durationMS=x1.processTimeMS()-r,this.connectionId=t.id}}Qt.ConnectionCheckedOutEvent=LF;class UF extends ts{constructor(e,t){super(e);this.name=Or.CONNECTION_CHECKED_IN,this.connectionId=t.id}}Qt.ConnectionCheckedInEvent=UF;class VF extends ts{constructor(e,t={}){super(e);this.name=Or.CONNECTION_POOL_CLEARED,this.serviceId=t.serviceId,this.interruptInUseConnections=t.interruptInUseConnections}}Qt.ConnectionPoolClearedEvent=VF});var dA=g(function(Xo){Object.defineProperty(Xo,"__esModule",{value:!0});Xo.WaitQueueTimeoutError=Xo.PoolClearedOnNetworkError=Xo.PoolClearedError=Xo.PoolClosedError=void 0;var za=X();class zF extends za.MongoDriverError{constructor(e){super("Attempted to check out a connection from closed connection pool");this.address=e.address}get name(){return"MongoPoolClosedError"}}Xo.PoolClosedError=zF;class fA extends za.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(za.MongoErrorLabel.PoolRequestedRetry)}get name(){return"MongoPoolClearedError"}}Xo.PoolClearedError=fA;class WF extends fA{constructor(e){super(e,`Connection to ${e.address} interrupted due to server monitor timeout`)}get name(){return"PoolClearedOnNetworkError"}}Xo.PoolClearedOnNetworkError=WF;class HF extends za.MongoDriverError{constructor(e,t){super(e);this.address=t}get name(){return"MongoWaitQueueTimeoutError"}}Xo.WaitQueueTimeoutError=HF});var QF=g(function(Pn){Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ConnectionPool=Pn.PoolState=void 0;var Fs=require("timers"),or=Br(),Sr=X(),$y=Zi(),KF=fi(),ln=he(),GF=lA(),Wa=My(),dt=hA(),Ns=dA(),YF=Q3();Pn.PoolState=Object.freeze({paused:"paused",ready:"ready",closed:"closed"});class Zr extends $y.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:Wa.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 Sr.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 $y.CancellationToken,this.cancellationToken.setMaxListeners(1/0),this.waitQueue=new ln.List,this.metrics=new YF.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)),Fs.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:i}=ln.promiseWithResolvers(),s=e.timeoutContext.connectionCheckoutTimeout,o={resolve:n,reject:i,cancelled:!1,checkoutTime:t},u=ln.addAbortListener(e.signal,function(){o.cancelled=!0,i(this.reason)});this.waitQueue.push(o),queueMicrotask(()=>this.processWaitQueue());try{return s?.throwIfExpired(),await(s?Promise.race([r,s]):r)}catch(a){if(KF.TimeoutError.is(a)){s?.clear(),o.cancelled=!0,this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,"timeout",o.checkoutTime));let c=new Ns.WaitQueueTimeoutError(this.loadBalanced?this.waitQueueErrorMetrics():"Timed out while checking out a connection from connection pool",this.address);if(e.timeoutContext.csotEnabled())throw new Sr.MongoOperationTimeoutError("Timed out during connection checkout",{cause:c});throw c}throw a}finally{u?.[ln.kDispose](),s?.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 i=e.closed?"error":t?"poolClosed":"stale";this.destroyConnection(e,i)}queueMicrotask(()=>this.processWaitQueue())}clear(e={}){if(this.closed)return;if(this.loadBalanced){let{serviceId:i}=e;if(!i)throw new Sr.MongoRuntimeError("ConnectionPool.clear() called in load balanced mode with no serviceId.");let s=i.toHexString(),o=this.serviceGenerations.get(s);if(o==null)throw new Sr.MongoRuntimeError("Service generations are required in load balancer mode.");else this.serviceGenerations.set(s,o+1);this.emitAndLog(Zr.CONNECTION_POOL_CLEARED,new dt.ConnectionPoolClearedEvent(this,{serviceId:i}));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 Ns.PoolClearedOnNetworkError(this))}closeCheckedOutConnections(){for(let e of this.checkedOut)e.onError(new Sr.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 Sr.MongoRuntimeError("No auth context found on connection.");let r=t.credentials;if(!r)throw new Sr.MongoMissingCredentialsError("Connection is missing credentials when asked to reauthenticate");let n=r.resolveAuthMechanism(e.hello),i=this.server.topology.client.s.authProviders.getOrCreateProvider(n.mechanism,n.mechanismProperties);if(!i)throw new Sr.MongoMissingCredentialsError(`Reauthenticate failed due to no auth provider for ${r.mechanism}`);await i.reauth(t);return}clearMinPoolSizeTimer(){let e=this.minPoolSizeTimer;if(e)Fs.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})),GF.connect(t).then((n)=>{if(this.poolState!==Pn.PoolState.ready){this.pending--,n.destroy(),e(this.closed?new Ns.PoolClosedError(this):new Ns.PoolClearedError(this));return}for(let i of[...or.APM_EVENTS,Wa.Connection.CLUSTER_TIME_RECEIVED])n.on(i,(s)=>this.emit(i,s));if(this.loadBalanced){n.on(Wa.Connection.PINNED,(s)=>this.metrics.markPinned(s)),n.on(Wa.Connection.UNPINNED,(s)=>this.metrics.markUnpinned(s));let i=n.serviceId;if(i){let s,o=i.toHexString();if(s=this.serviceGenerations.get(o))n.generation=s;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 Sr.MongoNetworkError||n instanceof Sr.MongoServerError)n.connectionGeneration=t.generation;e(n??new Sr.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)Fs.clearTimeout(this.minPoolSizeTimer),this.minPoolSizeTimer=Fs.setTimeout(()=>this.ensureMinPoolSize(),this.options.minPoolSizeCheckFrequencyMS)});else Fs.clearTimeout(this.minPoolSizeTimer),this.minPoolSizeTimer=Fs.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 i=this.closed?"poolClosed":"connectionError",s=this.closed?new Ns.PoolClosedError(this):new Ns.PoolClearedError(this);this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,i,r.checkoutTime,s)),this.waitQueue.shift(),r.reject(s);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,i)=>{if(r.cancelled){if(!n&&i)this.connections.push(i)}else if(n)this.emitAndLog(Zr.CONNECTION_CHECK_OUT_FAILED,new dt.ConnectionCheckOutFailedEvent(this,"connectionError",r.checkoutTime,n)),r.reject(n);else if(i)this.checkedOut.add(i),this.emitAndLog(Zr.CONNECTION_CHECKED_OUT,new dt.ConnectionCheckedOutEvent(this,i,r.checkoutTime)),r.resolve(i);queueMicrotask(()=>this.processWaitQueue())})}this.processingWaitQueue=!1}}Pn.ConnectionPool=Zr});var yA=g(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});xy.Server=void 0;var XF=My(),ZF=QF(),eN=dA(),Hr=Br(),Fe=X(),tN=Zi(),rN=Nf(),v1=J3(),Is=he(),Ry=hi(),Ce=bi(),nN=gA(),k1=Xf(),iN=Nl(),td=Is.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 Lc extends tN.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",Is.noop),this.serverApi=r.serverApi;let n={hostAddress:t.hostAddress,...r};this.topology=e,this.pool=new ZF.ConnectionPool(this,n),this.s={description:t,options:r,state:Ce.STATE_CLOSED,operationCount:0};for(let i of[...Hr.CMAP_EVENTS,...Hr.APM_EVENTS])this.pool.on(i,(s)=>this.emit(i,s));if(this.pool.on(XF.Connection.CLUSTER_TIME_RECEIVED,(i)=>{this.clusterTime=i}),this.loadBalanced){this.monitor=null;return}this.monitor=new nN.Monitor(this,this.s.options);for(let i of Hr.HEARTBEAT_EVENTS)this.monitor.on(i,(s)=>this.emit(i,s));this.monitor.on("resetServer",(i)=>pA(this,i)),this.monitor.on(Lc.SERVER_HEARTBEAT_SUCCEEDED,(i)=>{if(this.emit(Lc.DESCRIPTION_RECEIVED,new k1.ServerDescription(this.description.hostAddress,i.reply,{roundTripTime:this.monitor?.roundTripTime,minRoundTripTime:this.monitor?.minRoundTripTime})),this.s.state===Ce.STATE_CONNECTING)td(this,Ce.STATE_CONNECTED),this.emit(Lc.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(td(this,Ce.STATE_CONNECTING),!this.loadBalanced)this.monitor?.connect();else td(this,Ce.STATE_CONNECTED),this.emit(Lc.CONNECT,this)}closeCheckedOutConnections(){return this.pool.closeCheckedOutConnections()}close(){if(this.s.state===Ce.STATE_CLOSED)return;if(td(this,Ce.STATE_CLOSING),!this.loadBalanced)this.monitor?.close();this.pool.close(),td(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 eN.PoolClearedError))this.handleError(l);throw l}let i=null,s=()=>{if(this.decrementOperationCount(),r?.pinnedConnection!==n)if(i!=null){let l=()=>{this.pool.checkIn(n)};i.then(l,l)}else this.pool.checkIn(n)},o;try{o=e.buildCommand(n,r)}catch(l){throw s(),l}let u=e.buildOptions(t),a=e.ns;if(this.loadBalanced&&ene(o,r)&&!r?.pinnedConnection)r?.pin(n);if(u.directConnection=this.topology.s.options.directConnection,e instanceof rN.AggregateOperation&&e.hasWriteStage&&Is.maxWireVersion(n)<iN.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 Ry.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){i=this.pool.reauthenticate(n),i.then(void 0,(f)=>{i=null,Is.squashError(f)}),await Is.abortable(i,u),i=null;try{let f=await n.command(a,o,u,e.SERVER_COMMAND_RESPONSE_TYPE);return Ry.throwIfWriteConcernError(f),f}catch(f){throw this.decorateCommandError(n,o,u,f)}}else throw l}finally{s()}}handleError(e,t){if(!(e instanceof Fe.MongoError))return;if(rne(this,e))return;let r=e instanceof Fe.MongoNetworkError&&!(e instanceof Fe.MongoNetworkTimeoutError),n=e instanceof Fe.MongoNetworkError&&e.beforeHandshake,i=e.hasErrorLabel(Fe.MongoErrorLabel.HandshakeError),s=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);pA(this,e),queueMicrotask(()=>this.requestCheck());return}if(t&&o)this.pool.clear({serviceId:t.serviceId})}else if(r||n||i){if(s)return;if(!this.loadBalanced)e.addErrorLabel(Fe.MongoErrorLabel.ResetPool),pA(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(tne(this.pool,e))return n;let i=r?.session;if(n instanceof Fe.MongoNetworkError){if(i&&!i.hasEnded&&i.serverSession)i.serverSession.isDirty=!0;if(mA(i,t)&&!n.hasErrorLabel(Fe.MongoErrorLabel.TransientTransactionError))n.addErrorLabel(Fe.MongoErrorLabel.TransientTransactionError);if((JF(this.topology)||v1.isTransactionCommand(t))&&Is.supportsRetryableWrites(this)&&!mA(i,t))n.addErrorLabel(Fe.MongoErrorLabel.RetryableWriteError)}else if((JF(this.topology)||v1.isTransactionCommand(t))&&Fe.needsRetryableWriteLabel(n)&&!mA(i,t))n.addErrorLabel(Fe.MongoErrorLabel.RetryableWriteError);if(i&&i.isPinned&&n.hasErrorLabel(Fe.MongoErrorLabel.TransientTransactionError))i.unpin({force:!0});return this.handleError(n,e),n}decrementOperationCount(){return this.s.operationCount-=1}incrementOperationCount(){return this.s.operationCount+=1}}xy.Server=Lc;function pA(e,t){if(e.loadBalanced)return;if(t instanceof Fe.MongoNetworkError&&!(t instanceof Fe.MongoNetworkTimeoutError))e.monitor?.reset();e.emit(Lc.DESCRIPTION_RECEIVED,new k1.ServerDescription(e.description.hostAddress,void 0,{error:t}))}function ene(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 tne(e,t){if(t.serviceId)return t.generation!==e.serviceGenerations.get(t.serviceId.toHexString());return t.generation!==e.generation}function mA(e,t){return e&&e.inTransaction()&&!v1.isTransactionCommand(t)}function JF(e){return e.s.options.retryWrites!==!1}function rne(e,t){let r=e.pool.generation,n=t.connectionGeneration;if(n&&n<r)return!0;let i=e.description.topologyVersion;return k1.compareTopologyVersion(i,t.topologyVersion)>=0}});var gA=g(function(Ri){Object.defineProperty(Ri,"__esModule",{value:!0});Ri.RTTSampler=Ri.MonitorInterval=Ri.RTTPinger=Ri.Monitor=Ri.ServerMonitoringMode=void 0;var Gn=require("timers"),vy=Te(),Ha=lA(),uN=D6(),L1=Br(),$s=X(),aN=Aa(),ky=Zi(),pt=he(),mt=bi(),Zo=Iy(),eu=yA(),q1="idle",Uc="monitoring",j1=pt.makeStateMachine({[mt.STATE_CLOSING]:[mt.STATE_CLOSING,q1,mt.STATE_CLOSED],[mt.STATE_CLOSED]:[mt.STATE_CLOSED,Uc],[q1]:[q1,Uc,mt.STATE_CLOSING],[Uc]:[Uc,q1,mt.STATE_CLOSING]}),nne=new Set([mt.STATE_CLOSING,mt.STATE_CLOSED,Uc]);function rd(e){return e.s.state===mt.STATE_CLOSED||e.s.state===mt.STATE_CLOSING}Ri.ServerMonitoringMode=Object.freeze({auto:"auto",poll:"poll",stream:"stream"});class cN extends ky.TypedEventEmitter{constructor(e,t){super();this.component=aN.MongoLoggableComponent.TOPOLOGY,this.on("error",pt.noop),this.server=e,this.connection=null,this.cancellationToken=new ky.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=uN.getFAASEnv()!=null,this.mongoLogger=this.server.topology.client?.mongoLogger,this.rttSampler=new AA(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 qy(oN(this),{heartbeatFrequencyMS:e,minHeartbeatFrequencyMS:t,immediate:!0})}requestCheck(){if(nne.has(this.s.state))return;this.monitorId?.wake()}reset(){let e=this.server.description.topologyVersion;if(rd(this)||e==null)return;j1(this,mt.STATE_CLOSING),sN(this),j1(this,q1);let t=this.options.heartbeatFrequencyMS,r=this.options.minHeartbeatFrequencyMS;this.monitorId=new qy(oN(this),{heartbeatFrequencyMS:t,minHeartbeatFrequencyMS:r})}close(){if(rd(this))return;j1(this,mt.STATE_CLOSING),sN(this),this.emit("close"),j1(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()}}Ri.Monitor=cN;function sN(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 EA(e,t){if(t==null)return!1;let r=e.options.serverMonitoringMode;if(r===Ri.ServerMonitoringMode.poll)return!1;if(r===Ri.ServerMonitoringMode.stream)return!0;if(e.isRunningInFaasEnv)return!1;return!0}function ine(e,t){let r,n,i=e.server.description.topologyVersion,s=EA(e,i);e.emitAndLogHeartbeat(eu.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new Zo.ServerHeartbeatStartedEvent(e.address,s));function o(c){e.connection?.destroy(),e.connection=null,e.emitAndLogHeartbeat(eu.Server.SERVER_HEARTBEAT_FAILED,e.server.topology.s.id,void 0,new Zo.ServerHeartbeatFailedEvent(e.address,pt.calculateDurationInMs(r),c,n));let l=!(c instanceof $s.MongoError)?new $s.MongoError($s.MongoError.buildErrorMessage(c),{cause:c}):c;if(l.addErrorLabel($s.MongoErrorLabel.ResetPool),l instanceof $s.MongoNetworkTimeoutError)l.addErrorLabel($s.MongoErrorLabel.InterruptInUseConnections);e.emit("resetServer",l),t(c)}function u(c){if(!("isWritablePrimary"in c))c.isWritablePrimary=c[L1.LEGACY_HELLO_COMMAND];let l=s&&e.rttPinger?e.rttPinger.latestRtt??pt.calculateDurationInMs(r):pt.calculateDurationInMs(r);if(e.addRttSample(l),e.emitAndLogHeartbeat(eu.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,c.connectionId,new Zo.ServerHeartbeatSucceededEvent(e.address,l,c,s)),s)e.emitAndLogHeartbeat(eu.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new Zo.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":L1.LEGACY_HELLO_COMMAND]:1,...s&&i?{maxAwaitTimeMS:h,topologyVersion:sne(i)}:{}},p=s?{socketTimeoutMS:f?f+h:0,exhaustAllowed:!0}:{socketTimeoutMS:f};if(s&&e.rttPinger==null)e.rttPinger=new _A(e);if(r=pt.processTimeMS(),s)return n=!0,a.exhaustCommand(pt.ns("admin.$cmd"),d,p,(m,E)=>{if(m)return o(m);return u(E)});n=!1,a.command(pt.ns("admin.$cmd"),d,p).then(u,o);return}(async()=>{let c=await Ha.makeSocket(e.connectOptions),l=Ha.makeConnection(e.connectOptions,c);r=pt.processTimeMS();try{return await Ha.performInitialHandshake(l,e.connectOptions),l}catch(f){throw l.destroy(),f}})().then((c)=>{if(rd(e)){c.destroy();return}let l=pt.calculateDurationInMs(r);e.addRttSample(l),e.connection=c,e.emitAndLogHeartbeat(eu.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,c.hello?.connectionId,new Zo.ServerHeartbeatSucceededEvent(e.address,l,c.hello,EA(e,c.hello?.topologyVersion))),t(void 0,c.hello)},(c)=>{e.connection=null,n=!1,o(c)})}function oN(e){return(t)=>{if(e.s.state===Uc){queueMicrotask(t);return}j1(e,Uc);function r(){if(!rd(e))j1(e,q1);t()}ine(e,(n,i)=>{if(n){if(e.server.description.type===mt.ServerType.Unknown)return r()}if(EA(e,i?.topologyVersion))Gn.setTimeout(()=>{if(!rd(e))e.monitorId?.wake()},0);r()})}}function sne(e){return{processId:e.processId,counter:vy.Long.isLong(e.counter)?e.counter:vy.Long.fromNumber(e.counter)}}class _A{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){Ha.connect(this.monitor.connectOptions).then((n)=>{this.measureAndReschedule(e,n)},()=>{this.connection=void 0});return}let r=t.serverApi?.version||t.helloOk?"hello":L1.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})}}Ri.RTTPinger=_A;class qy{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)}}Ri.MonitorInterval=qy;class AA{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}}Ri.RTTSampler=AA});var CA=g(function(pi){Object.defineProperty(pi,"__esModule",{value:!0});pi.DEFAULT_OPTIONS=pi.OPTIONS=void 0;pi.resolveSRVRecord=dne;pi.parseOptions=mne;var U1=require("dns"),one=z6(),Yn=require("process"),dN=require("url"),Rs=q0(),Kr=zo(),jy=Df(),Ly=vB(),R=X(),Ka=qc(),z1=Aa(),V1=fo(),fn=Xr(),pN=kB(),mN=gA(),Xe=he(),hn=hi(),wA=["authSource","replicaSet","loadBalanced"],une=["srvMaxHosts","srvServiceName","srvAllowedHostsSuffix","srvHostValidator"],lN=new Set(["test","localhost","invalid","example","local","internal","corp","home","mail"]),ane="loadBalanced option only supported with a single host in the URI",cne="loadBalanced option not supported with a replicaSet option",lne="loadBalanced option not supported when directConnection is provided";function yN(e){let t=e==="SRV"?(r)=>U1.promises.resolve(r,"SRV"):(r)=>U1.promises.resolve(r,"TXT");return async function(n){try{return await t(n)}catch(i){if(i.code===U1.TIMEOUT)return await t(n);else throw i}}}var hne=yN("SRV"),fne=yN("TXT");async function dne(e){if(typeof e.srvHost!=="string")throw new R.MongoAPIError('Option "srvHost" must not be empty');let t=e.srvHost,r=fne(t);r.then(void 0,Xe.squashError);let n=`_${e.srvServiceName}._tcp.${t}`,i=await hne(n);if(i.length===0)throw new R.MongoAPIError("No addresses found at host");let s=i.map(({name:h,port:d})=>{let p=Xe.normalizeDnsName(h);return Xe.verifySrvHost(p,t,e),Xe.HostAddress.fromString(`${p}:${d??27017}`)});OA(s,e,!0);let o;try{o=await r}catch(h){if(h.code!=="ENODATA"&&h.code!=="ENOTFOUND")throw h;return s}if(o.length>1)throw new R.MongoParseError("Multiple text records not allowed");let u=new dN.URLSearchParams(o[0].join(""));if([...u.keys()].some((h)=>!wA.includes(h)))throw new R.MongoParseError(`Text record may only set any of: ${wA.join(", ")}`);if(wA.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=Rs.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 OA(s,e,!0),s}function pne(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 Ru(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 SA(e,t){let r=Xe.parseInteger(t);if(r!=null)return r;throw new R.MongoParseError(`Expected ${e} to be stringified int value`)}function nd(e,t){let r=SA(e,t);if(r<0)throw new R.MongoParseError(`${e} can only be a positive int value, got: ${r}`);return r}function*hN(e){if(e==="")return;let t=e.split(",");for(let r of t){let[n,i]=r.split(/:(.*)/);if(i==null)throw new R.MongoParseError("Cannot have undefined values in key value pairs");yield[n,i]}}class id 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 mne(e,t=void 0,r={}){if(t!=null&&!(t instanceof Ka.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 one.default(e)}catch(y){if(y.message?.startsWith("Username contains unescaped characters"))throw new R.MongoParseError("Username contains unescaped characters");throw y}let{hosts:i,isSRV:s}=n,o=Object.create(null);o.hosts=s?[]:i.map(Xe.HostAddress.fromString);let u=new id;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(pi.OPTIONS).map((y)=>y.toLowerCase())),c=Array.from(n.searchParams.keys()).flatMap((y,_)=>a.has(y.toLowerCase())?[]:[_+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 _=n.searchParams.getAll(y),O=Object.keys(pi.OPTIONS).find((A)=>A.toLowerCase()===y.toLowerCase()),b=/readPreferenceTags/i.test(y);if(!b&&_.length>1)throw new R.MongoInvalidArgumentError(`URI option "${O}" cannot appear more than once in the connection string`);if(!b&&_.includes("")&&!Ene(y))throw new R.MongoAPIError(`URI option "${O}" cannot be specified with no value`);if(!u.has(y))u.set(y,_)}let l=new id(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 id,p=new Set([...u.keys(),...l.keys()]);for(let y of p){let _=[],O=l.get(y);if(O!=null)_.push(O);let b=u.get(y)??[];_.push(...b),d.set(y,_)}if(d.has("tls")||d.has("ssl")){let y=(d.get("tls")||[]).concat(d.get("ssl")||[]).map(Ru.bind(null,"tls/ssl"));if(new Set(y).size!==1)throw new R.MongoParseError("All values of tls/ssl must be the same.")}pne(d);let m=Xe.setDifference(p,a);if(m.size!==0){let y=m.size>1?"options":"option",_=m.size>1?"are":"is";throw new R.MongoParseError(`${y} ${Array.from(m).join(", ")} ${_} not supported`)}for(let[y,_]of Object.entries(pi.OPTIONS)){let O=d.get(y);if(!O||O.length===0){if(pi.DEFAULT_OPTIONS.has(y))fN(o,y,_,[pi.DEFAULT_OPTIONS.get(y)])}else{let{deprecated:b,ignored:A}=_;if(b){let P=typeof b==="string"?`: ${b}`:"";Xe.emitWarning(`${y} is a deprecated option${P}`)}if(A)continue;fN(o,y,_,O)}}if(o.credentials){let y=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_GSSAPI,_=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_X509,O=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_AWS,b=o.credentials.mechanism===Kr.AuthMechanism.MONGODB_OIDC;if((y||_)&&d.has("authSource")&&o.credentials.source!=="$external")throw new R.MongoParseError(`authMechanism ${o.credentials.mechanism} requires an authSource of '$external'`);if(!(y||_||O||b)&&o.dbName&&!d.has("authSource"))o.credentials=Rs.MongoCredentials.merge(o.credentials,{source:o.dbName});if(O){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(OA(i,o,s),t&&o.autoEncryption)Ly.Encrypter.checkForMongoCrypt(),o.encrypter=new Ly.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"),s){if(o.srvHost=i[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"),_=!l.has("ssl")&&!u.has("ssl");if(y&&_)o.tls=!0}else{let y=une.filter((_)=>u.has(_)||l.has(_));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=z1.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=pN.resolveRuntimeAdapters(r),o.runtime.then(void 0,Xe.squashError),o[gN]=yne,o.toJSON=EN,o}var gN=Symbol.for("nodejs.util.inspect.custom");function EN(){let e={...this};delete e[gN];for(let t of["proxyUsername","proxyPassword","passphrase"])if(e[t]!=null)e[t]="<redacted>";return e}function yne(e,t,r){return r(EN.call(this),t)}function OA(e,t,r){if(t.loadBalanced){if(e.length>1)throw new R.MongoParseError(ane);if(t.replicaSet)throw new R.MongoParseError(cne);if(t.directConnection)throw new R.MongoParseError(lne);if(r&&t.srvMaxHosts>0)throw new R.MongoParseError("Cannot limit srv hosts with loadBalanced enabled")}return}function gne(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(".")&&!lN.has(r))throw new R.MongoParseError(`srvAllowedHostsSuffix must contain at least two domain labels, or be one of: ${[...lN].join(", ")}`);return`.${r}`}function Ene(e){return Object.entries(pi.OPTIONS).some(([t,r])=>r.ignored&&t.toLowerCase()===e.toLowerCase())}function fN(e,t,r,n){let{target:i,type:s,transform:o}=r,u=i??t;switch(s){case"boolean":e[u]=Ru(u,n[0]);break;case"int":e[u]=SA(u,n[0]);break;case"uint":e[u]=nd(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}}}pi.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 Rs.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 i=e.credentials?.source;if(n===Kr.AuthMechanism.MONGODB_PLAIN||Kr.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(n))i="$external";let s=e.credentials?.password;if(n===Kr.AuthMechanism.MONGODB_X509&&s==="")s=void 0;return Rs.MongoCredentials.merge(e.credentials,{mechanism:n,source:i,password:s})}},authMechanismProperties:{target:"credentials",transform({options:e,values:t}){let r=Object.create(null);for(let n of t)if(typeof n==="string")for(let[i,s]of hN(n))try{r[i]=Ru(i,s)}catch{r[i]=s}else{if(!Xe.isRecord(n))throw new R.MongoParseError("AuthMechanismProperties must be an object");r={...n}}return Rs.MongoCredentials.merge(e.credentials,{mechanismProperties:r})}},authSource:{target:"credentials",transform({options:e,values:[t]}){let r=String(t);return Rs.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(Ka.ServerApiVersion).join('", "')}"]`);if(!Object.values(Ka.ServerApiVersion).some((n)=>n===r))throw new R.MongoParseError(`Invalid server API version=${r}; must be in the following enum: ["${Object.values(Ka.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 i of n)if(Object.keys(jy.Compressor).includes(String(i)))t.add(String(i));else throw new R.MongoInvalidArgumentError(`compressors contains a value that is not a valid compression mechanism. Must be one of: ${Object.keys(jy.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=SA(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:Ru(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:Ru(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:Ru(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=nd(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=nd(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 V1.ReadConcern||Xe.isRecord(e,["level"]))return V1.ReadConcern.fromOptions({...t.readConcern,...e});throw new R.MongoParseError("ReadConcern must be an object")}},readConcernLevel:{target:"readConcern",transform({values:[e],options:t}){return V1.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 i of r){let s=Object.create(null);if(typeof i==="string")for(let[o,u]of hN(i))s[o]=u;if(Xe.isRecord(i))for(let[o,u]of Object.entries(i))s[o]=u;n.push(s)}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(mN.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 gne(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!Ru(e,t)}},tlsAllowInvalidHostnames:{target:"checkServerIdentity",transform({name:e,values:[t]}){return Ru(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=Ru(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:nd("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:nd("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(z1.MongoLoggableComponent).some((n)=>n===t)&&t!=="default")throw new R.MongoAPIError(`User input for option 'mongodbLogComponentSeverities' contains invalid key: ${t}`);if(!Object.values(z1.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"}};pi.DEFAULT_OPTIONS=new id(Object.entries(pi.OPTIONS).filter(([,e])=>e.default!=null).map(([e,t])=>[e,t.default]))});var AN=g(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});DA.aws4Sign=_ne;var Ga=Te(),_N=async(e)=>{let t=bA(e),r=await crypto.subtle.digest("SHA-256",t);return Ga.ByteUtils.toHex(new Uint8Array(r))},sd=async(e,t)=>{let r;if(typeof e==="string")r=bA(e);else r=e;let n=await crypto.subtle.importKey("raw",r,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),i=bA(t),s=await crypto.subtle.sign("HMAC",n,i);return new Uint8Array(s)},Vc=(e)=>e.toString().trim().replace(/\s+/g," ");function bA(e){let t=new Uint8Array(Ga.ByteUtils.utf8ByteLength(e));return Ga.ByteUtils.encodeUTF8Into(t,e,0),t}async function _ne(e,t){let n=e.date.toISOString().replace(/[:-]|\.\d{3}/g,""),i=n.substring(0,8),{method:s,path:o}=e,u="",a=new Headers({"content-length":Vc(e.headers["Content-Length"]),"content-type":Vc(e.headers["Content-Type"]),host:Vc(e.host),"x-amz-date":Vc(n),"x-mongodb-gs2-cb-flag":Vc(e.headers["X-MongoDB-GS2-CB-Flag"]),"x-mongodb-server-nonce":Vc(e.headers["X-MongoDB-Server-Nonce"])});if("sessionToken"in t&&t.sessionToken)a.append("x-amz-security-token",Vc(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 _N(e.body),d=[s,o,"",c+`
|
|
25
|
+
`,f,h].join(`
|
|
26
|
+
`),p=await _N(d),m="AWS4-HMAC-SHA256",E=`${i}/${e.region}/${e.service}/aws4_request`,y=[m,n,E,p].join(`
|
|
27
|
+
`),_=await sd("AWS4"+t.secretAccessKey,i),O=await sd(_,e.region),b=await sd(O,e.service),A=await sd(b,"aws4_request"),P=await sd(A,y),S=Ga.ByteUtils.toHex(P);return{Authorization:["AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+E,"SignedHeaders="+f,"Signature="+S].join(", "),"X-Amz-Date":n}}});var TN=g(function(Vy){Object.defineProperty(Vy,"__esModule",{value:!0});Vy.MongoDBAWS=void 0;var Uy=Te(),W1=Te(),tu=X(),H1=he(),wN=Ba(),ON=H6(),SN=AN(),CN=q0(),bN=zo(),Ane=110,TA={useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1};class DN extends wN.AuthProvider{constructor(e){super();this.credentialFetcher=new ON.AWSSDKCredentialProvider(e)}async auth(e){let{connection:t}=e;if(!e.credentials)throw new tu.MongoMissingCredentialsError("AuthContext must provide credentials.");e.credentials=await wne(e.credentials,this.credentialFetcher);let{credentials:r}=e,{username:n,password:i}=r,s=r.mechanismProperties.AWS_SESSION_TOKEN,o=s?{accessKeyId:n,secretAccessKey:i,sessionToken:s}:{accessKeyId:n,secretAccessKey:i},u=r.source,a=await H1.randomBytes(32),c={saslStart:1,mechanism:"MONGODB-AWS",payload:W1.serialize({r:a,p:Ane},TA)},l=await t.command(H1.ns(`${u}.$cmd`),c,void 0),f=W1.deserialize(l.payload.buffer,TA),h=f.h,d=f.s.buffer;if(d.length!==64)throw new tu.MongoRuntimeError(`Invalid server nonce length ${d.length}, expected 64`);if(!Uy.ByteUtils.equals(d.subarray(0,a.byteLength),a))throw new tu.MongoRuntimeError("Server nonce does not begin with client nonce");if(h.length<1||h.length>255||h.indexOf("..")!==-1)throw new tu.MongoRuntimeError(`Server returned an invalid host: "${h}"`);let p="Action=GetCallerIdentity&Version=2011-06-15",m=await SN.aws4Sign({method:"POST",host:h,region:One(f.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":p.length,"X-MongoDB-Server-Nonce":Uy.ByteUtils.toBase64(d),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:p,date:new Date},o),E={a:m.Authorization,d:m["X-Amz-Date"]};if(s)E.t=s;let y={saslContinue:1,conversationId:l.conversationId,payload:W1.serialize(E,TA)};await t.command(H1.ns(`${u}.$cmd`),y,void 0)}}Vy.MongoDBAWS=DN;async function wne(e,t){function r(i){if(!i.AccessKeyId||!i.SecretAccessKey)throw new tu.MongoMissingCredentialsError("Could not obtain temporary MONGODB-AWS credentials");return new CN.MongoCredentials({username:i.AccessKeyId,password:i.SecretAccessKey,source:e.source,mechanism:bN.AuthMechanism.MONGODB_AWS,mechanismProperties:{AWS_SESSION_TOKEN:i.Token}})}let n=await t.getCredentials();return r(n)}function One(e){let t=e.split(".");if(t.length===1||t[1]==="amazonaws")return"us-east-1";return t[1]}});var MN=g(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});Wy.finishCommandDocument=Sne;Wy.startCommandDocument=Cne;var xs=Te(),zy=zo();function Sne(e,t){if(t!=null)return{saslContinue:1,conversationId:t,payload:new xs.Binary(xs.BSON.serialize({jwt:e}))};return{saslStart:1,mechanism:zy.AuthMechanism.MONGODB_OIDC,payload:new xs.Binary(xs.BSON.serialize({jwt:e}))}}function Cne(e){let t={};if(e.username)t.n=e.username;return{saslStart:1,autoAuthorize:1,mechanism:zy.AuthMechanism.MONGODB_OIDC,payload:new xs.Binary(xs.BSON.serialize(t))}}});var PA=g(function(Ya){Object.defineProperty(Ya,"__esModule",{value:!0});Ya.CallbackWorkflow=Ya.AUTOMATED_TIMEOUT_MS=Ya.HUMAN_TIMEOUT_MS=void 0;var PN=require("timers/promises"),BN=X(),Hy=he(),K1=MN();Ya.HUMAN_TIMEOUT_MS=300000;Ya.AUTOMATED_TIMEOUT_MS=60000;var bne=["accessToken","expiresInSeconds","refreshToken"],Dne="User provided OIDC callbacks must return a valid object with an accessToken.",MA=100;class FN{constructor(e,t){this.cache=e,this.callback=this.withLock(t),this.lastExecutionTime=Date.now()-MA}async speculativeAuth(e,t){if(this.cache.hasAccessToken){let r=this.cache.getAccessToken();e.accessToken=r;let n=K1.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(Hy.ns(t.source),K1.startCommandDocument(t),void 0);return n}async finishAuthentication(e,t,r,n){await e.command(Hy.ns(t.source),K1.finishCommandDocument(r,n),void 0)}async executeAndValidateCallback(e){let t=await this.callback(e);if(Tne(t))throw new BN.MongoMissingCredentialsError(Dne);return t}withLock(e){let t=Promise.resolve();return async(r)=>{let n=t.then(async()=>{let i=Date.now()-this.lastExecutionTime;if(i<=MA)await PN.setTimeout(MA-i,{signal:r.timeoutContext});return this.lastExecutionTime=Date.now(),await e(r)});return t=n.then(()=>{return},()=>{return}),await n}}}Ya.CallbackWorkflow=FN;function Tne(e){if(e==null||typeof e!=="object")return!0;if(!("accessToken"in e))return!0;return!Object.getOwnPropertyNames(e).every((t)=>bne.includes(t))}});var BA=g(function(Gy){Object.defineProperty(Gy,"__esModule",{value:!0});Gy.AutomatedCallbackWorkflow=void 0;var G1=X(),Ky=fi(),NN=Yy(),Y1=PA();class IN extends Y1.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(i){if(i instanceof G1.MongoError&&i.code===G1.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeAccessToken(),await this.execute(e,t);else throw i}}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:NN.OIDC_VERSION};if(e.username)r.username=e.username;if(e.mechanismProperties.TOKEN_RESOURCE)r.tokenAudience=e.mechanismProperties.TOKEN_RESOURCE;let n=Ky.Timeout.expires(Y1.AUTOMATED_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(r),n])}catch(i){if(Ky.TimeoutError.is(i))throw t.abort(),new G1.MongoOIDCError(`OIDC callback timed out after ${Y1.AUTOMATED_TIMEOUT_MS}ms.`);throw i}finally{n.clear()}}}Gy.AutomatedCallbackWorkflow=IN});var RN=g(function(Jy){Object.defineProperty(Jy,"__esModule",{value:!0});Jy.azureCallback=void 0;var Qy=Y6(),Q1=X(),$N=he(),Mne=Object.freeze({Metadata:"true",Accept:"application/json"}),Pne="Azure endpoint did not return a value with only access_token and expires_in properties",Bne="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure.",Fne=async(e)=>{let{tokenAudience:t,username:r}=e;if(!t)throw new Q1.MongoAzureError(Bne);let n=await Nne(t,r);if(!Ine(n))throw new Q1.MongoAzureError(Pne);return n};Jy.azureCallback=Fne;async function Nne(e,t){let r=new URL(Qy.AZURE_BASE_URL);Qy.addAzureParams(r,e,t);let n=await $N.get(r,{headers:Mne});if(n.status!==200)throw new Q1.MongoAzureError(`Status code ${n.status} returned from the Azure endpoint. Response body: ${n.body}`);let i=JSON.parse(n.body);return{accessToken:i.access_token,expiresInSeconds:Number(i.expires_in)}}function Ine(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 vN=g(function(Zy){Object.defineProperty(Zy,"__esModule",{value:!0});Zy.gcpCallback=void 0;var Xy=X(),xN=he(),$ne="http://metadata/computeMetadata/v1/instance/service-accounts/default/identity",Rne=Object.freeze({"Metadata-Flavor":"Google"}),xne="TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is gcp.",vne=async(e)=>{let t=e.tokenAudience;if(!t)throw new Xy.MongoGCPError(xne);return await kne(t)};Zy.gcpCallback=vne;async function kne(e){let t=new URL($ne);t.searchParams.append("audience",e);let r=await xN.get(t,{headers:Rne});if(r.status!==200)throw new Xy.MongoGCPError(`Status code ${r.status} returned from the GCP endpoint. Response body: ${r.body}`);return{accessToken:r.body}}});var LN=g(function(e2){Object.defineProperty(e2,"__esModule",{value:!0});e2.k8sCallback=void 0;var jN=require("fs/promises"),Qa=require("process"),qne="/var/run/secrets/kubernetes.io/serviceaccount/token",kN="AZURE_FEDERATED_TOKEN_FILE",qN="AWS_WEB_IDENTITY_TOKEN_FILE",jne=async()=>{let e;if(Qa.env[kN])e=Qa.env[kN];else if(Qa.env[qN])e=Qa.env[qN];else e=qne;return{accessToken:await jN.readFile(e,"utf8")}};e2.k8sCallback=jne});var FA=g(function(r2){Object.defineProperty(r2,"__esModule",{value:!0});r2.TokenCache=void 0;var UN=X();class t2 extends UN.MongoDriverError{}class VN{get hasAccessToken(){return!!this.accessToken}get hasRefreshToken(){return!!this.refreshToken}get hasIdpInfo(){return!!this.idpInfo}getAccessToken(){if(!this.accessToken)throw new t2("Attempted to get an access token when none exists.");return this.accessToken}getRefreshToken(){if(!this.refreshToken)throw new t2("Attempted to get a refresh token when none exists.");return this.refreshToken}getIdpInfo(){if(!this.idpInfo)throw new t2("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}}r2.TokenCache=VN});var KN=g(function(n2){Object.defineProperty(n2,"__esModule",{value:!0});n2.tokenMachineCallback=void 0;var zN=require("fs"),WN=require("process"),HN=X(),Lne="OIDC_TOKEN_FILE must be set in the environment.",Une=async()=>{let e=WN.env.OIDC_TOKEN_FILE;if(!e)throw new HN.MongoAWSError(Lne);return{accessToken:await zN.promises.readFile(e,"utf8")}};n2.tokenMachineCallback=Une});var Yy=g(function(vs){Object.defineProperty(vs,"__esModule",{value:!0});vs.MongoDBOIDC=vs.OIDC_WORKFLOWS=vs.OIDC_VERSION=void 0;var i2=X(),YN=Ba(),Ja=BA(),QN=RN(),JN=vN(),XN=LN(),Xa=FA(),ZN=KN(),Vne="AuthContext must provide credentials.";vs.OIDC_VERSION=1;vs.OIDC_WORKFLOWS=new Map;vs.OIDC_WORKFLOWS.set("test",()=>new Ja.AutomatedCallbackWorkflow(new Xa.TokenCache,ZN.tokenMachineCallback));vs.OIDC_WORKFLOWS.set("azure",()=>new Ja.AutomatedCallbackWorkflow(new Xa.TokenCache,QN.azureCallback));vs.OIDC_WORKFLOWS.set("gcp",()=>new Ja.AutomatedCallbackWorkflow(new Xa.TokenCache,JN.gcpCallback));vs.OIDC_WORKFLOWS.set("k8s",()=>new Ja.AutomatedCallbackWorkflow(new Xa.TokenCache,XN.k8sCallback));class eI extends YN.AuthProvider{constructor(e){super();if(!e)throw new i2.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 i=GN(e);if(r)await this.workflow.reauthenticate(t,i);else await this.workflow.execute(t,i,n)}async prepare(e,t){let{connection:r}=t,n=GN(t),i=await this.workflow.speculativeAuth(r,n);return{...e,...i}}}vs.MongoDBOIDC=eI;function GN(e){let{credentials:t}=e;if(!t)throw new i2.MongoMissingCredentialsError(Vne);return t}});var iI=g(function(o2){Object.defineProperty(o2,"__esModule",{value:!0});o2.HumanCallbackWorkflow=void 0;var tI=Te(),ru=X(),s2=fi(),rI=Yy(),J1=PA();class nI extends J1.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 ru.MongoError&&u.code===ru.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 ru.MongoError&&a.code===ru.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,i=tI.BSON.deserialize(r.payload.buffer),s=await this.fetchAccessToken(i,t);return this.cache.put(s,i),e.accessToken=s.accessToken,await this.finishAuthentication(e,t,s.accessToken,n)}async fetchAccessToken(e,t,r){let n=new AbortController,i={timeoutContext:n.signal,version:rI.OIDC_VERSION,idpInfo:e};if(t.username)i.username=t.username;if(r)i.refreshToken=r;let s=s2.Timeout.expires(J1.HUMAN_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(i),s])}catch(o){if(s2.TimeoutError.is(o))throw n.abort(),new ru.MongoOIDCError(`OIDC callback timed out after ${J1.HUMAN_TIMEOUT_MS}ms.`);throw o}finally{s.clear()}}}o2.HumanCallbackWorkflow=nI});var cI=g(function(a2){Object.defineProperty(a2,"__esModule",{value:!0});a2.Plain=void 0;var u2=Te(),sI=X(),oI=he(),uI=Ba();class aI extends uI.AuthProvider{async auth(e){let{connection:t,credentials:r}=e;if(!r)throw new sI.MongoMissingCredentialsError("AuthContext must provide credentials.");let{username:n,password:i}=r,o={saslStart:1,mechanism:"PLAIN",payload:new u2.Binary(u2.ByteUtils.fromUTF8(`\x00${n}\x00${i}`)),autoAuthorize:1};await t.command(oI.ns("$external.$cmd"),o,void 0)}}a2.Plain=aI});var dI=g(function(pge,fI){var lI=(e)=>e.codePointAt(0),zne=(e)=>e[0],Wne=(e)=>e[e.length-1];function hI(e){let t=[],r=e.length;for(let n=0;n<r;n+=1){let i=e.charCodeAt(n);if(i>=55296&&i<=56319&&r>n+1){let s=e.charCodeAt(n+1);if(s>=56320&&s<=57343){t.push((i-55296)*1024+s-56320+65536),n+=1;continue}}t.push(i)}return t}function od({unassigned_code_points:e,commonly_mapped_to_nothing:t,non_ASCII_space_characters:r,prohibited_characters:n,bidirectional_r_al:i,bidirectional_l:s},o,u={}){let a=r,c=t;if(typeof o!=="string")throw TypeError("Expected string.");if(o.length===0)return"";let l=hI(o).map((_)=>a.get(_)?32:_).filter((_)=>!c.get(_)),f=String.fromCodePoint.apply(null,l).normalize("NFKC"),h=hI(f);if(h.some((_)=>n.get(_)))throw Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(u.allowUnassigned!==!0){if(h.some((O)=>e.get(O)))throw Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}let p=h.some((_)=>i.get(_)),m=h.some((_)=>s.get(_));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 E=i.get(lI(zne(f))),y=i.get(lI(Wne(f)));if(p&&!(E&&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}od.saslprep=od;od.default=od;fI.exports=od});var yI=g(function(mge,mI){mI.exports=xu;function xu(e,t){if(!(this instanceof xu))return new xu(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?c2(this.deduplicate.length):null}xu.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)};xu.prototype.lastUpdate=function(){if(!this.updates||!this.updates.length)return null;var e=this.updates.pop();return e.updated=!1,e};xu.prototype._array=function(e,t){if(e>=this.maxPages){if(t)return;Hne(this,e)}Yne(e,this.path);var r=this.pages;for(var n=this.level;n>0;n--){var i=this.path[n],s=r[i];if(!s){if(t)return;s=r[i]=Array(32768)}r=s}return r};xu.prototype.get=function(e,t){var r=this._array(e,t),n=this.path[0],i=r&&r[n];if(!i&&!t){if(i=r[n]=new pI(e,c2(this.pageSize)),e>=this.length)this.length=e+1}if(i&&i.buffer===this.deduplicate&&this.deduplicate&&!t)i.buffer=Gne(i.buffer),i.deduplicate=0;return i};xu.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 i=r[n],s=Kne(t,this.pageSize);if(i)i.buffer=s;else r[n]=new pI(e,s)};xu.prototype.toBuffer=function(){var e=Array(this.length),t=c2(this.pageSize),r=0;while(r<e.length){var n=this._array(r,!0);for(var i=0;i<32768&&r<e.length;i++)e[r++]=n&&n[i]?n[i].buffer:t}return Buffer.concat(e)};function Hne(e,t){while(e.maxPages<t){var r=e.pages;e.pages=Array(32768),e.pages[0]=r,e.level++,e.maxPages*=32768}}function Kne(e,t){if(e.length===t)return e;if(e.length>t)return e.slice(0,t);var r=c2(t);return e.copy(r),r}function c2(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function Gne(e){var t=Buffer.allocUnsafe?Buffer.allocUnsafe(e.length):new Buffer(e.length);return e.copy(t),t}function pI(e,t){this.offset=e*t.length,this.buffer=t,this.updated=!1,this.deduplicate=0}function Yne(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 EI=g(function(yge,gI){var Qne=yI();gI.exports=Za;function Za(e){if(!(this instanceof Za))return new Za(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||Qne(this.pageSize),this.byteLength=this.pages.length*this.pageSize,this.length=8*this.byteLength,!Xne(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}}Za.prototype.get=function(e){var t=e&7,r=(e-t)/8;return!!(this.getByte(r)&128>>t)};Za.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};Za.prototype.set=function(e,t){var r=e&7,n=(e-r)/8,i=this.getByte(n);return this.setByte(n,t?i|128>>r:i&(255^128>>r))};Za.prototype.toBuffer=function(){var e=Jne(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};Za.prototype.setByte=function(e,t){var r=e&this._pageMask,n=(e-r)/this.pageSize,i=this.pages.get(n,!1);if(r+=this.pageOffset,i.buffer[r]===t)return!1;if(i.buffer[r]=t,e>=this.byteLength)this.byteLength=e+1,this.length=this.byteLength*8;if(this._trackUpdates)this.pages.updated(i);return!0};function Jne(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function Xne(e){return!(e&e-1)}});var _I=g(function(ud){var Zne=ud&&ud.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ud,"__esModule",{value:!0});ud.createMemoryCodePoints=tie;var eie=Zne(EI());function tie(e){let t=0;function r(){let c=e.readUInt32BE(t);t+=4;let l=e.slice(t,t+c);return t+=c,(0,eie.default)({buffer:l})}let n=r(),i=r(),s=r(),o=r(),u=r(),a=r();return{unassigned_code_points:n,commonly_mapped_to_nothing:i,non_ASCII_space_characters:s,prohibited_characters:o,bidirectional_r_al:u,bidirectional_l:a}}});var wI=g(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var AI=require("zlib");NA.default=AI.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 bI=g(function(IA,CI){var OI=IA&&IA.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},rie=OI(dI()),SI=_I(),nie=OI(wI()),iie=SI.createMemoryCodePoints(nie.default);function ad(e,t){return(0,rie.default)(iie,e,t)}ad.saslprep=ad;ad.default=ad;CI.exports=ad});var RI=g(function(X1){Object.defineProperty(X1,"__esModule",{value:!0});X1.ScramSHA256=X1.ScramSHA1=void 0;var TI=bI(),xe=Te(),ur=X(),ec=he(),MI=Ba(),f2=zo();class RA extends MI.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 i=await ec.randomBytes(24);return t.nonce=i,{...e,speculativeAuthenticate:{...FI(r,n,i),db:n.source}}}async auth(e){let{reauthenticating:t,response:r}=e;if(r?.speculativeAuthenticate&&!t)return await NI(this.cryptoMethod,r.speculativeAuthenticate,e);return await sie(this.cryptoMethod,e)}}function PI(e){return e.replace("=","=3D").replace(",","=2C")}function BI(e,t){return xe.ByteUtils.concat([xe.ByteUtils.fromUTF8("n="),xe.ByteUtils.fromUTF8(e),xe.ByteUtils.fromUTF8(",r="),xe.ByteUtils.fromUTF8(xe.ByteUtils.toBase64(t))])}function FI(e,t,r){let n=PI(t.username);return{saslStart:1,mechanism:e==="sha1"?f2.AuthMechanism.MONGODB_SCRAM_SHA1:f2.AuthMechanism.MONGODB_SCRAM_SHA256,payload:new xe.Binary(xe.ByteUtils.concat([xe.ByteUtils.fromUTF8("n,,"),BI(n,r)])),autoAuthorize:1,options:{skipEmptyExchange:!0}}}async function sie(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 i=t.nonce,s=n.source,o=FI(e,n,i),u=await r.command(ec.ns(`${s}.$cmd`),o,void 0);await NI(e,u,t)}async function NI(e,t,r){let{connection:n,credentials:i}=r;if(!i)throw new ur.MongoMissingCredentialsError("AuthContext must provide credentials.");if(!r.nonce)throw new ur.MongoInvalidArgumentError("Unable to continue SCRAM without valid nonce");let s=r.nonce,o=i.source,u=PI(i.username),a=i.password,c=e==="sha256"?TI.saslprep(a):oie(u,a),l=xe.ByteUtils.isUint8Array(t.payload)?new xe.Binary(t.payload):t.payload,f=DI(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}`,E=await hie(c,xe.ByteUtils.fromBase64(d),h,e),y=await l2(e,E,"Client Key"),_=await l2(e,E,"Server Key"),O=await aie(e,y),b=BI(u,s),A=xe.ByteUtils.toUTF8(b,0,b.length,!1),P=xe.ByteUtils.toUTF8(l.buffer,0,l.position,!1),S=[A,P,m].join(","),B=await l2(e,O,S),q=`p=${uie(y,B)}`,I=[m,q].join(","),we=await l2(e,_,S),Ne={saslContinue:1,conversationId:t.conversationId,payload:new xe.Binary(xe.ByteUtils.fromUTF8(I))},ae=await n.command(ec.ns(`${o}.$cmd`),Ne,void 0),ir=DI(ae.payload);if(!fie(xe.ByteUtils.fromBase64(ir.v),we))throw new ur.MongoRuntimeError("Server returned an invalid signature");if(ae.done!==!1)return;let G={saslContinue:1,conversationId:ae.conversationId,payload:xe.ByteUtils.allocate(0)};await n.command(ec.ns(`${o}.$cmd`),G,void 0)}function DI(e){let t=xe.ByteUtils.toUTF8(e.buffer,0,e.position,!1),r={},n=t.split(",");for(let i=0;i<n.length;i++){let s=(n[i].match(/^([^=]*)=(.*)$/)??[]).slice(1);r[s[0]]=s[1]}return r}function oie(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 uie(e,t){let r=Math.max(e.length,t.length),n=[];for(let i=0;i<r;i+=1)n.push(e[i]^t[i]);return xe.ByteUtils.toBase64(xe.ByteUtils.fromNumberArray(n))}async function aie(e,t){let r=await crypto.subtle.digest(e==="sha256"?"SHA-256":"SHA-1",t);return new Uint8Array(r)}async function l2(e,t,r){let n=xe.ByteUtils.toLocalBufferType(t),i=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:{name:e==="sha256"?"SHA-256":"SHA-1"}},!1,["sign","verify"]),s=typeof r==="string"?new TextEncoder().encode(r):r,o=xe.ByteUtils.toLocalBufferType(s),u=await crypto.subtle.sign("HMAC",i,o);return new Uint8Array(u)}var h2={},$A=0;function cie(){h2={},$A=0}var lie={sha256:32,sha1:20};async function hie(e,t,r,n){let i=[e,xe.ByteUtils.toBase64(t),r].join("_");if(h2[i]!=null)return h2[i];let s=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,s,lie[n]*8),a=new Uint8Array(u);if($A>=200)cie();return h2[i]=a,$A+=1,a}function fie(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 II extends RA{constructor(){super("sha1")}}X1.ScramSHA1=II;class $I extends RA{constructor(){super("sha256")}}X1.ScramSHA256=$I});var jI=g(function(p2){Object.defineProperty(p2,"__esModule",{value:!0});p2.X509=void 0;var d2=X(),vI=he(),kI=Ba();class qI extends kI.AuthProvider{async prepare(e,t){let{credentials:r}=t;if(!r)throw new d2.MongoMissingCredentialsError("AuthContext must provide credentials.");return{...e,speculativeAuthenticate:xI(r)}}async auth(e){let{connection:t,credentials:r}=e;if(!r)throw new d2.MongoMissingCredentialsError("AuthContext must provide credentials.");if(e.response?.speculativeAuthenticate)return;await t.command(vI.ns("$external.$cmd"),xI(r),void 0)}}p2.X509=qI;function xI(e){let t={authenticate:1,mechanism:"MONGODB-X509"};if(e.username)t.user=e.username;return t}});var xA=g(function(_2){Object.defineProperty(_2,"__esModule",{value:!0});_2.MongoClientAuthProviders=void 0;var LI=v0(),UI=TN(),g2=Yy(),VI=BA(),zI=iI(),m2=FA(),WI=cI(),xi=zo(),y2=RI(),HI=jI(),E2=X(),die=new Map([[xi.AuthMechanism.MONGODB_AWS,({AWS_CREDENTIAL_PROVIDER:e})=>new UI.MongoDBAWS(e)],[xi.AuthMechanism.MONGODB_GSSAPI,()=>new LI.GSSAPI],[xi.AuthMechanism.MONGODB_OIDC,(e)=>new g2.MongoDBOIDC(pie(e))],[xi.AuthMechanism.MONGODB_PLAIN,()=>new WI.Plain],[xi.AuthMechanism.MONGODB_SCRAM_SHA1,()=>new y2.ScramSHA1],[xi.AuthMechanism.MONGODB_SCRAM_SHA256,()=>new y2.ScramSHA256],[xi.AuthMechanism.MONGODB_X509,()=>new HI.X509]]);class KI{constructor(){this.existingProviders=new Map}getOrCreateProvider(e,t){let r=this.existingProviders.get(e);if(r)return r;let n=die.get(e);if(!n)throw new E2.MongoInvalidArgumentError(`authMechanism ${e} not supported`);let i=n(t);return this.existingProviders.set(e,i),i}}_2.MongoClientAuthProviders=KI;function pie(e){if(e.OIDC_HUMAN_CALLBACK)return new zI.HumanCallbackWorkflow(new m2.TokenCache,e.OIDC_HUMAN_CALLBACK);else if(e.OIDC_CALLBACK)return new VI.AutomatedCallbackWorkflow(new m2.TokenCache,e.OIDC_CALLBACK);else{let t=e.ENVIRONMENT,r=g2.OIDC_WORKFLOWS.get(t)?.();if(!r)throw new E2.MongoInvalidArgumentError(`Could not load workflow for environment ${e.ENVIRONMENT}`);return r}}});var kA=g(function(A2){Object.defineProperty(A2,"__esModule",{value:!0});A2.ClientBulkWriteOperation=void 0;var GI=St(),YI=he(),QI=fr(),vi=vt();class vA extends QI.CommandOperation{get commandName(){return"bulkWrite"}constructor(e,t){super(void 0,t);this.SERVER_COMMAND_RESPONSE_TYPE=GI.ClientBulkWriteCursorResponse,this.commandBuilder=e,this.options=t,this.ns=new YI.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}}A2.ClientBulkWriteOperation=vA;vi.defineAspects(vA,[vi.Aspect.WRITE_OPERATION,vi.Aspect.SKIP_COLLATION,vi.Aspect.CURSOR_CREATING,vi.Aspect.RETRYABLE,vi.Aspect.COMMAND_BATCHING,vi.Aspect.SUPPORTS_RAW_DATA])});var e$=g(function(O2){Object.defineProperty(O2,"__esModule",{value:!0});O2.ClientBulkWriteCursor=void 0;var JI=kA(),XI=sn(),w2=he(),ZI=Fi();class qA extends ZI.AbstractCursor{constructor(e,t,r={}){super(e,new w2.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=w2.mergeOptions({},this.clientBulkWriteOptions);return delete e.session,new qA(this.client,this.commandBuilder,{...e})}async _initialize(e){let t=new JI.ClientBulkWriteOperation(this.commandBuilder,{...this.clientBulkWriteOptions,...this.cursorOptions,session:e}),r=await XI.executeOperation(this.client,t,this.timeoutContext);return this.cursorResponse=r,{server:t.server,session:e,response:r}}}O2.ClientBulkWriteCursor=qA});var s$=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=LA;var Z1=Te(),S2=ca(),nu=X(),C2=ql(),eh=he(),t$=1000;class r${constructor(e,t,r){this.models=e,this.options=t,this.pkFactory=r??eh.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,i=0,s=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=LA(u,c,this.pkFactory,this.options),f;try{f=Z1.BSON.serialize(l)}catch(h){throw new nu.MongoInvalidArgumentError("Could not serialize operation to BSON",{cause:h})}if(jA("ops",f,r),n+f.length<e&&s.ops.documents.length<t)n=t$+s.ops.push(l,f),this.currentModelIndex++;else break}else{o.set(a,i);let l={ns:a},f=LA(u,i,this.pkFactory,this.options),h,d;try{h=Z1.BSON.serialize(l),d=Z1.BSON.serialize(f)}catch(p){throw new nu.MongoInvalidArgumentError("Could not serialize ns info to BSON",{cause:p})}if(jA("nsInfo",h,r),jA("ops",d,r),n+h.length+d.length<e&&s.ops.documents.length<t)n=t$+s.nsInfo.push(l,h)+s.ops.push(f,d),i++,this.currentModelIndex++;else break}}return this.lastOperations=s.ops.documents,s}baseCommand(){let e={bulkWrite:1,errorsOnly:this.errorsOnly,ordered:this.options.ordered??!0,ops:new S2.DocumentSequence("ops"),nsInfo:new S2.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=r$;function jA(e,t,r){if(t.length>r)throw new nu.MongoInvalidArgumentError(`Client bulk write operation ${e} of length ${t.length} exceeds the max bson object size of ${r}`)}var mie=(e,t,r)=>{let n={insert:t,document:e.document};return n.document._id=e.document._id??r.createPk(),n};dr.buildInsertOneOperation=mie;var yie=(e,t)=>n$(e,t,!1);dr.buildDeleteOneOperation=yie;var gie=(e,t)=>n$(e,t,!0);dr.buildDeleteManyOperation=gie;function n$(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 Eie=(e,t,r)=>i$(e,t,!1,r);dr.buildUpdateOneOperation=Eie;var _ie=(e,t,r)=>i$(e,t,!0,r);dr.buildUpdateManyOperation=_ie;function Aie(e,t){if(!eh.hasAtomicOperators(e,t))throw new nu.MongoAPIError("Client bulk write update models must only contain atomic modifiers (start with $) and must not be empty.")}function i$(e,t,r,n){Aie(e.update,n);let i={update:t,multi:r,filter:e.filter,updateMods:e.update};if(e.hint)i.hint=e.hint;if(e.upsert)i.upsert=e.upsert;if(e.arrayFilters)i.arrayFilters=e.arrayFilters;if(e.collation)i.collation=e.collation;if(!r&&"sort"in e&&e.sort!=null)i.sort=C2.formatSort(e.sort);return i}var wie=(e,t)=>{if(eh.hasAtomicOperators(e.replacement))throw new nu.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=C2.formatSort(e.sort);return r};dr.buildReplaceOneOperation=wie;function LA(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 c$=g(function(b2){Object.defineProperty(b2,"__esModule",{value:!0});b2.ClientBulkWriteResultsMerger=void 0;var o$=Pa(),u$=X(),Oie={acknowledged:!1,insertedCount:0,upsertedCount:0,matchedCount:0,modifiedCount:0,deletedCount:0,insertResults:void 0,updateResults:void 0,deleteResults:void 0};class a${static unacknowledged(){return Oie}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 u$.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 o$.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 i of n.cursor.firstBatch)if(i.ok===1)this.processDocument(e,i)}}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}}b2.ClientBulkWriteResultsMerger=a$});var E$=g(function(M2){Object.defineProperty(M2,"__esModule",{value:!0});M2.ClientBulkWriteExecutor=void 0;var D2=Fi(),l$=e$(),ki=X(),h$=fi(),f$=he(),d$=hi(),p$=sn(),m$=kA(),y$=s$(),T2=c$();class g${constructor(e,t,r){if(t.length===0)throw new ki.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=d$.WriteConcern.fromOptions(this.client.s.options);if(this.options.writeConcern?.w===0){if(this.options.verboseResults)throw new ki.MongoInvalidArgumentError("Cannot request unacknowledged write concern and verbose results");if(this.options.ordered)throw new ki.MongoInvalidArgumentError("Cannot request unacknowledged write concern and ordered writes")}}async execute(){let e=this.client.s.options.pkFactory,t=new y$.ClientBulkWriteCommandBuilder(this.operations,this.options,e),r=f$.resolveTimeoutOptions(this.client,this.options),n=h$.TimeoutContext.create(r);if(this.options.writeConcern?.w===0){while(t.hasNextBatch()){let i=new m$.ClientBulkWriteOperation(t,this.options);await p$.executeOperation(this.client,i,n)}return T2.ClientBulkWriteResultsMerger.unacknowledged()}else{let i=new T2.ClientBulkWriteResultsMerger(this.options);while(t.hasNextBatch()){let s=new D2.CursorTimeoutContext(n,Symbol()),o={...this.options,timeoutContext:s,...r.timeoutMS!=null&&{timeoutMode:D2.CursorTimeoutMode.LIFETIME}},u=new l$.ClientBulkWriteCursor(this.client,t,o);try{await i.merge(u)}catch(a){if(a instanceof ki.MongoServerError&&!(a instanceof ki.MongoClientBulkWriteError)){let c=new ki.MongoClientBulkWriteError({message:"Mongo client bulk write encountered an error during execution"});throw c.cause=a,c.partialResult=i.bulkWriteResult,c}else throw a}}if(i.writeConcernErrors.length>0||i.writeErrors.size>0){let s=new ki.MongoClientBulkWriteError({message:"Mongo client bulk write encountered errors during execution."});throw s.writeConcernErrors=i.writeConcernErrors,s.writeErrors=i.writeErrors,s.partialResult=i.bulkWriteResult,s}return i.bulkWriteResult}}}M2.ClientBulkWriteExecutor=g$});var S$=g(function(B2){Object.defineProperty(B2,"__esModule",{value:!0});B2.EndSessionsOperation=void 0;var _$=St(),A$=fr(),w$=Xr(),O$=he(),P2=vt();class UA extends A$.CommandOperation{constructor(e){super();this.writeConcern={w:0},this.ns=O$.MongoDBNamespace.fromString("admin.$cmd"),this.SERVER_COMMAND_RESPONSE_TYPE=_$.MongoDBResponse,this.sessions=e}buildCommandDocument(e,t){return{endSessions:this.sessions}}buildOptions(e){return{timeoutContext:e,readPreference:w$.ReadPreference.primaryPreferred}}get commandName(){return"endSessions"}}B2.EndSessionsOperation=UA;P2.defineAspects(UA,P2.Aspect.WRITE_OPERATION)});var VA=g(function(ks){Object.defineProperty(ks,"__esModule",{value:!0});ks.WaitingForSuitableServerEvent=ks.ServerSelectionSucceededEvent=ks.ServerSelectionFailedEvent=ks.ServerSelectionStartedEvent=ks.ServerSelectionEvent=void 0;var C$=he(),tc=Br();class th{constructor(e,t,r){this.selector=e,this.operation=r,this.topologyDescription=t}}ks.ServerSelectionEvent=th;class b$ extends th{constructor(e,t,r){super(e,t,r);this.name=tc.SERVER_SELECTION_STARTED,this.message="Server selection started"}}ks.ServerSelectionStartedEvent=b$;class D$ extends th{constructor(e,t,r,n){super(e,t,n);this.name=tc.SERVER_SELECTION_FAILED,this.message="Server selection failed",this.failure=r}}ks.ServerSelectionFailedEvent=D$;class T$ extends th{constructor(e,t,r,n){super(e,t,n);this.name=tc.SERVER_SELECTION_SUCCEEDED,this.message="Server selection succeeded";let{host:i,port:s}=C$.HostAddress.fromString(r).toHostPort();this.serverHost=i,this.serverPort=s}}ks.ServerSelectionSucceededEvent=T$;class M$ extends th{constructor(e,t,r,n){super(e,t,n);this.name=tc.WAITING_FOR_SUITABLE_SERVER,this.message="Waiting for suitable server to become available",this.remainingTimeMS=r}}ks.WaitingForSuitableServerEvent=M$});var HA=g(function(nh){Object.defineProperty(nh,"__esModule",{value:!0});nh.SrvPoller=nh.SrvPollingEvent=void 0;var P$=require("dns"),rh=require("timers"),B$=X(),F$=Zi(),qs=he();class zA{constructor(e){this.srvRecords=e}hostnames(){return new Set(this.srvRecords.map((e)=>qs.HostAddress.fromSrvRecord(e).toString()))}}nh.SrvPollingEvent=zA;class WA extends F$.TypedEventEmitter{static{this.SRV_RECORD_DISCOVERY="srvRecordDiscovery"}constructor(e){super();if(this.on("error",qs.noop),!e||!e.srvHost)throw new B$.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)rh.clearTimeout(this._timeout),this.generation+=1,this._timeout=void 0}schedule(){if(this._timeout)rh.clearTimeout(this._timeout);this._timeout=rh.setTimeout(()=>{this._poll().then(void 0,qs.squashError)},this.intervalMS)}success(e){this.haMode=!1,this.schedule(),this.emit(WA.SRV_RECORD_DISCOVERY,new zA(e))}failure(){this.haMode=!0,this.schedule()}async _poll(){let e=this.generation,t;try{t=await P$.promises.resolve(this.srvAddress,"SRV")}catch{this.failure();return}if(e!==this.generation)return;let r=[];for(let n of t)try{let i=qs.normalizeDnsName(n.name);qs.verifySrvHost(i,this.srvHost,this),r.push({...n,name:i})}catch(i){qs.squashError(i)}if(!r.length){this.failure();return}this.success(r)}}nh.SrvPoller=WA});var q$=g(function(I2){Object.defineProperty(I2,"__esModule",{value:!0});I2.Topology=void 0;var $$=CA(),Lt=Br(),Gr=X(),ve=Aa(),R$=Zi(),iu=Xr(),ih=fi(),Ut=he(),te=bi(),Qn=Iy(),F2=yA(),oh=Xf(),rc=Nl(),Jn=VA(),nc=HA(),N2=uA(),Sie=0,cd=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 R$.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($$.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 i=Cie(r),s=Sie++,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 oh.ServerDescription(a));if(this.waitQueue=new Ut.List,this.s={id:s,options:r,seedlist:n,state:te.STATE_CLOSED,description:new N2.TopologyDescription(i,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 nc.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,s=!!this.s.srvPoller?.listeners(nc.SrvPoller.SRV_RECORD_DISCOVERY)?.includes(this.s.detectSrvRecords);if(n&&!s)this.s.srvPoller?.on(nc.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;N$(this),this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Qn.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;cd(this,te.STATE_CONNECTING),this.emitAndLog(Bn.TOPOLOGY_OPENING,new Qn.TopologyOpeningEvent(this.s.id)),this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Qn.TopologyDescriptionChangedEvent(this.s.id,new N2.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,v$(this,o)])),this.s.options.loadBalanced)for(let o of t){let u=new oh.ServerDescription(o.hostAddress,void 0,{loadBalanced:this.s.options.loadBalanced});this.serverUpdateHandler(u)}let r=this.client.s.options.serverSelectionTimeoutMS,n=e.readPreference??iu.ReadPreference.primary,i=ih.TimeoutContext.create({timeoutMS:void 0,serverSelectionTimeoutMS:r,waitQueueTimeoutMS:this.client.s.options.waitQueueTimeoutMS}),s={operationName:"handshake",...e,timeoutContext:i,deprioritizedServers:new rc.DeprioritizedServers};try{let o=await this.selectServer(rc.readPreferenceServerSelector(n),s);if(this.s.options.__skipPingOnConnect!==!0){let a=await o.pool.checkOut({timeoutContext:i});return o.pool.checkIn(a),cd(this,te.STATE_CONNECTED),this.emit(Bn.OPEN,this),this.emit(Bn.CONNECT,this),this}return cd(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())x$(e,this);if(this.s.servers.clear(),cd(this,te.STATE_CLOSING),k$(this.waitQueue,new Gr.MongoTopologyClosedError),this.s.srvPoller)this.s.srvPoller.stop(),this.s.srvPoller.removeListener(nc.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords);this.removeListener(Bn.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology),cd(this,te.STATE_CLOSED),this.emitAndLog(Bn.TOPOLOGY_CLOSED,new Qn.TopologyClosedEvent(this.s.id))}async selectServer(e,t){let r;if(typeof e!=="function")if(typeof e==="string")r=rc.readPreferenceServerSelector(iu.ReadPreference.fromString(e));else{let h;if(e instanceof iu.ReadPreference)h=e;else iu.ReadPreference.translate(t),h=t.readPreference||iu.ReadPreference.primary;r=rc.readPreferenceServerSelector(h)}else r=e;if(t={serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS,...t},this.client.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.ServerSelectionStartedEvent(e,this.description,t.operationName));let n;if(t.timeoutContext)n=t.timeoutContext.serverSelectionTimeout;else n=ih.Timeout.expires(t.serverSelectionTimeoutMS??0);let i=this.description.type===te.TopologyType.Sharded,s=t.session,o=s&&s.transaction;if(i&&o&&o.server){if(this.client.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.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),I$(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(ih.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(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))this.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.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(bie(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 i=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(!i){let s=this.s.description.servers.get(e.address);if(s)this.emit(Bn.SERVER_DESCRIPTION_CHANGED,new Qn.ServerDescriptionChangedEvent(this.s.id,e.address,r,s))}if(N$(this,e),this.waitQueue.length>0)I$(this);if(!i)this.emitAndLog(Bn.TOPOLOGY_DESCRIPTION_CHANGED,new Qn.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}}I2.Topology=Bn;function x$(e,t){for(let r of Lt.LOCAL_SERVER_EVENTS)e.removeAllListeners(r);e.close(),t.emitAndLog(Bn.SERVER_CLOSED,new Qn.ServerClosedEvent(t.s.id,e.description.address));for(let r of Lt.SERVER_RELAY_EVENTS)e.removeAllListeners(r)}function Cie(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 v$(e,t){e.emitAndLog(Bn.SERVER_OPENING,new Qn.ServerOpeningEvent(e.s.id,t.address));let r=new F2.Server(e,t,e.s.options);for(let n of Lt.SERVER_RELAY_EVENTS)r.on(n,(i)=>e.emit(n,i));return r.on(F2.Server.DESCRIPTION_RECEIVED,(n)=>e.serverUpdateHandler(n)),r.connect(),r}function N$(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=v$(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 i=e.s.servers.get(n);if(e.s.servers.delete(n),i)x$(i,e)}}function k$(e,t){while(e.length){let r=e.shift();if(!r)continue;if(!r.cancelled){if(r.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))r.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.ServerSelectionFailedEvent(r.serverSelector,r.topologyDescription,t,r.operationName));r.reject(t)}}}function I$(e){if(e.s.state===te.STATE_CLOSED){k$(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 i=0;i<n;++i){let s=e.waitQueue.shift();if(!s)continue;if(s.cancelled)continue;let o;try{let{serverSelector:c,deprioritizedServers:l}=s;o=c?c(e.description,r,l):r}catch(c){if(e.client.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.ServerSelectionFailedEvent(s.serverSelector,e.description,c,s.operationName));s.reject(c);continue}let u;if(o.length===0){if(!s.waitingLogged){if(e.client.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.INFORMATIONAL))e.client.mongoLogger?.info(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.WaitingForSuitableServerEvent(s.serverSelector,e.description,e.s.serverSelectionTimeoutMS!==0?e.s.serverSelectionTimeoutMS-(Ut.processTimeMS()-s.startTime):-1,s.operationName));s.waitingLogged=!0}e.waitQueue.push(s);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(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.ServerSelectionFailedEvent(s.serverSelector,e.description,c,s.operationName));s.reject(c);return}let a=s.transaction;if(t&&a&&a.isActive&&u)a.pinServer(u);if(e.client.mongoLogger?.willLog(ve.MongoLoggableComponent.SERVER_SELECTION,ve.SeverityLevel.DEBUG))e.client.mongoLogger?.debug(ve.MongoLoggableComponent.SERVER_SELECTION,new Jn.ServerSelectionSucceededEvent(s.serverSelector,s.topologyDescription,u.pool.address,s.operationName));s.resolve(u)}if(e.waitQueue.length>0)for(let[,i]of e.s.servers)queueMicrotask(function(){return i.requestCheck()})}function bie(e,t){let n=e.servers.get(t.address)?.topologyVersion;return oh.compareTopologyVersion(n,t.topologyVersion)>0}});var qc=g(function(ch){Object.defineProperty(ch,"__esModule",{value:!0});ch.MongoClient=ch.ServerApiVersion=void 0;var uh=require("fs"),j$=Pa(),L$=Te(),U$=f1(),V$=q0(),z$=zo(),$2=D6(),R2=CA(),W$=Br(),H$=R0(),ah=X(),K$=xA(),x2=Aa(),G$=Zi(),Y$=E$(),Q$=S$(),J$=sn(),X$=Xr(),v2=Nl(),k2=q$(),q2=Rf(),nt=he();ch.ServerApiVersion=Object.freeze({v1:"1"});class Z$ extends G$.TypedEventEmitter{constructor(e,t){super();this.driverInfoList=[],this.on("error",nt.noop),this.options=R2.parseOptions(e,this,t),this.appendMetadata(this.options.driverInfo);let r=Object.values(this.options.mongoLoggerOptions.componentSeverities).some((i)=>i!==x2.SeverityLevel.OFF);this.mongoLogger=r?new x2.MongoLogger(this.options.mongoLoggerOptions):void 0;let n=this;this.s={url:e,bsonOptions:L$.resolveBSONOptions(this.options),namespace:nt.ns("admin"),hasBeenClosed:!1,sessionPool:new q2.ServerSessionPool(this),activeSessions:new Set,activeCursors:new Set,authProviders:new K$.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)=>$2.isDriverInfoEqual(r,e)))return;this.driverInfoList.push(e),this.options.metadata=$2.makeClientMetadata(this.driverInfoList,this.options).then(void 0,nt.squashError).then((r)=>r??{})}checkForNonGenuineHosts(){let e=this.options.hosts.filter((i)=>nt.isHostMatch(nt.DOCUMENT_DB_CHECK,i.host)),t=nt.isHostMatch(nt.DOCUMENT_DB_CHECK,this.options.srvHost),r=this.options.hosts.filter((i)=>nt.isHostMatch(nt.COSMOS_DB_CHECK,i.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 ah.MongoInvalidArgumentError("MongoClient bulkWrite does not currently support automatic encryption.");return await new Y$.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 uh.promises.readFile(e.tlsCAFile);if(typeof e.tlsCRLFile==="string")e.crl??=await uh.promises.readFile(e.tlsCRLFile);if(typeof e.tlsCertificateKeyFile==="string"){if(!e.key||!e.cert){let r=await uh.promises.readFile(e.tlsCertificateKeyFile);e.key??=r,e.cert??=r}}}if(typeof e.srvHost==="string"){let r=await R2.resolveSRVRecord(e);for(let[n,i]of r.entries())e.hosts[n]=i}if(e.credentials?.mechanism===z$.AuthMechanism.MONGODB_OIDC){let r=e.credentials?.mechanismProperties?.ALLOWED_HOSTS||V$.DEFAULT_ALLOWED_HOSTS;if(!e.credentials?.mechanismProperties?.ENVIRONMENT){for(let i of e.hosts)if(!nt.hostMatchesWildcards(i.toHostPort().host,r))throw new ah.MongoInvalidArgumentError(`Host '${i}' is not valid for OIDC authentication with ALLOWED_HOSTS of '${r.join(",")}'`)}}this.topology=new k2.Topology(this,e.hosts,e),this.topology.once(k2.Topology.OPEN,()=>this.emit("open",this));for(let r of W$.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===j$.TopologyType.LoadBalanced||this.topology.description.logicalSessionTimeoutMinutes!=null)await s(this,this.topology);let n=this.topology;this.topology=void 0,n.close();let{encrypter:i}=this.options;if(i)await i.close(this);async function s(o,{description:u}){let a=v2.readPreferenceServerSelector(X$.ReadPreference.primaryPreferred),c=Array.from(u.servers.values());if(a(u,c,new v2.DeprioritizedServers).length!==0){let f=Array.from(o.s.sessionPool.sessions,({id:h})=>h);if(f.length!==0)try{await J$.executeOperation(o,new Q$.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 H$.Db(this,e,r)}static async connect(e,t){return await new this(e,t).connect()}startSession(e){let t=new q2.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 ah.MongoInvalidArgumentError("Missing required callback parameter");let i=this.startSession(r);try{return await n(i)}finally{try{await i.endSession()}catch(s){nt.squashError(s)}}}watch(e=[],t={}){if(!Array.isArray(e))t=e,e=[];return new U$.ChangeStream(this,e,nt.resolveOptions(this,t))}}ch.MongoClient=Z$});var f1=g(function(ld){Object.defineProperty(ld,"__esModule",{value:!0});ld.ChangeStream=void 0;ld.filterOutOptions=uR;var eR=a1(),Cr=Br(),tR=Fi(),rR=g6(),nR=R0(),it=X(),iR=qc(),sR=Zi(),oR=Nl(),dn=he(),zc={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")},Die=[Cr.RESUME_TOKEN_CHANGED,Cr.END,Cr.CLOSE],Tie="A change stream document has been received that lacks a resume token (_id).",j2="ChangeStream is closed",Mie=Pie();function uR(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>!Mie.has(t)))}class Wc extends sR.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 eR.Collection)this.type=zc.COLLECTION;else if(e instanceof nR.Db)this.type=zc.DATABASE;else if(e instanceof iR.MongoClient)this.type=zc.CLUSTER;else throw new it.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 it.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 it.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 it.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 it.MongoChangeStreamError(j2);return this.cursor.stream()}_setIsEmitter(){if(this.mode==="iterator")throw new it.MongoAPIError("ChangeStream cannot be used as an EventEmitter after being used as an iterator");this.mode="emitter"}_setIsIterator(){if(this.mode==="emitter")throw new it.MongoAPIError("ChangeStream cannot be used as an iterator after being used as an EventEmitter");this.mode="iterator"}_createChangeStreamCursor(e){let t=uR(e);if(this.type===zc.CLUSTER)t.allChangesForCluster=!0;let r=[{$changeStream:t},...this.pipeline],n=this.type===zc.CLUSTER?this.parent:this.type===zc.DATABASE?this.parent.client:this.type===zc.COLLECTION?this.parent.client:null;if(n==null)throw new it.MongoRuntimeError(`Changestream type should only be one of cluster, database, collection. Found ${this.type.toString()}`);let i=new rR.ChangeStreamCursor(n,this.namespace,r,{...e,timeoutContext:this.timeoutContext?new tR.CursorTimeoutContext(this.timeoutContext,this.contextOwner):void 0});for(let s of Die)i.on(s,(o)=>this.emit(s,o));if(this.listenerCount(Wc.CHANGE)>0)this._streamEvents(i);return i}_closeEmitterModeWithError(e){this.emit(Wc.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(Wc.CHANGE,n)}catch(n){this.emit(Wc.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 it.MongoAPIError(j2);if(e==null)throw new it.MongoRuntimeError(j2);if(e&&!e._id)throw new it.MongoChangeStreamError(Tie);return this.cursor.cacheResumeToken(e._id),this.options.startAtOperationTime=void 0,e}_processErrorStreamMode(e,t){if(this.isClosed)return;if(t&&(it.isResumableError(e,this.cursor.maxWireVersion)||e instanceof it.MongoOperationTimeoutError))this._endStream(),this.cursor.close().then(()=>this._resume(e),(r)=>(dn.squashError(r),this._resume(e))).then(()=>{if(e instanceof it.MongoOperationTimeoutError)this.emit(Wc.ERROR,e)},()=>this._closeEmitterModeWithError(e));else this._closeEmitterModeWithError(e)}async _processErrorIteratorMode(e,t){if(this.isClosed)throw new it.MongoAPIError(j2);if(t&&(it.isResumableError(e,this.cursor.maxWireVersion)||e instanceof it.MongoOperationTimeoutError)){try{await this.cursor.close()}catch(r){dn.squashError(r)}if(await this._resume(e),e instanceof it.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 oR.DeprioritizedServers}),this.cursor=this._createChangeStreamCursor(this.cursor.resumeOptions)}catch{throw await this.close(),e}}}ld.ChangeStream=Wc;function Pie(){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 GA=g(function(L2){Object.defineProperty(L2,"__esModule",{value:!0});L2.GridFSBucketReadStream=void 0;var cR=require("stream"),lR=Te(),Jt=X();class KA extends cR.Readable{static{this.FILE="file"}constructor(e,t,r,n,i){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,...i},readPreference:r}}_read(){if(this.destroyed)return;Nie(this,()=>Bie(this))}start(e=0){return aR(this),this.s.options.start=e,this}end(e=0){return aR(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})}}L2.GridFSBucketReadStream=KA;function aR(e){if(e.s.init)throw new Jt.MongoGridFSStreamError("Options cannot be changed after the stream is initialized")}function Bie(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,i=e.s.expected++,s=Math.min(e.s.file.chunkSize,n);if(r.n>i)return e.destroy(new Jt.MongoGridFSChunkError(`ChunkIsMissing: Got unexpected n: ${r.n}, expected: ${i}`));if(r.n<i)return e.destroy(new Jt.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${r.n}, expected: ${i}`));let o=lR.ByteUtils.isUint8Array(r.data)?r.data:r.data.buffer;if(o.byteLength!==s){if(n<=0)return e.destroy(new Jt.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 Jt.MongoGridFSChunkError(`ChunkIsWrongSize: Got unexpected length: ${o.byteLength}, expected: ${s}`))}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=i===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 Fie(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=(i)=>{if(e.destroyed)return;if(!i){let a=`FileNotFound: file ${e.s.filter._id!=null?e.s.filter._id.$eq:e.s.filter.filename} was not found`,c=new Jt.MongoRuntimeError(a);return c.code="ENOENT",e.destroy(c)}if(i.length<=0){e.push(null);return}if(e.destroyed){e.destroy();return}try{e.s.bytesToSkip=Iie(e,i,e.s.options)}catch(u){return e.destroy(u)}let s={files_id:{$eq:i._id}};if(e.s.options&&e.s.options.start!=null){let u=Math.floor(e.s.options.start/i.chunkSize);if(u>0)s.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(s,{timeoutMS:o}).sort({n:1}),e.s.readPreference)e.s.cursor.withReadPreference(e.s.readPreference);e.s.expectedEnd=Math.ceil(i.length/i.chunkSize),e.s.file=i;try{e.s.bytesToTrim=$ie(e,i,e.s.cursor,e.s.options)}catch(u){return e.destroy(u)}e.emit(KA.FILE,i);return},n;try{n=e.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${e.s.timeoutContext?.timeoutMS}ms`)}catch(i){if(!e.destroyed)e.destroy(i);return}t.timeoutMS=n,e.s.files.findOne(e.s.filter,t).then(r,(i)=>{if(e.destroyed)return;e.destroy(i)})}function Nie(e,t){if(e.s.file)return t();if(!e.s.init)Fie(e),e.s.init=!0;e.once("file",()=>{t()})}function Iie(e,t,r){if(r&&r.start!=null){if(r.start>t.length)throw new Jt.MongoInvalidArgumentError(`Stream start (${r.start}) must not be more than the length of the file (${t.length})`);if(r.start<0)throw new Jt.MongoInvalidArgumentError(`Stream start (${r.start}) must not be negative`);if(r.end!=null&&r.end<r.start)throw new Jt.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 Jt.MongoInvalidArgumentError("Start option must be defined")}function $ie(e,t,r,n){if(n&&n.end!=null){if(n.end>t.length)throw new Jt.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 Jt.MongoInvalidArgumentError(`Stream end (${n.end}) must not be negative`);let i=n.start!=null?Math.floor(n.start/t.chunkSize):0;return r.limit(Math.ceil(n.end/t.chunkSize)-i),e.s.expectedEnd=Math.ceil(n.end/t.chunkSize),Math.ceil(n.end/t.chunkSize)*t.chunkSize-n.end}throw new Jt.MongoInvalidArgumentError("End option must be defined")}});var QA=g(function(lh){Object.defineProperty(lh,"__esModule",{value:!0});lh.GridFSBucketWriteStream=void 0;lh.checkChunksIndex=yR;lh.checkIndexes=gR;var hR=require("stream"),pn=Te(),br=X(),fR=he(),dR=hi();class pR extends hR.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=dR.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,gR(this).then(()=>{this.bucket.s.checkedIndexes=!0,this.bucket.emit("index"),e()},(t)=>{if(t instanceof br.MongoOperationTimeoutError)return Hc(this,t,e);fR.squashError(t),e()});else return queueMicrotask(e)}_write(e,t,r){xie(this,e,t,r)}_final(e){if(this.state.streamEnd)return queueMicrotask(e);this.state.streamEnd=!0,vie(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})}}lh.GridFSBucketWriteStream=pR;function Hc(e,t,r){if(e.state.errored){queueMicrotask(r);return}e.state.errored=!0,queueMicrotask(()=>r(t))}function mR(e,t,r){return{_id:new pn.ObjectId,files_id:e,n:t,data:r}}async function yR(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(s){if(s instanceof br.MongoError&&br.isNamespaceNotFoundError(s))n=[];else throw s}if(!n.find((s)=>{if(Object.keys(s.key).length===2&&s.key.files_id===1&&s.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 YA(e,t){if(e.done)return queueMicrotask(t);if(e.state.streamEnd&&e.state.outstandingRequests===0&&!e.state.errored){e.done=!0;let r=Rie(e.id,e.length,e.chunkSizeBytes,e.filename,e.options.metadata);if(U2(e,t))return;let n=e.timeoutContext?.remainingTimeMS;if(n!=null&&n<=0)return Hc(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()},(i)=>Hc(e,i,t));return}queueMicrotask(t)}async function gR(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},i;t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);let s={timeoutMS:t};try{i=await e.files.listIndexes(s).toArray()}catch(u){if(u instanceof br.MongoError&&br.isNamespaceNotFoundError(u))i=[];else throw u}if(!i.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 yR(e)}function Rie(e,t,r,n,i){let s={_id:e,length:t,chunkSize:r,uploadDate:new Date,filename:n};if(i)s.metadata=i;return s}function xie(e,t,r,n){if(U2(e,n))return;let i=typeof t==="string"?pn.ByteUtils.fromUTF8(t):pn.ByteUtils.toLocalBufferType(t);if(e.length+=i.length,e.pos+i.length<e.chunkSizeBytes){pn.ByteUtils.copy(i,e.bufToStore,e.pos),e.pos+=i.length,queueMicrotask(n);return}let s=i.length,o=e.chunkSizeBytes-e.pos,u=Math.min(o,i.length),a=0;while(s>0){let c=i.length-s;pn.ByteUtils.copy(i,e.bufToStore,e.pos,c,c+u),e.pos+=u,o-=u;let l;if(o===0){l=mR(e.id,e.n,new Uint8Array(e.bufToStore));let f=e.timeoutContext?.remainingTimeMS;if(f!=null&&f<=0)return Hc(e,new br.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),n);if(++e.state.outstandingRequests,++a,U2(e,n))return;e.chunks.insertOne(l,{writeConcern:e.writeConcern,timeoutMS:f}).then(()=>{if(--e.state.outstandingRequests,--a,!a)YA(e,n)},(h)=>Hc(e,h,n)),o=e.chunkSizeBytes,e.pos=0,++e.n}s-=u,u=Math.min(o,s)}}function vie(e,t){if(e.pos===0)return YA(e,t);let r=pn.ByteUtils.allocate(e.pos);pn.ByteUtils.copy(e.bufToStore,r,0,0,e.pos);let n=mR(e.id,e.n,r);if(U2(e,t))return;let i=e.timeoutContext?.remainingTimeMS;if(i!=null&&i<=0)return Hc(e,new br.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),t);++e.state.outstandingRequests,e.chunks.insertOne(n,{writeConcern:e.writeConcern,timeoutMS:i}).then(()=>{--e.state.outstandingRequests,YA(e,t)},(s)=>Hc(e,s,t))}function U2(e,t){if(e.state.aborted)return queueMicrotask(()=>t(new br.MongoAPIError("Stream has been aborted"))),!0;return!1}});var wR=g(function(H2){Object.defineProperty(H2,"__esModule",{value:!0});H2.GridFSBucket=void 0;var hh=X(),ER=Zi(),V2=fi(),ic=he(),_R=hi(),z2=GA(),W2=QA(),kie={bucketName:"fs",chunkSizeBytes:261120};class AR extends ER.TypedEventEmitter{static{this.INDEX="index"}constructor(e,t){super();this.on("error",ic.noop),this.setMaxListeners(0);let r=ic.resolveOptions(e,{...kie,...t,writeConcern:_R.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 W2.GridFSBucketWriteStream(this,e,{timeoutMS:this.s.options.timeoutMS,...t})}openUploadStreamWithId(e,t,r){return new W2.GridFSBucketWriteStream(this,t,{timeoutMS:this.s.options.timeoutMS,...r,id:e})}openDownloadStream(e,t){return new z2.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}=ic.resolveOptions(this.s.db,t),n=void 0;if(r)n=new V2.CSOTTimeoutContext({timeoutMS:r,serverSelectionTimeoutMS:this.s.db.client.s.options.serverSelectionTimeoutMS});let{deletedCount:i}=await this.s._filesCollection.deleteOne({_id:{$eq:e}},{timeoutMS:n?.remainingTimeMS}),s=n?.remainingTimeMS;if(s!=null&&s<=0)throw new hh.MongoOperationTimeoutError(`Timed out after ${r}ms`);if(await this.s._chunksCollection.deleteMany({files_id:{$eq:e}},{timeoutMS:s}),i===0)throw new hh.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 z2.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}},i={$set:{filename:t}},{matchedCount:s}=await this.s._filesCollection.updateOne(n,i,r);if(s===0)throw new hh.MongoRuntimeError(`File with id ${e} not found`)}async drop(e){let{timeoutMS:t}=ic.resolveOptions(this.s.db,e),r=void 0;if(t)r=new V2.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()}}H2.GridFSBucket=AR});var Pa=g(function(w){Object.defineProperty(w,"__esModule",{value:!0});w.MongoRuntimeError=w.MongoParseError=w.MongoOperationTimeoutError=w.MongoOIDCError=w.MongoNotConnectedError=w.MongoNetworkTimeoutError=w.MongoNetworkError=w.MongoMissingDependencyError=w.MongoMissingCredentialsError=w.MongoKerberosError=w.MongoInvalidArgumentError=w.MongoGridFSStreamError=w.MongoGridFSChunkError=w.MongoGCPError=w.MongoExpiredSessionError=w.MongoError=w.MongoDriverError=w.MongoDecompressionError=w.MongoCursorInUseError=w.MongoCursorExhaustedError=w.MongoCompatibilityError=w.MongoClientClosedError=w.MongoClientBulkWriteExecutionError=w.MongoClientBulkWriteError=w.MongoClientBulkWriteCursorError=w.MongoChangeStreamError=w.MongoBatchReExecutionError=w.MongoAzureError=w.MongoAWSError=w.MongoAPIError=w.ExplainableCursor=w.ChangeStreamCursor=w.ClientEncryption=w.MongoBulkWriteError=w.UUID=w.Timestamp=w.ObjectId=w.MinKey=w.MaxKey=w.Long=w.Int32=w.Double=w.Decimal128=w.DBRef=w.Code=w.BSONType=w.BSONSymbol=w.BSONRegExp=w.Binary=w.BSON=void 0;w.CommandStartedEvent=w.CommandFailedEvent=w.WriteConcern=w.ReadPreference=w.ReadConcern=w.TopologyType=w.ServerType=w.ReadPreferenceMode=w.ReadConcernLevel=w.ProfilingLevel=w.ReturnDocument=w.SeverityLevel=w.MongoLoggableComponent=w.ServerApiVersion=w.ExplainVerbosity=w.MongoErrorLabel=w.CursorTimeoutMode=w.CURSOR_FLAGS=w.Compressor=w.AuthMechanism=w.GSSAPICanonicalizationValue=w.AutoEncryptionLoggerLevel=w.BatchType=w.UnorderedBulkOperation=w.OrderedBulkOperation=w.MongoClient=w.ListIndexesCursor=w.ListCollectionsCursor=w.GridFSBucketWriteStream=w.GridFSBucketReadStream=w.GridFSBucket=w.FindCursor=w.Db=w.Collection=w.ClientSession=w.ChangeStream=w.CancellationToken=w.AggregationCursor=w.Admin=w.AbstractCursor=w.MongoWriteConcernError=w.MongoUnexpectedServerResponseError=w.MongoTransactionError=w.MongoTopologyClosedError=w.MongoTailableCursorError=w.MongoSystemError=w.MongoStalePrimaryError=w.MongoServerSelectionError=w.MongoServerError=w.MongoServerClosedError=void 0;w.MongoClientAuthProviders=w.MongoCryptKMSRequestNetworkTimeoutError=w.MongoCryptInvalidArgumentError=w.MongoCryptError=w.MongoCryptCreateEncryptedCollectionError=w.MongoCryptCreateDataKeyError=w.MongoCryptAzureKMSRequestError=w.SrvPollingEvent=w.WaitingForSuitableServerEvent=w.ServerSelectionSucceededEvent=w.ServerSelectionStartedEvent=w.ServerSelectionFailedEvent=w.ServerSelectionEvent=w.TopologyOpeningEvent=w.TopologyDescriptionChangedEvent=w.TopologyClosedEvent=w.ServerOpeningEvent=w.ServerHeartbeatSucceededEvent=w.ServerHeartbeatStartedEvent=w.ServerHeartbeatFailedEvent=w.ServerDescriptionChangedEvent=w.ServerClosedEvent=w.ConnectionReadyEvent=w.ConnectionPoolReadyEvent=w.ConnectionPoolMonitoringEvent=w.ConnectionPoolCreatedEvent=w.ConnectionPoolClosedEvent=w.ConnectionPoolClearedEvent=w.ConnectionCreatedEvent=w.ConnectionClosedEvent=w.ConnectionCheckOutStartedEvent=w.ConnectionCheckOutFailedEvent=w.ConnectionCheckedOutEvent=w.ConnectionCheckedInEvent=w.CommandSucceededEvent=void 0;var OR=j3();Object.defineProperty(w,"Admin",{enumerable:!0,get:function(){return OR.Admin}});var SR=L3();Object.defineProperty(w,"OrderedBulkOperation",{enumerable:!0,get:function(){return SR.OrderedBulkOperation}});var CR=U3();Object.defineProperty(w,"UnorderedBulkOperation",{enumerable:!0,get:function(){return CR.UnorderedBulkOperation}});var bR=f1();Object.defineProperty(w,"ChangeStream",{enumerable:!0,get:function(){return bR.ChangeStream}});var DR=a1();Object.defineProperty(w,"Collection",{enumerable:!0,get:function(){return DR.Collection}});var TR=Fi();Object.defineProperty(w,"AbstractCursor",{enumerable:!0,get:function(){return TR.AbstractCursor}});var MR=vf();Object.defineProperty(w,"AggregationCursor",{enumerable:!0,get:function(){return MR.AggregationCursor}});var PR=o6();Object.defineProperty(w,"FindCursor",{enumerable:!0,get:function(){return PR.FindCursor}});var BR=A6();Object.defineProperty(w,"ListCollectionsCursor",{enumerable:!0,get:function(){return BR.ListCollectionsCursor}});var FR=l6();Object.defineProperty(w,"ListIndexesCursor",{enumerable:!0,get:function(){return FR.ListIndexesCursor}});var NR=R0();Object.defineProperty(w,"Db",{enumerable:!0,get:function(){return NR.Db}});var IR=wR();Object.defineProperty(w,"GridFSBucket",{enumerable:!0,get:function(){return IR.GridFSBucket}});var $R=GA();Object.defineProperty(w,"GridFSBucketReadStream",{enumerable:!0,get:function(){return $R.GridFSBucketReadStream}});var RR=QA();Object.defineProperty(w,"GridFSBucketWriteStream",{enumerable:!0,get:function(){return RR.GridFSBucketWriteStream}});var xR=qc();Object.defineProperty(w,"MongoClient",{enumerable:!0,get:function(){return xR.MongoClient}});var vR=Zi();Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return vR.CancellationToken}});var kR=Rf();Object.defineProperty(w,"ClientSession",{enumerable:!0,get:function(){return kR.ClientSession}});var qie=Te();Object.defineProperty(w,"BSON",{enumerable:!0,get:function(){return qie.BSON}});var mi=Te();Object.defineProperty(w,"Binary",{enumerable:!0,get:function(){return mi.Binary}});Object.defineProperty(w,"BSONRegExp",{enumerable:!0,get:function(){return mi.BSONRegExp}});Object.defineProperty(w,"BSONSymbol",{enumerable:!0,get:function(){return mi.BSONSymbol}});Object.defineProperty(w,"BSONType",{enumerable:!0,get:function(){return mi.BSONType}});Object.defineProperty(w,"Code",{enumerable:!0,get:function(){return mi.Code}});Object.defineProperty(w,"DBRef",{enumerable:!0,get:function(){return mi.DBRef}});Object.defineProperty(w,"Decimal128",{enumerable:!0,get:function(){return mi.Decimal128}});Object.defineProperty(w,"Double",{enumerable:!0,get:function(){return mi.Double}});Object.defineProperty(w,"Int32",{enumerable:!0,get:function(){return mi.Int32}});Object.defineProperty(w,"Long",{enumerable:!0,get:function(){return mi.Long}});Object.defineProperty(w,"MaxKey",{enumerable:!0,get:function(){return mi.MaxKey}});Object.defineProperty(w,"MinKey",{enumerable:!0,get:function(){return mi.MinKey}});Object.defineProperty(w,"ObjectId",{enumerable:!0,get:function(){return mi.ObjectId}});Object.defineProperty(w,"Timestamp",{enumerable:!0,get:function(){return mi.Timestamp}});Object.defineProperty(w,"UUID",{enumerable:!0,get:function(){return mi.UUID}});var jie=Vl();Object.defineProperty(w,"MongoBulkWriteError",{enumerable:!0,get:function(){return jie.MongoBulkWriteError}});var Lie=cy();Object.defineProperty(w,"ClientEncryption",{enumerable:!0,get:function(){return Lie.ClientEncryption}});var Uie=g6();Object.defineProperty(w,"ChangeStreamCursor",{enumerable:!0,get:function(){return Uie.ChangeStreamCursor}});var Vie=Wm();Object.defineProperty(w,"ExplainableCursor",{enumerable:!0,get:function(){return Vie.ExplainableCursor}});var Ge=X();Object.defineProperty(w,"MongoAPIError",{enumerable:!0,get:function(){return Ge.MongoAPIError}});Object.defineProperty(w,"MongoAWSError",{enumerable:!0,get:function(){return Ge.MongoAWSError}});Object.defineProperty(w,"MongoAzureError",{enumerable:!0,get:function(){return Ge.MongoAzureError}});Object.defineProperty(w,"MongoBatchReExecutionError",{enumerable:!0,get:function(){return Ge.MongoBatchReExecutionError}});Object.defineProperty(w,"MongoChangeStreamError",{enumerable:!0,get:function(){return Ge.MongoChangeStreamError}});Object.defineProperty(w,"MongoClientBulkWriteCursorError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteCursorError}});Object.defineProperty(w,"MongoClientBulkWriteError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteError}});Object.defineProperty(w,"MongoClientBulkWriteExecutionError",{enumerable:!0,get:function(){return Ge.MongoClientBulkWriteExecutionError}});Object.defineProperty(w,"MongoClientClosedError",{enumerable:!0,get:function(){return Ge.MongoClientClosedError}});Object.defineProperty(w,"MongoCompatibilityError",{enumerable:!0,get:function(){return Ge.MongoCompatibilityError}});Object.defineProperty(w,"MongoCursorExhaustedError",{enumerable:!0,get:function(){return Ge.MongoCursorExhaustedError}});Object.defineProperty(w,"MongoCursorInUseError",{enumerable:!0,get:function(){return Ge.MongoCursorInUseError}});Object.defineProperty(w,"MongoDecompressionError",{enumerable:!0,get:function(){return Ge.MongoDecompressionError}});Object.defineProperty(w,"MongoDriverError",{enumerable:!0,get:function(){return Ge.MongoDriverError}});Object.defineProperty(w,"MongoError",{enumerable:!0,get:function(){return Ge.MongoError}});Object.defineProperty(w,"MongoExpiredSessionError",{enumerable:!0,get:function(){return Ge.MongoExpiredSessionError}});Object.defineProperty(w,"MongoGCPError",{enumerable:!0,get:function(){return Ge.MongoGCPError}});Object.defineProperty(w,"MongoGridFSChunkError",{enumerable:!0,get:function(){return Ge.MongoGridFSChunkError}});Object.defineProperty(w,"MongoGridFSStreamError",{enumerable:!0,get:function(){return Ge.MongoGridFSStreamError}});Object.defineProperty(w,"MongoInvalidArgumentError",{enumerable:!0,get:function(){return Ge.MongoInvalidArgumentError}});Object.defineProperty(w,"MongoKerberosError",{enumerable:!0,get:function(){return Ge.MongoKerberosError}});Object.defineProperty(w,"MongoMissingCredentialsError",{enumerable:!0,get:function(){return Ge.MongoMissingCredentialsError}});Object.defineProperty(w,"MongoMissingDependencyError",{enumerable:!0,get:function(){return Ge.MongoMissingDependencyError}});Object.defineProperty(w,"MongoNetworkError",{enumerable:!0,get:function(){return Ge.MongoNetworkError}});Object.defineProperty(w,"MongoNetworkTimeoutError",{enumerable:!0,get:function(){return Ge.MongoNetworkTimeoutError}});Object.defineProperty(w,"MongoNotConnectedError",{enumerable:!0,get:function(){return Ge.MongoNotConnectedError}});Object.defineProperty(w,"MongoOIDCError",{enumerable:!0,get:function(){return Ge.MongoOIDCError}});Object.defineProperty(w,"MongoOperationTimeoutError",{enumerable:!0,get:function(){return Ge.MongoOperationTimeoutError}});Object.defineProperty(w,"MongoParseError",{enumerable:!0,get:function(){return Ge.MongoParseError}});Object.defineProperty(w,"MongoRuntimeError",{enumerable:!0,get:function(){return Ge.MongoRuntimeError}});Object.defineProperty(w,"MongoServerClosedError",{enumerable:!0,get:function(){return Ge.MongoServerClosedError}});Object.defineProperty(w,"MongoServerError",{enumerable:!0,get:function(){return Ge.MongoServerError}});Object.defineProperty(w,"MongoServerSelectionError",{enumerable:!0,get:function(){return Ge.MongoServerSelectionError}});Object.defineProperty(w,"MongoStalePrimaryError",{enumerable:!0,get:function(){return Ge.MongoStalePrimaryError}});Object.defineProperty(w,"MongoSystemError",{enumerable:!0,get:function(){return Ge.MongoSystemError}});Object.defineProperty(w,"MongoTailableCursorError",{enumerable:!0,get:function(){return Ge.MongoTailableCursorError}});Object.defineProperty(w,"MongoTopologyClosedError",{enumerable:!0,get:function(){return Ge.MongoTopologyClosedError}});Object.defineProperty(w,"MongoTransactionError",{enumerable:!0,get:function(){return Ge.MongoTransactionError}});Object.defineProperty(w,"MongoUnexpectedServerResponseError",{enumerable:!0,get:function(){return Ge.MongoUnexpectedServerResponseError}});Object.defineProperty(w,"MongoWriteConcernError",{enumerable:!0,get:function(){return Ge.MongoWriteConcernError}});var zie=Vl();Object.defineProperty(w,"BatchType",{enumerable:!0,get:function(){return zie.BatchType}});var Wie=eA();Object.defineProperty(w,"AutoEncryptionLoggerLevel",{enumerable:!0,get:function(){return Wie.AutoEncryptionLoggerLevel}});var Hie=v0();Object.defineProperty(w,"GSSAPICanonicalizationValue",{enumerable:!0,get:function(){return Hie.GSSAPICanonicalizationValue}});var Kie=zo();Object.defineProperty(w,"AuthMechanism",{enumerable:!0,get:function(){return Kie.AuthMechanism}});var Gie=Df();Object.defineProperty(w,"Compressor",{enumerable:!0,get:function(){return Gie.Compressor}});var qR=Fi();Object.defineProperty(w,"CURSOR_FLAGS",{enumerable:!0,get:function(){return qR.CURSOR_FLAGS}});Object.defineProperty(w,"CursorTimeoutMode",{enumerable:!0,get:function(){return qR.CursorTimeoutMode}});var Yie=X();Object.defineProperty(w,"MongoErrorLabel",{enumerable:!0,get:function(){return Yie.MongoErrorLabel}});var Qie=d3();Object.defineProperty(w,"ExplainVerbosity",{enumerable:!0,get:function(){return Qie.ExplainVerbosity}});var Jie=qc();Object.defineProperty(w,"ServerApiVersion",{enumerable:!0,get:function(){return Jie.ServerApiVersion}});var jR=Aa();Object.defineProperty(w,"MongoLoggableComponent",{enumerable:!0,get:function(){return jR.MongoLoggableComponent}});Object.defineProperty(w,"SeverityLevel",{enumerable:!0,get:function(){return jR.SeverityLevel}});var Xie=d6();Object.defineProperty(w,"ReturnDocument",{enumerable:!0,get:function(){return Xie.ReturnDocument}});var Zie=O6();Object.defineProperty(w,"ProfilingLevel",{enumerable:!0,get:function(){return Zie.ProfilingLevel}});var ese=fo();Object.defineProperty(w,"ReadConcernLevel",{enumerable:!0,get:function(){return ese.ReadConcernLevel}});var tse=Xr();Object.defineProperty(w,"ReadPreferenceMode",{enumerable:!0,get:function(){return tse.ReadPreferenceMode}});var LR=bi();Object.defineProperty(w,"ServerType",{enumerable:!0,get:function(){return LR.ServerType}});Object.defineProperty(w,"TopologyType",{enumerable:!0,get:function(){return LR.TopologyType}});var rse=fo();Object.defineProperty(w,"ReadConcern",{enumerable:!0,get:function(){return rse.ReadConcern}});var nse=Xr();Object.defineProperty(w,"ReadPreference",{enumerable:!0,get:function(){return nse.ReadPreference}});var ise=hi();Object.defineProperty(w,"WriteConcern",{enumerable:!0,get:function(){return ise.WriteConcern}});var JA=sA();Object.defineProperty(w,"CommandFailedEvent",{enumerable:!0,get:function(){return JA.CommandFailedEvent}});Object.defineProperty(w,"CommandStartedEvent",{enumerable:!0,get:function(){return JA.CommandStartedEvent}});Object.defineProperty(w,"CommandSucceededEvent",{enumerable:!0,get:function(){return JA.CommandSucceededEvent}});var js=hA();Object.defineProperty(w,"ConnectionCheckedInEvent",{enumerable:!0,get:function(){return js.ConnectionCheckedInEvent}});Object.defineProperty(w,"ConnectionCheckedOutEvent",{enumerable:!0,get:function(){return js.ConnectionCheckedOutEvent}});Object.defineProperty(w,"ConnectionCheckOutFailedEvent",{enumerable:!0,get:function(){return js.ConnectionCheckOutFailedEvent}});Object.defineProperty(w,"ConnectionCheckOutStartedEvent",{enumerable:!0,get:function(){return js.ConnectionCheckOutStartedEvent}});Object.defineProperty(w,"ConnectionClosedEvent",{enumerable:!0,get:function(){return js.ConnectionClosedEvent}});Object.defineProperty(w,"ConnectionCreatedEvent",{enumerable:!0,get:function(){return js.ConnectionCreatedEvent}});Object.defineProperty(w,"ConnectionPoolClearedEvent",{enumerable:!0,get:function(){return js.ConnectionPoolClearedEvent}});Object.defineProperty(w,"ConnectionPoolClosedEvent",{enumerable:!0,get:function(){return js.ConnectionPoolClosedEvent}});Object.defineProperty(w,"ConnectionPoolCreatedEvent",{enumerable:!0,get:function(){return js.ConnectionPoolCreatedEvent}});Object.defineProperty(w,"ConnectionPoolMonitoringEvent",{enumerable:!0,get:function(){return js.ConnectionPoolMonitoringEvent}});Object.defineProperty(w,"ConnectionPoolReadyEvent",{enumerable:!0,get:function(){return js.ConnectionPoolReadyEvent}});Object.defineProperty(w,"ConnectionReadyEvent",{enumerable:!0,get:function(){return js.ConnectionReadyEvent}});var vu=Iy();Object.defineProperty(w,"ServerClosedEvent",{enumerable:!0,get:function(){return vu.ServerClosedEvent}});Object.defineProperty(w,"ServerDescriptionChangedEvent",{enumerable:!0,get:function(){return vu.ServerDescriptionChangedEvent}});Object.defineProperty(w,"ServerHeartbeatFailedEvent",{enumerable:!0,get:function(){return vu.ServerHeartbeatFailedEvent}});Object.defineProperty(w,"ServerHeartbeatStartedEvent",{enumerable:!0,get:function(){return vu.ServerHeartbeatStartedEvent}});Object.defineProperty(w,"ServerHeartbeatSucceededEvent",{enumerable:!0,get:function(){return vu.ServerHeartbeatSucceededEvent}});Object.defineProperty(w,"ServerOpeningEvent",{enumerable:!0,get:function(){return vu.ServerOpeningEvent}});Object.defineProperty(w,"TopologyClosedEvent",{enumerable:!0,get:function(){return vu.TopologyClosedEvent}});Object.defineProperty(w,"TopologyDescriptionChangedEvent",{enumerable:!0,get:function(){return vu.TopologyDescriptionChangedEvent}});Object.defineProperty(w,"TopologyOpeningEvent",{enumerable:!0,get:function(){return vu.TopologyOpeningEvent}});var hd=VA();Object.defineProperty(w,"ServerSelectionEvent",{enumerable:!0,get:function(){return hd.ServerSelectionEvent}});Object.defineProperty(w,"ServerSelectionFailedEvent",{enumerable:!0,get:function(){return hd.ServerSelectionFailedEvent}});Object.defineProperty(w,"ServerSelectionStartedEvent",{enumerable:!0,get:function(){return hd.ServerSelectionStartedEvent}});Object.defineProperty(w,"ServerSelectionSucceededEvent",{enumerable:!0,get:function(){return hd.ServerSelectionSucceededEvent}});Object.defineProperty(w,"WaitingForSuitableServerEvent",{enumerable:!0,get:function(){return hd.WaitingForSuitableServerEvent}});var sse=HA();Object.defineProperty(w,"SrvPollingEvent",{enumerable:!0,get:function(){return sse.SrvPollingEvent}});var fh=C1();Object.defineProperty(w,"MongoCryptAzureKMSRequestError",{enumerable:!0,get:function(){return fh.MongoCryptAzureKMSRequestError}});Object.defineProperty(w,"MongoCryptCreateDataKeyError",{enumerable:!0,get:function(){return fh.MongoCryptCreateDataKeyError}});Object.defineProperty(w,"MongoCryptCreateEncryptedCollectionError",{enumerable:!0,get:function(){return fh.MongoCryptCreateEncryptedCollectionError}});Object.defineProperty(w,"MongoCryptError",{enumerable:!0,get:function(){return fh.MongoCryptError}});Object.defineProperty(w,"MongoCryptInvalidArgumentError",{enumerable:!0,get:function(){return fh.MongoCryptInvalidArgumentError}});Object.defineProperty(w,"MongoCryptKMSRequestNetworkTimeoutError",{enumerable:!0,get:function(){return fh.MongoCryptKMSRequestNetworkTimeoutError}});var ose=xA();Object.defineProperty(w,"MongoClientAuthProviders",{enumerable:!0,get:function(){return ose.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 sc=g(function(kge,UR){var fd=Te().ObjectId,use=de().objectIdSymbol;Object.defineProperty(fd.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(fd.prototype,"valueOf"))fd.prototype.valueOf=function(){return this.toString()};fd.prototype[use]=!0;UR.exports=fd});var Xn=g(function(qge,VR){VR.exports=function(t){if(t==null)return;if(typeof t.constructor!=="function")return;return t.constructor.name}});var Ao=g(function(zR){/*!
|
|
30
|
+
* ignore
|
|
31
|
+
*/zR.internalToObjectOptions={transform:!1,virtuals:!1,getters:!1,_skipDepopulateTopLevel:!0,depopulate:!0,flattenDecimals:!1,useProjection:!1,versionKey:!0,flattenObjectIds:!1,flattenUUIDs:!1}});var K2=g(function(Lge,WR){WR.exports=Te().Decimal128});var oc=g(function(Uge,HR){HR.exports=new Set(["__proto__","constructor","prototype"])});var dh=g(function(Vge,KR){KR.exports=function(t,r){if(t==null)return;let n=Object.getPrototypeOf(t);return n==null?void 0:n[r]}});var G2=g(function(GR){GR.isMongooseArray=function(e){return Array.isArray(e)&&e.isMongooseArray}});var Fn=g(function(Wge,YR){var ase=dh();YR.exports=function(t){return t!=null&&t.$isMongooseDocumentPrototype===!0&&ase(t,"$isMongooseDocumentPrototype")===!0}});var dd=g(function(Hge,QR){var cse=dh(),lse=G2().isMongooseArray,hse=Fn();QR.exports=function(e){return e!=null&&(lse(e)||hse(e)||e.isMongooseBuffer&&Buffer.isBuffer(e)||e.$isMongooseMap&&cse(e,"$isMongooseMap"))}});var XA=g(function(Kge,JR){var fse=/^function\s*([^\s(]+)/;JR.exports=function(e){return e.name||(e.toString().trim().match(fse)||[])[1]}});var Zn=g(function(Gge,XR){function dse(e,t){return e!=null&&e._bsontype===t}XR.exports=dse});var Kc=g(function(Yge,ZR){ZR.exports=function(e){return Buffer.isBuffer(e)||Object.prototype.toString.call(e)==="[object Object]"}});var ph=g(function(ZA){var ex=Symbol("mongoose#trustedSymbol");ZA.trustedSymbol=ex;ZA.trusted=function(t){if(t==null||typeof t!=="object"&&typeof t!=="function")return t;return t[ex]=!0,t}});var ar=g(function(Jge,ox){var nx=K2(),pse=sc(),ix=oc(),mse=dd(),yse=XA(),tx=dh(),e4=Zn(),gse=G2().isMongooseArray,Ese=Fn(),_se=Kc(),sx=de(),t4=ph().trustedSymbol,mh=Te(),rx=mh.UUID,r4=mh.Binary;function pd(e,t,r){if(e==null)return e;if(e4(e,"Double"))return new mh.Double(e.value);if(typeof e==="number"||typeof e==="string"||typeof e==="boolean"||typeof e==="bigint")return e;if(Array.isArray(e))return Ase(e,t);if(mse(e)){if(t){if(t.flattenUUIDs){if(e instanceof r4&&e._subtype===r4.SUBTYPE_UUID)return e.toString();if(Buffer.isBuffer(e)&&e.isMongooseBuffer&&e._subtype===r4.SUBTYPE_UUID)return e.toUUID().toString()}if(t.retainDocuments&&Ese(e)){let s=e.$clone();if(e.__index!=null)s.__index=e.__index;if(e.__parentArray!=null)s.__parentArray=t.parentArray??e.__parentArray;return s.$__setParent(t.parentDoc??e.$__parent),s}if(t.retainDocuments&&tx(e,"$isMongooseMap")){let s=t.parentDoc??e.$__parent,u=new e.constructor({},e.$__path,s,e.$__schemaType);for(let[a,c]of e)u.$__set(a,pd(c,{...t,parentDoc:s}));return u}}let i;if(t?.json&&typeof e.toJSON==="function")i=e.toJSON(t);else i=e.toObject(t);return i}let n=e.constructor;if(n)switch(yse(n)){case"Object":if(tx(e.$__,"strictMode")!=null&&e._doc!=null)return e._doc;return n4(e,t,r);case"Date":return new n(+e);case"RegExp":return wse(e);default:break}if(e4(e,"ObjectId")){if(t?.flattenObjectIds)return e.toJSON();return new pse(e.id)}if(e4(e,"Decimal128")){if(t?.flattenDecimals)return e.toJSON();return nx.fromString(e.toString())}if(e instanceof rx){if(t?.flattenUUIDs)return e.toJSON();return new rx(e.buffer)}if(!n&&_se(e))return n4(e,t,r);if(typeof e==="object"&&e[sx.schemaTypeSymbol])return e.clone();if(t?.bson&&typeof e.toBSON==="function")return e;if(typeof e.valueOf==="function")return e.valueOf();return n4(e,t,r)}ox.exports=pd;/*!
|
|
32
|
+
* ignore
|
|
33
|
+
*/function n4(e,t,r){let n=t?.minimize,i=t?.omitUndefined,s=t?._seen,o={},u;if(s&&s.has(e))return s.get(e);else if(s)s.set(e,o);if(t4 in e&&t?.copyTrustedSymbol!==!1)o[t4]=e[t4];let a=Object.keys(e),c=a.length;for(let l=0;l<c;++l){let f=a[l];if(ix.has(f))continue;let h=pd(e[f],t,!1);if((n===!1||i)&&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 Ase(e,t){let r=t?._seen;if(r&&r.has(e))return r.get(e);let n=0,i=e.length,s=null;if(t?.retainDocuments){let o=t.parentDoc??(e.isMongooseArray?e.$parent():void 0);if(e.isMongooseDocumentArray)s=new(e.$schemaType()).schema.base.Types.DocumentArray([],e.$path(),o,e.$schemaType());else if(e.isMongooseArray)s=new(e.$parent()).schema.base.Types.Array([],e.$path(),o,e.$schemaType());else s=Array(i)}else s=Array(i);if(r)r.set(e,s);if(e=gse(e)?e.__array:e,s.isMongooseDocumentArray){t={...t,parentArray:s};for(n=0;n<i;++n){let o=pd(e[n],t,!0);if(typeof o?.$setIndex==="function")o.$setIndex(n);s.set(n,o,!0)}}else for(n=0;n<i;++n)s[n]=pd(e[n],t,!0);return s}function wse(e){let t=new RegExp(e.source,e.flags);if(t.lastIndex!==e.lastIndex)t.lastIndex=e.lastIndex;return t}});var hx=g(function(Xge,lx){/*!
|
|
34
|
+
* Module dependencies.
|
|
35
|
+
*/var uc=R3(),i4=ze(),s4=Pa().Collection,ux=sc(),ax=Xn(),Ose=Ao().internalToObjectOptions,cx=require("stream"),gh=require("util"),Sse=Object.freeze({...Ose,copyTrustedSymbol:!1});function wo(e,t,r){this.collection=null,this.Promise=r.Promise||Promise,this.modelName=r.modelName,delete r.modelName,this._closed=!1,uc.apply(this,arguments)}/*!
|
|
36
|
+
* Inherit from abstract Collection.
|
|
37
|
+
*/Object.setPrototypeOf(wo.prototype,uc.prototype);wo.prototype.onOpen=function(){return this.collection=this.conn.db.collection(this.name),uc.prototype.onOpen.call(this),this.collection};wo.prototype.onClose=function(e){uc.prototype.onClose.call(this,e)};wo.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 Cse(e){wo.prototype[e]=function(){let t=this._getCollection(),r=arguments,n=this,i=n?.conn?.base?.options?.debug,s=n?.conn?.options?.debug,o=s==null?i:s;if(this.conn.$wasForceClosed){let h=new i4("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 ux;let l=null,f=null;if(this._shouldBufferCommands()&&this.buffer){if(u==null)u=new ux;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 E="Operation `"+this.name+"."+e+"()` buffering timed out after "+h+"ms",y=new i4(E);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 cx.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 i4(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(s4.prototype)){if(Object.getOwnPropertyDescriptor(s4.prototype,e).get!==void 0)continue;if(typeof s4.prototype[e]!=="function")continue;Cse(e)}wo.prototype.$print=function(e,t,r,n,i,s){let o="";if(s){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,i));let l="("+c.join(", ")+")";console.info(o+u+a+l)};wo.prototype.$printToStream=function(e,t,r,n){let i=[e,t].join("."),s=[];for(let u=r.length-1;u>=0;--u)if(this.$format(r[u])||s.length)s.unshift(this.$format(r[u]));let o="("+s.join(", ")+")";n.write(i+o,"utf8")};wo.prototype.$format=function(e,t,r){let n=typeof e;if(n==="function"||n==="undefined")return"";return o4(e,!1,t,r)};function yh(e){let t={inspect:function(){return e}};if(gh.inspect.custom)t[gh.inspect.custom]=t.inspect;return t}function bse(e){return o4(e,!0)}function Dse(e,t){e[t]=yh('ObjectId("'+e[t].toHexString()+'")')}function Tse(e,t,r){if(r)e[t]=yh('ISODate("'+e[t].toUTCString()+'")');else e[t]=yh('new Date("'+e[t].toUTCString()+'")')}function o4(e,t,r,n){if(typeof e?.toBSON==="function")e=e.toBSON();if(e==null)return e;let i=ar(),s=t?e:i(e,Sse),o=ax(s);if(o==="Binary")s="BinData("+s.sub_type+', "'+s.toString("base64")+'")';else if(o==="ObjectId")s=yh('ObjectId("'+s.toHexString()+'")');else if(o==="Date")s=yh('new Date("'+s.toUTCString()+'")');else if(o==="Object"){let u=Object.keys(s),a=u.length,c;for(let l=0;l<a;++l)if(c=u[l],s[c]){let f;if(typeof s[c].toBSON==="function")try{s[c]=s[c].toBSON()}catch(d){f=d}let h=ax(s[c]);if(h==="Binary")s[c]="BinData("+s[c].sub_type+', "'+s[c].buffer.toString("base64")+'")';else if(h==="Object")s[c]=o4(s[c],!0);else if(h==="ObjectId")Dse(s,c);else if(h==="Date")Tse(s,c,n);else if(h==="ClientSession")s[c]=yh('ClientSession("'+(s[c]?.id?.id?.buffer||"").toString("hex")+'")');else if(Array.isArray(s[c]))s[c]=s[c].map(bse);else if(f!=null)throw f}}if(t)return s;return gh.inspect(s,!1,10,r).replace(/\n/g,"").replace(/\s{2,}/g," ")}wo.prototype.getIndexes=wo.prototype.indexInformation;/*!
|
|
38
|
+
* Module exports.
|
|
39
|
+
*/lx.exports=wo});var u4=g(function(Zge,px){/*!
|
|
40
|
+
* Module dependencies.
|
|
41
|
+
*/var Mse=require("events").EventEmitter,md=ze();/*!
|
|
42
|
+
* ignore
|
|
43
|
+
*/var fx=["close","change","end","error","resumeTokenChanged"];/*!
|
|
44
|
+
* ignore
|
|
45
|
+
*/class dx extends Mse{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}),fx.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}),fx.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 md("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 md("Cannot call next() on errored ChangeStream");if(this.options?.hydrate){if(e!=null){let r=e;e=(n,i)=>{if(n!=null)return r(n);if(i.fullDocument!=null)i.fullDocument=this.options.model.hydrate(i.fullDocument);return r(null,i)}}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 md("Cannot call addListener() on errored ChangeStream");return this._bindEvents(),super.addListener(e,t)}on(e,t){if(this.errored)throw new md("Cannot call on() on errored ChangeStream");return this._bindEvents(),super.on(e,t)}once(e,t){if(this.errored)throw new md("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
|
+
*/px.exports=dx});var Gc=g(function(eEe,yx){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,i){let s=this._pres.get(t)||[];if(i?.filter)s=s.filter(i.filter);let o=s.length,u=n,a=null;if(!o)return u;for(let c of s)try{let l=c.fn.apply(r,u);if(a4(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 i=this._pres.get(e)||[];if(n?.filter)i=i.filter(n.filter);let s=i.length,o=r||[];for(let u=0;u<s;++u){let a=i[u].fn.apply(t,o);if(a instanceof ct.overwriteArguments)o=a.args}return o};ct.prototype.execPost=async function(t,r,n,i){let s=this._posts.get(t)||[];if(i?.filter)s=s.filter(i.filter);let o=s.length,u=null;if(i&&i.error)u=i.error;if(!o){if(u!=null)throw u;return n}let a=null,c,l,f=function(E){if(E)l(E);else c()},h=n.slice();Y2(h,i?.numCallbackParams);let d=h.length;h.push(f);let p=i?.error?[u,...h]:null;for(let m of s){let E=m.fn;if(a=new Promise((y,_)=>{c=y,l=_}),u)if(mx(m,d))try{let y=E.apply(r,p);if(a4(y))await y;else if(E.length===d+2)await a}catch(y){if(y instanceof ct.overwriteResult){n=y.args,h=n.slice(),Y2(h,i?.numCallbackParams),d=h.length,h.push(f);continue}u=y,p=[u,...h]}else continue;else if(mx(m,d))continue;else{let y=null;try{if(y=E.apply(r,h),a4(y))y=await y;else if(E.length===d+1)y=await a}catch(_){if(_ instanceof ct.overwriteResult){n=_.args,h=n.slice(),Y2(h,i?.numCallbackParams),d=h.length,h.push(f),p=[u,...h];continue}u=_,p=[u,...h];continue}if(y instanceof ct.overwriteResult){n=y.args,h=n.slice(),Y2(h,i?.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 Y2(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 i=this._posts.get(e)||[];if(n?.filter)i=i.filter(n.filter);let s=i.length;for(let o=0;o<s;++o){let u=i[o].fn.apply(t,r||[]);if(u instanceof ct.overwriteResult)r=u.args}return r};ct.prototype.createWrapperSync=function(e,t,r,n){let i=this,s=n?.getOptions;return function(...u){let a=r??this,c=typeof s==="function"?s(u):{},l=c.pre??c,f=c.post??c,h=i.execPreSync(e,a,u,l),d=t.apply(a,h);return i.execPostSync(e,a,[d],f)[0]}};ct.prototype.wrap=async function(t,r,n,i,s){let o=s?.getOptions,u=typeof o==="function"?o(i):{},a=u.pre??u,c=u.post??u,l,f=!1,h=i;try{h=await this.execPre(t,n,i,a)}catch(d){if(d instanceof ct.skipWrappedFunction)l=d.args,f=!0;else await this.execPost(t,n,i,{...s,...c,error:d})}if(!f)l=await r.apply(n,h);return l=await this.execPost(t,n,[l],{...s,...c}),l[0]};ct.prototype.filter=function(e){let t=this.clone(),r=Array.from(t._pres.keys());for(let i of r){let s=this._pres.get(i).map((o)=>Object.assign({},o,{name:i})).filter(e);if(s.length===0){t._pres.delete(i);continue}t._pres.set(i,s)}let n=Array.from(t._posts.keys());for(let i of n){let s=this._posts.get(i).map((o)=>Object.assign({},o,{name:i})).filter(e);if(s.length===0){t._posts.delete(i);continue}t._posts.set(i,s)}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 i=this;if(!this.hasHooks(e))return t;return function(...o){let u=r??this;return i.wrap(e,t,u,o,n)}};ct.prototype.pre=function(e,t,r,n,i){if(typeof t==="function")r=t,t={};else if(t==null)t={};let s=this._pres.get(e)||[];if(this._pres.set(e,s),typeof r!=="function")throw Error('pre() requires a function, got "'+typeof r+'"');if(i)s.unshift(Object.assign({},t,{fn:r}));else s.push(Object.assign({},t,{fn:r}));return this};ct.prototype.post=function(e,t,r,n){let i=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)i.unshift(Object.assign({},t,{fn:r}));else i.push(Object.assign({},t,{fn:r}));return this._posts.set(e,i),this};ct.prototype.postError=function(t,r,n,i){if(typeof r==="function")i=!!n,n=r,r={};return this.post(t,{...r,errorHandler:!0},n,i)};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 i=r._pres.get(n)||[],s=e._pres.get(n).filter((u)=>i.map((a)=>a.fn).indexOf(u.fn)===-1),o=i.concat(s);r._pres.set(n,o)}for(let n of e._posts.keys()){let i=r._posts.get(n)||[],s=e._posts.get(n).filter((o)=>i.indexOf(o)===-1);r._posts.set(n,i.concat(s))}return r};function a4(e){return typeof e==="object"&&e!==null&&typeof e.then==="function"}function mx(e,t){if(e.errorHandler)return!0;return e.fn.length===t+2}yx.exports=ct});var l4=g(function(tEe,Ex){var Pse=/^\d+$/;class c4{constructor(){this.children=new Map,this.terminal=!1,this.hasWildcard=!1}}class gx{constructor(e){if(this.root=new c4,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 c4,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 i=this.root.children.get("$*");if(i.terminal)return!0;r.push(i)}return r.length===0?!1:r}let t=[this.root];for(let r of e){let n=[],i=Pse.test(r);for(let s of t){if(i)n.push(s);let o=s.children.get(r);if(o!=null){if(o.terminal)return!0;n.push(o)}if(s.hasWildcard){let u=s.children.get("$*");if(u.terminal)return!0;n.push(u)}}if(n.length===0)return!1;t=n}return t}}Ex.exports=gx});var wx=g(function(rEe,Ax){class _x{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 i="";for(let s=0;s<n.length-1;++s){if(i=s===0?n[0]:i+"."+n[s],e.nested[i]!==!0)continue;let o=this.defaultsByNestedPath.get(i);if(o==null)o={paths:[],schemaTypes:[],depth:s+1},this.defaultsByNestedPath.set(i,o);o.paths.push(t),o.schemaTypes.push(r)}}}}Ax.exports=_x});var Cx=g(function(Ox,Sx){var Nn=Sx.exports=Ox={};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 ei=g(function(nEe,Mx){/*!
|
|
54
|
+
* Module dependencies.
|
|
55
|
+
*/var Bse=ze(),Tx=require("util");class d4 extends Bse{constructor(e,t,r,n,i){if(arguments.length>0){let s=bx(t),o=Dx(i),u=h4(null,e,t,r,o,s,n);super(u);this.init(e,t,r,n,i)}else super(h4())}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,i){/*!
|
|
56
|
+
* ignore
|
|
57
|
+
*/this.stringValue=f4(t),this.messageFormat=Dx(i),this.kind=e,this.value=t,this.path=r,this.reason=n,this.valueType=bx(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=h4(e,this.kind,this.value,this.path,this.messageFormat,this.valueType,this.reason)}}Object.defineProperty(d4.prototype,"name",{value:"CastError"});function f4(e){let t=Tx.inspect(e);if(t=t.replace(/^'|'$/g,'"'),!t.startsWith('"'))t='"'+t+'"';return t}function bx(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 Dx(e){let t=e?._castErrorMessage||null;if(typeof t==="string"||typeof t==="function")return t}/*!
|
|
60
|
+
* ignore
|
|
61
|
+
*/function h4(e,t,r,n,i,s,o){if(typeof i==="string"){let u=f4(r),a=i.replace("{KIND}",t).replace("{VALUE}",u).replace("{PATH}",n);if(e!=null)a=a.replace("{MODEL}",e.modelName);return a}else if(typeof i==="function")return i(r,n,e,t);else{let u=f4(r),a=s?" (type "+s+")":"",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
|
+
*/Mx.exports=d4});var Q2=g(function(iEe,Bx){/*!
|
|
64
|
+
* Module dependencies.
|
|
65
|
+
*/var p4=ze(),Px=require("util");class m4 extends p4{constructor(e,t,r,n){let i,s=p4.messages;if(s.DocumentNotFoundError!=null)i=typeof s.DocumentNotFoundError==="function"?s.DocumentNotFoundError(e,t):s.DocumentNotFoundError;else i='No document found for query "'+Px.inspect(e)+'" on model "'+t+'"';super(i);this.result=n,this.numAffected=r,this.filter=e,this.query=e}}Object.defineProperty(m4.prototype,"name",{value:"DocumentNotFoundError"});/*!
|
|
66
|
+
* exports
|
|
67
|
+
*/Bx.exports=m4});var y4=g(function(sEe,Fx){/*!
|
|
68
|
+
* ignore
|
|
69
|
+
*/Fx.exports=function(t){let r=Object.keys(t.errors||{}),n=r.length,i=[],s;for(let o=0;o<n;++o){if(s=r[o],t===t.errors[s])continue;i.push(s+": "+t.errors[s].message)}return i.join(", ")}});var Qc=g(function(oEe,Ix){/*!
|
|
70
|
+
* Module requirements
|
|
71
|
+
*/var Fse=ze(),Nse=Xn(),J2=require("util"),Nx=y4();class Yc extends Fse{constructor(e){let t;if(Nse(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+": "+Nx(this)}addError(e,t){if(t instanceof Yc){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+": "+Nx(this)}}if(J2.inspect.custom)Yc.prototype[J2.inspect.custom]=Yc.prototype.inspect;Object.defineProperty(Yc.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}});Object.defineProperty(Yc.prototype,"name",{value:"ValidationError"});/*!
|
|
72
|
+
* Module exports
|
|
73
|
+
*/Ix.exports=Yc});var E4=g(function(uEe,xx){/*!
|
|
74
|
+
* Module dependencies.
|
|
75
|
+
*/var g4=ze(),$x=require("util");class yd extends g4{constructor(e,t){let r=e.message;if(!r)r=g4.messages.general.default;let n=Rx(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(yd.prototype,"name",{value:"ValidatorError"});Object.defineProperty(yd.prototype,"properties",{enumerable:!1,writable:!0,value:null});yd.prototype.formatMessage=Rx;function Rx(e,t,r){if(typeof e==="function")return e(t,r);let n=Object.keys(t);for(let i of n){if(i==="message")continue;let s="{"+i.toUpperCase()+"}";if(!e.includes(s))continue;let o;try{o=String(t[i])}catch{o=$x.inspect(t[i])}e=e.replace(s,o)}return e}/*!
|
|
76
|
+
* exports
|
|
77
|
+
*/xx.exports=yd});var A4=g(function(aEe,vx){/*!
|
|
78
|
+
* Module dependencies.
|
|
79
|
+
*/var Ise=ze();class _4 extends Ise{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(_4.prototype,"name",{value:"VersionError"});/*!
|
|
80
|
+
* exports
|
|
81
|
+
*/vx.exports=_4});var O4=g(function(cEe,kx){/*!
|
|
82
|
+
* Module dependencies.
|
|
83
|
+
*/var $se=ze();class w4 extends $se{constructor(e){super("Can't save() the same doc multiple times in parallel. Document: "+e._doc._id)}}Object.defineProperty(w4.prototype,"name",{value:"ParallelSaveError"});/*!
|
|
84
|
+
* exports
|
|
85
|
+
*/kx.exports=w4});var C4=g(function(lEe,qx){/*!
|
|
86
|
+
* Module dependencies.
|
|
87
|
+
*/var Rse=ze();class S4 extends Rse{constructor(e){super("Cannot overwrite `"+e+"` model once compiled.")}}Object.defineProperty(S4.prototype,"name",{value:"OverwriteModelError"});/*!
|
|
88
|
+
* exports
|
|
89
|
+
*/qx.exports=S4});var Lx=g(function(hEe,jx){/*!
|
|
90
|
+
* Module dependencies.
|
|
91
|
+
*/var xse=ze();class b4 extends xse{constructor(e){let t=`Schema hasn't been registered for model "`+e+`".
|
|
92
|
+
Use mongoose.model(name, schema)`;super(t)}}Object.defineProperty(b4.prototype,"name",{value:"MissingSchemaError"});/*!
|
|
93
|
+
* exports
|
|
94
|
+
*/jx.exports=b4});var T4=g(function(fEe,Ux){/*!
|
|
95
|
+
* Module dependencies.
|
|
96
|
+
*/var vse=ze();class D4 extends vse{constructor(e,t,r){let n=r?.matchedCount??0,i=r?.insertedCount??0,s=t.map((u)=>u._id).join(", ");if(s.length>100)s=s.slice(0,100)+"...";let o=t.length-n-i;super(`${e}.bulkSave() was not able to update ${o} of the given documents due to incorrect version or optimistic concurrency, document ids: ${s}`);this.modelName=e,this.documents=t,this.bulkWriteResult=r,this.numDocumentsNotUpdated=o}}Object.defineProperty(D4.prototype,"name",{value:"MongooseBulkSaveIncompleteError"});/*!
|
|
97
|
+
* exports
|
|
98
|
+
*/Ux.exports=D4});var zx=g(function(dEe,Vx){var kse=Xn();Vx.exports=function(t){if(kse(t)!=="TopologyDescription")return!1;let r=Array.from(t.servers.values());return r.length>0&&r.every((n)=>n.type==="Unknown")}});var Hx=g(function(pEe,Wx){var qse=Xn();Wx.exports=function(t){if(qse(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 Gx=g(function(mEe,Kx){var jse=Xn(),Lse="Client network socket disconnected before secure TLS connection was established";Kx.exports=function(t){if(jse(t)!=="TopologyDescription")return!1;let r=Array.from(t.servers.values());return r.length>0&&r.every((n)=>n.error&&n.error.message.indexOf(Lse)!==-1)}});var P4=g(function(yEe,Yx){/*!
|
|
99
|
+
* Module dependencies.
|
|
100
|
+
*/var Use=ze(),Vse=zx(),zse=Hx(),Wse=Gx();/*!
|
|
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/",Kse="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 M4 extends Use{assimilateError(e){let t=e.reason;if(zse(t)&&Vse(t)&&e.message.indexOf("bad auth")===-1&&e.message.indexOf("Authentication failed")===-1)this.message=Hse;else if(Wse(t))this.message=Kse;else this.message=e.message;for(let n in e)if(n!=="name")this[n]=e[n];return this.cause=t,this}}Object.defineProperty(M4.prototype,"name",{value:"MongooseServerSelectionError"});Yx.exports=M4});var F4=g(function(gEe,Qx){/*!
|
|
103
|
+
* Module dependencies.
|
|
104
|
+
*/var Gse=ze();class B4 extends Gse{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(B4.prototype,"name",{value:"DivergentArrayError"});/*!
|
|
107
|
+
* exports
|
|
108
|
+
*/Qx.exports=B4});var ac=g(function(EEe,Jx){/*!
|
|
109
|
+
* Module dependencies.
|
|
110
|
+
*/var Yse=ze();class N4 extends Yse{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(N4.prototype,"name",{value:"StrictModeError"});Jx.exports=N4});var $4=g(function(_Ee,Xx){/*!
|
|
111
|
+
* Module dependencies.
|
|
112
|
+
*/var Qse=ze();class I4 extends Qse{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(I4.prototype,"name",{value:"StrictPopulateError"});Xx.exports=I4});var ns=g(function(Zx,ev){var mn=ze();/*!
|
|
113
|
+
* Module exports.
|
|
114
|
+
*/ev.exports=Zx=mn;mn.messages=Cx();mn.Messages=mn.messages;mn.CastError=ei();mn.DocumentNotFoundError=Q2();mn.ValidationError=Qc();mn.ValidatorError=E4();mn.VersionError=A4();mn.ParallelSaveError=O4();mn.OverwriteModelError=C4();mn.MissingSchemaError=Lx();mn.MongooseBulkSaveIncompleteError=T4();mn.MongooseServerSelectionError=P4();mn.DivergentArrayError=F4();mn.StrictModeError=ac();mn.StrictPopulateError=$4()});var is=g(function(AEe,tv){tv.exports=Object.freeze({enumerable:!0,configurable:!0,writable:!0,value:void 0})});var qi=g(function(wEe,rv){var Jse=ar();class In{constructor(e){if(e==null)return this;Object.assign(this,Jse(e))}}var yi=is();Object.defineProperty(In.prototype,"type",yi);Object.defineProperty(In.prototype,"validate",yi);Object.defineProperty(In.prototype,"cast",yi);Object.defineProperty(In.prototype,"required",yi);Object.defineProperty(In.prototype,"allowNull",yi);Object.defineProperty(In.prototype,"default",yi);Object.defineProperty(In.prototype,"ref",yi);Object.defineProperty(In.prototype,"refPath",yi);Object.defineProperty(In.prototype,"select",yi);Object.defineProperty(In.prototype,"index",yi);Object.defineProperty(In.prototype,"unique",yi);Object.defineProperty(In.prototype,"immutable",yi);Object.defineProperty(In.prototype,"sparse",yi);Object.defineProperty(In.prototype,"text",yi);Object.defineProperty(In.prototype,"transform",yi);rv.exports=In});var X2=g(function(OEe,Eh){var Xse=ei();Eh.exports=function(t,r){if(Eh.exports.convertToTrue.has(t))return!0;if(Eh.exports.convertToFalse.has(t))return!1;if(t==null)return t;throw new Xse("boolean",t,r)};Eh.exports.convertToTrue=new Set([!0,"true",1,"1","yes"]);Eh.exports.convertToFalse=new Set([!1,"false",0,"0","no"])});var Z2=g(function(SEe,nv){var Zse=X2();/*!
|
|
115
|
+
* ignore
|
|
116
|
+
*/nv.exports=function(e){let t=this?.path??null;return Zse(e,t)}});var R4=g(function(CEe,iv){/*!
|
|
117
|
+
* ignore
|
|
118
|
+
*/iv.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 Ls=g(function(bEe,sv){sv.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 uv=g(function(DEe,ov){var eoe=ac();/*!
|
|
119
|
+
* ignore
|
|
120
|
+
*/ov.exports=function(e){if(e.$immutable)e.$immutableSetter=toe(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 toe(e,t){return function(n,i,s,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 eoe(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return a}}});var cv=g(function(TEe,av){av.exports=function(t){return typeof t==="function"&&t.constructor&&t.constructor.name==="AsyncFunction"}});var hv=g(function(MEe,lv){lv.exports=function(t){let r=Object.keys(t),n=!0;for(let i=0,s=r.length;i<s;++i)if(typeof t[r[i]]==="object"&&t[r[i]]!==null){n=!1;break}return n}});var dv=g(function(PEe,fv){var _h=1000,Ah=_h*60,wh=Ah*60,Jc=wh*24,roe=Jc*7,noe=Jc*365.25;fv.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return ioe(e);else if(r==="number"&&isFinite(e))return t.long?ooe(e):soe(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ioe(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*noe;case"weeks":case"week":case"w":return r*roe;case"days":case"day":case"d":return r*Jc;case"hours":case"hour":case"hrs":case"hr":case"h":return r*wh;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ah;case"seconds":case"second":case"secs":case"sec":case"s":return r*_h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function soe(e){var t=Math.abs(e);if(t>=Jc)return Math.round(e/Jc)+"d";if(t>=wh)return Math.round(e/wh)+"h";if(t>=Ah)return Math.round(e/Ah)+"m";if(t>=_h)return Math.round(e/_h)+"s";return e+"ms"}function ooe(e){var t=Math.abs(e);if(t>=Jc)return eg(e,t,Jc,"day");if(t>=wh)return eg(e,t,wh,"hour");if(t>=Ah)return eg(e,t,Ah,"minute");if(t>=_h)return eg(e,t,_h,"second");return e+" ms"}function eg(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var mv=g(function(BEe,pv){pv.exports=function(t){let r=[],n="",i="DEFAULT";for(let s=0;s<t.length;++s){if(i==="IN_SQUARE_BRACKETS"&&!/\d/.test(t[s])&&t[s]!=="]")i="DEFAULT",n=r[r.length-1]+"["+n,r.splice(r.length-1,1);if(t[s]==="["){if(i!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n),n="";i="IN_SQUARE_BRACKETS"}else if(t[s]==="]")if(i==="IN_SQUARE_BRACKETS")i="IMMEDIATELY_AFTER_SQUARE_BRACKETS",r.push(n),n="";else i="DEFAULT",n+=t[s];else if(t[s]==="."){if(i!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n),n="";i="DEFAULT"}else n+=t[s]}if(i!=="IMMEDIATELY_AFTER_SQUARE_BRACKETS")r.push(n);return r}});var _v=g(function(ku){var gd=mv(),yv=["__proto__","constructor","prototype"];ku.get=function(e,t,r,n){var i;if(typeof r=="function")if(r.length<2)n=r,r=void 0;else i=r,r=void 0;n||(n=Ev);var s=typeof e=="string"?gd(e):e;if(!Array.isArray(s))throw TypeError("Invalid `path`. Must be either string or array");var o=t,u;for(var a=0;a<s.length;++a){if(u=s[a],typeof s[a]!=="string"&&typeof s[a]!=="number")throw TypeError("Each segment of path to `get()` must be a string or number, got "+typeof s[a]);if(Array.isArray(o)&&!/^\d+$/.test(u)){var c=s.slice(a);return[].concat(o).map(function(f){return f?ku.get(c,f,r||i,n):n(void 0)})}if(i)o=i(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)};ku.has=function(e,t){var r=typeof e==="string"?gd(e):e;if(!Array.isArray(r))throw TypeError("Invalid `path`. Must be either string or array");var n=r.length,i=t;for(var s=0;s<n;++s){if(typeof r[s]!=="string"&&typeof r[s]!=="number")throw TypeError("Each segment of path to `has()` must be a string or number, got "+typeof r[s]);if(i==null||typeof i!=="object"||!(r[s]in i))return!1;i=i[r[s]]}return!0};ku.unset=function(e,t){var r=typeof e==="string"?gd(e):e;if(!Array.isArray(r))throw TypeError("Invalid `path`. Must be either string or array");var n=r.length,i=t;for(var s=0;s<n;++s){if(i==null||typeof i!=="object"||!(r[s]in i))return!1;if(typeof r[s]!=="string"&&typeof r[s]!=="number")throw TypeError("Each segment of path to `unset()` must be a string or number, got "+typeof r[s]);if(yv.indexOf(r[s])!==-1)return!1;if(s===n-1)return delete i[r[s]],!0;i=i instanceof Map?i.get(r[s]):i[r[s]]}return!0};ku.set=function(e,t,r,n,i,s){var o;if(typeof n=="function")if(n.length<2)i=n,n=void 0;else o=n,n=void 0;i||(i=Ev);var u=typeof e=="string"?gd(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(yv.indexOf(u[a])!==-1)return}var c=s||/\$/.test(e)&&s!==!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)ku.set(d,t[p],l[p],n||o,i,c);else for(var p=0;p<l.length;++p)ku.set(d,t,l[p],n||o,i,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))gv(l,t,f,o,n,i);else for(var p=0;p<l.length;++p){var E=l[p];if(E)if(o)o(E,f,i(t));else{if(E[n])E=E[n];E[f]=i(t)}}else if(o)o(l,f,i(t));else if(l instanceof Map)l.set(f,i(t));else l[f]=i(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
|
+
*/ku.stringToParts=gd;/*!
|
|
127
|
+
* Recursively set nested arrays
|
|
128
|
+
*/function gv(e,t,r,n,i,s){for(var o,u=0;u<e.length&&u<t.length;++u)if(o=e[u],Array.isArray(o)&&Array.isArray(t[u]))gv(o,t[u],r,n,i,s);else if(o)if(n)n(o,r,s(t[u]));else{if(o[i])o=o[i];o[r]=s(t[u])}}/*!
|
|
129
|
+
* Returns the value passed to it.
|
|
130
|
+
*/function Ev(e){return e}});var ss=g(function(Av,wv){wv.exports=Av=_v()});var tg=g(function(NEe,Sv){var uoe=ar();class Ov{constructor(e){if(this._docs={},this._childDocs=[],e==null)return;if(e=uoe(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+"`.")}}Sv.exports=Ov});var bv=g(function(Cv){Cv.isMongooseDocumentArray=function(e){return Array.isArray(e)&&e.isMongooseDocumentArray}});var su=g(function($Ee,Dv){Dv.exports=function(t){if(t==null||typeof t!=="object")return!1;let r=Object.getPrototypeOf(t);return!r||r.constructor.name==="Object"}});var rg=g(function(REe,Tv){Tv.exports=function(t,r,n){let i=Object.keys(r.tree),s={};for(let o of i){if(n&&(t.paths[o]||t.nested[o]||t.singleNestedPaths[o]))continue;s[o]=r.tree[o]}t.options._isMerging=!0,t.add(s,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 Bv=g(function(Mv,Pv){/*!
|
|
131
|
+
* Module dependencies.
|
|
132
|
+
*/var xEe=be(),Us=Pv.exports=Mv=function(){};Us.ctor=function(){let e=[...arguments],t=function(){this.paths={},this.states={}};return t.prototype=new Us,t.prototype.constructor=t,t.prototype.stateNames=e,e.forEach(function(r){t.prototype[r]=function(n){this._changeState(n,r)}}),t};Us.prototype._changeState=function(t,r){let n=this.paths[t];if(n===r)return;if(n!==void 0){let s=this.states[n];if(s)delete s[t]}this.paths[t]=r;let i=this.states[r];if(i==null)i=this.states[r]={};i[t]=!0};/*!
|
|
133
|
+
* ignore
|
|
134
|
+
*/Us.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 i of n)this.paths[i]=t;this.states={[t]:this.states[t]}};/*!
|
|
135
|
+
* ignore
|
|
136
|
+
*/Us.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
|
+
*/Us.prototype.clearPath=function(t){let r=this.paths[t];if(!r)return;delete this.paths[t],delete this.states[r][t]};Us.prototype.getStatePaths=function(t){if(this.states[t]!=null)return this.states[t];return{}};Us.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})};Us.prototype._iter=function(t){return function(){let r=[...arguments],n=r.pop();if(!r.length)r=this.stateNames;let i=this;return r.reduce(function(o,u){if(i.states[u]==null)return o;return o.concat(Object.keys(i.states[u]))},[])[t](function(o,u,a){return n(o,u,a)})}};Us.prototype.forEach=function(){return this.forEach=this._iter("forEach"),this.forEach.apply(this,arguments)};Us.prototype.map=function(){return this.map=this._iter("map"),this.map.apply(this,arguments)};Us.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 $v=g(function(Nv,Iv){/*!
|
|
139
|
+
* Dependencies
|
|
140
|
+
*/var Fv=Bv(),aoe=Fv.ctor("require","modify","init","default","ignore");Iv.exports=Nv=pr;function pr(){this.activePaths=new aoe}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 ig=g(function(vEe,xv){/*!
|
|
141
|
+
* Module dependencies.
|
|
142
|
+
*/var x4=Te().Binary,coe=Te().UUID,ng=be();function gi(e,t,r){let n=e;if(e==null)n=0;let i,s,o;if(Array.isArray(t))s=t[0],o=t[1];else i=t;let u;if(typeof n==="number"||n instanceof Number)u=Buffer.alloc(n);else u=Buffer.from(n,i,r);return ng.decorate(u,gi.mixin),u.isMongooseBuffer=!0,u[gi.pathSymbol]=s,u[Rv]=o,u._subtype=0,u}var loe=Symbol.for("mongoose#Buffer#_path"),Rv=Symbol.for("mongoose#Buffer#_parent");gi.pathSymbol=loe;/*!
|
|
143
|
+
* Inherit from Buffer.
|
|
144
|
+
*/gi.mixin={_subtype:void 0,_markModified:function(){let e=this[Rv];if(e)e.markModified(this[gi.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
|
+
*/ng.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;gi.mixin[e]=function(){let t=Buffer.prototype[e].apply(this,arguments);return this._markModified(),t}});gi.mixin.toObject=function(e){let t=typeof e==="number"?e:this._subtype||0;return new x4(Buffer.from(this),t)};gi.mixin.$toObject=gi.mixin.toObject;gi.mixin.toBSON=function(){return new x4(this,this._subtype||0)};gi.mixin.toUUID=function(){if(this._subtype!==4)throw Error("Cannot convert a Buffer with subtype "+this._subtype+" to a UUID");return new coe(this)};gi.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};gi.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
|
+
*/gi.Binary=x4;xv.exports=gi});var kv=g(function(kEe,vv){vv.exports=class{constructor(t,r,n){this.subdocSnapshot=t,this.activePaths=r,this.version=n}}});var sg=g(function(qEe,qv){/*!
|
|
149
|
+
* Module dependencies.
|
|
150
|
+
*/var hoe=ze();class v4 extends hoe{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(v4.prototype,"name",{value:"ObjectExpectedError"});qv.exports=v4});var og=g(function(jEe,jv){/*!
|
|
151
|
+
* Module dependencies.
|
|
152
|
+
*/var foe=ze();class k4 extends foe{constructor(e,t,r){super('Parameter "'+t+'" to '+r+'() must be an object, got "'+(e==null?e:e.toString())+'" (type '+typeof e+")")}}Object.defineProperty(k4.prototype,"name",{value:"ObjectParameterError"});jv.exports=k4});var Uv=g(function(LEe,Lv){/*!
|
|
153
|
+
* Module dependencies.
|
|
154
|
+
*/var doe=ze();class q4 extends doe{constructor(e){super("Can't validate() the same doc multiple times in parallel. Document: "+e._doc._id)}}Object.defineProperty(q4.prototype,"name",{value:"ParallelValidateError"});/*!
|
|
155
|
+
* exports
|
|
156
|
+
*/Lv.exports=q4});var j4=g(function(UEe,Vv){Vv.exports=function(t){let r={},n=Object.keys(t);for(let i of n){if(i.indexOf(".")===-1){r[i]=1;continue}let s=i.split("."),o=s[0];for(let u=0;u<s.length;++u)if(r[o]=1,u+1<s.length)o=o+"."+s[u+1]}return r}});var Wv=g(function(VEe,zv){zv.exports=function(t){if(t==null||typeof t!=="object")return!1;return t.$slice==null&&t.$elemMatch==null&&t.$meta==null&&t.$==null}});var ag=g(function(zEe,Kv){var Hv=Wv();Kv.exports=function(t,r,n,i,s,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],E,y="";if(m==="_id"&&h)continue;let _=c[p];if(typeof _.defaultValue==="function"&&!_.defaultValue.$runBeforeSetters)d=!0;let O=_.splitPath(),b=O.length,A=!1,P=t._doc;if(b===1){if(n===!0){if(m in r)continue}else if(n===!1&&r){let S=_.$isSingleNested||_.$isMongooseDocumentArray;if(m in r&&!Hv(r[m])||S&&i!=null&&i[m])A=!0;else if(i!=null&&!i[m])continue}if(P[m]!==void 0)continue;if(s!=null){if(typeof _.defaultValue==="function"){if(!_.defaultValue.$runBeforeSetters&&s)continue;if(_.defaultValue.$runBeforeSetters&&!s)continue}else if(!s)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 E<"u")P[m]=E,ug(t,m,f);continue}for(let S=0;S<b;++S){if(P==null)break;let B=O[S];if(y=y.length?y+"."+B:B,n===!0){if(y in r)break}else if(n===!1&&r&&!A){let q=_.$isSingleNested||_.$isMongooseDocumentArray;if(y in r&&!Hv(r[y])||S===b-1&&q&&i!=null&&i[y])A=!0;else if(i!=null&&!i[y])break}if(S===b-1){if(P[B]!==void 0)break;if(s!=null){if(typeof _.defaultValue==="function"){if(!_.defaultValue.$runBeforeSetters&&s)break;if(_.defaultValue.$runBeforeSetters&&!s)break}else if(!s)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 E<"u")P[B]=E,ug(t,m,f)}else if(A){try{E=_.getDefault(t,!1)}catch(q){t.invalidate(m,q);break}if(typeof E<"u")P[B]=E,ug(t,m,f)}}else{try{E=_.getDefault(t,!1)}catch(q){t.invalidate(m,q);break}if(typeof E<"u")P[B]=E,ug(t,m,f)}}else P=P[B]}}return d};/*!
|
|
157
|
+
* ignore
|
|
158
|
+
*/function ug(e,t,r){if(e.$__.activePaths.default(t),!r&&e.$isSubdocument&&e.$isSingleNested&&e.$parent()!=null)e.$parent().$__.activePaths.default(e.$__pathRelativeToParent(t))}});var cg=g(function(WEe,Yv){/*!
|
|
159
|
+
* ignore
|
|
160
|
+
*/Yv.exports=function(t,r,n){n=n||{};let i=n.skipDocArrays,s=0;if(!t)return s;for(let o of Object.keys(t.$__.activePaths.getStatePaths("modify"))){if(i){if(t.$__schema.path(o)?.$isMongooseDocumentArray)continue}if(o.startsWith(r+".")){if(t.$__.activePaths.clearPath(o),++s,t.$isSubdocument)Gv(t,o)}}return s};function Gv(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(),i=e.$__pathRelativeToParent(void 0,!1)+"."+t;if(n.$__.activePaths.clearPath(i),n.$isSubdocument)Gv(n,i,r)}});var L4=g(function(HEe,Qv){Qv.exports=function(t,r,n){if(r.has(t))return!0;for(let i of n)if(t.slice(0,i.length)===i&&t.charAt(i.length)===".")return!0;return!1}});var fg=g(function(U4){var poe=ar(),moe=de().documentSchemaSymbol,yoe=Ao().internalToObjectOptions,goe=Fn(),hg=be(),Oh,Eoe=de().getSymbol,lg=de().scopeSymbol,Jv=hg.isPOJO;/*!
|
|
161
|
+
* exports
|
|
162
|
+
*/U4.compile=Xv;U4.defineKey=Zv;var _oe=Object.freeze({minimize:!0,virtuals:!1,getters:!1,transform:!1}),Aoe=Object.freeze({noDottedPath:!0});function Xv(e,t,r,n){Oh=Oh||ou();let i=n.typeKey;for(let s of Object.keys(e)){let o=e[s],a=Jv(o)&&hg.hasOwnKeys(o)&&(!o[i]||i==="type"&&Jv(o.type)&&o.type.type)?o:null;Zv({prop:s,subprops:a,prototype:t,prefix:r,options:n})}}function Zv({prop:e,subprops:t,prototype:r,prefix:n,options:i}){Oh=Oh||ou();let s=(n?n+".":"")+e;n=n||"";let o=n?Object.freeze({}):Aoe;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[s]){let a=Object.create(Oh.prototype,woe(this));if(!n)a.$__[lg]=this;a.$__.nestedPath=s,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,moe,{enumerable:!1,configurable:!0,writable:!1,value:r.schema}),Object.defineProperty(a,"toObject",{enumerable:!1,configurable:!0,writable:!1,value:function(){return poe(u.get(s,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(s,null,{virtuals:this?.schema?.options?.toObject?.virtuals||null})}}),Object.defineProperty(a,"toJSON",{enumerable:!1,configurable:!0,writable:!1,value:function(){return u.get(s,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(s,null,_oe)||{}).length===0}}),Object.defineProperty(a,"$__parent",{enumerable:!1,configurable:!0,writable:!1,value:this}),Xv(t,a,s,i),this.$__.getters[s]=a}return this.$__.getters[s]},set:function(u){if(goe(u)&&u.$__isNested)u=u.$__get();else if(u instanceof Oh&&!u.$__isNested)u=u.$toObject(yoe);(this.$__[lg]||this).$set(s,u)}});else Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:function(){return this[Eoe].call(this.$__[lg]||this,s,null,o)},set:function(u){this.$set.call(this.$__[lg]||this,s,u)}})}function woe(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 tk=g(function(GEe,ek){ek.exports=function(t){if(t==null)return null;return Object.keys(t)[0]}});var os=g(function(YEe,rk){rk.exports=function(t,r){if(t==null||r==null)return null;return Object.hasOwn(t,r)?t[r]:null}});var Dr=g(function(QEe,nk){nk.exports=function(t,r,n){let i,s=!1;if(typeof r==="string"){if(r.indexOf(".")===-1){let a=V4(t,r);if(a==null)return n;return a}i=r.split(".")}else if(s=!0,i=r,i.length===1){let a=V4(t,i[0]);if(a==null)return n;return a}let o=r,u=t;for(let a of i){if(u==null)return n;if(!s&&u[o]!=null)return u[o];if(u=V4(u,a),!s)o=o.substring(a.length+1)}return u==null?n:u};function V4(e,t){if(e==null)return e;if(e instanceof Map)return e.get(t);return e[t]}});var z4=g(function(JEe,sk){var ik=Zn();sk.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(ik(t,"ObjectId")&&ik(r,"ObjectId"))return t.toString()===r.toString();return!1}});var dg=g(function(XEe,ok){var Ooe=z4();ok.exports=function(t,r){if(t?.discriminators==null)return null;for(let n of Object.keys(t.discriminators)){let i=t.discriminators[n];if(i.discriminatorMapping==null)continue;if(Ooe(i.discriminatorMapping.value,r))return i}return null}});var ak=g(function(ZEe,uk){var Soe=os(),Coe=Dr(),boe=dg();uk.exports=function e(t,r,n){n=n||{};let i=n.typeOnly,s=Array.isArray(r)?r:r.indexOf(".")===-1?[r]:r.split("."),o=null,u="adhocOrUndefined",a=boe(t.schema,t.get(t.schema.options.discriminatorKey))||t.schema;for(let c=0;c<s.length;++c){let l=s.slice(0,c+1).join(".");if(o=a.path(l),o==null){u="adhocOrUndefined";continue}if(o.instance==="Mixed")return i?"real":o;if(u=a.pathType(l),(o.$isSingleNested||o.$isMongooseDocumentArrayElement)&&o.schema.discriminators!=null){let f=o.schema.discriminators,h=t.get(l+"."+Coe(o,"schema.options.discriminatorKey"));if(h==null||Soe(f,h)==null)continue;let d=s.slice(c+1).join(".");return e(t.get(l),d,n)}}return i?u:o}});var lk=g(function(e_e,ck){var Doe=Dr();ck.exports=function(t,r,n){let i=Object.keys(r);if(i.length<=1)return i;let s=n!=null?Object.keys(Doe(t.tree,n,{})):Object.keys(t.tree),o=new Set(i),u=[];for(let a of s)if(o.delete(a))u.push(a);for(let a of o)u.push(a);return u}});var uu=g(function(t_e,hk){hk.exports=function(t,r){return t!=null&&Object.hasOwn(t,r)?t[r]:void 0}});var dk=g(function(r_e,fk){fk.exports=function(t,r){if(r.length===1)return;let n=r[0],i=void 0;for(let s=0;s<r.length-1;++s){let o=t.path(n);if(o?.schema)i=o.schema.options.strict,t=o.schema,n=o.$isMongooseDocumentArray&&!isNaN(r[s+1])?"":r[s+1];else n+=n.length?"."+r[s+1]:r[s+1]}return i}});var pg=g(function(n_e,mk){var Toe=dh(),pk=be(),Moe=new Set(["__index","__parentArray","_doc"]);mk.exports=function(t,r){if(pk.isPOJO(t)&&Toe(t.$__,"strictMode")!=null&&t._doc!=null){if(r){let n={};for(let i of Object.keys(t)){if(typeof i==="symbol")continue;if(i[0]==="$")continue;if(Moe.has(i))continue;n[i]=t[i]}return{...t._doc,...n}}return t._doc}return t}});var Sh=g(function(i_e,yk){/*!
|
|
163
|
+
* ignore
|
|
164
|
+
*/yk.exports=function(t){if(t==null)return!0;if(typeof t==="object")return!("$meta"in t)&&!("$slice"in t);return!0}});var Xc=g(function(s_e,gk){var Poe=Sh(),Boe=su();/*!
|
|
165
|
+
* ignore
|
|
166
|
+
*/gk.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 i=0;i<r.length;++i){let s=r[i];if(s!=="_id"&&Poe(t[s])){if(n=Boe(t[s])?e(t[s])??n:!t[s],n!=null)break}}return n}});var W4=g(function(o_e,Ek){var Foe=Sh();Ek.exports=function(t,r){if(t==null)return!1;if(r==="_id")return t._id===0;let n=Object.keys(t),i=null;for(let s of n)if(Foe(t[s])){i=t[r]===1?"inclusive":"exclusive";break}if(i==="inclusive")return t[r]!==1;if(i==="exclusive")return t[r]===0;return!1}});var H4=g(function(u_e,Ak){var _k=be();Ak.exports=function(t,r){if(t._doc._id==null||r==null||r.length===0)return;let n=String(t._doc._id);for(let i of r){if(i.isVirtual)continue;let o=i.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(_k.isMongooseDocumentArray(l)){for(let f=0;f<l.length;++f)if(l[f])l[f].populated(c,i._docs[n]==null?void 0:i._docs[n][f],i);break}}}}});var K4=g(function(a_e,Ok){var{isPOJO:Noe}=be();Ok.exports=wk;function wk(e){let t=Object.keys(e),r=t.length,n,i,s;while(r--){if(i=t[r],s=e[i],Noe(s))e[i]=wk(s);if(e[i]===void 0){delete e[i];continue}n=!0}return n?e:void 0}});var G4=g(function(c_e,Sk){var Ioe=/\./g;Sk.exports=function(t){if(t.indexOf(".")===-1)return[t];let r=t.split(Ioe),n=r.length,i=Array(n),s="";for(let o=0;o<n;++o)s+=s.length!==0?"."+r[o]:r[o],i[o]=s;return i}});var bk=g(function(l_e,Ck){Ck.exports=function(t,r,n,i,s){let o=Object.keys(t).reduce((a,c)=>a||c.startsWith(r+"."),!1),u=r+"."+n.options.discriminatorKey;if(!o&&s.length===1&&s[0]===u)i.splice(i.indexOf(u),1)}});var Vs=g(function(h_e,Dk){var $oe=z4();Dk.exports=function(t,r){if(t==null)return null;for(let n of Object.keys(t)){let i=t[n];if(i.schema&&i.schema.discriminatorMapping&&$oe(i.schema.discriminatorMapping.value,r))return i}return null}});var mg=g(function(f_e,Tk){/*!
|
|
167
|
+
* ignore
|
|
168
|
+
*/Tk.exports=function(t,r){let n=r.split("."),i="";for(let s=0;s<n.length;++s)if(i+=i.length?"."+n[s]:n[s],t[i])return!0;return!1}});var Y4=g(function(d_e,Mk){/*!
|
|
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
|
+
*/Mk.exports=function(t,r){let n=t.options,i="readPreference"in n?n.readPreference:void 0;for(let s of r)s._inheritedReadPreference=i,s._inheritedReadConcern=n.readConcern}});var Ed=g(function(Zc){/*!
|
|
177
|
+
* Module dependencies
|
|
178
|
+
*/var Roe=os(),Pk=tg(),xoe=bk(),Bk=Dr(),voe=Vs(),Q4=Sh(),koe=Xc(),qoe=su(),joe=ar(),Loe=mg(),Uoe=Y4();Zc.preparePopulationOptionsMQ=function(t,r){let n=t._mongooseOptions.populate,i=Object.keys(n).reduce((u,a)=>u.concat([n[a]]),[]);if(r.lean!=null)i.filter((u)=>u?.options?.lean==null).forEach(Voe(r.lean));let s=t?.options?.session||null;if(s!=null)i.forEach((u)=>{if(u.options==null){u.options={session:s};return}if(!("session"in u.options))u.options.session=s});let o=t._fieldsForExec();for(let u=0;u<i.length;++u)if(i[u]instanceof Pk)i[u]=new Pk({...i[u],_queryProjection:o,_localModel:t.model});else i[u]._queryProjection=o,i[u]._localModel=t.model;return Uoe(t,i),i};Zc.createModel=function(t,r,n,i,s){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(s?.defaults!=null)a.defaults=s.defaults;if(s?.strict!=null)a.strict=s.strict;let c=r[u];if(u&&c&&t.discriminators){let l=Roe(t.discriminators,c)||voe(t.discriminators,c);if(l){let f=joe(i);return Zc.applyPaths(f,l.schema),new l(void 0,f,a)}}return new t(void 0,n,a)};/*!
|
|
179
|
+
* ignore
|
|
180
|
+
*/Zc.createModelAndInit=function(t,r,n,i,s,o,u){let a={};if(o)a.populated=o;if(s?.middleware!=null)a.middleware=s.middleware;let c=Zc.createModel(t,r,n,i,s);try{c.$init(r,a,u)}catch(l){u(l,c)}};/*!
|
|
181
|
+
* ignore
|
|
182
|
+
*/Zc.applyPaths=function(t,r,n){let i,s,o=new Set;if(t){if(n){for(let E of Object.keys(t))if(E[0]==="+"||E.startsWith("-+"))delete t[E]}s=Object.keys(t);let p=[];for(let E=0;E<s.length;++E){let y=s[E];if(s[E][0]!=="-")continue;if(delete t[y],y==="-_id")t._id=0;else p.push(y.slice(1))}s=Object.keys(t);let m=!1;for(let E=0;E<s.length;++E){if(s[E][0]==="+")continue;let y=t[s[E]];if(!Q4(y))continue;if(y?.$elemMatch!=null){m=!0;continue}if(s[E]==="_id"&&s.length>1)continue;if(s[E]===r.options.discriminatorKey&&s.length>1&&y!=null&&!y)continue;if(qoe(y)&&!Object.keys(y).some((_)=>_.startsWith("$"))){if(i=koe(y)??void 0,i===void 0)continue;break}i=!y;break}if(i===void 0&&m)i=!1;for(let E of p){let y=r.path(E);if(!y?.selected||i!==!1)t[E]=0,i=!0;else if(y?.selected&&i===!1)o.add(E)}}let u=[],a=[],c=[];if(r._hasSelectedPaths!==!1)l(r);if(n&&i===!1){let p=Object.keys(t);if(!p.some((m)=>(m!=="_id"||p.length===1)&&Q4(t[m])&&t[m]))i=!0}switch(i){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(Loe(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 E=[];return p.eachPath(function(y,_){if(m)y=m+"."+y;if(_.$isSchemaMap||y.endsWith(".$*")){let b="+"+y,A=t&&b in t;if(_.options?.select===!1&&n)h(y),a.push(y);else if(_.options?.select===!1&&!A)a.push(y);return}let O=f(y,_);if(O==null&&!Array.isArray(_)&&_.$isMongooseArray&&!_.$isMongooseDocumentArray)O=f(y,_.embeddedSchemaType);if(O!=null)E.push(O);if(_.schema){let b=l(_.schema,y);if(i===!1)xoe(t,y,_.schema,u,b)}}),c.pop(),E}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(!i&&m.selected&&p===r.options.discriminatorKey&&t[p]!=null&&!t[p]){delete t[p];return}if(i===!1&&m.selected&&t[p]!=null&&!t[p]){delete t[p];return}let E="+"+p;if(t&&E in t){if(delete t[E],i===!1&&s.length>1&&!~s.indexOf(p))t[p]=1;return}let _=p.split("."),O="";for(let b=0;b<_.length;++b)if(O+=O.length?"."+_[b]:_[b],a.indexOf(O)!==-1)return;if(!i&&(m?.options?.$skipDiscriminatorCheck||!1)){let b="";for(let A=0;A<_.length;++A){b+=(b.length===0?"":".")+_[A];let P=Bk(t,b,!1)||Bk(t,b+".$",!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(Q4(t[m])&&!t[m])continue;let E=m.endsWith(".$")?m.slice(0,-2):m;if(E===p||E.startsWith(p+".")||p.startsWith(E+"."))delete t[m]}}function d(p,m){let E=-1;while((E=m.indexOf(".",E+1))!==-1){let y=p[m.slice(0,E)];if(y!=null&&!y)return!0}return!1}};function Voe(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 Oo=g(function(_d){_d.schemaMixedSymbol=Symbol.for("mongoose:schema_mixed");_d.builtInMiddleware=Symbol.for("mongoose:built-in-middleware");_d.skipOnSubdocuments=Symbol("mongoose:skip-on-subdocuments");_d.requiresShardKey=Symbol.for("mongoose:requires-shard-key")});var qu=g(function(y_e,Nk){var zoe=su(),Fk=Oo(),Woe=(e)=>e.fn[Fk.builtInMiddleware];function J4(e,t){return e?.middleware===!1||e?.middleware?.[t]===!1?Woe:null}function Hoe(e){let t=e[e.length-1],r=zoe(t)?t:null;return{pre:{filter:J4(r,"pre")},post:{filter:J4(r,"post")}}}Nk.exports={buildMiddlewareFilter:J4,middlewareFiltersFromLastArg:Hoe}});var X4=g(function(g_e,Ik){function Koe(e){return!!e&&(typeof e==="object"||typeof e==="function")&&typeof e.then==="function"}Ik.exports=Koe});var Rk=g(function(E_e,$k){$k.exports=function(t,r,n){let i=r[0],s=n,o=t;for(let u=0;u<r.length-1;++u){let a=s.path(i);if(a?.schema){let c=o.get(i);if(s=a.schema,i=r[u+1],Array.isArray(c)&&!isNaN(i))c=c[i],i="";if(c==null)break;o=c}else i+=i.length?"."+r[u+1]:r[u+1]}return o}});var kk=g(function(__e,vk){var Goe=su();vk.exports=function(t,r){return xk(t,r,!0,new Set)};function xk(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)&&!Goe(e))return e;if(n.has(e))return e;n.add(e);let i=e;for(let s of Object.keys(e)){let o=xk(e[s],t,!1,n);if(o===e[s])continue;if(i===e)i=Array.isArray(e)?Object.assign([],e):{...e};i[s]=o}return n.delete(e),i}});var Eg=g(function(A_e,qk){var yn=ou(),Yoe=Ao().internalToObjectOptions,yg=require("util"),gg=be();qk.exports=Vt;function Vt(e,t,r,n){if(r!=null){let i={isNew:r.isNew};if("defaults"in r.$__)i.defaults=r.$__.defaults;n=Object.assign(i,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(Yoe)};Vt.prototype.save=async function(t){if(t=t||{},!t.suppressWarning)gg.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((i)=>this.$__pathRelativeToParent(i)).filter((i)=>i!=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(),i=this.$__pathRelativeToParent(e);if(n!=null&&i!=null)n.invalidate(i,t,r);else if(t.kind==="cast"||t.name==="CastError"||i==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(Qoe(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(yg.inspect.custom)Vt.prototype[yg.inspect.custom]=Vt.prototype.inspect;Vt.prototype.$toObject=function(t,r){let n=yn.prototype.$toObject.call(this,t,r);if(gg.hasOwnKeys(n)===!1&&t?._calledWithOptions!=null){if((t._calledWithOptions?.minimize??this?.$__schemaTypeOptions?.minimize??t.minimize)&&!this.constructor.$__required&&!this.$isDocumentArrayElement)return}return n};function Qoe(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 Ch=g(function(w_e,Uk){/*!
|
|
203
|
+
* Module dependencies.
|
|
204
|
+
*/var jk=require("events").EventEmitter,_g=Eg(),Lk=be(),Joe=de().arrayParentSymbol,Z4=de().documentArrayParent;function Ei(e,t,r,n,i){let s;if(Lk.isMongooseDocumentArray(t))this.__parentArray=t,s=t[Joe];else this.__parentArray=void 0;this[Z4]=s,this.$setIndex(i),this.$__parent=s;let o={isNew:!0};if(s!=null&&"defaults"in s.$__)o.defaults=s.$__.defaults;if(typeof r==="object"&&r!=null)Object.assign(o,r);_g.call(this,e,n,null,o)}/*!
|
|
205
|
+
* Inherit from Subdocument
|
|
206
|
+
*/Ei.prototype=Object.create(_g.prototype);Ei.prototype.constructor=Ei;Object.defineProperty(Ei.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!1});Object.defineProperty(Ei.prototype,"$isDocumentArrayElement",{configurable:!1,writable:!1,value:!0});for(let e in jk.prototype)Ei[e]=jk.prototype[e];/*!
|
|
207
|
+
* ignore
|
|
208
|
+
*/Ei.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
|
+
*/Ei.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
|
+
*/Ei.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})};Ei.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};Ei.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};Ei.prototype.$parent=function(){return this[Z4]};/*!
|
|
213
|
+
* Sets this sub-documents parent document.
|
|
214
|
+
*
|
|
215
|
+
* @api private
|
|
216
|
+
*/Ei.prototype.$__setParent=function(t){this[Z4]=t,this.$__parent=t};Ei.prototype.parentArray=function(){return this.__parentArray};/*!
|
|
217
|
+
* Module exports.
|
|
218
|
+
*/Uk.exports=Ei});var Sg=g(function(O_e,Qk){var tw=ou(),ew=Ch(),Xoe=ze(),Vk=cg(),Zoe=ar(),zk=Ao().internalToObjectOptions,Og=ss(),st=be(),el=Zn(),eue=Te().UUID,tue=de().arrayAtomicsBackupSymbol,So=de().arrayAtomicsSymbol,cc=de().arrayParentSymbol,lc=de().arrayPathSymbol,ju=de().arraySchemaSymbol,Gk=de().populateModelSymbol,rue=Symbol("mongoose#Array#sliced"),Wk=Array.prototype.push;/*!
|
|
219
|
+
* ignore
|
|
220
|
+
*/var wg={$__getAtomics(){let e=[],t=Object.keys(this[So]||{}),r=t.length,n=Object.assign({},zk,{_isNested:!0});if(r===0)return e[0]=["$set",this.toObject(n)],e;while(r--){let i=t[r],s=this[So][i];if(st.isMongooseObject(s))s=s.toObject(n);else if(Array.isArray(s))s=this.toObject.call(s,n);else if(Array.isArray(s?.$each))s.$each=this.toObject.call(s.$each,n);else if(typeof s?.valueOf==="function")s=s.valueOf();if(i==="$addToSet")s={$each:s};e.push([i,s])}return e},getAtomics(){return this.$__getAtomics()},clearAtomics(){this[tue]=this[So],this[So]={}},$atomics(){/*!
|
|
221
|
+
* ignore
|
|
222
|
+
*/return this[So]},$parent(){/*!
|
|
223
|
+
* ignore
|
|
224
|
+
*/return this[cc]},$path(){/*!
|
|
225
|
+
* ignore
|
|
226
|
+
*/return this[lc]},$schemaType(){/*!
|
|
227
|
+
* ignore
|
|
228
|
+
*/return this[ju]},$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[ju]},_cast(e){let t=!1,r,n=this[cc];if(n)t=n.$populated(this[lc],!0);if(t&&e!=null){if(r=t.options[Gk],r==null)throw new Xoe("No populated model found for path `"+this[lc]+"`. This is likely a bug in Mongoose, please report an issue on github.com/Automattic/mongoose.");if(Buffer.isBuffer(e)||el(e,"ObjectId")||!st.isObject(e))e={_id:e};if(e.schema?.discriminatorMapping?.key===void 0)e=new r(e);return this[ju].embeddedSchemaType.applySetters(e,n,!0)}return this[ju].embeddedSchemaType.applySetters(e,n,!1)},_mapCast(e,t){return this._cast(e,this.length+t)},_markModified(e){let t=this[cc],r;if(t){if(r=this[lc],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[rue])return;if(e==="$set")return this[So]={$set:t},Vk(this[cc],this[lc]),this._markModified(),this;let r=this[So];if(e==="$pop"&&!("$pop"in r)){let i=this;this[cc].once("save",function(){i._popped=i._shifted=null})}if(r.$set||st.hasOwnKeys(r)&&!(e in r))return this[So]={$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 i=r.$pull||(r.$pull={});if(t[0]instanceof ew)n=i.$or||(i.$or=[]),Array.prototype.push.apply(n,t.map((s)=>s.toObject({transform:(o,u)=>{if(s==null||s.$__==null)return u;return Object.keys(s.$__.activePaths.getStatePaths("default")).forEach((a)=>{Og.unset(a,u),Yk(u,a)}),u},virtuals:!1})));else n=i._id||(i._id={$in:[]}),n.$in=n.$in.concat(t)}else if(e==="$push")if(r.$push=r.$push||{$each:[]},t!=null&&st.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 i of t)r.$push.$each.push(i);else r[e]=t;return this},addToSet(){Ag(this,arguments),Kk(this,arguments);let e=[].map.call(arguments,this._mapCast,this),t=[],r="";if(e[0]instanceof ew)r="doc";else if(e[0]instanceof Date)r="date";else if(el(e[0],"ObjectId"))r="ObjectId";let n=st.isMongooseArray(e)?e.__array:e,i=st.isMongooseArray(this)?this.__array:this;return n.forEach(function(s){let o;switch(r){case"doc":o=this.some(function(u){return u.equals(s)});break;case"date":{let u=+s;o=this.some(function(a){return+a===u});break}case"ObjectId":o=this.find((u)=>u.toString()===s.toString());break;default:o=~this.indexOf(s);break}if(!o)this._markModified(),i.push(s),this._registerAtomic("$addToSet",s),[].push.call(t,s)},this),t},hasAtomics(){if(!st.isPOJO(this[So]))return 0;return Object.keys(this[So]).length},includes(e,t){return this.indexOf(e,t)!==-1},indexOf(e,t){if(el(e,"ObjectId")||e instanceof eue)e=e.toString();let r=null;if(e instanceof Date)r=nue;else if(Buffer.isBuffer(e))r=iue;else if(el(e,"Double"))r=sue;else if(el(e,"Decimal128"))r=oue;t=t==null?0:t;let n=this.length;for(let i=t;i<n;++i)if(r===null?e==this[i]:r(e,this[i]))return i;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,(i,s)=>this._cast(i,s,{defaults:!1}),this),t=this;if(st.isMongooseArray(t))t=t.__array;let r=t.length,n;this._markModified();while(r--)if(n=t[r],n instanceof tw){if(e.some(function(s){return n.equals(s)}))t.splice(r,1)}else if(~this.indexOf.call(e,n))t.splice(r,1);if(e[0]instanceof ew)this._registerAtomic("$pullDocs",e.map(function(i){let s=i.$__getValue("_id");if(s===void 0||i.$isDefault("_id"))return i;return s}));else this._registerAtomic("$pullAll",e);if(Vk(this[cc],this[lc])>0)this._registerAtomic("$set",this);return this},push(){let e=arguments,t=e,r=e[0]!=null&&st.hasUserDefinedProperty(e[0],"$each"),n=st.isMongooseArray(this)?this.__array:this;if(r)t=e[0],e=e[0].$each;if(this[ju]==null)return Wk.apply(this,e);Ag(this,e),Kk(this,e),e=[].map.call(e,this._mapCast,this);let i,s=this[So];if(this._markModified(),r)if(t.$each=e,aue(s.$push,t)){if(t.$position!=null)[].splice.apply(n,[t.$position,0].concat(e)),i=n.length;else i=[].push.apply(n,e);this._registerAtomic("$set",this)}else if(t.$position!=null)[].splice.apply(n,[t.$position,0].concat(e)),i=this.length;else i=[].push.apply(n,e);else if(t=e,i=Wk.apply(n,e),s.$push?.$position!=null)this._registerAtomic("$set",this);return this._registerAtomic("$push",s.$push?.$each?.length?e:t),i},remove(){return this.pull.apply(this,arguments)},set(e,t,r){let n=this.__array;if(r)return n[e]=t,this;let i=wg._cast.call(this,t,e);return wg._markModified.call(this,e),n[e]=i,this},shift(){let e=st.isMongooseArray(this)?this.__array:this;this._markModified();let t=[].shift.call(e);return this._registerAtomic("$set",this),t},sort(){let e=st.isMongooseArray(this)?this.__array:this,t=[].sort.apply(e,arguments);return this._registerAtomic("$set",this),t},splice(){let e,t=st.isMongooseArray(this)?this.__array:this;if(this._markModified(),Ag(this,Array.prototype.slice.call(arguments,2)),arguments.length){let r;if(this[ju]==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(zk)},toObject(e){let t=st.isMongooseArray(this)?this.__array:this;if(e?.depopulate)return e=Zoe(e),e._isNested=!0,[].concat(t).map(function(r){return r instanceof tw?r.toObject(e):r});return[].concat(t)},$toObject(){return this.constructor.prototype.toObject.apply(this,arguments)},unshift(){Ag(this,arguments);let e;if(this[ju]==null)e=arguments;else e=[].map.call(arguments,this._cast,this);let t=st.isMongooseArray(this)?this.__array:this;return this._markModified(),[].unshift.apply(t,e),this._registerAtomic("$set",this),this.length}};/*!
|
|
233
|
+
* ignore
|
|
234
|
+
*/function nue(e,t){return t instanceof Date&&+e===+t}function iue(e,t){return Buffer.isBuffer(t)&&(e._subtype||0)===(t._subtype||0)&&e.equals(t)}function sue(e,t){if(!el(t,"Double"))return!1;let r=e.valueOf(),n=t.valueOf();return r===n||Number.isNaN(r)&&Number.isNaN(n)}var Hk=/^(-?)(\d+)(?:\.(\d*))?(?:E([+-]\d+))?$/;function oue(e,t){if(!el(t,"Decimal128"))return!1;let r=e.toString(),n=t.toString();if(r===n)return!0;let i=Hk.exec(r),s=Hk.exec(n);if(i===null||s===null)return!1;let o=i[3]||"",u=s[3]||"",a=BigInt(i[1]+i[2]+o),c=BigInt(s[1]+s[2]+u),l=(+i[4]||0)-o.length,f=(+s[4]||0)-u.length;return l>f?a*10n**BigInt(l-f)===c:c*10n**BigInt(f-l)===a}function uue(e,t){if(!t)return!1;for(let r of e){if(r==null)return!1;let n=r.constructor;if(!(r instanceof tw)||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 Yk(e,t,r){if(typeof t==="string"){if(t.indexOf(".")===-1)return;t=Og.stringToParts(t)}if(r=r||0,r>=t.length)return;if(e==null||typeof e!=="object")return;if(Yk(e[t[0]],t,r+1),e[t[0]]!=null&&typeof e[t[0]]==="object"&&st.hasOwnKeys(e[t[0]])===!1)delete e[t[0]]}/*!
|
|
245
|
+
* ignore
|
|
246
|
+
*/function Ag(e,t){let r=e==null?null:e[ju]?.embeddedSchemaType?.options?.ref||null;if(e.length===0&&t.length!==0){if(uue(t,r))e[cc].$populated(e[lc],[],{[Gk]:t[0].constructor})}}/*!
|
|
247
|
+
* If `docs` isn't all instances of the right model, depopulate `arr`
|
|
248
|
+
*/function Kk(e,t){let r=e==null?null:e[ju]?.embeddedSchemaType?.options?.ref||null,n=e[cc],i=e[lc];if(!r||!n.populated(i))return;for(let s of t){if(s==null)continue;if(typeof s!=="object"||s instanceof String||s instanceof Number||s instanceof Buffer||st.isMongooseType(s)){n.depopulate(i);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 aue(e,t){if(!e?.$each?.length)return!1;return[e,t].some((r)=>r.$position!=null||r.$slice!=null||r.$sort!=null)}var cue=["filter","flat","flatMap","map","slice"];for(let e of cue){if(Array.prototype[e]==null)continue;wg[e]=function(){let t=st.isMongooseArray(this)?this.__array:this,r=[].concat(t);return r[e].apply(r,arguments)}}Qk.exports=wg});var tq=g(function(S_e,eq){var Yr=Sg(),lue=ou(),Jk=os(),Xk=Vs(),hue=Ao().internalToObjectOptions,gn=be(),fue=Zn(),Cg=de().arrayParentSymbol,rw=de().arrayPathSymbol,Ad=de().arraySchemaSymbol,Zk=de().documentArrayParent,due=Array.prototype.reverse,pue=Array.prototype.toString,nw={toBSON(){/*!
|
|
252
|
+
* ignore
|
|
253
|
+
*/return this.toObject(hue)},toString(){return pue.call(this.__array.map((e)=>{if(e?.$__!=null)return e.toString();return e}))},getArrayParent(){/*!
|
|
254
|
+
* ignore
|
|
255
|
+
*/return this[Cg]},$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[Zk]&&e.__parentArray))e[Zk]=this[Cg],e.__parentArray=this;return e.$setIndex(t),e}if(e==null)return null;if(Buffer.isBuffer(e)||fue(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"?Jk(n.discriminators,e[n.schema.options.discriminatorKey]):null;if(o)n=o;else{let u=Xk(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 s=new n(e,this,r,void 0,t);return s.isNew=!0,s},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 i;for(let s of this){if(!s)continue;if(i=s.get("_id"),i==null)continue;else if(i instanceof lue){if(i=i.get("_id"),n!=null&&gn.deepEqual(n,i))return s;else if(n==null&&(e==i||gn.deepEqual(e,i)))return s}else if(n!=null&&gn.deepEqual(n,i))return s;else if(n==null&&(i==e||gn.deepEqual(e,i)))return s}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 Lu(this),e},push(){let e=mue(arguments),t=Yr.push.apply(this,arguments);if(e)Lu(this);return au(this),t},pop(){let e=Yr.pop.apply(this,arguments);return au(this),e},$pop(){/*!
|
|
258
|
+
* ignore
|
|
259
|
+
*/let e=Yr.$pop.apply(this,arguments);return au(this),e},pull(){let e=Yr.pull.apply(this,arguments);return Lu(this),au(this),e},shift(){let e=Yr.shift.apply(this,arguments);return Lu(this),au(this),e},$shift(){/*!
|
|
260
|
+
* ignore
|
|
261
|
+
*/let e=Yr.$shift.apply(this,arguments);return Lu(this),au(this),e},splice(){let e=Yr.splice.apply(this,arguments);return Lu(this),au(this),e},reverse(){return due.call(this.__array),this._registerAtomic("$set",this),Lu(this),au(this),this},sort(){let e=Yr.sort.apply(this,arguments);return Lu(this),au(this),e},unshift(){let e=Yr.unshift.apply(this,arguments);return Lu(this),au(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"?Jk(t.discriminators,e[t.schema.options.discriminatorKey]):null;if(r)t=r;else{let n=Xk(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,i){i=i||t;let s=i.length;while(s--){if(i[s]==null)continue;switch(e){case"save":n=t[s];break;default:break}if(gn.isMongooseArray(i[s]))r(n,i[s]);else if(i[s])i[s].emit(e,n)}}},set(e,t,r){let n=this.__array;if(r)return n[e]=t,this;let i=nw._cast.call(this,t,e);return nw._markModified.call(this,e),n[e]=i,this},_markModified(e,t){let r=this[Cg],n;if(r){if(n=this[rw],arguments.length)if(t!=null){let i=e.__index;n=n+"."+i+"."+t}else n=n+"."+e;if(n!=null&&n.endsWith(".$"))return this;r.markModified(n,arguments.length!==0?e:r)}return this}};eq.exports=nw;/*!
|
|
264
|
+
* ignore
|
|
265
|
+
*/function Lu(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 mue(e){return e[0]!=null&&gn.hasUserDefinedProperty(e[0],"$each")&&e[0].$position!=null}function au(e){let t=e[Cg];if(!t||t.$__.populated==null)return;let r=Object.keys(t.$__.populated).filter((n)=>n.startsWith(e[rw]+"."));for(let n of r){let i=n.slice((e[rw]+".").length);if(!Array.isArray(t.$__.populated[n].value))continue;t.$__.populated[n].value=e.map((s)=>s.$populated(i))}}});var rl=g(function(C_e,nq){/*!
|
|
266
|
+
* Module dependencies.
|
|
267
|
+
*/var rq=Sg(),bg=tq(),iw=de().arrayAtomicsSymbol,yue=de().arrayAtomicsBackupSymbol,sw=de().arrayParentSymbol,ow=de().arrayPathSymbol,tl=de().arraySchemaSymbol,gue=Array.prototype.push,Eue=/^\d+$/;function _ue(e,t,r,n){let i=[],s={[iw]:{},[yue]:void 0,[ow]:t,[tl]:void 0,[sw]:void 0};if(Array.isArray(e)){if(e[ow]===t&&e[sw]===r)s[iw]=Object.assign({},e[iw]);e.forEach((u)=>{gue.call(i,u)})}if(s[ow]=t,s.__array=i,r?.$__){s[sw]=r,s[tl]=r.$__schema.path(t);while(s[tl]!=null&&s[tl].$isMongooseArray&&!s[tl].$isMongooseDocumentArray)s[tl]=s[tl].embeddedSchemaType}let o=new Proxy(i,{get:function(u,a){if(a==="isMongooseArray"||a==="isMongooseArrayProxy"||a==="isMongooseDocumentArray"||a==="isMongooseDocumentArrayProxy")return!0;if(Object.hasOwn(s,a))return s[a];if(Object.hasOwn(bg,a))return bg[a];if(n?.virtuals&&Object.hasOwn(n.virtuals,a))return n.virtuals[a].applyGetters(void 0,u);if(Object.hasOwn(rq,a))return rq[a];return i[a]},set:function(u,a,c){if(typeof a==="string"&&Eue.test(a))bg.set.call(o,a,c,!1);else if(Object.hasOwn(s,a))s[a]=c;else if(n?.virtuals&&Object.hasOwn(n.virtuals,a))n.virtuals[a].applySetters(c,u);else i[a]=c;return!0}});return o}/*!
|
|
268
|
+
* Module exports.
|
|
269
|
+
*/nq.exports=_ue});var ou=g(function(Bq,Fq){/*!
|
|
270
|
+
* Module dependencies.
|
|
271
|
+
*/var Aue=F4(),lw=require("events").EventEmitter,wue=$v(),pq=ig(),Nr=ns(),Oue=kv(),mq=sg(),dw=og(),Sue=Uv(),iq=l4(),Cue=nl(),bh=ac(),Od=Qc(),yq=E4(),gq=j4(),hw=ag(),uw=cg(),Co=ar(),aw=L4(),bue=fg().compile,Due=fg().defineKey,Tue=tk(),Mue=Xn(),cw=ak(),sq=lk(),Eq=uu(),Pue=dk(),Bue=pg(),Fue=Sh(),Nue=Xc(),ti=Fn(),oq=W4(),Tg=require("util").inspect,_q=Ao().internalToObjectOptions,Iue=H4(),$ue=K4(),Aq=ss(),pw=G4(),wq=Ed(),{buildMiddlewareFilter:Oq}=qu(),z=be(),Rue=X4(),Dg=z.deepEqual,xue=Object.freeze({skipParentChangeTracking:!0}),Sd=de().arrayAtomicsBackupSymbol,_i=de().arrayAtomicsSymbol,vue=de().documentArrayParent,kue=de().documentIsModified,Sq=de().documentModifiedPaths,que=de().documentSchemaSymbol,jue=de().getSymbol,uq=de().modelSymbol,aq=de().populateModelSymbol,Lue=de().scopeSymbol,Cq=Oo().schemaMixedSymbol,Uue=Rk(),Vue=de().sessionNewDocuments,zue=kk(),Mg,wd,mw=z.specialProperties;/*!
|
|
272
|
+
* Document internals that don't start with `$`. `isNew` is a getter/setter
|
|
273
|
+
* for `$isNew`.
|
|
274
|
+
*/var Wue=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 wue,this.$__schema==null){let l=z.isObject(t)&&!t.instanceOfSchema?new Cue(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 dw(e,"obj","Document");let i=!0;if(r.defaults!==void 0)this.$__.defaults=r.defaults,i=r.defaults;let s=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(s.options.strict!==!0)this.$__.strictMode=s.options.strict;let o=s.requiredPaths();for(let l of o)this.$__.activePaths.require(l);let u=null;if(z.isPOJO(t)&&z.hasOwnKeys(t))u=Nue(t),this.$__.selected=t,this.$__.exclude=u;let a=u===!1&&t?gq(t):null,c=!0;if(this._doc==null){if(this.$__buildDoc(e,t,n,u,a,!1),i)c=hw(this,t,u,a,!0,null,xue)}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&&i){if(r.skipDefaults)this.$__.skipDefaults=r.skipDefaults}else if(i&&c)hw(this,t,u,a,!1,r.skipDefaults);if(!this.$__.strictMode&&e){let l=this;Object.keys(this._doc).forEach(function(h){if(!(h in s.tree)&&!(h in s.methods)&&!(h in s.virtuals)&&fw(h))Due({prop:h,subprops:null,prototype:l})})}eae(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 lw,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 lw.prototype)j[e]=lw.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 Hue(e,t,r){if(e==null)return;let n=r.$__schema._getDefaultsCache().defaultsByNestedPath.get(t);if(n==null)return;let{paths:i,schemaTypes:s,depth:o}=n,u=i.length;for(let a=0;a<u;++a){let c=i[a],l=s[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 E=l.getDefault(r,!1);if(E!==void 0)d[m]=E,r.$__.activePaths.default(c)}catch(E){r.invalidate(c,E)}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,i){if(!z.hasOwnKeys(this.$__schema.nested)){this._doc={};return}let s={},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=s,m=!1;for(let E=0;E<f;++E){let y=l[E];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(!i[d])break}if(E<h)p=p[y]||(p[y]={})}}this._doc=s};/*!
|
|
282
|
+
* Converts to POJO when you use the document for querying
|
|
283
|
+
*/j.prototype.toBSON=function(){return this.toObject(_q)};j.prototype.init=function(e,t,r){if(typeof t==="function")r=t,t=null;if(e==null)throw new dw(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 dw(e,"doc","init");if(this.$isNew=!1,t=t||{},e._id!=null&&t.populated&&t.populated.length){let n=String(e._id);for(let i of t.populated){if(i.isVirtual)this.$populated(i.path,z.getValue(i.path,e),i);else this.$populated(i.path,i._docs[n],i);if(i._childDocs==null)continue;for(let s of i._childDocs){if(s?.$__==null)continue;s.$__.parent=this}i._childDocs=[]}}bq(this,e,this._doc,t),Iue(this,t.populated),this.$emit("init",this),this.constructor.emit("init",this);let r=this.$__.exclude===!1&&this.$__.selected?gq(this.$__.selected):null;return hw(this,this.$__.selected,this.$__.exclude,r,!1,this.$__.skipDefaults),this};function bq(e,t,r,n,i){if(i=i||"",typeof t!=="object"||Array.isArray(t))throw new mq(e.$basePath,t);if(ti(t))t=t._doc;let s=Object.keys(t),o=s.length,u,a,c,l=e.$__.strictMode,f=e.$__schema,h=f.options.strictRead;for(let d=0;d<o;++d){if(c=s[d],mw.has(c))continue;if(a=i?i+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 bh(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&&!i&&!(c in f.tree)&&!(c in f.methods)&&!(c in f.virtuals)&&fw(c))e[c]=r[c];else if(n?.virtuals&&Object.hasOwn(f.virtuals,c))e[c]=r[c]}bq(e,p,r[c],n,a+".")}else if(!u){if(h==="throw")throw new bh(a,"Field `"+a+"` is not in schema and strictRead is set to throw.");else if(h===!0)continue;if(r[c]=p,!l&&!i){if(fw(c))e[c]=p}else if(n?.virtuals&&Object.hasOwn(f.virtuals,c))e[c]=p;else if(n?.strict==="throw")throw new bh(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 E=ti(p)?p.$__.wasPopulated:null;if(u&&!E&&!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 yq({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}),ti(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&&ti(r[c][0])&&r[c][0].$__.wasPopulated)e.$populated(a,r[c].map((y)=>ti(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 fw(e){return!e.startsWith("$")&&!Wue.has(e)}j.prototype.updateOne=function(t,r){let n=this.constructor.updateOne(),i=this;return n.pre(async function(){let o=await i._execDocumentPreHooks("updateOne",r,[i,t,r]);if(o[0]!==i||o[1]!==t||o[2]!==r)throw Error("Document updateOne pre hooks cannot overwrite arguments");if(n.updateOne({_id:i._doc._id},t,r),i.$where!=null)this.where(i.$where);if(i.$session()!=null){if(!("session"in n.options))n.options.session=i.$session()}return o}),n.post(function(){return i._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 i of Object.keys(t))r.add(i);let n=this.$__schema.options;for(let i of r){if(i==="_id")continue;if(n.versionKey&&i===n.versionKey)continue;if(n.discriminatorKey&&i===n.discriminatorKey)continue;this.$set(i,t[i])}return this};j.prototype.$set=function(t,r,n,i){if(z.isPOJO(n))i=n,n=void 0;let s=n===!0;if(n&&!s){let y=this.$__.adhocPaths||(this.$__.adhocPaths={});y[t]=this.$__schema.interpretAsType(t,n,this.$__schema.options)}let o=i!=null&&"strict"in i,u=o?i.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?gw(y,{...y._doc}):y._doc;let _=r?r+".":"";for(let A of sq(this.$__schema,y)){let P=_+A,S=y[A],B=this.$__schema.pathType(P);if(s&&!_&&S!=null&&B==="nested"&&this._doc[A]!=null)delete this._doc[A];if(B==="nested"&&z.isNonBuiltinObject(S)){this.$set(P,S,s,i),Hue(this.$get(P),P,this);continue}if(u){if(s&&S===void 0&&this.$get(P)!==void 0)continue;if(B==="adhocOrUndefined")B=cw(this,P,{typeOnly:!0});if(B!=="real"&&B!=="virtual"){if(u==="throw")throw B==="nested"?new mq(A,S):new bh(A);if(B!=="nested"||S!=null)continue}}this.$set(P,S,s,i)}let O=this._doc,b={};for(let A of Object.keys(this.$__schema.tree))if(Object.hasOwn(O,A))b[A]=O[A];for(let A of Object.keys(O))if(!Object.hasOwn(b,A))b[A]=O[A];return this._doc=b,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=cw(this,c,{typeOnly:!0});if(l==="adhocOrUndefined"&&!o){let y=Pue(this.$__schema,c);if(y!==void 0)u=y}r=Bue(r,!0);let f=this.$__.priorDoc!=null?this.$__.priorDoc.$__getValue(t):s?void 0:this.$__getValue(t);if(l==="nested"&&r){if(typeof r==="object")r=zue(r,_q);if(r==null||typeof r!=="object")return this.invalidate(t,new Nr.CastError("Object",r,t)),this;let y=this.$__.savedState,_=y!=null&&Object.hasOwn(y,t);if(y!=null&&!this.$isNew&&!_){let A=this.$__getValue(t);y[t]=A;for(let P of Object.keys(A||{}))y[t+"."+P]=A[P]}if(i?.merge)return this.$set(r,t,s,i);let O=this.$isModified(t);uw(this,t),this.$__setValue(t,{});let b={...i,_skipMarkModified:!0};for(let A of sq(this.$__schema,r,t))this.$set(t+"."+A,r[A],s,b);if(f!=null&&(!O||_)&&z.deepEqual(_?y[t]:f,r))this.unmarkModified(t);else this.markModified(t);return this}let h;if(l==="adhocOrUndefined"&&u){let y="";for(let _=0;_<c.length-1;++_)if(y=_===0?c[0]:y+"."+c[_],this.$__schema.pathType(y)==="virtual")return Aq.set(t,r,this),this;if(h=this.$__schema.path(t)??cw(this,t),h==null){if(u==="throw")throw new bh(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,i,s,c,h,r,f),l==="nested"&&r==null)uw(this,t);return this}if(h.$isSingleNested||h.$isMongooseArray)Xue(this,t);if(r!=null&&i?.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],s,i);return this}let E=!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[uq])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[uq]){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 "+Tg(B));let q=this.ownerDocument().get(B);y=q===A||q===P}}let _=!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,{[aq]:r.constructor}),r.$__.wasPopulated={value:A},_=!0}let O=h.options?.[this.$__schema.options.typeKey],b=Array.isArray(O)?O[0]?.ref:null;if(b&&Kue(r,b)){this.$populated(t,r.map((A)=>A._doc._id),{[aq]:r[0].constructor});for(let A of r)A.$__.wasPopulated={value:A._doc._id};_=!0}if(!y||!h.$isSingleNested){let A=this;if(Eq(this.$__schema.singleNestedPaths,t)!=null&&c.length>1)A=Uue(this,c,this.schema);let P={path:t};if(i?.overwriteImmutable)P.overwriteImmutable=!0;r=h.applySetters(r,A,!1,f,P)}if(h.$isMongooseDocumentArray&&Array.isArray(r)&&ti(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);_=!0}if(!_&&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)Zue(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));E=!1}if(E){let y=null,_=null;if(!s){let O=this.$isSubdocument?this.ownerDocument():this;y=O.$__.savedState,_=this.$isSubdocument?this.$__.fullPath+"."+t:t,O.$__saveInitialState(_)}if(this.$__set(d,t,i,s,c,h,r,f),y!=null&&Object.hasOwn(y,_)){let O=this.$__.session,b=O?.[Vue]?.get(this)?.modifiedPaths,A=b!=null&&!b.has(_);if((!O?.transaction||A)&&z.deepEqual(r,y[_]))this.unmarkModified(t)}}if(h.$isSingleNested&&(this.isDirectModified(t)||r==null)||h.$isSchemaMap&&r==null)uw(this,t);return this};/*!
|
|
284
|
+
* ignore
|
|
285
|
+
*/function Kue(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,i,s,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&&Dg(o._doc._id,u))return!1;if(!Dg(o,u!==void 0?u:z.getValue(t,this)))return!0;if(!n&&o!==null&&o!==void 0&&t in this.$__.activePaths.getStatePaths("default")&&Dg(o,s.getDefault(this,n)))return!0;return!1};j.prototype.$__set=function(e,t,r,n,i,s,o,u){wd=wd||Ch();let a=this.$isNew&&!r?._skipMarkModified?!0:this.$__shouldModify(e,t,r,n,i,s,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[_i]=u[_i],o[Sd]=u[Sd],z.isMongooseDocumentArray(o))o.forEach((d)=>{if(d!=null)d.$isNew=!1})}let c=this._doc,l=0,f=i.length,h="";for(;l<f;l++){let p=l+1===f;if(h+=h?"."+i[l]:i[l],mw.has(i[l]))continue;if(p)if(c instanceof Map)c.set(i[l],o);else if(c.$isSingleNested){if(!(i[l]in c))c[i[l]]=o,c._doc[i[l]]=o;else c._doc[i[l]]=o;if(a)c.markModified(i[l])}else c[i[l]]=o;else{let m=c instanceof Map,E=m?c.get(i[l]):c[i[l]],y=ti(c)&&!c.$__isNested?c._doc:c;if(!m&&!Object.hasOwn(y,i[l])&&i[l]in c)return;if(z.isPOJO(E))c=E;else if(E&&E instanceof wd)c=E;else if(E&&!Array.isArray(E)&&E.$isSingleNested)c=E;else if(E&&Array.isArray(E))c=E;else if(E==null){if(E={},m)c.set(i[l],E);else c[i[l]]=E;c=E}else c=E}}};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 bh(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 i=this.$__getValue(t)||0,s=!1,o=null,u=r;try{r=n.cast(r),o=n.applySetters(i+r,this),u=o-i,s=!0}catch(a){this.invalidate(t,new Nr.CastError("number",r,t,a))}if(s){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 i=r.noDottedPath,s=i?Object.hasOwn(this.$__schema.paths,e)?this.$__schema.paths[e]:void 0:this.$__path(e);if(s==null){if(s=this.$__schema.virtualpath(e),s!=null)return s.applyGetters(void 0,this)}if(i){let c=Object.hasOwn(this._doc,e)?this._doc[e]:void 0;if(n)c=n.cast(c);if(s!=null&&r.getters!==!1)return s.applyGetters(c,this);return c}if(s?.instance==="Mixed"){let c=this.$__schema.virtualpath(e);if(c!=null)s=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(mw.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(s!=null&&r.getters!==!1)u=s.applyGetters(u,this);else if(Object.hasOwn(this.$__schema.nested,e)&&r.virtuals)return gw(this,Co(u)||{},{path:e});return u};/*!
|
|
286
|
+
* ignore
|
|
287
|
+
*/j.prototype[jue]=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 i=n.indexOf("."),s=i===-1?n:n.slice(0,i);if(!Object.hasOwn(r,s))r[s]=Co(this.$__getValue(s))}};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 Dq(r);return Object.keys(r.toObject(t)).length===0}return Object.keys(this.toObject(t)).length===0};/*!
|
|
290
|
+
* ignore
|
|
291
|
+
*/function Dq(e){if(e==null)return!0;if(typeof e!=="object"||Array.isArray(e))return!1;for(let t of Object.keys(e))if(!Dq(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,i=0,s=t.length;for(n=0;n<s;++n){let o=t[n],u=pw(o),a=u.length;for(i=0;i<a;++i)r.add(u[i]);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),ti(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[Sq]=j.prototype.modifiedPaths;j.prototype.isModified=function(e,t,r){if(e){let n=t?.ignoreAtomics,i=this.$__.activePaths.states.modify;if(i==null)return!1;if(typeof e==="string")e=e.indexOf(" ")===-1?[e]:e.split(" ");for(let a of e)if(i[a]!=null)return!0;let s=r||this[Sq](),o=e.some(function(a){return!!~s.indexOf(a)}),u=Object.keys(i);if(n)u=u.filter((a)=>{let c=this.$__getValue(a);if(c?.[_i]!=null&&c[_i].$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[kue]=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 i=0;i<n.length-1;++i){let s=n.slice(0,i+1).join("."),o=this.$get(s);if(ti(o)&&o.isDirectModified(n.slice(i+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=Tq(this),{paths:n,inclusive:i}=r;if(r.onlyId)return this.$__.selected._id===0;if(i===null)return!0;if(t in this.$__.selected)return i;let s=t.indexOf(".")!==-1;if(!r.hasNestedKey){if(s)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 i}return!i}for(let o of n){if(o==="_id")continue;if(o.charAt(t.length)==="."&&o.slice(0,t.length)===t)return i||o!==t+".";if(s&&t.charAt(o.length)==="."&&t.slice(0,o.length)===o)return i}return!i};/*!
|
|
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 Tq(e){if(e.$__.selectedIndex!==void 0)return e.$__.selectedIndex;let t=e.$__.selected,r=Object.keys(t),n=null,i=!1;for(let s of r){if(s==="_id")continue;if(s.indexOf(".")!==-1)i=!0;if(n===null&&Fue(t[s]))n=!!t[s]}return e.$__.selectedIndex={paths:r,inclusive:n,hasNestedKey:i,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=Tq(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 s=r.pathsToSkip.indexOf(" ")===-1;r.pathsToSkip=s?[r.pathsToSkip]:r.pathsToSkip.split(" ")}let n=r?._skipParallelValidateCheck;if(this.$isSubdocument!=null);else if(this.$__.validating&&!n)throw new Sue(this);else if(!n)this.$__.validating=!0;let i=this.$__middleware.hasHooks("validate");try{try{if(i)[r]=await this._execDocumentPreHooks("validate",r,[r]);else if(!n)await Promise.resolve()}catch(y){if(i)await this._execDocumentPostHooks("validate",r,y);return}if(this.$__.saveOptions&&this.$__.saveOptions.pathsToSave&&!t)t=[...this.$__.saveOptions.pathsToSave];let s=r&&typeof r==="object"&&"validateModifiedOnly"in r,o=r?.pathsToSkip||null,u;if(s)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(s&&u)throw TypeError("Cannot set both `validateAllPaths` and `validateModifiedOnly`")}let c=this,l,f;if(a)[l,f]=Mq(this);else{let y=Pq(this,t,o);l=u?y[0].filter((_)=>this.$isModified(_)):y[0],f=y[1]}if(typeof t==="string")t=t.split(" ");if(l.length===0){let y=cq(this);if(i)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 _=l[y];if(d!=null&&!d.has(_)){p.push(Promise.resolve(null));continue}if(_==null||h[_]){p.push(Promise.resolve(null));continue}h[_]=!0;let O=c.$__schema.path(_);if(!O){p.push(Promise.resolve(null));continue}if(!c.$isValid(_)){p.push(Promise.resolve(null));continue}if(O[Cq]!=null&&_!==O.path){p.push(Promise.resolve(null));continue}let b=c.$__getValue(_),A;if(A=c.$populated(_))b=A;else if(ti(b)&&b.$__.wasPopulated)b=b._doc._id;let P=c.$__.pathsToScopes!=null&&_ in c.$__.pathsToScopes?c.$__.pathsToScopes[_]:c,S={...f[_],path:_,validateAllPaths:a,_nestedValidate:!0};if(u)S.validateModifiedOnly=!0;p.push(O.doValidate(b,P,S).then(()=>null,(B)=>{if((O.$isSingleNested||O.$isArraySubdocument||O.$isMongooseDocumentArray)&&B instanceof Od)return null;return B}))}let m=await Promise.all(p);for(let y=0;y<m.length;++y){let _=m[y];if(_==null)continue;if(this.$__.validationError==null)this.$__.validationError=new Od(this);c.invalidate(l[y],_,void 0,!0)}let E=cq(this);if(i)await this._execDocumentPostHooks("validate",r,E);else if(E!=null)throw E}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 cq(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[vue]&&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 Mq(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 i=t[n],s=e.$__schema.path(i);if(s==null)continue;let o=e.$__getValue(i);if(!o)continue;if(s.$isSchemaMap)for(let u of o.keys())t.push(i+"."+u);else if(s.$isMongooseDocumentArray){if(s.embeddedSchemaType?.validators.length)for(let u=0;u<o.length;++u){let a=i+"."+u;t.push(a),r[a]={skipSubdocumentValidation:!0,index:u}}}else if(s.$isMongooseArray)yw(o,t,i)}return[t,r]}/*!
|
|
308
|
+
* ignore
|
|
309
|
+
*/var lq=Object.freeze(["init","default","modify"]),hq=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 Pq(e,t,r){let n=e.$__schema,{paths:i,singleNestedPaths:s}=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 E=Object.hasOwn(i,m),y=E?i[m]:n.path(m);if(typeof y?.originalRequiredValue==="function"){let O=e.$__.cachedRequired??(e.$__.cachedRequired={});try{O[m]=y.originalRequiredValue.call(e,e)}catch(b){e.invalidate(m,b)}}if(!e.$__isSelected(m)){if(p??=e.modifiedPaths(),!e.$isModified(m,null,p))continue}if(m.charCodeAt(m.length-1)===hq&&m.endsWith(".$*"))continue;let _=e.$__.cachedRequired;if(_!=null&&m in _&&!_[m])continue;if(!E&&y!=null&&Object.hasOwn(s,m))continue;if(c.add(m),y!=null&&y.schema!=null)a[m]=!0}}for(let p=0;p<lq.length;++p){let m=o[lq[p]];if(m==null)continue;for(let E in m){if(E.charCodeAt(E.length-1)===hq&&E.endsWith(".$*"))continue;let y=Object.hasOwn(i,E),_=y?i[E]:n.path(E);if(_!=null&&(Gue(_)||!y&&Object.hasOwn(s,E)))continue;if(_?.[Cq]!=null&&E!==_.path)continue;if(c.add(E),_!=null&&_.schema!=null)a[E]=!0}}if(c.size===0&&e.$__hasOnlyPrimitiveValues())return[[],u];for(let p of c){if(!Eq(n.nested,p))continue;c.delete(p);let m=e.$__getValue(p);if(m==null||Array.isArray(m))continue;for(let E of Object.keys(m)){let y=p+"."+E;if(c.add(y),Object.hasOwn(i,y)&&i[y].schema!=null)a[y]=!0}}let f=null,h=[],d=[];for(let p of Object.keys(i)){let m=i[p];if(m.$isSingleNested||m.$isMongooseDocumentArray){h.push([p,m]);continue}if(!m.$isSchemaMap||!m.$__schemaType.$isMongooseDocumentArray)continue;f??=e.modifiedPaths();let E=e.$get(p);if(E==null)continue;for(let y of E.keys()){let _=p+"."+y;if(f.includes(_))d.push([_,m.$__schemaType])}}for(let[p,m]of h.concat(d)){f??=e.modifiedPaths();let E;if(m.$isSingleNested){let _=e.$get(p);if(_==null)continue;E=[_]}else if(m.$isMongooseDocumentArray){if(E=e.$get(p),!E?.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 _ of E){if(_==null||!_.$basePath)continue;let O=m.$isMongooseDocumentArray?p+"."+_.__index:_.$__pathRelativeToParent(),b=_.$parent();if(b==null)throw Error("Cannot validate subdocument that does not have a parent");if(y){c.delete(O);for(let A of _.modifiedPaths({includeChildren:!0}))c.delete(O+"."+A);if(p!==m.path&&Object.hasOwn(o.modify,O))u[O]={skipSchemaValidators:!1}}if(!e.$isModified(O,null,f)||Object.hasOwn(b.$__.activePaths.getStatePaths("modify"),O)||b.$isDefault(O))continue;if(!y)for(let A of _.modifiedPaths())c.delete(O+"."+A);if(!y&&a[p]!==!0)c.add(O);if(a[O]=!0,e.$__.pathsToScopes??={},e.$__.pathsToScopes[O]=_.$isDocumentArrayElement?_.__parentArray:_.$parent(),u[O]??=_.$isDocumentArrayElement?{}:{skipSchemaValidators:!0},_.$isDocumentArrayElement&&_.__index!=null)u[O].index=_.__index}}if(Array.isArray(t))c=Que(c,t);else if(Array.isArray(r))c=Jue(c,r);Yue(e,c,u);for(let p of c){let m=n.path(p);if(!m||!m.$isSchemaMap)continue;let E=e.$__getValue(p);if(E==null)continue;for(let y of E.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 Gue(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 Yue(e,t,r){for(let n of t){let i=e.$__schema.path(n);if(!i)continue;if(!i.$isMongooseArray||!Array.isArray(i)&&i.$isMongooseDocumentArray&&!i.embeddedSchemaType?.validators.length)continue;if(i.$isMongooseArray&&!i.$isMongooseDocumentArray&&!i.embeddedSchemaType.$isMongooseArray&&i.embeddedSchemaType.validators.length===0)continue;let s=e.$__getValue(n);if(i.$isMongooseDocumentArray){let o=s?.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}yw(s,t,n)}}function yw(e,t,r){if(e!=null){let n=e.length;for(let i=0;i<n;++i)if(Array.isArray(e[i]))yw(e[i],t,r+"."+i);else if(Array.isArray(t))t.push(r+"."+i);else t.add(r+"."+i)}}/*!
|
|
344
|
+
* ignore
|
|
345
|
+
*/j.prototype._execDocumentPreHooks=function(t,r,n){let i=Oq(r,"pre");return this.$__middleware.execPre(t,this,n||[],{filter:i})};/*!
|
|
346
|
+
* ignore
|
|
347
|
+
*/j.prototype._execDocumentPostHooks=function(t,r,n){let i=Oq(r,"post");return this.$__middleware.execPost(t,this,[this],{error:n,filter:i})};/*!
|
|
348
|
+
* ignore
|
|
349
|
+
*/function Que(e,t){let r=new Set(t),n=new Map([]);for(let s of t){if(s.indexOf(".")===-1)continue;let o=s.split("."),u=o[0];for(let a=1;a<o.length;++a)n.set(u,s),u=u+"."+o[a]}let i=new Set;for(let s of e){let o=!1,u=s.length;while((u=s.lastIndexOf(".",u-1))!==-1)if(r.has(s.slice(0,u))){o=!0;break}if(r.has(s)||o)i.add(s);else if(n.has(s))i.add(n.get(s))}return i}/*!
|
|
350
|
+
* ignore
|
|
351
|
+
*/function Jue(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,i;if(n)i=!!t.validateModifiedOnly;else i=this.$__schema.options.validateModifiedOnly;let s=t?.pathsToSkip,o=t?.validateAllPaths;if(o){if(s)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 s==="string"&&s.indexOf(" ")!==-1)s=s.split(" ");let u,a;if(o)[u,a]=Mq(this);else{let f=Pq(this,e,s);u=i?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),E=a[d],y=p.doValidateSync(m,r,{...E!=null&&typeof E==="object"?E:null,skipSchemaValidators:typeof E==="object"?E.skipSchemaValidators:E,path:d,validateModifiedOnly:i,validateAllPaths:o,_nestedValidate:!0});if(y){if((p.$isSingleNested||p.$isArraySubdocument||p.$isMongooseDocumentArray)&&y instanceof Od)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 Od(this);if(this.$__.validationError.errors[e])return;if(!t||typeof t==="string")t=new yq({path:e,message:t,type:n||"user defined",value:r});if(this.$__.validationError===t)return this.$__.validationError;if(typeof t.setModel==="function"){let i=this.ownerDocument();if(Mue(i)==="model")t.setModel(i.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 Xue(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 Zue(e,t,r){let n=t.schema;if(n==null)return;for(let i of Object.keys(n.paths)){let s=n.paths[i];if(s.$immutableSetter==null)continue;let o=r==null?void 0:r.$__getValue(i);s.$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 i of n)i.$__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 i of this.$__schema.requiredPaths())this.$__.activePaths.require(i);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");fq(this,r),fq(this,n)};function fq(e,t){if(t==null)return;let r=e.$__schema.paths,n=Object.keys(t);for(let i=0;i<n.length;++i){let s=Object.hasOwn(r,n[i])?r[n[i]]:null;if(s!=null&&!s.$isMongooseArray&&!s.$isSchemaMap&&!s.$isSchemaUnion&&s.instance!=="Mixed")continue;let o=e.$__getValue(n[i]);if(o!=null){if(typeof o.clearAtomics==="function")o.clearAtomics();else if(o[_i])o[Sd]=o[_i],o[_i]={}}}}/*!
|
|
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?.[_i]&&r[Sd])r[_i]=r[Sd]}if(!this.$isSubdocument)for(let t of this.$getAllSubdocs())t.$__undoReset()};j.prototype.$__dirty=function(){let e=this,t=this.$__.activePaths.map("modify",function(i){return{path:i,value:e.$__getValue(i),schema:e.$__path(i)}});t=t.concat(this.$__.activePaths.map("default",function(i){if(i==="_id"||e.$__getValue(i)==null)return;return{path:i,value:e.$__getValue(i),schema:e.$__path(i)}}));let r=new Map(t.filter((i)=>i!=null).map((i)=>[i.path,i.value])),n=[];return t.forEach(function(i){if(!i)return;let s=null,o=!1,u=pw(i.path);for(let a=0;a<u.length-1;a++)if(r.has(u[a])){s=r.get(u[a]),o=!0;break}if(!o)n.push(i);else if(s!=null&&s[_i]!=null&&s.hasAtomics())s[_i]={},s[_i].$set=s}),n};j.prototype.$__setSchema=function(e){bue(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[que]=e};j.prototype.$__getArrayPathsToValidate=function(){return Mg||(Mg=rl()),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;Mg||(Mg=rl()),wd=wd||Ch();let t=[];function r(n){let i=[];for(let{model:s}of n.$__schema.childSchemas){let o=n.$__getValue(s.path);if(o==null)continue;if(ti(o))i.push(o);if(Array.isArray(o)){for(let u of o)if(ti(u))i.push(u)}if(o instanceof Map){for(let u of o.values())if(ti(u))i.push(u)}}for(let s of i)r(s);t.push(...i)}if(r(this),this.$__.saveOptions)this.$__.saveOptions.__subdocs=t;return t};/*!
|
|
365
|
+
* Runs queued functions
|
|
366
|
+
*/function eae(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 i;if(e._calledWithOptions.minimize!=null)i=e.minimize;else if(this.$__schemaTypeOptions?.minimize!=null)i=this.$__schemaTypeOptions.minimize;else if(r?.minimize!=null)i=r.minimize;else i=this.$__schema.options.minimize;if(e.minimize=i,!n)e._seen=e._seen||new Map;if((e._calledWithOptions.depopulate??r?.depopulate??e.depopulate??!1)&&e._isNested&&this.$__.wasPopulated)return Co(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,E=a;if(d.indexOf(".")!==-1){let y=d.split(".");m=y[y.length-1];for(let _=0;_<y.length-1;++_)E[y[_]]=E[y[_]]??{},E=E[y[_]]}if(p===null){E[m]=null;continue}E[m]=Co(p,e)}}else a=Co(this._doc,e)||{};let c=e._calledWithOptions.getters??e.getters??r?.getters??!1;if(c){if(tae(this,a),e.minimize)a=$ue(a)||{}}let l=e._calledWithOptions.virtuals??r?.virtuals??o?.virtuals??void 0;if(l||c&&l!==!1)gw(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)rae(this,a);if(e.useProjection)nae(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 i of n){let s=this._doc[i];if(s instanceof Date)r[i]=new Date(s);else if(s!==void 0)r[i]=s}}return r};j.prototype.toObject=function(e){return this.$toObject(e)};/*!
|
|
371
|
+
* Applies virtuals properties to `json`.
|
|
372
|
+
*/function gw(e,t,r,n){let i=e.$__schema,s=i.virtuals,o=Object.keys(s),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(i.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=s[c].applyGetters(void 0,e),h===void 0)continue;h=Co(h,r),t[l]=h;continue}let m=l.split(".");if(h=Co(e.get(c),r),h===void 0)continue;let E=m.length;f=t;for(let y=0;y<E-1;++y)f[m[y]]=f[m[y]]||{},f=f[m[y]];f[m[E-1]]=h}return t}function tae(e,t){let r=e.$__schema,n=Object.keys(r.paths),i=n.length,s,o=e._doc,u;if(!o)return t;while(i--){s=n[i];let a=r.paths[s];if(!a.getters?.length&&!a.embeddedSchemaType?.getters?.length)continue;if(!e.$__isSelected(s))continue;if(s.indexOf(".")===-1){if(t[s]=a.applyGetters(t[s],e),Array.isArray(t[s])&&a.embeddedSchemaType)for(let p=0;p<t[s].length;++p)t[s][p]=a.embeddedSchemaType.applyGetters(t[s][p],e);continue}let c=s.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 rae(e,t){let r=e.$__schema,n=r.pathsWithTransforms();if(!e._doc||!n)return t;for(let s of n){let o=r.paths[s],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(s);if(c===void 0)continue;let l=u.call(e,c);dq(s,l),z.setValue(s,l,t)}else if(typeof a==="function"){let c=e.$get(s);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,dq(s,h)}t[s]=l}}return t}function dq(e,t){if(Rue(t))throw Error("`transform` function must be synchronous, but the transform on path `"+e+"` returned a promise.")}/*!
|
|
373
|
+
* ignore
|
|
374
|
+
*/function nae(e,t){let r=e.$__schema,n=Object.keys(r.paths||{});if(!e._doc)return t;let s=e.$__.selected;if(s===void 0)s={},wq.applyPaths(s,r);if(s==null||z.hasOwnKeys(s)===!1)return t;for(let o of n)if(s[o]!=null&&!s[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(Tg.custom)j.prototype[Tg.custom]=j.prototype.inspect;j.prototype.toString=function(){let e=this.inspect();if(typeof e==="string")return e;return Tg(e)};j.prototype.equals=function(e){if(!e)return!1;let t=this.$__getValue("_id"),r=ti(e)?e.$__getValue("_id"):e;if(!t&&!r)return Dg(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 s=z.populate.apply(null,r);for(let o of s)t[o.path]=o}let n=z.object.vals(t),i=this.constructor;if(this.$__isNested){i=this.$__[Lue].constructor;let s=this.$__.nestedPath;n.forEach(function(o){o.path=s+"."+o.path})}if(this.$session()!=null){let s=this.$session();n.forEach((o)=>{if(o.options==null){o.options={session:s};return}if(!("session"in o.options))o.options.session=s})}return n.forEach((s)=>{s._localModel=i}),i.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 i=this.$get(n);if(Array.isArray(i))r=r.concat(i);else if(i instanceof j)r.push(i)}return r};j.prototype.populated=function(e,t,r){if(t==null||t===!0){if(!this.$__.populated)return;if(typeof e!=="string")return;let i=e.endsWith(".$*")?e.replace(/\.\$\*$/,""):e,s=this.$__.populated[i];if(s)return t===!0?s:s.value;return}this.$__.populated||(this.$__.populated={}),this.$__.populated[e]={value:t,options:r};let n=e.split(".");for(let i=0;i<n.length-1;++i){let s=n.slice(0,i+1).join("."),o=this.$get(s);if(ti(o)&&this.$populated(s)){let u=n.slice(i+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 s of r)delete this.$$populatedVirtuals[s],delete this._doc[s],delete n[s];let i=Object.keys(n);for(let s of i){if(t=this.$populated(s),!t)continue;if(delete n[s],Array.isArray(t)){let o=z.getValue(s,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(s,t,this._doc)}else z.setValue(s,t,this._doc)}return this}for(let i of e)if(t=this.$populated(i),delete n[i],r.indexOf(i)!==-1)delete this.$$populatedVirtuals[i],delete this._doc[i];else if(t)if(Array.isArray(t)){let s=z.getValue(i,this._doc);if(s.isMongooseArray){let o=s.__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(i,t,this._doc)}else z.setValue(i,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(),i=n,s=null;if(t!=null){i=[],s=[];for(let h of n)if(aw(h.path,r,t))i.push(h);else s.push(h)}let o=this.$__schema.options.optimisticConcurrency;if(o)if(Array.isArray(o)){if(!this.$__schema.options._optimisticConcurrencyTrie)this.$__schema.options._optimisticConcurrencyTrie=new iq(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("."))&&aw(m,r,t)))this.$__.version=i.length?3:1}else if(Array.isArray(o?.exclude)){if(!this.$__schema.options._optimisticConcurrencyExcludeTrie)this.$__schema.options._optimisticConcurrencyExcludeTrie=new iq(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("."))&&aw(m,r,t)))this.$__.version=i.length?3:1}else this.$__.version=i.length?3:1;if(!i.length&&this.$__.version!==3)return;let u={},a={},c=i.length,l=[],f=0;if(u._id=this._doc._id,ti(u?._id))u._id=u._id.toObject({transform:!1,depopulate:!0});for(;f<c;++f){let h=i[f],d=h.value,p=iae(this,h.path,d);if(p){l.push(p);continue}if(!this.$populated(h.path,!0)&&this.$__.selected){let E=h.path.split("."),y=E[0];if(this.$__.selected[y]&&this.$__.selected[y].$elemMatch)if(E.length>1&&E[1]==0&&typeof u[y]>"u")u[y]=this.$__.selected[y],E[1]="$",h.path=E.join(".");else{l.push(h.path);continue}}if(this.$isDefault(h.path)&&this.$__.selected){if(h.path.indexOf(".")===-1&&oq(this.$__.selected,h.path))continue;if(pw(h.path).find((y)=>oq(this.$__.isSelected,y)))continue}if(l.length)continue;if(d===void 0)Uu(this,u,a,h,1,"$unset");else if(d===null)Uu(this,u,a,h,null);else if(typeof d.getAtomics==="function")sae(this,u,a,h,d);else if(d[pq.pathSymbol]&&Buffer.isBuffer(d))d=d.toObject(),Uu(this,u,a,h,d);else if(this.$__.primitiveAtomics?.[h.path]!=null){let E=this.$__.primitiveAtomics[h.path],y=Tue(E);Uu(this,u,a,h,E[y],y)}else d=Co(d,{depopulate:!0,transform:!1,virtuals:!1,getters:!1,omitUndefined:!0,_isNested:!0}),Uu(this,u,a,h,d)}if(l.length)throw new Aue(l);if(this.$__.version)this.$__version(u,a);if(z.hasOwnKeys(a)===!1)return[u,null,s];return[u,a,s]};function iae(e,t,r){let n=e.$populated(t,!0);if(!n&&e.$__.selected){let s=t.split(".")[0];if(e.$__.selected[s]&&e.$__.selected[s].$slice!=null&&z.isMongooseArray(r)){if(r[_i].$set)return s}if(e.$__.selected[s+".$"])return s}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 s=r[_i];if(z.hasOwnKeys(s)===!1||s.$set||s.$pop)return t}}function Uu(e,t,r,n,i,s){if(s||(s="$set"),!r[s])r[s]={};if(r[s][n.path]=i,e.$__schema.options.versionKey===!1)return;if(oae(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(s){case"$set":case"$unset":case"$pop":case"$pull":case"$pullAll":case"$push":case"$addToSet":case"$inc":break;default:return}if(s==="$push"||s==="$addToSet"||s==="$pullAll"||s==="$pull")if(/\.\d+\.|\.\d+$/.test(n.path))e.$__.version=3;else e.$__.version|=2;else if(/^\$p/.test(s))e.$__.version=3;else if(Array.isArray(i))e.$__.version=3;else if(/\.\d+\.|\.\d+$/.test(n.path))e.$__.version|=1}function sae(e,t,r,n,i){if(r.$set?.[n.path])return;if(typeof i.getAtomics==="function"){i.getAtomics().forEach(function(f){let h=f[0],d=f[1];Uu(e,t,r,n,d,h)});return}if(typeof i.$__getAtomics==="function"){i.$__getAtomics().forEach(function(f){let h=f[0],d=f[1];Uu(e,t,r,n,d,h)});return}let s=i[_i],o=Object.keys(s),u=o.length,a,c;if(u===0){if(z.isMongooseObject(i))i=i.toObject({depopulate:1,_isNested:!0});else if(i.valueOf)i=i.valueOf();return Uu(e,t,r,n,i)}function l(f){return z.isMongooseObject(f)?f.toObject({depopulate:1,_isNested:!0}):f}while(u--){if(c=o[u],a=s[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};Uu(e,t,r,n,a,c)}}function oae(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=Co(this._doc,{retainDocuments:!0,parentDoc:t});if(this.$__){let n=new this.$__.constructor;for(let i of Object.getOwnPropertyNames(this.$__)){if(i==="activePaths")continue;n[i]=Co(this.$__[i])}Object.assign(n.activePaths,Co({...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 Oue(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 i=n._bsontype;if(i==="ObjectId"||i==="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=Od;Fq.exports=Bq=j});var be=g(function(ce){/*!
|
|
383
|
+
* Module dependencies.
|
|
384
|
+
*/var uae=Te().UUID,aae=dv(),Bg=ss(),cae=sc(),Iq=tg(),_w=ar(),lae=ma(),hae=Kc(),Fg=G2(),Ng=bv(),Pg=Fn(),hc=Zn(),fae=su(),dae=XA(),Cd=dd(),pae=rg(),Vu=oc(),{trustedSymbol:Dh}=ph(),Ew;ce.specialProperties=Vu;ce.isMongooseArray=Fg.isMongooseArray;ce.isMongooseDocumentArray=Ng.isMongooseDocumentArray;ce.registerMongooseArray=Fg.registerMongooseArray;ce.registerMongooseDocumentArray=Ng.registerMongooseDocumentArray;var Aw=/\s/,ww=/\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(hc(t,"ObjectId")&&hc(r,"ObjectId")||hc(t,"Decimal128")&&hc(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(Pg(t))t=t._doc;else if(Cd(t))t=t.toObject();if(Pg(r))r=r._doc;else if(Cd(r))r=r.toObject();let n=Object.keys(t),i=Object.keys(r),s=n.length;if(s!==i.length)return!1;for(let o=s-1;o>=0;o--)if(n[o]!==i[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 i of r)delete n[i];return n};ce.clonePOJOsAndArrays=function(t){if(t==null)return t;if(Pg(t))return t;if(fae(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,i){if(n=n||{},r==null)return t;let s=Object.keys(r),o=0,u=s.length,a;if(r[Dh])t[Dh]=r[Dh];i=i||"";let c=n.omitNested||{};while(o<u){if(a=s[o++],n.omit&&n.omit[a])continue;if(c[i])continue;if(Vu.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)pae(t[a],r[a].clone(),n.isDiscriminatorSchemaMerge);else t[a]=r[a].clone();continue}else if(hc(r[a],"ObjectId")){t[a]=new cae(r[a]);continue}}e(t[a],r[a],n,i?i+"."+a:a)}else if(n.overwrite)t[a]=r[a]}return t};ce.toObject=function e(t){Ew||(Ew=ou());let r;if(t==null)return t;if(t instanceof Ew)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[Dh])r[Dh]=t[Dh];for(let n of Object.keys(t)){if(Vu.has(n))continue;r[n]=e(t[n])}return r}return t};ce.isObject=hae;ce.isPOJO=su();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 uae)&&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 i of n){if(i===r)return!0;if(ce.isPOJO(t[i])&&ce.hasKey(t[i],r))return!0}return!1};ce.tick=function(t){if(typeof t!=="function")return;return function(){try{t.apply(this,arguments)}catch(r){lae(function(){throw r})}}};ce.isMongooseType=function(e){return hc(e,"ObjectId")||hc(e,"Decimal128")||e instanceof Buffer};ce.isMongooseObject=Cd;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(aae(t.expires)/1000),delete t.expires};ce.populate=function(t,r,n,i,s,o,u,a){let c=null;if(arguments.length===1){if(t instanceof Iq)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:i};else c={path:t,select:r,model:n,match:i,options:s,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 mae(c);function l(f){let h=[];return f.forEach(function(d){if(Aw.test(d.path))d.path.split(ww).forEach(function(m){let E=Object.assign({},d);E.path=m,h.push(E)});else h.push(d)}),h}};function mae(e){if(Array.isArray(e.populate)){let n=[];e.populate.forEach(function(i){if(Aw.test(i.path)){let s=Object.assign({},i);s.path.split(ww).forEach(function(u){s.path=u,n.push(ce.populate(s)[0])})}else n.push(ce.populate(i)[0])}),e.populate=ce.populate(n)}else if(e.populate!=null&&typeof e.populate==="object")e.populate=ce.populate(e.populate);let t=[],r=Aw.test(e.path)?e.path.split(ww):Array.isArray(e.path)?e.path:[e.path];if(e.options!=null)e.options=_w(e.options);for(let n of r)t.push(new Iq(Object.assign({},e,{path:n})));return t}ce.getValue=function(e,t,r){return Bg.get(e,t,gae,r)};/*!
|
|
389
|
+
* ignore
|
|
390
|
+
*/var yae=Object.freeze({getters:!1});function gae(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,yae):r[t]}ce.setValue=function(e,t,r,n,i){Bg.set(e,t,r,"_doc",n,i)};ce.object={};ce.object.vals=function(t){if(t==null)return[];let r=Object.keys(t),n=r.length,i=[];while(n--)i.push(t[r[n]]);return i};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(i){if(Array.isArray(i))e(i,r,n);else if(!r||r(i))n.push(i)}),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 Nq=Math.pow(2,32)-1;ce.isArrayIndex=function(e){if(typeof e==="number")return e>=0&&e<=Nq;if(typeof e==="string"){if(!/^\d+$/.test(e))return!1;return e=+e,e>=0&&e<=Nq}return!1};ce.array.unique=function(e){let t=new Set,r=new Set,n=[];for(let i of e)if(typeof i==="number"||typeof i==="string"||i==null){if(t.has(i))continue;n.push(i),t.add(i)}else if(hc(i,"ObjectId")){let s=i.toString();if(r.has(s))continue;n.push(i),r.add(s)}else n.push(i);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=dae;ce.decorate=function(e,t){for(let r in t){if(Vu.has(r))continue;e[r]=t[r]}};ce.mergeClone=function(e,t){if(Cd(t))t=t.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});let r=Object.keys(t),n=r.length,i=0,s;while(i<n){if(s=r[i++],Vu.has(s))continue;if(!Object.hasOwn(Pg(e)?e._doc:e,s)&&s in e)continue;if(typeof e[s]>"u")e[s]=_w(t[s],{transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});else{let o=t[s];if(o?.valueOf&&!(o instanceof Date))o=o.valueOf();if(ce.isObject(o)){let u=o,a=Buffer.isBuffer(o)&&o.isMongooseBuffer;if(Cd(o)&&!a)u=u.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});if(a)u=Buffer.from(u);ce.mergeClone(e[s],u)}else e[s]=_w(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((i,s)=>{if(s===t)i[r]=e[t];else i[s]=e[s];return i},{})};/*!
|
|
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 i of Object.getOwnPropertyNames(t))n[i]=t[i];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($g,qq){/*!
|
|
403
|
+
* Module dependencies.
|
|
404
|
+
*/var Tr=ns(),kq=qi(),Eae=Z2(),_ae=R4(),Ig=ar(),Aae=Ls(),Ow=uv(),wae=cv(),Oae=Fn(),Sw=hv(),Sae=de().schemaTypeSymbol,ri=be(),bd=de().validatorErrorSymbol,Cae=de().documentIsModified,$q=de().populateModelSymbol,Cw=Tr.CastError,Th=Tr.ValidatorError,bae={_skipMarkModified:!0};function ke(e,t,r,n){this[Sae]=!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 i=this.constructor.defaultOptions||{},s=Object.keys(i);for(let a of s)if(a==="validate")this.validate(i.validate);else if(Object.hasOwn(i,a)&&!Object.hasOwn(t,a))t[a]=i[a];if(t.select==null)delete t.select;let o=this.OptionsConstructor||kq;if(this.options=new o(t),this.parentSchema=n,this._index=null,ri.hasUserDefinedProperty(this.options,"immutable"))this.$immutable=this.options.immutable,Ow(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(ri.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=kq;ke.prototype.path;ke.prototype.toJSON=function(){let{parentSchema:t,...r}=this;return r};ke.prototype._createJSONSchemaTypeDefinition=function(t,r,n){let i=n?.useBsonType,s=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(i){if(s||!o)return{bsonType:r};return{bsonType:[r,"null"]}}if(s||!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,ri.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,Ow(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&&ri.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=Sw(t)?Object.assign({},t):Ig(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,i,s;for(n=0,i=arguments.length;n<i;n++){if(s=arguments[n],!ri.isPOJO(s)){let o="Invalid validator. Received ("+typeof s+") "+s+". See https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.validate()";throw new Tr(o)}this.validate(s.validator,s)}return this};ke.prototype.required=function(e,t){let r={};if(arguments.length>0&&e==null)return this.validators=this.validators.filter(function(s){return s.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(s){return s.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"&&(ri.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(s){let o=this?.$__?.cachedRequired;if(o!=null&&!this.$__isSelected(n.path)&&!this[Cae](n.path))return!0;if(o!=null&&n.path in o){let u=o[n.path]?n.checkRequired(s,this):!0;return delete o[n.path],u}else if(typeof e==="function")return e.apply(this)?n.checkRequired(s,this):!0;return n.checkRequired(s,this)},typeof e==="string")t=e,e=void 0;let i=t||Tr.messages.general.required;return this.validators.unshift(Object.assign({},r,{validator:this.requiredValidator,message:i,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,i){let s;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")s=this.defaultValue.call(o);else s=this.defaultValue.call(o,o)}else s=this.defaultValue;if(s!=null){if(typeof s==="object"&&s!=null&&s._bsontype!=="ObjectId"&&!this.options?.shared)s=Ig(s);if(n?.skipCast)return this._applySetters(s,t);let o=this.applySetters(s,t,r,void 0,i??bae);if(o&&!Array.isArray(o)&&o.$isSingleNested)o.$__parent=t;return o}return s};ke.prototype._applySetters=function(e,t,r,n,i){let s=e;if(r)return s;let o=this.setters;for(let u=o.length-1;u>=0;u--)s=o[u].call(t,s,n,this,i);return s};/*!
|
|
405
|
+
* ignore
|
|
406
|
+
*/ke.prototype._castNullish=function(t){return t};ke.prototype.applySetters=function(e,t,r,n,i){let s=this._applySetters(e,t,r,n,i);if(s==null)return this._castNullish(s);return s=this.cast(s,t,r,n,i),s};ke.prototype.applyGetters=function(e,t){let r=e,n=this.getters,i=n.length;if(i===0)return r;for(let s=0;s<i;++s)r=n[s].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 i=!1,s=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=Sw(l)?Object.assign({},l):Ig(l);if(d.path=n?.path||s,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 i=new(d.ErrorConstructor||Th)(d,r),i[bd]=!0,i;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 i=new(d.ErrorConstructor||Th)(d,r),i[bd]=!0,i},function(p){throw d.reason=p,d.message=p.message,h=!1,i=new(d.ErrorConstructor||Th)(d,r),i[bd]=!0,i}));else if(h!==void 0&&!h)throw i=new(d.ErrorConstructor||Th)(d,r),i[bd]=!0,i}await Promise.all(u)};function Rq(e,t){if(e!==void 0&&!e){let n=new(t.ErrorConstructor||Th)(t);return n[bd]=!0,n}}ke.prototype.doValidateSync=function(e,t,r){let n=this.path;if(!this.validators.length)return null;let s=this.validators;if(e===void 0)if(this.validators.length!==0&&this.validators[0].type==="required")s=[this.validators[0]];else return null;let o=null,u=0,a=s.length;for(u=0;u<a;++u){let c=s[u];if(c===null||typeof c!=="object")continue;let l=c.validator,f=Sw(c)?Object.assign({},c):Ig(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(wae(l))continue;if(l instanceof RegExp){o=Rq(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=Rq(h,f),o)break}return o};ke._isRef=function(e,t,r,n){let i=n&&(e.options?.ref||e.options?.refPath);if(!i&&r?.$__!=null){let s=r.$__fullPath(e.path,!0),o=r.ownerDocument();i=s!=null&&o.$populated(s)||r.$populated(e.path)}if(i){if(t==null)return!0;if(!Buffer.isBuffer(t)&&t._bsontype!=="Binary"&&ri.isObject(t))return!0;return n}return!1};/*!
|
|
407
|
+
* ignore
|
|
408
|
+
*/ke.prototype._castRef=function(t,r,n,i){if(t==null)return t;if(Oae(t))return t.$__.wasPopulated=t.$__.wasPopulated||{value:t._doc._id},t;if(Buffer.isBuffer(t)||!ri.isObject(t)){if(n)return t;throw new Cw(this.instance,t,this.path,null,this)}let s=r.$__fullPath(this.path,!0),o=r.ownerDocument(),u=o.$populated(s,!0),a=t;if(!r.$__.populated||!r.$__.populated[s]||!r.$__.populated[s].options||!r.$__.populated[s].options.options||!r.$__.populated[s].options.options.lean){let c=u?u.options[$q]:o.constructor.db.model(this.options.ref);a=c.hydrate(t,null,i),a.$__.wasPopulated={value:a._doc._id,options:{[$q]:c}}}return a};/*!
|
|
409
|
+
* ignore
|
|
410
|
+
*/function xq(e,t){return this.castForQuery(null,e,t)}/*!
|
|
411
|
+
* ignore
|
|
412
|
+
*/function Dae(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 vq(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:Dae,$eq:xq,$in:vq,$ne:xq,$nin:vq,$exists:Eae,$type:_ae};ke.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Aae(this.$conditionalHandlers,e),!n)throw new Tr("Can't use "+e);return n.call(this,t,r)}try{return this.applySetters(t,r)}catch(i){if(i instanceof Cw&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};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,Ow(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
|
+
*/qq.exports=$g=ke;$g.CastError=Cw;$g.ValidatorError=Th});var bw=g(function(D_e,jq){var bo=is();class us{constructor(e){if(Object.assign(this,e),e?.options!=null)this.options=Object.assign({},e.options)}}Object.defineProperty(us.prototype,"ref",bo);Object.defineProperty(us.prototype,"refPath",bo);Object.defineProperty(us.prototype,"localField",bo);Object.defineProperty(us.prototype,"foreignField",bo);Object.defineProperty(us.prototype,"justOne",bo);Object.defineProperty(us.prototype,"count",bo);Object.defineProperty(us.prototype,"match",bo);Object.defineProperty(us.prototype,"options",bo);Object.defineProperty(us.prototype,"skip",bo);Object.defineProperty(us.prototype,"limit",bo);Object.defineProperty(us.prototype,"perDocumentLimit",bo);jq.exports=us});var Rg=g(function(T_e,Lq){Lq.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((i)=>t[i]);if(t instanceof Map)return t.get(r);return t[r]}});var Dw=g(function(M_e,Hq){var Uq=ze(),Tae=W4(),Vq=Rg(),xg=ss(),vg=require("util"),Wq=be(),zq=/(\.\d+$|\.\d+\.)/g;Hq.exports=function(t,r,n,i,s){if(t==null)return[];if(typeof t!=="string")throw new Uq("`refPath` must be a string or a function that returns a string, got "+vg.inspect(t));if(s!=null&&Tae(s,t))throw new Uq("refPath `"+t+"` must not be excluded in projection, got "+vg.inspect(s));if(zq.test(n)){let a=n.split(zq);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=xg.get(c,r,Vq),h=Array.isArray(f)?f:[f];return h=Wq.array.flatten(h),h}let o=xg.get(t,r,Vq),u;if(i!=null&&Object.hasOwn(i.virtuals,t))u=[i.virtuals[t].applyGetters(void 0,r)];else u=Array.isArray(o)?o:[o];return u}});var kg=g(function(P_e,Gq){var Mae=Dw(),Kq=be(),Pae=de().modelSymbol;function zu(e,t){this.path=t,this.getters=[],this.setters=[],this.options=Object.assign({},e)}zu.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
|
+
*/zu.prototype.clone=function(){let e=new zu(this.options,this.path);return e.getters=[].concat(this.getters),e.setters=[].concat(this.setters),e};zu.prototype.get=function(e){return this.getters.push(e),this};zu.prototype.set=function(e){return this.setters.push(e),this};zu.prototype.applyGetters=function(e,t){if(Kq.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};zu.prototype.applySetters=function(e,t){let r=e;for(let n of this.setters)r=n.call(t,r,this,t);return r};zu.prototype._getModelNamesForPopulate=function(t){if(this.options.refPath)return Mae(this.options.refPath,t,this.path);let r=null;if(typeof this.options.ref==="function"&&!this.options.ref[Pae])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
|
+
*/Gq.exports=zu});var Tw=g(function(B_e,Yq){Yq.exports=function(t){let r={_id:{auto:!0}};r._id[t.options.typeKey]="ObjectId",t.add(r)}});var Mw=g(function(F_e,Qq){Qq.exports=function(t,r){let n=t.discriminatorMapping?.value;if(n&&!("sparse"in r)){let i=t.options.discriminatorKey;r.partialFilterExpression=r.partialFilterExpression||{},r.partialFilterExpression[i]=n}return r}});var Xq=g(function(N_e,Jq){var Pw=Dr(),Bae=Kc(),Fae=Mw();Jq.exports=function(t){let r=[],n=new WeakMap,i=t.constructor.indexTypes,s=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(Pw(d,"options.excludeIndexes")!==!0&&Pw(d,"schemaOptions.excludeIndexes")!==!0&&Pw(d,"schema.options.excludeIndexes")!==!0)o(d.schema,c+h+".");if(d.schema.discriminators!=null){let m=d.schema.discriminators,E=Object.keys(m);for(let y of E)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={},E=Bae(p),y=E?{...p}:{},_=typeof p==="string"?p:E?p.type:!1;if(_&&i.indexOf(_)!==-1)m[c+h]=_;else if(y.text)m[c+h]="text",delete y.text;else{let b=!1;if(p==="descending"||p==="desc")b=!0;else if(p==="ascending"||p==="asc")b=!1;else b=Number(p)===-1;m[c+h]=b?-1:1}if(delete y.type,a.options.autoIndex!=null)y._autoIndex=a.options.autoIndex;let O=y?.name;if(typeof O==="string")if(s.has(O))Object.assign(s.get(O),m);else r.push([m,y]),s.set(O,m);else r.push([m,y]),s.set(O,m)}}if(n.delete(a),c)u(a,c);else a._indexes.forEach(function(h){let d=h[1];Fae(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),E=m.length,y={};for(let O=0;O<E;++O){let b=m[O];y[c+b]=d[b]}let _=Object.assign({},p);if(p?.partialFilterExpression!=null){_.partialFilterExpression={};let O=p.partialFilterExpression;for(let b of Object.keys(O))_.partialFilterExpression[c+b]=O[b]}r.push([y,_])}}}});var Bw=g(function(I_e,Zq){Zq.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 qg=g(function($_e,ej){/*!
|
|
423
|
+
* ignore
|
|
424
|
+
*/ej.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(Nae),t};function Nae(){if(this._doc)return this._doc._id?.toString()??null;if(this._id!=null)return this._id.toString();return null}});var Fw=g(function(R_e,tj){tj.exports=function(t,r){let n=Object.keys(t),i=Object.keys(r);if(n.length!==i.length)return!1;for(let s=0;s<n.length;s++){let o=n[s];if(o!==i[s]||t[o]!==r[o])return!1}return!0}});var nj=g(function(x_e,rj){rj.exports=function(t,r,n,i){if(i.justOne||i.count){if(t[r]=Array.isArray(n)?n[0]:n,typeof t[r]!=="object")t[r]=i.count?n:null}else t[r]=Array.isArray(n)?n:n==null?[]:[n],t[r]=t[r].filter(function(s){return s&&typeof s==="object"});return t[r]}});var Dd=g(function(v_e,ij){ij.exports=function(t){if(t.indexOf("$")===-1)return t;return t.replace(/\.\$(\[[^\]]*\])?(?=\.|$)/g,".0")}});var jg=g(function(k_e,sj){sj.exports=Iae;/*!
|
|
425
|
+
* ignore
|
|
426
|
+
*/function Iae(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 Iw=g(function(q_e,uj){var oj=Dd(),Wu=jg();uj.exports=il;/*!
|
|
427
|
+
* ignore
|
|
428
|
+
*/function il(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)Nw(r,a,t.$set,e)}if(t.$setOnInsert!=null){let u=Object.keys(t.$setOnInsert);for(let a of u)Nw(r,a,t.$setOnInsert,e)}}let s=Object.keys(t).filter((u)=>u[0]!=="$");for(let u of s)Nw(r,u,t,e);function o(u){for(let a of Object.keys(u)){let c=r.path(oj(a));if(u[a]&&c&&c.$isMongooseDocumentArray&&c.schema.options.timestamps){let l=c.schema.options.timestamps,f=Wu(l,"createdAt"),h=Wu(l,"updatedAt");if(u[a].$each)u[a].$each.forEach(function(d){if(h!=null)d[h]=e;if(f!=null)d[f]=e;il(e,d,c.schema)});else{if(h!=null)u[a][h]=e;if(f!=null)u[a][f]=e;il(e,u[a],c.schema)}}}}}function $ae(e,t,r){let n=t.schema.options.timestamps,i=e.length;if(!n){for(let u=0;u<i;++u)il(r,e[u],t.schema);return}let s=Wu(n,"createdAt"),o=Wu(n,"updatedAt");for(let u=0;u<i;++u){if(o!=null)e[u][o]=r;if(s!=null)e[u][s]=r;il(r,e[u],t.schema)}}function Rae(e,t,r){let n=t.schema.options.timestamps;if(!n){il(r,e,t.schema);return}let i=Wu(n,"createdAt"),s=Wu(n,"updatedAt");if(s!=null)e[s]=r;if(i!=null)e[i]=r;il(r,e,t.schema)}function Nw(e,t,r,n){let i=oj(t),s=e.path(i);if(!s)return;let o=[],u=i.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])&&s.$isMongooseDocumentArray)$ae(r[t],s,n);else if(r[t]&&s.$isSingleNested)Rae(r[t],s,n);else if(o.length>0)for(let a of o){let{parentPath:c,parentSchemaType:l}=a,f=l.schema.options.timestamps,h=Wu(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(s.schema!=null&&s.schema!=e&&r[t]){let a=s.schema.options.timestamps,c=Wu(a,"createdAt"),l=Wu(a,"updatedAt");if(!a)return;if(l!=null)r[t][l]=n;if(c!=null)r[t][c]=n}}});var Rw=g(function(j_e,cj){/*!
|
|
429
|
+
* ignore
|
|
430
|
+
*/var aj=be(),$w=Dr();cj.exports=xae;/*!
|
|
431
|
+
* ignore
|
|
432
|
+
*/function xae(e,t,r,n,i,s,o){let u=n,a=u,c=i?.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("."),E=d.slice(0,-p).join(".");if(n[E]!=null){n[E][m]=e,h=!0;break}else if(n.$set?.[E]){n.$set[E][m]=e,h=!0;break}}}if(!h)u.$set[r]=e;if(Object.hasOwn(u,r))delete u[r]}if(!l&&t){let h=i?.overwriteImmutable,d=$w(n,t)!=null||$w(n.$set,t)!=null||$w(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 E=1;E<m.length;++E){let y=m.slice(-E).join("."),_=m.slice(0,-E).join(".");if(n[_]!=null){n[_][y]=e,p=!0;break}else if(n.$set?.[_]){n.$set[_][y]=e,p=!0;break}}}if(!p&&s)u.$setOnInsert=u.$setOnInsert||{},u.$setOnInsert[t]=e}}if(aj.hasOwnKeys(u.$set)===!1)delete u.$set;return u}});var hj=g(function(L_e,lj){lj.exports=function(t,r,n,i,s){let o=r?.updatedAt===!1,u=r?.createdAt===!1,a=n!=null?n():t.ownerDocument().constructor.base.now();if(!u&&(t.isNew||t.$isSubdocument)&&i&&!t.$__getValue(i)&&t.$__isSelected(i))t.$set(i,a,void 0,{overwriteImmutable:!0});if(!o&&s&&(t.isNew||t.$isModified())){let c=a;if(t.isNew&&i!=null)c=t.$__getValue(i);t.$set(s,c)}}});var mj=g(function(U_e,pj){var vae=Iw(),kae=Rw(),Lg=jg(),qae=hj(),Ug=Oo(),fj=new Set(["replaceOne","findOneAndReplace"]);pj.exports=function(t,r){let n=t.childSchemas.find(i);function i(l){return!!l.schema.options.timestamps}if(!r&&!n)return;let s=Lg(r,"createdAt"),o=Lg(r,"updatedAt"),u=r!=null&&Object.hasOwn(r,"currentTime")?r.currentTime:null,a={};if(t.$timestamps={createdAt:s,updatedAt:o},s&&!t.paths[s]){let f=t.base?.get("timestamps.createdAt.immutable")??null??!0;a[s]={[t.options.typeKey||"type"]:Date,immutable:f}}if(o&&!t.paths[o])a[o]=Date;t.add(a),t.pre("save",dj),t.methods.initializeTimestamps=function(l){if(l===!1)return this;let f=u!=null?u():this.constructor.base.now(),h=l!=null?Lg(l,"createdAt"):s,d=l!=null?Lg(l,"updatedAt"):o;if(h&&!this.get(h))this.$set(s,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,sl),t.pre("findOneAndUpdate",c,sl),t.pre("replaceOne",c,sl),t.pre("update",c,sl),t.pre("updateOne",c,sl),t.pre("updateMany",c,sl)};function dj(){let e=this.$__?.saveOptions?.timestamps;if(e===!1)return;let t=this.$__schema,{createdAt:r,updatedAt:n}=t.$timestamps,i=t.options.timestamps,s=i!=null&&Object.hasOwn(i,"currentTime")?i.currentTime:null;qae(this,e,s,r,n)}function sl(){let e=this.model.schema,{createdAt:t,updatedAt:r}=e.$timestamps,n=e.options.timestamps,i=n!=null&&Object.hasOwn(n,"currentTime")?n.currentTime:null,s=i!=null?i():this.model.base.now();if(fj.has(this.op)&&this.getUpdate()==null)this.setUpdate({});kae(s,t,r,this.getUpdate(),this._mongooseOptions,this.options.upsert,fj.has(this.op)),vae(s,this.getUpdate(),this.model.schema)}dj[Ug.builtInMiddleware]=!0;sl[Ug.builtInMiddleware]=!0});var Ej=g(function(V_e,gj){var jae=ze(),yj=require("util");gj.exports=Lae;function Lae(e,t){if(typeof e==="string")return;if(typeof e==="function")return;throw new jae('Invalid ref at path "'+t+'". Got '+yj.inspect(e,{depth:0}))}});var Td=g(function(Mh){/*!
|
|
433
|
+
* ignore
|
|
434
|
+
*/var _j=Object.freeze(["countDocuments","distinct","estimatedDocumentCount","find","findOne","findOneAndReplace","findOneAndUpdate","replaceOne","updateMany","updateOne","deleteMany","deleteOne","findOneAndDelete"]);Mh.queryOperations=_j;/*!
|
|
435
|
+
* ignore
|
|
436
|
+
*/var Uae=_j.concat(["validate"]);Mh.queryMiddlewareFunctions=Uae;/*!
|
|
437
|
+
* ignore
|
|
438
|
+
*/var Vae=["aggregate"];Mh.aggregateMiddlewareFunctions=Vae;/*!
|
|
439
|
+
* ignore
|
|
440
|
+
*/var zae=["bulkWrite","createCollection","insertMany"];Mh.modelMiddlewareFunctions=zae;/*!
|
|
441
|
+
* ignore
|
|
442
|
+
*/var Wae=["validate","save","remove","updateOne","deleteOne","init"];Mh.documentMiddlewareFunctions=Wae});var Dj=g(function(Cj,bj){/*!
|
|
443
|
+
* Module dependencies.
|
|
444
|
+
*/var zg=Sg(),Vg=de().arrayAtomicsSymbol,Hae=de().arrayAtomicsBackupSymbol,Aj=de().arrayParentSymbol,Kae=de().arrayPathSymbol,wj=de().arraySchemaSymbol,Oj=Array.prototype.push,Sj=/^\d+$/;function Gae(e,t,r,n){let i;if(Array.isArray(e)){let u=e.length;if(u===0)i=[];else if(u===1)i=[,],i[0]=e[0];else if(u<1e4)i=[],Oj.apply(i,e);else{i=[];for(let a=0;a<u;++a)Oj.call(i,e[a])}}else i=[];let s={[Vg]:{},[Hae]:void 0,[Kae]:t,[wj]:n,[Aj]:void 0,isMongooseArray:!0,isMongooseArrayProxy:!0,__array:i};if(e&&e[Vg]!=null)s[Vg]=e[Vg];if(r?.$__)s[Aj]=r,s[wj]=n||r.schema.path(t);let o=new Proxy(i,{get:function(u,a){if(Object.hasOwn(s,a))return s[a];if(Object.hasOwn(zg,a))return zg[a];if(n?.virtuals&&Object.hasOwn(n.virtuals,a))return n.virtuals[a].applyGetters(void 0,u);if(typeof a==="string"&&Sj.test(a)&&n?.embeddedSchemaType!=null)return n.embeddedSchemaType.applyGetters(i[a],r);return i[a]},set:function(u,a,c){if(typeof a==="string"&&Sj.test(a))zg.set.call(o,a,c,!1);else if(Object.hasOwn(s,a))s[a]=c;else if(n?.virtuals&&Object.hasOwn(n.virtuals,a))n.virtuals[a].applySetters(c,u);else i[a]=c;return!0}});return o}/*!
|
|
445
|
+
* Module exports.
|
|
446
|
+
*/bj.exports=Cj=Gae});var Mj=g(function(W_e,Tj){Tj.exports=Te().Double});var Ph=g(function(H_e,Bj){/*!
|
|
447
|
+
* Module dependencies.
|
|
448
|
+
*/var fc=Mr(),Pj=Oo(),Yae=Kc(),Wg=be();function zs(e,t,r,n){if(t?.default){let i=t.default;if(Array.isArray(i)&&i.length===0)t.default=Array;else if(!t.shared&&Yae(i)&&Wg.hasOwnKeys(i)===!1)t.default=function(){return{}}}fc.call(this,e,t,"Mixed",n),this[Pj.schemaMixedSymbol]=!0}zs.schemaName="Mixed";zs.defaultOptions={};/*!
|
|
449
|
+
* Inherits from SchemaType.
|
|
450
|
+
*/zs.prototype=Object.create(fc.prototype);zs.prototype.constructor=zs;zs.get=fc.get;zs.set=fc.set;zs.setters=[];zs.prototype.cast=function(e){if(e instanceof Error)return Wg.errorToPOJO(e);return e};zs.prototype.castForQuery=function(e,t){return t};zs.prototype.toJSONSchema=function(t){return{}};/*!
|
|
451
|
+
* Module exports.
|
|
452
|
+
*/Bj.exports=zs});var Gg=g(function(K_e,xj){var Qae=Ph(),Jae=ze(),Fj=ar(),Xae=be().deepEqual,Zae=be().isMongooseArray,ece=Xn(),tce=pg(),Nj=Fn(),Kg=require("util"),Rj=oc(),Hg=Zn(),rce=cg(),Ij=de().populateModelSymbol;/*!
|
|
453
|
+
* ignore
|
|
454
|
+
*/class cu extends Map{constructor(e,t,r,n){if(ece(e)==="Object")e=Object.keys(e).map((i)=>[i,e[i]]);super(e);this.$__parent=r?.$__!=null?r:null,this.$__path=t,this.$__schemaType=n==null?new Qae(t):n,this.$__runDeferred()}$init(e,t){if($j(e),super.set(e,t),t?.$isSingleNested)t.$basePath=this.$__path+"."+e}$__set(e,t){super.set(e,t)}get(e,t){if(Hg(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(Hg(e,"ObjectId"))e=e.toString();return super.has(e)}set(e,t){if(Hg(e,"ObjectId"))e=e.toString();if($j(e),t=tce(t),this.$__schemaType==null){this.$__deferred=this.$__deferred||[],this.$__deferred.push({key:e,value:t});return}let r,n=this.$__parent,i=n?.$__?.populated?n.$populated(o.call(this),!0)||n.$populated(this.$__path,!0):null,s=this.get(e);if(i!=null){if(this.$__schemaType.$isSingleNested)throw new Jae(`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(!Nj(u))u=new i.options[Ij](u);return u.$__.wasPopulated={value:u._doc._id},u});else if(t!=null){if(!Nj(t))t=new i.options[Ij](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&&!Xae(t,s)){let u=o.call(this);if(n.markModified(u),Zae(t))t._registerAtomic("$set",t);if(this.$__schemaType.$isMongooseDocumentArray||this.$__schemaType.$isSingleNested)rce(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(Hg(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]=Fj(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]=Fj(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(Kg.inspect.custom)Object.defineProperty(cu.prototype,Kg.inspect.custom,{enumerable:!1,writable:!1,configurable:!1,value:cu.prototype.inspect});Object.defineProperty(cu.prototype,"$__set",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(cu.prototype,"$__parent",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(cu.prototype,"$__path",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(cu.prototype,"$__schemaType",{enumerable:!1,writable:!0,configurable:!1});Object.defineProperty(cu.prototype,"$isMongooseMap",{enumerable:!1,writable:!1,configurable:!1,value:!0});Object.defineProperty(cu.prototype,"$__deferredCalls",{enumerable:!1,writable:!1,configurable:!1,value:!0});function $j(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(Rj.has(e))throw Error(`Mongoose maps do not support reserved key name "${e}"`)}xj.exports=cu});var kj=g(function(G_e,vj){vj.exports=Te().UUID});var Bh=g(function(Ws){/*!
|
|
455
|
+
* Module exports.
|
|
456
|
+
*/Ws.Array=Dj();Ws.Buffer=ig();Ws.Document=Ws.Embedded=Ch();Ws.DocumentArray=rl();Ws.Double=Mj();Ws.Decimal128=K2();Ws.ObjectId=sc();Ws.Map=Gg();Ws.Subdocument=Eg();Ws.UUID=kj()});var jj=g(function(Q_e,qj){var nce=qi();class Md extends nce{}var xw=is();Object.defineProperty(Md.prototype,"enum",xw);Object.defineProperty(Md.prototype,"of",xw);Object.defineProperty(Md.prototype,"castNonArrays",xw);/*!
|
|
457
|
+
* ignore
|
|
458
|
+
*/qj.exports=Md});var Uj=g(function(J_e,Lj){Lj.exports=vw;function vw(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=vw(e[0]);for(let r=1;r<e.length;++r){let n=vw(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 Pd=g(function(X_e,Vj){Vj.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 kw=g(function(Z_e,zj){zj.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 Gj=g(function(e3e,Kj){var Fh=ei(),Hj=ac(),Yg=Pd(),ice=su(),Wj=kw(),sce=new Set(["$and","$or"]),oce=new Set(["$cmp","$eq","$lt","$lte","$gt","$gte"]),uce=new Set(["$multiply","$divide","$log","$mod","$trunc","$avg","$max","$min","$stdDevPop","$stdDevSamp","$sum"]),ace=new Set(["$abs","$exp","$ceil","$floor","$ln","$log10","$sqrt","$sin","$cos","$tan","$asin","$acos","$atan","$atan2","$asinh","$acosh","$atanh","$sinh","$cosh","$tanh","$degreesToRadians","$radiansToDegrees"]),cce=new Set(["$arrayElemAt","$first","$last"]),lce=new Set(["$year","$month","$week","$dayOfMonth","$dayOfYear","$hour","$minute","$second","$isoDayOfWeek","$isoWeekYear","$isoWeek","$millisecond"]),hce=new Set(["$not"]);Kj.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 ji(t,r,n)};function ji(e,t,r){if(Bd(e)||e===null)return e;if(e.$cond!=null)if(Array.isArray(e.$cond))e.$cond=e.$cond.map((i)=>ji(i,t,r));else e.$cond.if=ji(e.$cond.if,t,r),e.$cond.then=ji(e.$cond.then,t,r),e.$cond.else=ji(e.$cond.else,t,r);else if(e.$ifNull!=null)e.$ifNull.map((i)=>ji(i,t,r));else if(e.$switch!=null){if(Array.isArray(e.$switch.branches))for(let i of e.$switch.branches){if(i?.case!=null)i.case=ji(i.case,t,r);if(i?.then!=null)i.then=ji(i.then,t,r);Wj(i)}if("default"in e.$switch)e.$switch.default=ji(e.$switch.default,t,r)}let n=Object.keys(e);for(let i of n)if(sce.has(i))e[i]=e[i].map((s)=>ji(s,t,r));else if(oce.has(i))e[i]=pce(e[i],t,r);else if(uce.has(i))e[i]=dce(e[i],t,r);else if(ace.has(i))e[i]=qw(e[i],t,r);else if(hce.has(i))e[i]=ji(e[i],t,r);if(e.$in)e.$in=fce(e.$in,t,r);if(e.$size)e.$size=qw(e.$size,t,r);if(e.$round){let i=e.$round;if(!Array.isArray(i)||i.length<1||i.length>2)throw new Fh("Array",i,"$round");e.$round=i.map((s)=>qw(s,t,r))}return Wj(e),e}function qw(e){if(!Fd(e))return e;try{return Yg(e)}catch{throw new Fh("Number",e)}}function fce(e,t,r){let n=e[1];if(!Bd(n))return e;let i=e[0],s=t.path(n.slice(1));if(s===null){if(r===!1)return e;else if(r==="throw")throw new Hj("$in");return}if(!s.$isMongooseArray)throw Error("Path must be an array for $in");if(!Fd(i)&&(typeof i==="string"||ice(i)))return[ji(i,t,r),n];if(typeof i==="object"&&i!=null&&i.$literal!=null)return[{$literal:s.embeddedSchemaType.cast(i.$literal)},n];return[s.embeddedSchemaType.cast(i),n]}function dce(e){if(!Array.isArray(e)){if(!Fd(e))return e;try{return Yg(e)}catch{throw new Fh("Number",e)}}return e.map((t)=>{if(!Fd(t))return t;try{return Yg(t)}catch{throw new Fh("Number",t)}})}function pce(e,t,r){if(!Array.isArray(e)||e.length!==2)throw Error("Comparison operator must be an array of length 2");e[0]=ji(e[0],t,r);let n=e[0];if(Fd(e[1])){let i=null,s=null,o=null;if(Bd(n))i=n.slice(1),s=t.path(i);else if(typeof n==="object"&&n!=null){for(let a of Object.keys(n))if(lce.has(a)&&Bd(n[a]))i=n[a].slice(1)+"."+a,o=Yg;else if(cce.has(a)&&Bd(n[a])){if(i=n[a].slice(1)+"."+a,s=t.path(n[a].slice(1)),s!=null){if(s.$isMongooseArray)s=s.embeddedSchemaType}}}let u=typeof e[1]==="object"&&e[1]!=null&&e[1].$literal!=null;if(s!=null)if(u)e[1]={$literal:s.cast(e[1].$literal)};else e[1]=s.cast(e[1]);else if(o!=null)if(u)try{e[1]={$literal:o(e[1].$literal)}}catch{throw new Fh(o.name.replace(/^cast/,""),e[1],i+".$literal")}else try{e[1]=o(e[1])}catch{throw new Fh(o.name.replace(/^cast/,""),e[1],i)}else if(i!=null&&r===!0)return;else if(i!=null&&r==="throw")throw new Hj(i)}else e[1]=ji(e[1],t,r);return e}function Bd(e){return typeof e==="string"&&e[0]==="$"}function Fd(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 Qg=g(function(t3e,Yj){var mce=ei();Yj.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 mce("string",t,r)}});var Zj=g(function(r3e,Xj){var yce=ei(),Qj=X2(),Jj=Qg();Xj.exports=function(t,r){if(t==null||typeof t!=="object")throw new yce("$text",t,r);if(t.$search!=null)t.$search=Jj(t.$search,r+".$search");if(t.$language!=null)t.$language=Jj(t.$language,r+".$language");if(t.$caseSensitive!=null)t.$caseSensitive=Qj(t.$caseSensitive,r+".$caseSensitive");if(t.$diacriticSensitive!=null)t.$diacriticSensitive=Qj(t.$diacriticSensitive,r+".$diacriticSensitive");return t}});var jw=g(function(n3e,eL){var gce=su();eL.exports=function(t){if(!gce(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 Nh=g(function(i3e,tL){var Ece=new Set(["$ref","$id","$db"]);tL.exports=function(t){return t[0]==="$"&&!Ece.has(t)}});var Nd=g(function(rL){rL.logicalOperators=new Set(["$and","$or","$nor"])});var ol=g(function(o3e,aL){/*!
|
|
459
|
+
* Module dependencies.
|
|
460
|
+
*/var _ce=os(),nL=ei(),Lw=ac(),oL=Id(),Ace=Gj(),wce=Qg(),Oce=Zj(),Sce=Dr(),iL=jw(),Cce=uu(),sL=dg(),Uw=Nh(),{logicalOperators:bce}=Nd(),uL=require("util"),zw=Kc(),Vw=dd(),Jg=be(),Dce=["Polygon","MultiPolygon"];aL.exports=function e(t,r,n,i){if(Array.isArray(r))throw Error("Query filter must be an object, got an array "+uL.inspect(r));if(r==null)return r;if(t?.discriminators!=null&&r[t.options.discriminatorKey]!=null){let p=iL(r[t.options.discriminatorKey]);t=sL(t,p)||t}let s=Object.keys(r),o=s.length,u,a,c,l,f,h,d;n=n||{};while(o--)if(f=s[o],d=r[f],bce.has(f)){if(!Array.isArray(d))throw new nL("Array",d,f);for(let p=d.length-1;p>=0;p--){if(d[p]==null||typeof d[p]!=="object")throw new nL("Object",d[p],f+"."+p);let m=Object.keys(d[p]).length,E=d[p][t.options.discriminatorKey];if(E==null)d[p]=e(t,d[p],n,i);else{let y=sL(i.schema,E);d[p]=e(y?y:t,d[p],n,i)}if(Jg.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=Ace(d,t);continue}else if(f==="$elemMatch")d=e(t,d,n,i);else if(f==="$text")d=Oce(d,f);else if(f==="$comment"&&!Object.hasOwn(t.paths,"$comment"))d=wce(d,f),r[f]=d;else if(Uw(f))continue;else{if(!t)continue;if(c=t.path(f),!c){let p=f.split("."),m=p.length;while(m--){let E=p.slice(0,m).join("."),y=p.slice(m).join("."),_=t.path(E),O=_?.schema?.options?.discriminatorKey;if(_?.schema?.discriminators!=null&&O!=null&&y!==O){let b=iL(Sce(r,E+"."+O)),A=_.schema.discriminators,P=typeof b==="string"?_ce(A,b):null;if(P!=null)c=P.path(y)}}}if(!c){let p=f.split("."),m=p.length,E,y,_;while(m--)if(E=p.slice(0,m).join("."),c=t.path(E),c)break;if(c){if(c.schema){_={},y=p.slice(m).join("."),_[y]=d;let A=e(c.schema,_,n,i)[y];if(A===void 0)delete r[f];else r[f]=A}else r[f]=d;continue}if(zw(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 oL.Number("__QueryCasting__",null,null,t),S=d[A];if(d.$maxDistance!=null)d.$maxDistance=P.castForQuery(null,d.$maxDistance,i);if(d.$minDistance!=null)d.$minDistance=P.castForQuery(null,d.$minDistance,i);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,i);if(S.$minDistance!=null)S.$minDistance=P.castForQuery(null,S.$minDistance,i);if(Vw(S.$geometry))S.$geometry=S.$geometry.toObject({transform:!1,virtuals:!1});S=S.$geometry.coordinates}else if(A==="$geoWithin"){if(S.$geometry){if(Vw(S.$geometry))S.$geometry=S.$geometry.toObject({virtuals:!1});let B=S.$geometry.type;if(Dce.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,Vw(S))S=S.toObject({virtuals:!1})}Ww(S,P,i);continue}}if(Cce(t.nested,f))continue;let O="strict"in n?n.strict:t.options.strict,b=Tce(n,t._userProvidedOptions,t.options,i);if(n.upsert&&O){if(O==="throw")throw new Lw(f);throw new Lw(f,'Path "'+f+'" is not in schema, strict mode is `true`, and upsert is `true`.')}if(b==="throw")throw new Lw(f,'Path "'+f+`" is not in schema and strictQuery is 'throw'.`);else if(b)delete r[f]}else if(d==null)continue;else if(Jg.isPOJO(d))if(a=Object.keys(d).some(Uw),!a)r[f]=c.castForQuery(null,d,i);else{let p=Object.keys(d),m,E=p.length;while(E--)if(m=p[E],l=d[m],m==="$elemMatch"){if(l&&c?.schema!=null)e(c.schema,l,n,i);else if(l&&c?.$isMongooseArray)d[m]=c.castForQuery(m,l,i)}else if(m==="$not"){if(l&&c){if(u=Object.keys(l),u.length&&Uw(u[0]))for(let y in l)l[y]=c.castForQuery(y,l[y],i);else d[m]=c.castForQuery(m,l,i);continue}}else d[m]=c.castForQuery(m,l,i)}else if(Array.isArray(d)&&["Buffer","Array"].indexOf(c.instance)===-1&&!n.sanitizeFilter){let p=[],m=d;for(let E of m)p.push(c.castForQuery(null,E,i));r[f]={$in:p}}else r[f]=c.castForQuery(null,d,i)}return r};function Ww(e,t,r){if(Array.isArray(e))e.forEach(function(n,i){if(Array.isArray(n)||zw(n))return Ww(n,t,r);e[i]=t.castForQuery(null,n,r)});else{let n=Object.keys(e),i=n.length;while(i--){let s=n[i],o=e[s];if(Array.isArray(o)||zw(o))Ww(o,t,r),e[s]=o;else e[s]=t.castForQuery(null,o,r)}}}function Tce(e,t,r,n){if("strictQuery"in e)return e.strictQuery;if("strictQuery"in t)return t.strictQuery;let i=n?.mongooseCollection?.conn?.base?.options;if(i){if("strictQuery"in i)return i.strictQuery}return r.strictQuery}});var lL=g(function(u3e,cL){var Mce=qi();class Ih extends Mce{}var Xg=is();Object.defineProperty(Ih.prototype,"min",Xg);Object.defineProperty(Ih.prototype,"max",Xg);Object.defineProperty(Ih.prototype,"enum",Xg);Object.defineProperty(Ih.prototype,"populate",Xg);/*!
|
|
461
|
+
* ignore
|
|
462
|
+
*/cL.exports=Ih});var $d=g(function(a3e,fL){/*!
|
|
463
|
+
* Module requirements.
|
|
464
|
+
*/var Pce=ei();/*!
|
|
465
|
+
* ignore
|
|
466
|
+
*/function Bce(e){let t=this;if(Array.isArray(e))return e.map(function(r){return hL(t.path,r)});else if(Buffer.isBuffer(e))return e;return hL(t.path,e)}/*!
|
|
467
|
+
* ignore
|
|
468
|
+
*/function hL(e,t){let r=Number(t);if(isNaN(r))throw new Pce("number",t,e);return r}fL.exports=Bce});var Hw=g(function(c3e,pL){/*!
|
|
469
|
+
* Module requirements.
|
|
470
|
+
*/var Hu=ns(),Fce=lL(),En=Mr(),Nce=Pd(),Zg=$d(),$h=be(),Ice=Ls(),dL=En.CastError;function tr(e,t,r,n){this.enumValues=[],En.call(this,e,t,"Number",n)}tr.get=En.get;tr.set=En.set;tr.setters=[];/*!
|
|
471
|
+
* ignore
|
|
472
|
+
*/tr._cast=Nce;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(En.prototype);tr.prototype.constructor=tr;tr.prototype.OptionsConstructor=Fce;/*!
|
|
477
|
+
* ignore
|
|
478
|
+
*/tr._checkRequired=(e)=>typeof e==="number"||e instanceof Number;tr.checkRequired=En.checkRequired;tr.prototype.checkRequired=function(t,r){if(typeof t==="object"&&En._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||Hu.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||Hu.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($h.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($h.isPOJO(e)){let i=Object.keys(e).sort(),s=Object.values(e).sort();if(i.length===s.length&&i.every((o,u)=>o===String(s[u]))&&s.filter((o)=>typeof o==="number").length===Math.floor(s.length/2))e=s.filter((o)=>typeof o==="number");else e=Object.values(e)}t=t||Hu.messages.Number.enum}t=t==null?Hu.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,i){if(typeof e!=="number"&&En._isRef(this,e,t,r)){if(e==null||$h.isNonBuiltinObject(e))return this._castRef(e,t,r,i)}let s=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(s)}catch(u){throw new dL("Number",s,this.path,u,this)}};/*!
|
|
479
|
+
* ignore
|
|
480
|
+
*/function eE(e){return this.cast(e)}function $ce(e){let t=this;if(!Array.isArray(e))return[this.cast(e)];return e.map(function(r){return t.cast(r)})}var Rce={...En.prototype.$conditionalHandlers,$bitsAllClear:Zg,$bitsAnyClear:Zg,$bitsAllSet:Zg,$bitsAnySet:Zg,$gt:eE,$gte:eE,$lt:eE,$lte:eE,$mod:$ce};Object.defineProperty(tr.prototype,"$conditionalHandlers",{enumerable:!1,value:Rce});tr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Ice(this.$conditionalHandlers,e),!n)throw new Hu("Can't use "+e+" with Number.");return n.call(this,t,r)}try{t=this.applySetters(t,r)}catch(i){if(i instanceof dL&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}return t};tr.prototype.toJSONSchema=function(t){return this._addJSONSchemaEnum(this._createJSONSchemaTypeDefinition("number","number",t))};/*!
|
|
481
|
+
* Module exports.
|
|
482
|
+
*/pL.exports=tr});var Rd=g(function(Kw){/*!
|
|
483
|
+
* Module requirements.
|
|
484
|
+
*/var mL=Hw();/*!
|
|
485
|
+
* ignore
|
|
486
|
+
*/Kw.castToNumber=yL;Kw.castArraysOfNumbers=gL;/*!
|
|
487
|
+
* ignore
|
|
488
|
+
*/function yL(e){return mL.cast()(e)}function gL(e,t){e.forEach(function(r,n){if(Array.isArray(r))gL(r,t);else e[n]=yL.call(t,r)})}});var Qw=g(function(tE){/*!
|
|
489
|
+
* Module requirements.
|
|
490
|
+
*/var EL=Rd().castArraysOfNumbers,xd=Rd().castToNumber;/*!
|
|
491
|
+
* ignore
|
|
492
|
+
*/tE.cast$geoIntersects=kce;tE.cast$near=xce;tE.cast$within=vce;function xce(e){let t=rE();if(Array.isArray(e))return EL(e,this),e;if(Yw(this,e),e?.$geometry)return Gw(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 Gw(e,t){switch(e.$geometry.type){case"Polygon":case"LineString":case"Point":EL(e.$geometry.coordinates,t);break;default:break}return Yw(t,e),e}function vce(e){if(Yw(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,i)=>{r[i]=xd.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((i,s)=>{r[s]=xd.call(this,i)});else e[t][n]=xd.call(this,r)})}else if(e.$geometry)Gw(e,this);return e}function kce(e){if(!e.$geometry)return;return Gw(e,this),e}function Yw(e,t){if(t.$maxDistance)t.$maxDistance=xd.call(e,t.$maxDistance);if(t.$minDistance)t.$minDistance=xd.call(e,t.$minDistance)}});var rE=g(function(f3e,OL){/*!
|
|
493
|
+
* Module dependencies.
|
|
494
|
+
*/var qce=Z2(),jce=R4(),wL=ze(),Lce=jj(),rr=Mr(),nE=rr.CastError,iE=Ph(),Uce=bw(),_L=kg(),Vce=Uj(),Xw=ol(),zce=ar(),Wce=Xn(),AL=Nh(),dc=require("util"),_n=be(),Hce=Rd().castToNumber,Rh=Qw(),Kce=os(),Gce=Vs(),Yce=Ls(),vd,Jw,Qce=Object.freeze({});function lt(e,t,r,n,i){Jw||(Jw=Bh().Embedded);let s="type";if(n?.typeKey)s=n.typeKey;if(this.schemaOptions=n,t){let a={};if(_n.isPOJO(t))if(t[s])a=zce(t),delete a[s],t=t[s];else t=iE;if(r?.ref!=null&&a.ref==null)a.ref=r.ref;if(t===Object)t=iE;let c=typeof t==="string"?t:_n.getFunctionName(t),l=Id(),f=Object.hasOwn(l,c)?l[c]:t;if(typeof f==="function")if(f===lt)this.embeddedSchemaType=new f(e,a,n,null,i);else this.embeddedSchemaType=new f(e,a,n,i);else if(f instanceof rr){if(this.embeddedSchemaType=f,!(this.embeddedSchemaType instanceof Jw))this.embeddedSchemaType.path=e}}this.$isMongooseArray=!0,rr.call(this,e,r,"Array",i);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=Lce;/*!
|
|
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)&&_n.isObject(arguments))t=_n.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 i=[],s=this;while(s!=null&&s.$isMongooseArray&&!s.$isMongooseDocumentArray)i.push(s),s=s.embeddedSchemaType;let o=Vce(e);if(o.min===o.max&&o.max<i.length&&o.containsNonArrayItem&&i.slice(o.max).every((u)=>u.options.castNonArrays??lt.options.castNonArrays))for(let u=o.max;u<i.length;++u)e=[e]}return rr.prototype._applySetters.call(this,e,t,r,n)};lt.prototype.cast=function(e,t,r,n,i){vd||(vd=Bh().Array);let s,o;if(Array.isArray(e)){if(!e.length&&t){let d=t.schema.indexedPaths(),p=this.path;for(s=0,o=d.length;s<o;++s){let E=d[s][0][p];if(E==="2dsphere"||E==="2d")return}let m=this.path.endsWith(".coordinates")?this.path.substring(0,this.path.lastIndexOf(".")):null;if(m!=null){for(s=0,o=d.length;s<o;++s)if(d[s][0][m]==="2dsphere")return}}i=i||Qce;let c=_n.isMongooseArray(e)?e.__array:e,l=i.path||this.path;if(i.arrayPathIndex!=null)l+="."+i.arrayPathIndex;if(e=vd(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!==iE)try{let d=c.length;for(s=0;s<d;s++){let p={};if(h){if(i.arrayPath!=null)p.arrayPathIndex=s;else if(f._arrayParentPath!=null)p.arrayPathIndex=s}if(i.hydratedPopulatedDocs)p.hydratedPopulatedDocs=i.hydratedPopulatedDocs;if(i.virtuals)p.virtuals=i.virtuals;if(c[s]===void 0&&f.defaultValue!==void 0)c[s]=f.getDefault(t,r,null,p);else c[s]=f.applySetters(c[s],t,r,void 0,p)}}catch(d){throw new nE("["+d.kind+"]",dc.inspect(e),this.path+"."+s,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 nE("Array",dc.inspect(e),this.path,null,this)};/*!
|
|
503
|
+
* ignore
|
|
504
|
+
*/lt.prototype._castForPopulate=function(t,r){if(vd||(vd=Bh().Array),Array.isArray(t)){let n,i=t.__array?t.__array:t,s=i.length;if(this.embeddedSchemaType&&this.embeddedSchemaType.constructor!==iE)try{for(n=0;n<s;n++){let o={};if(this.embeddedSchemaType.$isMongooseArray&&this.embeddedSchemaType._arrayParentPath!=null)o.arrayPathIndex=n;i[n]=this.embeddedSchemaType.cast(i[n],r,!1,void 0,o)}}catch(o){throw new nE("["+o.kind+"]",dc.inspect(t),this.path+"."+n,o,this)}return t}throw new nE("Array",dc.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 wL("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,i=r?.discriminators;if(e&&i&&typeof n==="string"){let s=Kce(i,e[n]);if(s)r=s;else{let o=Gce(i,e[n]);if(o)r=o}}if(Array.isArray(e)){for(let s=this.setters.length-1;s>=0;s--)e=this.setters[s].call(this,e,this);e=e.map(function(s){if(_n.isObject(s)&&s.$elemMatch)return s;return r.castForQuery(null,s,t)})}else e=r.castForQuery(null,e,t);return e};lt.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=Yce(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 _L||Wce(t)==="VirtualType")return this.virtual(t.path,t.options);if(r=new Uce(r),_n.hasUserDefinedProperty(r,["ref","refPath"]))throw new wL("Cannot set populate virtual as a property of an array");let n=new _L(r,t);if(this.virtuals===null)this.virtuals={};return this.virtuals[t]=n,n};function Jce(e,t){if(!Array.isArray(e))e=[e];return e=e.map((r)=>{if(!_n.isObject(r))return r;if(r.$elemMatch!=null)return{$elemMatch:Xw(this.embeddedSchemaType.schema,r.$elemMatch,null,this?.$$context)};let n={};return n[this.path]=r,Xw(this.embeddedSchemaType.schema,n,null,this?.$$context)[this.path]},this),this.castForQuery(null,e,t)}function Xce(e,t){let r=Object.keys(e),n=r.length;for(let i=0;i<n;++i){let s=r[i],o=e[s];if(s==="$not"){if(_n.isPOJO(o)){for(let u of Object.keys(o))if(AL(u)&&o[u]!=null)o[u]=this.castForQuery(u,o[u],t)}continue}if(AL(s)&&o!=null)e[s]=this.castForQuery(s,o,t)}return e}var Xt=lt.prototype.$conditionalHandlers={};Xt.$all=Jce;Xt.$options=String;Xt.$elemMatch=Xce;Xt.$geoIntersects=Rh.cast$geoIntersects;Xt.$or=Zw("$or");Xt.$and=Zw("$and");Xt.$nor=Zw("$nor");function Zw(e){return function(r,n){if(!Array.isArray(r))throw TypeError("conditional "+e+" requires an array");let i=[];for(let s of r)i.push(Xw(this.embeddedSchemaType.schema??n.schema,s,null,this?.$$context));return i}}Xt.$near=Xt.$nearSphere=Rh.cast$near;Xt.$within=Xt.$geoWithin=Rh.cast$within;Xt.$size=Xt.$minDistance=Xt.$maxDistance=Hce;Xt.$exists=qce;Xt.$type=jce;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
|
+
*/OL.exports=lt});var bL=g(function(d3e,CL){var{Long:Zce}=Te(),eO=9223372036854775807n,tO=-9223372036854775808n,SL=`Mongoose only supports BigInts between ${tO} and ${eO} because MongoDB does not support arbitrary precision integers`;CL.exports=function(t){if(t==null)return t;if(t==="")return null;if(typeof t==="bigint"){if(t>eO||t<tO)throw Error(SL);return t}if(t instanceof Zce)return t.toBigInt();if(typeof t==="string"||typeof t==="number"){if(t=BigInt(t),t>eO||t<tO)throw Error(SL);return t}throw Error(`Cannot convert value to BigInt: "${t}"`)}});var ML=g(function(p3e,TL){/*!
|
|
511
|
+
* Module dependencies.
|
|
512
|
+
*/var DL=ei(),Hs=Mr(),ele=bL(),tle=Ls();function Pr(e,t,r,n){Hs.call(this,e,t,"BigInt",n)}Pr.schemaName="BigInt";Pr.defaultOptions={};/*!
|
|
513
|
+
* Inherits from SchemaType.
|
|
514
|
+
*/Pr.prototype=Object.create(Hs.prototype);Pr.prototype.constructor=Pr;/*!
|
|
515
|
+
* ignore
|
|
516
|
+
*/Pr._cast=ele;Pr.set=Hs.set;Pr.setters=[];Pr.get=Hs.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=Hs.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 DL("BigInt",e,this.path,r,this)}};/*!
|
|
519
|
+
* ignore
|
|
520
|
+
*/var rle={...Hs.prototype.$conditionalHandlers,$gt:sE,$gte:sE,$lt:sE,$lte:sE};Object.defineProperty(Pr.prototype,"$conditionalHandlers",{enumerable:!1,value:rle});/*!
|
|
521
|
+
* ignore
|
|
522
|
+
*/function sE(e,t){return this.castForQuery(null,e,t)}Pr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=tle(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(i){if(i instanceof DL&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};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
|
+
*/TL.exports=Pr});var FL=g(function(m3e,BL){/*!
|
|
525
|
+
* Module dependencies.
|
|
526
|
+
*/var PL=ei(),Ks=Mr(),ul=X2(),nle=Ls();function nr(e,t,r,n){Ks.call(this,e,t,"Boolean",n)}nr.schemaName="Boolean";nr.defaultOptions={};/*!
|
|
527
|
+
* Inherits from SchemaType.
|
|
528
|
+
*/nr.prototype=Object.create(Ks.prototype);nr.prototype.constructor=nr;/*!
|
|
529
|
+
* ignore
|
|
530
|
+
*/nr._cast=ul;nr.set=Ks.set;nr.setters=[];nr.get=Ks.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=Ks.checkRequired;nr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Object.defineProperty(nr,"convertToTrue",{get:()=>ul.convertToTrue,set:(e)=>{ul.convertToTrue=e}});Object.defineProperty(nr,"convertToFalse",{get:()=>ul.convertToFalse,set:(e)=>{ul.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 PL("Boolean",e,this.path,r,this)}};var ile={...Ks.prototype.$conditionalHandlers};Object.defineProperty(nr.prototype,"$conditionalHandlers",{enumerable:!1,value:ile});nr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=nle(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(i){if(i instanceof PL&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};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
|
+
*/BL.exports=nr});var IL=g(function(y3e,NL){var sle=qi();class rO extends sle{}var ole=is();Object.defineProperty(rO.prototype,"subtype",ole);/*!
|
|
537
|
+
* ignore
|
|
538
|
+
*/NL.exports=rO});var RL=g(function(g3e,$L){/*!
|
|
539
|
+
* Module dependencies.
|
|
540
|
+
*/var al=ig(),ule=IL(),An=Mr(),oE=$d(),cE=be(),ale=Ls(),nO=al.Binary,aE=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=ule;/*!
|
|
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,i){let s;if(An._isRef(this,e,t,r)){if(Buffer.isBuffer(e)&&e.isMongooseBuffer)return e;if(Buffer.isBuffer(e)){if(e=new al(e,[this.path,t]),this.options.subtype!=null)e._subtype=this.options.subtype;return e}if(e instanceof nO){if(s=new al(e.value(!0),[this.path,t]),typeof e.sub_type!=="number")throw new aE("Buffer",e,this.path,null,this);return s._subtype=e.sub_type,s}if(e==null||cE.isNonBuiltinObject(e))return this._castRef(e,t,r,i)}if(e?._id)e=e._id;if(Buffer.isBuffer(e)&&e.isMongooseBuffer)return e;if(Buffer.isBuffer(e)){if(e=new al(e,[this.path,t]),this.options.subtype!=null)e._subtype=this.options.subtype;return e}if(e instanceof nO){if(s=new al(e.value(!0),[this.path,t]),typeof e.sub_type!=="number")throw new aE("Buffer",e,this.path,null,this);return s._subtype=e.sub_type,s}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(s=new al(e,[this.path,t]),this.options.subtype!=null)s._subtype=this.options.subtype;return s}if(cE.isPOJO(e)&&(e.$binary instanceof nO||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 aE("Buffer",e,this.path,null,this)};tn.prototype.subtype=function(e){return this.options.subtype=e,this};/*!
|
|
545
|
+
* ignore
|
|
546
|
+
*/function uE(e,t){return this.castForQuery(null,e,t)}var cle={...An.prototype.$conditionalHandlers,$bitsAllClear:oE,$bitsAnyClear:oE,$bitsAllSet:oE,$bitsAnySet:oE,$gt:uE,$gte:uE,$lt:uE,$lte:uE};Object.defineProperty(tn.prototype,"$conditionalHandlers",{enumerable:!1,value:cle});tn.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=ale(this.$conditionalHandlers,e),!n)throw Error("Can't use "+e+" with Buffer.");return n.call(this,t)}let i;try{i=this.applySetters(t,r)}catch(s){if(s instanceof aE&&s.path===this.path&&this.$fullPath!=null)s.path=this.$fullPath;throw s}return i?i.toObject({transform:!1,virtuals:!1}):i};tn.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","binData",t)};tn.prototype.autoEncryptionType=function(){return"binData"};/*!
|
|
547
|
+
* Module exports.
|
|
548
|
+
*/$L.exports=tn});var vL=g(function(E3e,xL){var lle=qi();class kd extends lle{}var iO=is();Object.defineProperty(kd.prototype,"min",iO);Object.defineProperty(kd.prototype,"max",iO);Object.defineProperty(kd.prototype,"expires",iO);/*!
|
|
549
|
+
* ignore
|
|
550
|
+
*/xL.exports=kd});var qL=g(function(_3e,kL){var xh=require("assert");kL.exports=function(t){if(t==null||t==="")return null;if(t instanceof Date)return xh.ok(!isNaN(t.valueOf())),t;let r;if(xh.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;xh.ok(!1)}});var VL=g(function(A3e,UL){/*!
|
|
551
|
+
* Module requirements.
|
|
552
|
+
*/var hE=ns(),hle=vL(),ni=Mr(),fle=qL(),dle=Xn(),jL=be(),ple=Ls(),LL=ni.CastError;function Zt(e,t,r,n){ni.call(this,e,t,"Date",n)}Zt.schemaName="Date";Zt.defaultOptions={};/*!
|
|
553
|
+
* Inherits from SchemaType.
|
|
554
|
+
*/Zt.prototype=Object.create(ni.prototype);Zt.prototype.constructor=Zt;Zt.prototype.OptionsConstructor=hle;/*!
|
|
555
|
+
* ignore
|
|
556
|
+
*/Zt._cast=fle;Zt.set=ni.set;Zt.setters=[];Zt.get=ni.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(dle(this._index)!=="Object")this._index={};return this._index.expires=e,jL.expires(this._index),this};/*!
|
|
559
|
+
* ignore
|
|
560
|
+
*/Zt._checkRequired=(e)=>e instanceof Date;Zt.checkRequired=ni.checkRequired;Zt.prototype.checkRequired=function(e,t){if(typeof e==="object"&&ni._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||hE.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(i){let s=e;if(typeof e==="function"&&e!==Date.now)s=s.call(this);let o=s===Date.now?s():n.cast(s);return i===null||i.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||hE.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(i){let s=e;if(typeof s==="function"&&s!==Date.now)s=s.call(this);let o=s===Date.now?s():n.cast(s);return i===null||i.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 LL("date",e,this.path,r,this)}};function lE(e){return this.cast(e)}var mle={...ni.prototype.$conditionalHandlers,$gt:lE,$gte:lE,$lt:lE,$lte:lE};Object.defineProperty(Zt.prototype,"$conditionalHandlers",{enumerable:!1,value:mle});Zt.prototype.castForQuery=function(e,t,r){if(e==null)try{return this.applySetters(t,r)}catch(i){if(i instanceof LL&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}let n=ple(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
|
+
*/UL.exports=Zt});var HL=g(function(w3e,WL){var Do=K2(),zL=require("assert");WL.exports=function(t){if(t==null)return t;if(typeof t==="object"&&typeof t.$numberDecimal==="string")return Do.fromString(t.$numberDecimal);if(t instanceof Do)return t;if(typeof t==="string")return Do.fromString(t);if(typeof Buffer==="function"&&Buffer.isBuffer(t))return new Do(t);if(typeof Uint8Array==="function"&&t instanceof Uint8Array)return new Do(t);if(typeof t==="number")return Do.fromString(String(t));if(typeof t.valueOf==="function"&&typeof t.valueOf()==="string")return Do.fromString(t.valueOf());zL.ok(!1)}});var GL=g(function(O3e,KL){/*!
|
|
563
|
+
* Module dependencies.
|
|
564
|
+
*/var wn=Mr(),yle=wn.CastError,gle=HL(),sO=Zn();function Ir(e,t,r,n){wn.call(this,e,t,"Decimal128",n)}Ir.schemaName="Decimal128";Ir.defaultOptions={};/*!
|
|
565
|
+
* Inherits from SchemaType.
|
|
566
|
+
*/Ir.prototype=Object.create(wn.prototype);Ir.prototype.constructor=Ir;/*!
|
|
567
|
+
* ignore
|
|
568
|
+
*/Ir._cast=gle;Ir.set=wn.set;Ir.setters=[];Ir.get=wn.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&&!sO(e,"Decimal128"))throw Error();return e};/*!
|
|
571
|
+
* ignore
|
|
572
|
+
*/Ir._checkRequired=(e)=>sO(e,"Decimal128");Ir.checkRequired=wn.checkRequired;Ir.prototype.checkRequired=function(t,r){if(wn._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,i){if(wn._isRef(this,e,t,r)){if(sO(e,"Decimal128"))return e;return this._castRef(e,t,r,i)}let s;if(typeof this._castFunction==="function")s=this._castFunction;else if(typeof this.constructor.cast==="function")s=this.constructor.cast();else s=Ir.cast();try{return s(e)}catch(o){throw new yle("Decimal128",e,this.path,o,this)}};/*!
|
|
573
|
+
* ignore
|
|
574
|
+
*/function fE(e){return this.cast(e)}var Ele={...wn.prototype.$conditionalHandlers,$gt:fE,$gte:fE,$lt:fE,$lte:fE};Object.defineProperty(Ir.prototype,"$conditionalHandlers",{enumerable:!1,value:Ele});Ir.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","decimal",t)};Ir.prototype.autoEncryptionType=function(){return"decimal"};/*!
|
|
575
|
+
* Module exports.
|
|
576
|
+
*/KL.exports=Ir});var QL=g(function(S3e,YL){var _le=qi();class qd extends _le{}var oO=is();Object.defineProperty(qd.prototype,"_id",oO);Object.defineProperty(qd.prototype,"minimize",oO);Object.defineProperty(qd.prototype,"discriminators",oO);YL.exports=qd});var XL=g(function(C3e,JL){var ii=Oo();/*!
|
|
577
|
+
* ignore
|
|
578
|
+
*/JL.exports=function(t){t.s.hooks.pre("save",!1,uO,null,!0),t.s.hooks.post("save",aO,null,!0),t.s.hooks.pre("save",cO),t.s.hooks.post("save",lO)};function uO(){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 aO(){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 cO(){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)}uO[ii.builtInMiddleware]=!0;uO[ii.skipOnSubdocuments]=!0;aO[ii.builtInMiddleware]=!0;aO[ii.skipOnSubdocuments]=!0;cO[ii.builtInMiddleware]=!0;cO[ii.skipOnSubdocuments]=!0;lO[ii.builtInMiddleware]=!0;lO[ii.skipOnSubdocuments]=!0});var ZL=g(function(b3e,dO){var Ale=de().objectIdSymbol,$t=Oo(),dE=be();/*!
|
|
579
|
+
* ignore
|
|
580
|
+
*/dO.exports=function(t){t.post("init",pE),t.pre("save",mE),t.post("save",yE),t.pre("deleteOne",{document:!0,query:!1},gE),t.pre("updateOne",{document:!0,query:!1},EE)};function pE(){return fO.call(this),this}function mE(){hO.call(this)}function yE(){fO.call(this)}function gE(){hO.call(this)}function EE(){hO.call(this)}/*!
|
|
581
|
+
* ignore
|
|
582
|
+
*/function hO(){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
|
+
*/dO.exports.storeShard=fO;/*!
|
|
585
|
+
* ignore
|
|
586
|
+
*/function fO(){let e=this.$__schema.options.shardKey||this.$__schema.options.shardkey;if(!dE.isPOJO(e))return;let t=this.$__.shardval={},r=Object.keys(e),n=r.length,i;for(let s=0;s<n;++s)if(i=this.$__getValue(r[s]),i==null)t[r[s]]=i;else if(dE.isMongooseObject(i))t[r[s]]=i.toObject({depopulate:!0,_isNested:!0});else if(i instanceof Date||i[Ale])t[r[s]]=i;else if(typeof i.valueOf==="function")t[r[s]]=i.valueOf();else t[r[s]]=i}pE[$t.builtInMiddleware]=!0;pE[$t.skipOnSubdocuments]=!0;pE[$t.requiresShardKey]=!0;mE[$t.builtInMiddleware]=!0;mE[$t.skipOnSubdocuments]=!0;mE[$t.requiresShardKey]=!0;yE[$t.builtInMiddleware]=!0;yE[$t.skipOnSubdocuments]=!0;yE[$t.requiresShardKey]=!0;gE[$t.builtInMiddleware]=!0;gE[$t.skipOnSubdocuments]=!0;gE[$t.requiresShardKey]=!0;EE[$t.builtInMiddleware]=!0;EE[$t.skipOnSubdocuments]=!0;EE[$t.requiresShardKey]=!0});var sU=g(function(D3e,iU){var vh=de().arrayAtomicsSymbol,_E=de().sessionNewDocuments,AE=Oo(),kh=be();iU.exports=function(t){t.pre("save",tU),t.pre("deleteOne",{document:!0,query:!1},rU)};function tU(){nU(this)}function rU(){let e=nU(this);if(e!=null&&!Object.hasOwn(e,"isDeleted"))e.isDeleted=this.$isDeleted()}function nU(e){let t=e.$session();if(t==null)return null;if(t.transaction==null||t[_E]==null)return null;if(!t[_E].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=wle(e),t[_E].set(e,r)}return t[_E].get(e)}function wle(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 s of n){let o=e.$__getValue(s);if(Array.isArray(o)&&kh.isMongooseDocumentArray(o)&&o.length&&o[vh]!=null&&kh.hasOwnKeys(o[vh])){let u=t.get(s)||{};r.set(s,eU(u,o[vh]))}}let i=e.$__dirty();for(let s of i){let{path:o,value:u}=s;if(u?.[vh]!=null&&kh.hasOwnKeys(u[vh])){let a=t.get(o)||{};r.set(o,eU(a,u[vh]))}}return r}function eU(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}tU[AE.builtInMiddleware]=!0;rU[AE.builtInMiddleware]=!0});var pO=g(function(wE){wE.saveSubdocs=XL();wE.sharding=ZL();wE.trackTransaction=sU()});var aU=g(function(M3e,uU){var oU=pO();uU.exports=function(t){for(let r of Object.values(oU))r(t,{deduplicate:!0});t.plugins=Object.values(oU).map((r)=>({fn:r,opts:{deduplicate:!0}})).concat(t.plugins)}});var fU=g(function(P3e,hU){var Ole=rg(),lU=oc(),Sle=Zn(),Cle=sc(),ble=Mr(),cU=Kc();hU.exports=function e(t,r,n,i){let s=Object.keys(r),o=0,u=s.length,a;if(n=n||"",i=i||new WeakSet,i.has(r))return;i.add(r);while(o<u){if(a=s[o++],!n){if(a==="discriminators"||a==="base"||a==="_applyDiscriminators"||a==="_userProvidedOptions"||a==="options"||a==="tree")continue}if(n==="tree"&&r?.instanceOfSchema)continue;if(lU.has(a))continue;if(a==="parentSchema")continue;if(t[a]==null)t[a]=r[a];else if(cU(r[a])){if(!cU(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)Ole(t[a],r[a].clone(),!0);else t[a]=r[a].clone();continue}else if(Sle(r[a],"ObjectId")){t[a]=new Cle(r[a]);continue}else if(r[a]instanceof ble){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,i)}}if(r?.instanceOfSchema)t.tree=Object.assign({},r.tree,t.tree)}});var OE=g(function(B3e,mU){var dU=Ph(),Dle=aU(),Tle=ar(),Mle=fg().defineKey,Ple=Dr(),Ble=uu(),qh=be(),Fle=fU(),pU={toJSON:!0,toObject:!0,_id:!0,id:!0,virtuals:!0,methods:!0,statics:!0,defaultSort:!0};function Nle(e,t){if(e.encryptionType()==null&&t.encryptionType()==null)return;let r=i(n(e),n(t));for(let s of r){if(e._hasEncryptedField(s)&&t._hasEncryptedField(s))throw Error(`encrypted fields cannot be declared on both the base schema and the child schema in a discriminator. path=${s}`);if(e._hasEncryptedField(s)||t._hasEncryptedField(s))throw Error(`encrypted fields cannot have the same path as a non-encrypted field for discriminators. path=${s}`)}function n(s){return[...Object.keys(s.paths),...Object.keys(s.singleNestedPaths)]}function*i(s,o){let u=new Set(s);for(let a of o)if(u.has(a))yield a}}/*!
|
|
587
|
+
* ignore
|
|
588
|
+
*/mU.exports=function(t,r,n,i,s,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(s){let h=Ple(t.base,"options.applyPluginsToDiscriminators",!1)||!o;t.base._applyPlugins(n,{skipTopLevel:!h})}else if(!o)Dle(n);let a=t.schema.options.discriminatorKey,c=t.schema.path(a);if(c!=null){if(!qh.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),Mle({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 i==="string"&&i.length||i!=null)l=i;Nle(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 dU||h.singleNestedPaths[q]instanceof dU)m.push(S)}h.obj={...h.obj},Fle(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 E={};if(E[a]={default:l,select:!0,set:function(S){if(S===l||Array.isArray(l)&&qh.deepEqual(S,l))return l;throw Error(`Can't set discriminator key "`+a+'"')},$skipDiscriminatorCheck:!0},E[a][h.options.typeKey]=c?c.options[h.options.typeKey]:String,h.add(E),h.discriminatorMapping={key:a,value:l,isRoot:!1},d.options.collection)h.options.collection=d.options.collection;let y=h.options.toJSON,_=h.options.toObject,O=h.options._id,b=h.options.id,A=Object.keys(h.options);h.options.discriminatorKey=d.options.discriminatorKey;let P=h._userProvidedOptions;for(let S of A)if(!pU[S]){if(S in P&&!qh.deepEqual(h.options[S],d.options[S]))throw Error("Can't customize discriminator option "+S+" (can only modify "+Object.keys(pU).join(", ")+")")}h.options=Tle(d.options);for(let S of Object.keys(P))h.options[S]=P[S];if(y)h.options.toJSON=y;if(_)h.options.toObject=_;if(typeof O<"u")h.options._id=O;if(h.options.id=b,o)h.s.hooks=t.schema.s.hooks.merge(h.s.hooks);if(s)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,Ble(t.discriminators,r)&&!n.options.overwriteModels&&!u)throw Error('Discriminator with name "'+r+'" already exists');return n}});var SE=g(function(F3e,yU){var Ile=os(),$le=Vs();yU.exports=function(t,r,n){let i=t.schema.options.discriminatorKey,s=r?.[i];if(s==null)s=n;if(t.discriminators&&s!=null){let o=Ile(t.discriminators,s);if(o)t=o;else{let u=$le(t.discriminators,s);if(u)t=u}}return t}});var mO=g(function(N3e,gU){var Rle=Tw();gU.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)Rle(t),t.options._id=!0;return t}});var gO=g(function(I3e,EU){/*!
|
|
589
|
+
* Module dependencies.
|
|
590
|
+
*/var xle=ze();class yO extends xle{constructor(e,t){let r=`Cannot create use schema for property "${e}" because the schema has the ${t} option enabled.`;super(r)}}Object.defineProperty(yO.prototype,"name",{value:"InvalidSchemaOptionError"});/*!
|
|
591
|
+
* exports
|
|
592
|
+
*/EU.exports=yO});var AO=g(function($3e,OU){/*!
|
|
593
|
+
* Module dependencies.
|
|
594
|
+
*/var _U=ei(),EO=require("events").EventEmitter,vle=sg(),kle=QL(),Li=Mr(),qle=ag(),jle=Z2(),AU=Rd().castToNumber,Lle=OE(),jh=Qw(),_O=SE(),Ule=qg(),Vle=mO(),zle=Ao().internalToObjectOptions,Wle=Xc(),bE=be(),Hle=gO(),Kle=Ls(),CE;OU.exports=rn;function rn(e,t,r,n){if(e.options.timeseries)throw new Hle(t,"timeseries");let i=rn.defaultOptions?._id;if(i!=null)r=r||{},r._id=i;e=Vle(e,r),this.Constructor=wU(e,null,r),this.Constructor.path=t,this.Constructor.prototype.$basePath=t,this.schema=e,this.$isSingleNested=!0,this.base=e.base,Li.call(this,t,r,"Embedded",n)}/*!
|
|
595
|
+
* ignore
|
|
596
|
+
*/rn.prototype=Object.create(Li.prototype);rn.prototype.constructor=rn;rn.prototype.OptionsConstructor=kle;/*!
|
|
597
|
+
* ignore
|
|
598
|
+
*/function wU(e,t,r){CE||(CE=Eg());let n=function(o,u,a){if(this.$__parent=a,CE.apply(this,arguments),a==null)return;this.$session(a.$session())};e.plugin(Ule,{deduplicate:!0});let i=t?.prototype??CE.prototype;n.prototype=Object.create(i),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 EO,n.prototype.toBSON=function(){return this.toObject(zle)};for(let s in e.methods)n.prototype[s]=e.methods[s];for(let s in e.statics)n[s]=e.statics[s];for(let s in EO.prototype)n[s]=EO.prototype[s];return n}/*!
|
|
599
|
+
* ignore
|
|
600
|
+
*/var lu={...Li.prototype.$conditionalHandlers};lu.$geoWithin=function(t,r){return{$geometry:this.castForQuery(null,t.$geometry,r)}};/*!
|
|
601
|
+
* ignore
|
|
602
|
+
*/lu.$near=lu.$nearSphere=jh.cast$near;lu.$within=lu.$geoWithin=jh.cast$within;lu.$geoIntersects=jh.cast$geoIntersects;lu.$minDistance=AU;lu.$maxDistance=AU;lu.$exists=jle;Object.defineProperty(rn.prototype,"$conditionalHandlers",{enumerable:!1,value:lu});rn.prototype.cast=function(e,t,r,n,i){if(e?.$isSingleNested&&e.parent===t)return e;if(!r&&e!=null&&(typeof e!=="object"||Array.isArray(e)))throw new vle(this.path,e);let s=this.schema.path(this.schema.options.discriminatorKey),o=s==null?null:s.getDefault(t),u=_O(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,i.path!=null){let{path:d,...p}=i;i=p}a.$init(e,i);let h=Wle(f);qle(a,f,h)}else{if(i=Object.assign({},i,{priorDoc:n}),bE.hasOwnKeys(e)===!1)return new u({},f,t,i);return new u(e,f,t,i)}return a};rn.prototype.castForQuery=function(e,t,r,n){let i;if(e!=null){if(i=Kle(this.$conditionalHandlers,e),!i)throw Error("Can't use "+e);return i.call(this,t)}if(t==null)return t;let s=_O(this.Constructor,t);if(t instanceof s)return t;if(this.options.runSetters)t=this._applySetters(t,r);let o=n?.strict??void 0;try{t=new s(t,o)}catch(u){if(!(u instanceof _U))throw new _U("Embedded",t,this.path,u,this);throw u}return t};rn.prototype.doValidate=async function(t,r,n){let i=_O(this.Constructor,t);if(t&&!(t instanceof i))t=new i(t,null,r?.$__!=null?r:null);if(n?.skipSchemaValidators){if(!t)return;return t.validate()}if(await Li.prototype.doValidate.call(this,t,r,n),t!=null)await t.validate()};rn.prototype.doValidateSync=function(e,t,r){if(!r?.skipSchemaValidators){let n=Li.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=bE.isPOJO(r)?r.value:r,i=typeof r.clone==="boolean"?r.clone:!0;if(t.instanceOfSchema&&i)t=t.clone();if(t=Lle(this.Constructor,e,t,n,null,null,r.overwriteExisting),this.parentSchema!=null)this.parentSchema._hasSelectedPaths=!0;return this.Constructor.discriminators[e]=wU(t,this.Constructor),this.Constructor.discriminators[e]};/*!
|
|
603
|
+
* ignore
|
|
604
|
+
*/rn.defaultOptions={};rn.set=Li.set;rn.setters=[];rn.get=Li.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 wO=g(function(R3e,CU){/*!
|
|
609
|
+
* Module dependencies.
|
|
610
|
+
*/var Gle=ze(),Ys=Mr(),DE=AO(),SU=SE();function Gs(e,t,r,n){if(this.$parentSchemaType=r?.$parentSchemaType,!this.$parentSchemaType)throw new Gle("Cannot create DocumentArrayElement schematype without a parent");delete r.$parentSchemaType,Ys.call(this,e,r,"DocumentArrayElement",n),this.$isMongooseDocumentArrayElement=!0,this.Constructor=r?.Constructor,this.schema=t}Gs.schemaName="DocumentArrayElement";Gs.defaultOptions={};Gs.set=Ys.set;Gs.get=Ys.get;/*!
|
|
611
|
+
* Inherits from SchemaType.
|
|
612
|
+
*/Gs.prototype=Object.create(Ys.prototype);Gs.prototype.constructor=Gs;Gs.prototype.cast=function(...e){return this.$parentSchemaType.cast(...e)[0]};Gs.prototype.doValidate=async function(t,r,n){let i=SU(this.Constructor,t);if(t&&!(t instanceof i))t=new i(t,r,null,null,n?.index??null);if(n?.skipSubdocumentValidation){if(n.skipSchemaValidators)return;return Ys.prototype.doValidate.call(this,t,r,n)}return DE.prototype.doValidate.call(this,t,r,n)};Gs.prototype.doValidateSync=function(t,r,n){let i=SU(this.Constructor,t);if(t&&!(t instanceof i))t=new i(t,r,null,null,n?.index??null);if(n?.skipSubdocumentValidation){if(n.skipSchemaValidators)return;return Ys.prototype.doValidateSync.call(this,t,r,n)}return DE.prototype.doValidateSync.call(this,t,r,n)};Gs.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
|
+
*/CU.exports=Gs});var DU=g(function(x3e,bU){var Yle=qi();class jd extends Yle{}var OO=is();Object.defineProperty(jd.prototype,"excludeIndexes",OO);Object.defineProperty(jd.prototype,"_id",OO);Object.defineProperty(jd.prototype,"discriminators",OO);/*!
|
|
615
|
+
* ignore
|
|
616
|
+
*/bU.exports=jd});var RU=g(function(v3e,$U){/*!
|
|
617
|
+
* Module dependencies.
|
|
618
|
+
*/var Qle=os(),TU=ei(),Jle=wO(),SO=require("events").EventEmitter,Lh=rE(),Xle=DU(),hu=Mr(),MU=ol(),Zle=OE(),PU=mO(),e1e=pg(),t1e=Nh(),si=be(),TE=SE(),r1e=qg(),n1e=gO(),BU=de().arrayAtomicsSymbol,CO=de().arrayPathSymbol,NU=de().documentArrayParent,Ku,cl;function mr(e,t,r,n,i){if(t.options?.timeseries)throw new n1e(e,"timeseries");let s=mr.defaultOptions?._id;if(s!=null)n=n||{},n._id=s;if(n?._id!=null)t=PU(t,n);else if(r?._id!=null)t=PU(t,r);let o=IU(t,r);o.prototype.$basePath=e,o.path=e;let u=this,a=new Jle(e+".$",t,{...n||{},$parentSchemaType:u,Constructor:o});Lh.call(this,e,a,r,null,i),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(Lh.prototype);mr.prototype.constructor=mr;mr.prototype.OptionsConstructor=Xle;Object.defineProperty(mr.prototype,"$conditionalHandlers",{enumerable:!1,value:{...Lh.prototype.$conditionalHandlers}});/*!
|
|
621
|
+
* ignore
|
|
622
|
+
*/function IU(e,t,r){cl||(cl=Ch());function n(){cl.apply(this,arguments);let s=this[NU];if(s==null)return;this.$session(s.$session())}e.plugin(r1e,{deduplicate:!0});let i=r?.prototype??cl.prototype;n.prototype=Object.create(i),n.prototype.$__setSchema(e),n.schema=e,n.prototype.constructor=n,n.$isArraySubdocument=!0,n.events=new SO,n.base=e.base;for(let s in e.methods)n.prototype[s]=e.methods[s];for(let s in e.statics)n[s]=e.statics[s];for(let s in SO.prototype)n[s]=SO.prototype[s];return n.options=t,n}mr.prototype.discriminator=function(e,t,r){if(typeof e==="function")e=si.getFunctionName(e);r=r||{};let n=si.isPOJO(r)?r.value:r,i=typeof r.clone==="boolean"?r.clone:!0;if(t.instanceOfSchema&&i)t=t.clone();if(t=Zle(this.Constructor,e,t,n,null,null,r?.overwriteExisting),this.parentSchema!=null)this.parentSchema._hasSelectedPaths=!0;let s=IU(t,null,this.Constructor);return s.baseCasterConstructor=this.Constructor,Object.defineProperty(s,"name",{value:e}),this.Constructor.discriminators[e]=s,this.Constructor.discriminators[e]};mr.prototype.doValidate=async function(t,r,n){Ku||(Ku=rl());let i;try{await hu.prototype.doValidate.call(this,t,r)}catch(u){i=u}if(n?.updateValidator){if(i!=null)throw i;return}if(!si.isMongooseDocumentArray(t))t=new Ku(t,this.path,r);let s=[];for(let u=0;u<t.length;++u){let a=t[u];if(a==null)continue;if(!(a instanceof cl)){let l=TE(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;s.push(a.validate(null,c))}let o;try{await Promise.all(s)}catch(u){o=u}if(i!=null)throw i;if(o!=null)throw o};mr.prototype.doValidateSync=function(e,t,r){let n=hu.prototype.doValidateSync.call(this,e,t),i=e?.length,s=n;if(!i)return s;for(let o=0,u=i;o<u;++o){let a=e[o];if(!a)continue;if(!(a instanceof cl)){let f=TE(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&&s==null)s=l}return s};/*!
|
|
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(Ku||(Ku=rl()),!Array.isArray(n))n=[n];n=new Ku(n,this.path,e);for(let i=0;i<n.length;++i){let o=new(TE(this.Constructor,n[i]))({},n,void 0,void 0,i);o.$init(n[i]),o.isNew=!0,Object.assign(o.$__.activePaths.default,o.$__.activePaths.init),o.$__.activePaths.init={},n[i]=o}return n};var i1e=Object.freeze({transform:!1,virtuals:!1}),FU=Object.freeze({skipId:!1,willInit:!0});mr.prototype.cast=function(e,t,r,n,i){if(Ku||(Ku=rl()),e?.[CO]!=null&&e===n)return e;let s,o;i=i||{};let u=i.path||this.path;if(!Array.isArray(e)){let l=this.options.castNonArrays??mr.options.castNonArrays;if(!r&&!l)throw new TU("DocumentArray",e,this.path,null,this);if(!!t&&r)t.markModified(u);return this.cast([e],t,r,n,i)}if(!i.skipDocumentArrayCast||si.isMongooseDocumentArray(e))e=new Ku(e,u,t,this);if(n!=null)e[BU]=n[BU]||{};if(i.arrayPathIndex!=null)e[CO]=u+"."+i.arrayPathIndex;let a=si.isMongooseDocumentArray(e)?e.__array:e,c=a.length;for(let l=0;l<c;++l){if(!a[l])continue;let f=TE(this.Constructor,a[l]),h=e1e(a[l],!0);if(a[l]!==h)a[l]=h;if(a[l]instanceof cl){if(a[l][NU]!==t||a[l].__index!=null&&a[l].__index!==l)if(r){let d=new f(null,e,FU,s,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)s||(s=s1e(this,t.$__.selected,r));else s=!0;if(o=new f(null,e,FU,s,l),i.path!=null||i.arrayPathIndex!=null){let{path:d,arrayPathIndex:p,...m}=i;i=m}a[l]=o.$init(a[l],i)}else if(o=n?.[l],o?._doc!=null&&a[l]._id!=null&&si.deepEqual(a[l]._id,o._doc._id)&&si.deepEqual(o.toObject(i1e),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 TU("embedded",a[l],e[CO],d,this)}}if(si.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 hu.prototype.applyGetters.call(this,e,t)};function s1e(e,t,r){if(!(r&&t))return;let n=e.path+".",i=Object.keys(t),s=i.length,o={},u,a,c;while(s--)if(a=i[s],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=hu.set;mr.setters=[];mr.get=hu.get;/*!
|
|
631
|
+
* Handle casting $elemMatch operators
|
|
632
|
+
*/mr.prototype.$conditionalHandlers.$elemMatch=o1e;function o1e(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(t1e(c)&&l!=null)e[c]=this.castForQuery(c,l,t)}let i=this?.Constructor?.schema?.options?.discriminatorKey,s=this?.Constructor?.schema?.discriminators||{},o=i!=null&&e[i]!=null?Qle(s,e[i]):null;if(o!=null)return MU(o,e,null,this?.$$context);let u=this.Constructor.schema??t.schema;return MU(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
|
+
*/$U.exports=mr});var vU=g(function(k3e,xU){var Uh=require("assert"),Vh=Te(),u1e=Zn();xU.exports=function(t){if(t==null||t==="")return null;let r;if(u1e(t,"Long"))r=t.toNumber();else if(typeof t==="string")try{return r=Vh.Double.fromString(t),r}catch{Uh.ok(!1)}else if(typeof t==="object"){if(Array.isArray(t))Uh.ok(!1);let n=t.valueOf()??t.toString();if(typeof n==="string")try{return r=Vh.Double.fromString(n),r}catch{Uh.ok(!1)}else r=Number(n)}else r=Number(t);return new Vh.Double(r)}});var qU=g(function(q3e,kU){/*!
|
|
635
|
+
* Module dependencies.
|
|
636
|
+
*/var a1e=ei(),Qs=Mr(),c1e=vU();function Qr(e,t,r,n){Qs.call(this,e,t,"Double",n)}Qr.schemaName="Double";Qr.defaultOptions={};/*!
|
|
637
|
+
* Inherits from SchemaType.
|
|
638
|
+
*/Qr.prototype=Object.create(Qs.prototype);Qr.prototype.constructor=Qr;/*!
|
|
639
|
+
* ignore
|
|
640
|
+
*/Qr._cast=c1e;Qr.set=Qs.set;Qr.setters=[];Qr.get=Qs.get;/*!
|
|
641
|
+
* ignore
|
|
642
|
+
*/Qr._defaultCaster=(e)=>{if(e!=null){if(e._bsontype!=="Double")throw Error()}return e};Qr.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
|
+
*/Qr._checkRequired=(e)=>e!=null;Qr.checkRequired=Qs.checkRequired;Qr.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};Qr.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=Qr.cast();try{return t(e)}catch(r){throw new a1e("Double",e,this.path,r,this)}};/*!
|
|
645
|
+
* ignore
|
|
646
|
+
*/function ME(e){return this.cast(e)}var l1e={...Qs.prototype.$conditionalHandlers,$gt:ME,$gte:ME,$lt:ME,$lte:ME};Object.defineProperty(Qr.prototype,"$conditionalHandlers",{enumerable:!1,value:l1e});Qr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("number","double",t)};Qr.prototype.autoEncryptionType=function(){return"double"};/*!
|
|
647
|
+
* Module exports.
|
|
648
|
+
*/kU.exports=Qr});var LU=g(function(j3e,jU){var h1e=Zn(),PE=require("assert");jU.exports=function(t){if(t==null)return t;if(t==="")return null;if(Array.isArray(t))PE.ok(!1);let r=h1e(t,"Long")?t.toNumber():Number(t),n=2147483647,i=-2147483648;if(r===(r|0)&&r>=i&&r<=n)return r;PE.ok(!1)}});var zU=g(function(L3e,VU){/*!
|
|
649
|
+
* Module dependencies.
|
|
650
|
+
*/var UU=ei(),Js=Mr(),f1e=LU(),BE=$d(),d1e=Ls();function $r(e,t,r,n){Js.call(this,e,t,"Int32",n)}$r.schemaName="Int32";$r.defaultOptions={};/*!
|
|
651
|
+
* Inherits from SchemaType.
|
|
652
|
+
*/$r.prototype=Object.create(Js.prototype);$r.prototype.constructor=$r;/*!
|
|
653
|
+
* ignore
|
|
654
|
+
*/$r._cast=f1e;$r.set=Js.set;$r.setters=[];$r.get=Js.get;/*!
|
|
655
|
+
* ignore
|
|
656
|
+
*/$r._defaultCaster=(e)=>{if(e!=null){if(typeof e!=="number"||e!==(e|0)||e<-2147483648||e>2147483647)throw Error()}return e};$r.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
|
+
*/$r._checkRequired=(e)=>e!=null;$r.checkRequired=Js.checkRequired;$r.prototype.checkRequired=function(e){return this.constructor._checkRequired(e)};$r.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=$r.cast();try{return t(e)}catch(r){throw new UU("Int32",e,this.path,r,this)}};/*!
|
|
659
|
+
* ignore
|
|
660
|
+
*/var p1e={...Js.prototype.$conditionalHandlers,$gt:FE,$gte:FE,$lt:FE,$lte:FE,$bitsAllClear:BE,$bitsAnyClear:BE,$bitsAllSet:BE,$bitsAnySet:BE};Object.defineProperty($r.prototype,"$conditionalHandlers",{enumerable:!1,value:p1e});/*!
|
|
661
|
+
* ignore
|
|
662
|
+
*/function FE(e,t){return this.castForQuery(null,e,t)}$r.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=d1e(this.$conditionalHandlers,e),n)return n.call(this,t);return this.applySetters(t,r)}try{return this.applySetters(t,r)}catch(i){if(i instanceof UU&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};$r.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("number","int",t)};$r.prototype.autoEncryptionType=function(){return"int"};/*!
|
|
663
|
+
* Module exports.
|
|
664
|
+
*/VU.exports=$r});var HU=g(function(U3e,WU){var m1e=qi();class bO extends m1e{}var y1e=is();Object.defineProperty(bO.prototype,"of",y1e);WU.exports=bO});var GU=g(function(V3e,KU){/*!
|
|
665
|
+
* ignore
|
|
666
|
+
*/var DO=Gg(),g1e=HU(),TO=Mr(),E1e=ze(),_1e=nl(),Xs=be();class ll extends TO{constructor(e,t,r,n){super(e,t,"Map",n);this.$isSchemaMap=!0,this._createNestedSchemaType(n,e,t,r)}cast(e,t,r,n,i){if(e instanceof DO)return e;let s=i?.path??this.path;if(r){let o=new DO({},s,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,{...i,path:s+"."+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,{...i,path:s+"."+u});o.$init(u,a)}return o}return new DO(e,s,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"}}ll.set=TO.set;ll.schemaName="Map";ll.prototype.OptionsConstructor=g1e;ll.defaultOptions={};/*!
|
|
667
|
+
* ignore
|
|
668
|
+
*/ll.prototype._createNestedSchemaType=function(t,r,n,i){let s=r+".$*",o={type:{}};if(Xs.hasUserDefinedProperty(n,"of")){if(Xs.isPOJO(n.of)&&Xs.hasOwnKeys(n.of)&&!Xs.hasUserDefinedProperty(n.of,t.options.typeKey))o={[t.options.typeKey]:new _1e(n.of)};else if(Xs.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 E1e('Cannot use schema-level projections (`select: true` or `select: false`) within maps at path "'+r+"."+c+'"')});if(Xs.hasUserDefinedProperty(n,"ref"))o.ref=n.ref}this.$__schemaType=t.interpretAsType(s,o,i)};KU.exports=ll});var JU=g(function(z3e,QU){var A1e=qi();class NE extends A1e{}var YU=is();Object.defineProperty(NE.prototype,"auto",YU);Object.defineProperty(NE.prototype,"populate",YU);/*!
|
|
669
|
+
* ignore
|
|
670
|
+
*/QU.exports=NE});var eV=g(function(W3e,ZU){var XU=Zn(),MO=sc();ZU.exports=function(t){if(t==null)return t;if(XU(t,"ObjectId"))return t;if(t._id){if(XU(t._id,"ObjectId"))return t._id;if(t._id.toString instanceof Function)return new MO(t._id.toString())}if(t.toString instanceof Function)return new MO(t.toString());return new MO(t)}});var nV=g(function(H3e,rV){/*!
|
|
671
|
+
* Module dependencies.
|
|
672
|
+
*/var w1e=JU(),On=Mr(),O1e=eV(),S1e=Xn(),BO=sc(),FO=Zn(),$E=be(),C1e=On.CastError,PO;function yr(e,t,r,n){let i=typeof e==="string"&&e.length===24&&/^[a-f0-9]+$/i.test(e),s=t?.suppressWarning;if((i||typeof e>"u")&&!s)$E.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.");On.call(this,e,t,"ObjectId",n)}yr.schemaName="ObjectId";yr.defaultOptions={};/*!
|
|
673
|
+
* Inherits from SchemaType.
|
|
674
|
+
*/yr.prototype=Object.create(On.prototype);yr.prototype.constructor=yr;yr.prototype.OptionsConstructor=w1e;yr.get=On.get;yr.set=On.set;yr.setters=[];yr.prototype.auto=function(e){if(e)this.default(tV),this.set(D1e);return this};/*!
|
|
675
|
+
* ignore
|
|
676
|
+
*/yr._checkRequired=(e)=>FO(e,"ObjectId");/*!
|
|
677
|
+
* ignore
|
|
678
|
+
*/yr._cast=O1e;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(!FO(e,"ObjectId"))throw Error(e+" is not an instance of ObjectId");return e};yr.checkRequired=On.checkRequired;yr.prototype.checkRequired=function(t,r){if(On._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,i){if(!FO(e,"ObjectId")&&On._isRef(this,e,t,r)){if((S1e(e)||"").toLowerCase()==="objectid")return new BO(e.toHexString());if(e==null||$E.isNonBuiltinObject(e))return this._castRef(e,t,r,i)}let s;if(typeof this._castFunction==="function")s=this._castFunction;else if(typeof this.constructor.cast==="function")s=this.constructor.cast();else s=yr.cast();try{return s(e)}catch(o){throw new C1e("ObjectId",e,this.path,o,this)}};/*!
|
|
681
|
+
* ignore
|
|
682
|
+
*/function IE(e){return this.cast(e)}var b1e={...On.prototype.$conditionalHandlers,$gt:IE,$gte:IE,$lt:IE,$lte:IE};Object.defineProperty(yr.prototype,"$conditionalHandlers",{enumerable:!1,value:b1e});/*!
|
|
683
|
+
* ignore
|
|
684
|
+
*/function tV(){return new BO}tV.$runBeforeSetters=!0;function D1e(e){if(PO||(PO=ou()),this instanceof PO){if(e===void 0)return new BO}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
|
+
*/rV.exports=yr});var sV=g(function(K3e,iV){var T1e=qi();class Zs extends T1e{}var fu=is();Object.defineProperty(Zs.prototype,"enum",fu);Object.defineProperty(Zs.prototype,"match",fu);Object.defineProperty(Zs.prototype,"lowercase",fu);Object.defineProperty(Zs.prototype,"trim",fu);Object.defineProperty(Zs.prototype,"uppercase",fu);Object.defineProperty(Zs.prototype,"minLength",fu);Object.defineProperty(Zs.prototype,"minlength",fu);Object.defineProperty(Zs.prototype,"maxLength",fu);Object.defineProperty(Zs.prototype,"maxlength",fu);Object.defineProperty(Zs.prototype,"populate",fu);/*!
|
|
687
|
+
* ignore
|
|
688
|
+
*/iV.exports=Zs});var NO=g(function(G3e,aV){/*!
|
|
689
|
+
* Module dependencies.
|
|
690
|
+
*/var Sn=Mr(),Ui=ns(),M1e=sV(),P1e=Qg(),RE=be(),B1e=Zn(),F1e=Ls(),uV=Sn.CastError;function yt(e,t,r,n){this.enumValues=[],this.regExp=null,Sn.call(this,e,t,"String",n)}yt.schemaName="String";yt.defaultOptions={};/*!
|
|
691
|
+
* Inherits from SchemaType.
|
|
692
|
+
*/yt.prototype=Object.create(Sn.prototype);yt.prototype.constructor=yt;Object.defineProperty(yt.prototype,"OptionsConstructor",{configurable:!1,enumerable:!1,writable:!1,value:M1e});/*!
|
|
693
|
+
* ignore
|
|
694
|
+
*/yt._cast=P1e;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=Sn.get;yt.set=Sn.set;yt.setters=[];/*!
|
|
697
|
+
* ignore
|
|
698
|
+
*/yt._checkRequired=(e)=>(e instanceof String||typeof e==="string")&&e.length;yt.checkRequired=Sn.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(RE.isObject(arguments[0]))if(Array.isArray(arguments[0].values))e=arguments[0].values,t=arguments[0].message;else e=RE.object.vals(arguments[0]),t=Ui.messages.String.enum;else e=arguments,t=Ui.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||Ui.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||Ui.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:$1e(r),type:"maxlength",maxlength:e})}return this};yt.prototype.maxLength=yt.prototype.maxlength;yt.prototype.match=function(t,r){let n=r||Ui.messages.String.match,i=function(s){if(!t)return!1;return t.lastIndex=0,s!=null&&s!==""?t.test(s):!0};return this.validators.push({validator:i,message:n,type:"regexp",regexp:t}),this};yt.prototype.checkRequired=function(t,r){if(typeof t==="object"&&Sn._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,i){if(typeof e!=="string"&&Sn._isRef(this,e,t,r))return this._castRef(e,t,r,i);let s;if(typeof this._castFunction==="function")s=this._castFunction;else if(typeof this.constructor.cast==="function")s=this.constructor.cast();else s=yt.cast();try{return s(e)}catch{throw new uV("string",e,this.path,null,this)}};/*!
|
|
699
|
+
* ignore
|
|
700
|
+
*/function Ld(e,t){return this.castForQuery(null,e,t)}/*!
|
|
701
|
+
* ignore
|
|
702
|
+
*/function N1e(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 oV(e){if(e==null)return this._castNullish(e);return this.cast(e,this)}var I1e={...Sn.prototype.$conditionalHandlers,$all:N1e,$gt:Ld,$gte:Ld,$lt:Ld,$lte:Ld,$options:oV,$regex:function(t){if(Object.prototype.toString.call(t)==="[object RegExp]")return t;return oV.call(this,t)},$not:Ld};Object.defineProperty(yt.prototype,"$conditionalHandlers",{enumerable:!1,value:I1e});yt.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=F1e(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]"||B1e(t,"BSONRegExp"))return t;try{return this.applySetters(t,r)}catch(i){if(i instanceof uV&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};yt.prototype.toJSONSchema=function(t){return this._addJSONSchemaEnum(this._createJSONSchemaTypeDefinition("string","string",t))};yt.prototype.autoEncryptionType=function(){return"string"};/*!
|
|
705
|
+
* Module exports.
|
|
706
|
+
*/aV.exports=yt;function $1e(e){return function(t,r){if(typeof e==="function")return Ui.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 Ui.ValidatorError.prototype.formatMessage(e,t,r)}}});var cV=g(function(Y3e,RO){var IO=Te().UUID,$O=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;RO.exports=function(t){if(t==null)return t;if(t instanceof IO)return t;if(typeof t==="string")if($O.test(t))return new IO(t);else throw Error(`"${t}" is not a valid UUID string`);if(t.toString&&t.toString!==Object.prototype.toString){if($O.test(t.toString()))return new IO(t.toString())}throw Error(`"${t}" cannot be casted to a UUID`)};RO.exports.UUID_FORMAT=$O});var dV=g(function(Q3e,fV){/*!
|
|
707
|
+
* Module dependencies.
|
|
708
|
+
*/var oi=Mr(),lV=oi.CastError,vO=cV(),hV=be(),xE=$d(),R1e=Ls(),x1e=vO.UUID_FORMAT;function v1e(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 Rr(e,t,r,n){oi.call(this,e,t,"UUID",n)}Rr.schemaName="UUID";Rr.defaultOptions={};/*!
|
|
709
|
+
* Inherits from SchemaType.
|
|
710
|
+
*/Rr.prototype=Object.create(oi.prototype);Rr.prototype.constructor=Rr;/*!
|
|
711
|
+
* ignore
|
|
712
|
+
*/Rr._cast=vO;Rr.get=oi.get;Rr.set=oi.set;Rr.setters=[];Rr.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
|
+
*/Rr._checkRequired=(e)=>e!=null;Rr.checkRequired=oi.checkRequired;Rr.prototype.checkRequired=function(t){if(Buffer.isBuffer(t))t=v1e(t);return t!=null&&x1e.test(t)};Rr.prototype.cast=function(e,t,r,n,i){if(hV.isNonBuiltinObject(e)&&oi._isRef(this,e,t,r))return this._castRef(e,t,r,i);let s;if(typeof this._castFunction==="function")s=this._castFunction;else if(typeof this.constructor.cast==="function")s=this.constructor.cast();else s=Rr.cast();try{return s(e)}catch(o){throw new lV(Rr.schemaName,e,this.path,o,this)}};/*!
|
|
715
|
+
* ignore
|
|
716
|
+
*/function k1e(e){return this.cast(e)}/*!
|
|
717
|
+
* ignore
|
|
718
|
+
*/function xO(e){return e.map((t)=>this.cast(t))}var q1e={...oi.prototype.$conditionalHandlers,$bitsAllClear:xE,$bitsAnyClear:xE,$bitsAllSet:xE,$bitsAnySet:xE,$all:xO,$in:xO,$ne:k1e,$nin:xO};Object.defineProperty(Rr.prototype,"$conditionalHandlers",{enumerable:!1,value:q1e});Rr.prototype.castForQuery=function(e,t,r){let n;if(e!=null){if(n=R1e(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(i){if(i instanceof lV&&i.path===this.path&&this.$fullPath!=null)i.path=this.$fullPath;throw i}};Rr.prototype.toJSONSchema=function(t){return this._createJSONSchemaTypeDefinition("string","binData",t)};Rr.prototype.autoEncryptionType=function(){return"binData"};/*!
|
|
719
|
+
* Module exports.
|
|
720
|
+
*/fV.exports=Rr});var mV=g(function(J3e,pV){var j1e=qi();class kO extends j1e{}var L1e=is();Object.defineProperty(kO.prototype,"of",L1e);pV.exports=kO});var gV=g(function(X3e,yV){/*!
|
|
721
|
+
* ignore
|
|
722
|
+
*/var U1e=mV(),V1e=Mr(),zh=Symbol("firstValue");/*!
|
|
723
|
+
* ignore
|
|
724
|
+
*/class Ud extends V1e{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((i)=>n.interpretAsType(e,i,r)),this.$isSchemaUnion=!0}cast(e,t,r,n,i){let s=zh,o;for(let u=0;u<this.schemaTypes.length;++u)try{let a=this.schemaTypes[u].cast(e,t,r,n,i);if(a===e)return a;if(s===zh)s=a}catch(a){o=a}if(s!==zh)return s;throw o}applySetters(e,t,r,n,i){e=this._applySetters(e,t,r,n,i);let s=zh,o;for(let u=0;u<this.schemaTypes.length;++u)try{let a=this.schemaTypes[u]._applySetters(e,t,r,n,i);if(a==null)a=this.schemaTypes[u]._castNullish(a);else a=this.schemaTypes[u].cast(a,t,r,n,i);if(a===e)return a;if(s===zh)s=a}catch(a){o=a}if(s!==zh)return s;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((i)=>i.toJSONSchema(r));if(t)return{anyOf:n};return{anyOf:[e?.useBsonType?{bsonType:"null"}:{type:"null"},...n]}}}Ud.schemaName="Union";Ud.defaultOptions={};Ud.prototype.OptionsConstructor=U1e;yV.exports=Ud});var Id=g(function(zt){/*!
|
|
725
|
+
* Module exports.
|
|
726
|
+
*/zt.Array=rE();zt.BigInt=ML();zt.Boolean=FL();zt.Buffer=RL();zt.Date=VL();zt.Decimal128=zt.Decimal=GL();zt.DocumentArray=RU();zt.DocumentArrayElement=wO();zt.Double=qU();zt.Int32=zU();zt.Map=GU();zt.Mixed=Ph();zt.Number=Hw();zt.ObjectId=nV();zt.String=NO();zt.Subdocument=AO();zt.UUID=dV();zt.Union=gV();zt.Oid=zt.ObjectId;zt.Object=zt.Mixed;zt.Bool=zt.Boolean;zt.ObjectID=zt.ObjectId});var nl=g(function(UO,FV){/*!
|
|
727
|
+
* Module dependencies.
|
|
728
|
+
*/var z1e=require("events").EventEmitter,W1e=Gc(),Mt=ze(),EV=l4(),H1e=wx(),jO=Mr(),wV=qi(),K1e=bw(),qE=kg(),OV=Tw(),Rn=ar(),LE=Dr(),G1e=Xn(),Y1e=Xq(),jE=Bw(),Q1e=qg(),_V=Fn(),J1e=Fw(),X1e=rg(),pc=ss(),Z1e=nj(),ehe=mj(),Wh=Oo(),Ae=be(),the=Ej(),rhe=/\.\d+(\.|$)/,mc,nhe=Td().queryMiddlewareFunctions,ihe=Td().documentMiddlewareFunctions,SV=nhe.concat(ihe).reduce((e,t)=>e.add(t),new Set),qO=Ae.isPOJO,CV=0,she=/^\d+$/;function Q(e,t){if(!(this instanceof Q))return new Q(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=++CV,this.mapPaths=[],this.encryptedFields={},this.s={hooks:new W1e},this.options=this.defaultOptions(t),Array.isArray(e))for(let i of e)this.add(i);else if(e)this.add(e);if(t?.virtuals){let i=t.virtuals,s=Object.keys(i);for(let o of s){let u=i[o].options?i[o].options:void 0,a=this.virtual(o,u);if(i[o].get)a.get(i[o].get);if(i[o].set)a.set(i[o].set)}}let r=e?._id&&Ae.isObject(e._id);if(!this.paths._id&&this.options._id&&!r)OV(this);this.setupTimestamp(this.options.timestamps)}function bV(e,t){for(let r of Object.keys(t)){let n=null;if(t[r]!=null)n=t[r];else{let s=LE(e.paths[r],"options");if(s==null)continue;n=s.alias}if(!n)continue;let i=e.paths[r].path;if(Array.isArray(n)){for(let s of n){if(typeof s!=="string")throw new Mt("Invalid value for alias option on "+i+", got "+s);e.aliases[s]=i,e.virtual(s).get(function(o){return function(){if(typeof this.get==="function")return this.get(o);return this[o]}}(i)).set(function(o){return function(u){return this.$set(o,u)}}(i))}continue}if(typeof n!=="string")throw new Mt("Invalid value for alias option on "+i+", got "+n);e.aliases[n]=i,e.virtual(n).get(function(s){return function(){if(typeof this.get==="function")return this.get(s);return this[s]}}(i)).set(function(s){return function(o){return this.$set(s,o)}}(i))}}/*!
|
|
729
|
+
* Inherit from EventEmitter.
|
|
730
|
+
*/Q.prototype=Object.create(z1e.prototype);Q.prototype.constructor=Q;Q.prototype.instanceOfSchema=!0;/*!
|
|
731
|
+
* ignore
|
|
732
|
+
*/Object.defineProperty(Q.prototype,"$schemaType",{configurable:!1,enumerable:!1,writable:!0});Object.defineProperty(Q.prototype,"childSchemas",{configurable:!1,enumerable:!0,writable:!0});Object.defineProperty(Q.prototype,"virtuals",{configurable:!1,enumerable:!0,writable:!0});Q.prototype.obj;Q.prototype.paths;Q.prototype.tree;Q.create=function(t,r){return new Q(t,r)};Q.prototype.clone=function(){let e=this._clone();return e.on("init",(t)=>this.emit("init",t)),e};/*!
|
|
733
|
+
* ignore
|
|
734
|
+
*/Q.prototype._clone=function(t){t=t||(this.base==null?Q:this.base.Schema);let r=new t({},this._userProvidedOptions);r.base=this.base,r.obj=this.obj,r.options=Rn(this.options),r.callQueue=this.callQueue.map(function(n){return n}),r.methods=Rn(this.methods),r.methodOptions=Rn(this.methodOptions),r.statics=Rn(this.statics),r.query=Rn(this.query),r.plugins=Array.prototype.slice.call(this.plugins),r._indexes=Rn(this._indexes),r._searchIndexes=Rn(this._searchIndexes),r.s.hooks=this.s.hooks.clone(),r.tree=Rn(this.tree),r.paths=Object.fromEntries(Object.entries(this.paths).map(([n,i])=>[n,i.clone()])),r.nested=Rn(this.nested),r.subpaths=Rn(this.subpaths),r.mapPaths=[];for(let[n,i]of Object.entries(r.paths)){let s=n+".$*";if(!i.$isSchemaMap||!Object.hasOwn(r.paths,s))continue;r.paths[s]=i.$__schemaType,r.mapPaths.push(r.paths[s])}for(let n of Object.values(r.paths))if(n.$isSingleNested){let i=n.path;for(let s of Object.keys(n.schema.paths))r.singleNestedPaths[i+"."+s]=n.schema.paths[s];for(let s of Object.keys(n.schema.singleNestedPaths))r.singleNestedPaths[i+"."+s]=n.schema.singleNestedPaths[s];for(let s of Object.keys(n.schema.subpaths))r.singleNestedPaths[i+"."+s]=n.schema.subpaths[s];for(let s of Object.keys(n.schema.nested))r.singleNestedPaths[i+"."+s]="nested"}if(r._gatherChildSchemas(),r.virtuals=Rn(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=++CV,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=Rn(this.encryptedFields),r};Q.prototype.pick=function(e,t){let r=new Q({},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 i=this.encryptedFields[n],s=this.path(n);r.add({[n]:{encrypt:i,[this.options.typeKey]:s}})}else if(this.nested[n])r.add({[n]:LE(this.tree,n)});else{let i=this.path(n);if(i==null)throw new Mt("Path `"+n+"` is not in the schema");r.add({[n]:i})}if(!this._hasEncryptedFields())r.options.encryptionType=null;return r};Q.prototype.omit=function(e,t){let r=new Q(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};Q.prototype.defaultOptions=function(e){this._userProvidedOptions=e==null?{}:Rn(e);let t=this.base?.options||{},r=t.strict??!0,n=t.strictQuery??!1,i=t.strictRead??!1,s=t.id??!0;if(e={strict:r,strictQuery:n,strictRead:i,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:s,typeKey:"type",...e},e.strict??=r,e.strictQuery??=n,e.id??=s,e.versionKey&&typeof e.versionKey!=="string")throw new Mt("`versionKey` must be falsy or string, got `"+typeof e.versionKey+"`");if(PV(e.defaultSort),typeof e.read==="string")e.read=jE(e.read);else if(Array.isArray(e.read)&&typeof e.read[0]==="string")e.read={mode:jE(e.read[0]),tags:e.read[1]};if(e.optimisticConcurrency&&!e.versionKey)throw new Mt("Must set `versionKey` if using `optimisticConcurrency`");return e};Q.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
|
+
*/Q.prototype._getDocumentMiddleware=function(t){let r=!!(this.options.shardKey||this.options.shardkey);return this.s.hooks.filter((n)=>{if(t&&n.fn[Wh.skipOnSubdocuments])return!1;if(!r&&n.fn[Wh.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[Wh.builtInMiddleware];return!0})};/*!
|
|
737
|
+
* Get this schema's default toObject/toJSON options, including Mongoose global
|
|
738
|
+
* options.
|
|
739
|
+
*/Q.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]||{},i=Object.assign({},r,n);return this._defaultToObjectOptionsMap=this._defaultToObjectOptionsMap||{},this._defaultToObjectOptionsMap[t]=Ae.hasOwnKeys(i)?i:null,i};Q.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};Q.prototype.add=function(t,r){if(t instanceof Q||t?.instanceOfSchema)return X1e(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),i=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??Q.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 qE||(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(!(qO(a)||a instanceof wV)){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[i]||i==="type"&&qO(a.type)&&a.type.type)this.nested[u]=!0,this.add(a,u+".");else{let l=a[i];if(qO(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 Q(l,f);h.$implicitlyCreated=!0;let d=Object.assign({},a,{[i]: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 s=Object.fromEntries(Object.entries(t).map(([o])=>[r+o,null]));return bV(this,s),this};Q.prototype._addEncryptedField=function(t,r){if(this.path(t).autoEncryptionType()==null)throw new Mt(`Invalid BSON type for FLE field: '${t}'`);this.encryptedFields[t]=Rn(r)};Q.prototype._removeEncryptedField=function(t){delete this.encryptedFields[t]};Q.prototype._hasEncryptedFields=function(){return Ae.hasOwnKeys(this.encryptedFields)};Q.prototype._hasEncryptedField=function(t){return t in this.encryptedFields};Q.prototype._buildEncryptedFields=function(){return{fields:Object.entries(this.encryptedFields).map(([t,r])=>{let n=this.path(t).autoEncryptionType();return{path:t,bsonType:n,...r}})}};Q.prototype._buildSchemaMap=function(){function e(n,i,s){let o=0,u=n[o];for(;o<n.length-1;++o,u=n[o])i[u]=i[u]==null?{bsonType:"object",properties:{}}:i[u],i=i[u].properties;i[u]=s}let t=(n,[i,s])=>{let o=this.path(i).autoEncryptionType(),u=i.split("."),a={encrypt:{...s,bsonType:o}};return e(u,n,a),n};return{bsonType:"object",properties:Object.entries(this.encryptedFields).reduce(t,{})}};Q.prototype.alias=function(e,t){return bV(this,{[e]:t}),this};Q.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(J1e(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};Q.prototype.clearIndexes=function(){return this._indexes.length=0,this};Q.prototype.searchIndex=function(t){return this._searchIndexes.push(t),this};Q.reserved=Object.create(null);Q.prototype.reserved=Q.reserved;var $n=Q.reserved;$n.prototype=$n.emit=$n.listeners=$n.removeListener=$n.collection=$n.errors=$n.get=$n.init=$n.isModified=$n.isNew=$n.populated=$n.remove=$n.save=$n.toObject=$n.validate=1;$n.collection=1;Q.prototype.path=function(e,t){if(t===void 0){if(Object.hasOwn(this.paths,e))return this.paths[e];let a=DV(e),c=ohe(this,e,a);if(c!=null)return c;let l=TV(this,e);if(l!=null)return l;if(c=this.hasMixedParent(a),c!=null)return c;return rhe.test(e)?uhe(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 i=r.length===0?n:r[0];if(Object.hasOwn($n,i)&&!this.options.suppressReservedKeysWarning){let a=`\`${i}\` 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"))the(t.ref,e);let s=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,!s[a])this.nested[o]=!0,s[a]={};if(typeof s[a]!=="object"){let c="Cannot set nested path `"+e+"`. Parent path `"+o+"` already set to type "+s[a].name+".";throw new Mt(c)}s=s[a]}s[n]=Rn(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
|
+
*/Q.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 ohe(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 DV(e){if(!/\.\d+/.test(e))return e;return e.replace(/\.\d+\./g,".$.").replace(/\.\d+$/,".$")}/*!
|
|
746
|
+
* ignore
|
|
747
|
+
*/function TV(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 i=t.slice(n.length+1);return i=i.slice(i.indexOf(".")+1),r.schema.path(i)}else if(r.$isSchemaMap&&t.startsWith(n+".")){let i=t.slice(n.length+1);i=i.slice(i.indexOf(".")+1);let s=r.$__schemaType._presplitPath;if(i.indexOf(".")===-1&&s[s.length-1]==="$*")return r.$__schemaType;else if(i.indexOf(".")!==-1&&r.$__schemaType.schema&&s[s.length-1]==="$*")return r.$__schemaType.schema.path(i.slice(i.indexOf(".")+1))}}return null}Object.defineProperty(Q.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null});Q.prototype.interpretAsType=function(e,t,r){if(t instanceof jO){if(t.path===e)return t;let a=t.clone();return a.path=e,a}let n=this.base?.Schema.Types??Q.Types,i=this.base?.Types??Bh();if(!Ae.isPOJO(t)&&!(t instanceof wV)){if(Ae.getFunctionName(t.constructor)!=="Object"){let c=t;t={},t[r.typeKey]=c}}let s=t[r.typeKey]&&(t[r.typeKey]instanceof Function||r.typeKey!=="type"||!t.type.type)?t[r.typeKey]:{};if(s instanceof jO){if(s.path===e)return s;let a=s.clone();return a.path=e,a}let o;if(Ae.isPOJO(s)||s==="mixed")return new n.Mixed(e,t,null,this);if(Array.isArray(s)||s===Array||s==="array"||s===n.Array){let a=s===Array||s==="array"?t.cast||t.of:s[0];if(a?.instanceOfSchema){if(!(a instanceof Q))if(this.options._isMerging)a=new Q(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 Q))if(this.options._isMerging)a[r.typeKey]=new Q(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(Q.Types.DocumentArray.defaultOptions._id!=null)l._id=Q.Types.DocumentArray.defaultOptions._id;let f=new Q(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(s=a[r.typeKey]&&(r.typeKey!=="type"||!a.type.type)?a[r.typeKey]:a,Array.isArray(s))return new n.Array(e,this.interpretAsType(e,a,r),t,null,this);if(o=typeof s==="string"?s:s.schemaName||Ae.getFunctionName(s),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(s?.instanceOfSchema)return new n.Subdocument(s,e,t,this);if(Buffer.isBuffer(s))o="Buffer";else if(typeof s==="function"||typeof s==="object")o=s.schemaName||Ae.getFunctionName(s);else if(s===i.ObjectId)o="ObjectId";else if(s===i.Decimal128)o="Decimal128";else o=s==null?""+s:s.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)};Q.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};Q.prototype.requiredPaths=function(t){if(this._requiredpaths&&!t)return this._requiredpaths;let r=Object.keys(this.paths),n=r.length,i=[];while(n--){let s=r[n];if(this.paths[s].isRequired)i.push(s)}return this._requiredpaths=i,this._requiredpaths};Q.prototype.pathsWithTransforms=function(t){if(this._pathsWithTransforms!==void 0&&!t)return this._pathsWithTransforms;let r=Object.keys(this.paths),n=[];for(let i of r){let s=this.paths[i],o=s.options.transform??s.constructor?.defaultOptions?.transform,u=s.embeddedSchemaType?.options?.transform??s.embeddedSchemaType?.constructor?.defaultOptions?.transform;if(o||u)n.push(i)}return this._pathsWithTransforms=n.length?n:null,this._pathsWithTransforms};Q.prototype._getDefaultsCache=function(){if(this._defaultsCache==null)this._defaultsCache=new H1e(this);return this._defaultsCache};Q.prototype.indexedPaths=function(){if(this._indexedpaths)return this._indexedpaths;return this._indexedpaths=this.indexes(),this._indexedpaths};Q.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=DV(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(TV(this,e)!=null)return"real";if(/\.\d+\.|\.\d+$/.test(e))return MV(this,e,t);return"adhocOrUndefined"};Q.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 mc.Mixed)return this.paths[e];return null};Q.prototype.setupTimestamp=function(e){return ehe(this,e)};function MV(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 i=e.path(n[0]),s=!1;if(!i)return"adhocOrUndefined";let o=n.length-1;for(let u=1;u<n.length;++u){s=!1;let a=n[u];if(u===o&&i&&!/\D/.test(a)){if(i.$isMongooseDocumentArray)i=i.embeddedSchemaType;else if(i instanceof mc.Array)i=i.embeddedSchemaType;else i=void 0;break}if(!/\D/.test(a)){if(i instanceof mc.Array&&u!==o)i=i.embeddedSchemaType;continue}if(!i?.schema){i=void 0;break}s=i.schema.pathType(a)==="nested",i=i.schema.path(a)}if(e.subpaths[r]=i,i)return"real";if(s)return"nested";return"adhocOrUndefined"}/*!
|
|
748
|
+
* ignore
|
|
749
|
+
*/function uhe(e,t,r){return MV(e,t,r),e.subpaths[r]}Q.prototype.queue=function(e,t){return this.callQueue.push([e,t]),this};Q.prototype.pre=function(e){if(e instanceof RegExp){let t=Array.prototype.slice.call(arguments,1);for(let r of SV)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};Q.prototype.post=function(e){if(e instanceof RegExp){let t=Array.prototype.slice.call(arguments,1);for(let r of SV)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};Q.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};Q.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};Q.prototype.method=function(e,t,r){if(typeof e!=="string")for(let n in e)this.methods[n]=e[n],this.methodOptions[n]=Rn(r);else this.methods[e]=t,this.methodOptions[e]=Rn(r);return this};Q.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};Q.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};Q.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:jE(t),tags:r};else if(Array.isArray(t)&&typeof t[0]==="string")this.options[e]={mode:jE(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)OV(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")Vd(this,{strict:t});if(e==="strictQuery")Vd(this,{strictQuery:t});if(e==="toObject")t={...t},delete t.transform,Vd(this,{toObject:t});if(e==="toJSON")t={...t},delete t.transform,Vd(this,{toJSON:t});return this};/*!
|
|
750
|
+
* Recursively set options on implicitly created schemas
|
|
751
|
+
*/function Vd(e,t){for(let{schema:r}of e.childSchemas){if(!r.$implicitlyCreated)continue;Object.assign(r.options,t),Vd(r,t)}}Q.prototype.get=function(e){return this.options[e]};var ahe="2d 2dsphere hashed text".split(" ");Object.defineProperty(Q,"indexTypes",{get:function(){return ahe},set:function(){throw new Mt("Cannot overwrite Schema.indexTypes")}});Q.prototype.indexes=function(){return Y1e(this)};Q.prototype.virtual=function(e,t){if(e instanceof qE||G1e(e)==="VirtualType")return this.virtual(e.path,e.options);let r=e.split(".");for(let i of r)if(Ae.specialProperties.has(i))throw new Mt("Cannot set special property `"+i+"` on a schema");if(t=new K1e(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 i=this.virtual(e);if(i.options=t,this.pre("init",function(a,c){if(pc.has(e,a)){let l=pc.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=i._getModelNamesForPopulate(this),h=this.$$populatedVirtuals[e];if(!Array.isArray(h)&&!_V(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(!_V(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})}}pc.unset(e,a)}}),i.set(function(u){if(!this.$$populatedVirtuals)this.$$populatedVirtuals={};return Z1e(this.$$populatedVirtuals,e,u,t)}),typeof t.get==="function")i.get(t.get);let s=e.split("."),o=s[0];for(let u=0;u<s.length-1;++u){if(this.paths[o]==null)continue;if(this.paths[o].$isMongooseDocumentArray||this.paths[o].$isSingleNested){let a=s.slice(u+1).join(".");this.paths[o].schema.virtual(a,t);break}else if(this.paths[o].$isSchemaMap){let a=s.slice(u+2).join(".");this.paths[o].$__schemaType.schema.virtual(a,t);break}o+="."+s[u+1]}return i}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(i,s,o){return i[s]||(i[s]=o===r.length-1?new qE(t,e):{}),i[s]},this.tree),t?.applyToArray&&r.length>1){let i=this.path(r.slice(0,-1).join("."));if(i?.$isMongooseArray)return i.virtual(r[r.length-1],t);else throw new Mt(`Path "${i}" is not an array`)}return n[e]};Q.prototype.virtualpath=function(e){return Object.hasOwn(this.virtuals,e)?this.virtuals[e]:null};Q.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],LE(this.tree,r)instanceof qE)vE(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],vE(this,n);this.mapPaths=this.mapPaths.filter((n)=>!n.path.startsWith(t+".")),AV(this,t),delete this.nested[t],vE(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+".")),AV(this,t),vE(this,t),this._removeEncryptedField(t)},this);return this};/*!
|
|
752
|
+
* ignore
|
|
753
|
+
*/function AV(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 vE(e,t){let r=t.split("."),n=r.pop(),i=e.tree;for(let s of r)if(i=i[s],i==null)return;delete i[n]}Q.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=LE(this.tree,r),i=n instanceof jO?n.options:n;for(let s of[this.paths[r]?.options,i])if(s?.alias===t)delete s.alias;else if(Array.isArray(s?.alias))s.alias=s.alias.filter((o)=>o!==t)}if(delete this.paths[t],delete this.virtuals[t],t.indexOf(".")!==-1)pc.unset(t,this.tree);else delete this.tree[t]}}return this};Q.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
|
+
*/Q.prototype._getSchema=function(e){let t=this,r=t.path(e),n=[];if(r)return r.$fullPath=e,r;function i(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 mc.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]==="$"||kE(o[h])))f=f.embeddedSchemaType,++h;if(h===o.length)return f;if(c.schema){let d;if(o[a]==="$"||kE(o[a])){if(a+1===o.length)return c.embeddedSchemaType;if(d=i(o.slice(a+1),c.schema),d)d.$parentSchemaDocArray=d.$parentSchemaDocArray||(c.schema.$isSingleNested?null:c);return d}if(d=i(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 mc.Mixed)return c.$__schemaType;if(c.$__schemaType.schema!=null)return i(o.slice(a+1),c.$__schemaType.schema)}return c.$fullPath=n.join("."),c}}let s=e.split(".");for(let o=0;o<s.length;++o){if(s[o]==="$"||kE(s[o]))s[o]="0";if(she.test(s[o]))s[o]="$"}return i(s,t)};/*!
|
|
756
|
+
* ignore
|
|
757
|
+
*/Q.prototype._getPathType=function(e){let t=this;if(t.path(e))return"real";function n(i,s){let o=i.length+1,u,a;while(o--)if(a=i.slice(0,o).join("."),u=s.path(a),u){if(u.embeddedSchemaType||u.Constructor){if(u.embeddedSchemaType instanceof mc.Mixed)return{schema:u,pathType:"mixed"};if(o!==i.length&&u.schema){if(i[o]==="$"||kE(i[o])){if(o===i.length-1)return{schema:u,pathType:"nested"};return n(i.slice(o+1),u.schema)}return n(i.slice(o),u.schema)}return{schema:u,pathType:u.$isSingleNested?"nested":"array"}}return{schema:u,pathType:"real"}}else if(o===i.length&&Object.hasOwn(s.nested,a))return{schema:s,pathType:"nested"};return{schema:u||s,pathType:"undefined"}}return n(e.split("."),t)};Q.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 i=n[0];if(!Object.hasOwn(this._duplicateKeyErrorMessagesByPath,i))return t;return new Mt(this._duplicateKeyErrorMessagesByPath[i],{cause:t})}return t};/*!
|
|
758
|
+
* ignore
|
|
759
|
+
*/function kE(e){return e.startsWith("$[")&&e.endsWith("]")}Q.prototype._preCompile=function(){PV(this.options.defaultSort),this.plugin(Q1e,{deduplicate:!0}),che(this),LO(this,new Set),this._hasSelectedPaths=BV(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 PV(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 LO(e,t){if(t.has(e))return;t.add(e),e._defaultsCache=null,e._pathsWithTransforms=void 0;for(let{schema:r}of e.childSchemas)LO(r,t);for(let r of Object.values(e.discriminators??{}))LO(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 BV(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&&BV(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 che(e){let t=e.options.optimisticConcurrency;if(!t||t===!0)return;if(Array.isArray(t))e.options._optimisticConcurrencyTrie=new EV(t);else if(Array.isArray(t.exclude))e.options._optimisticConcurrencyExcludeTrie=new EV(t.exclude)}Q.prototype.toJSONSchema=function(t){let r=t?.useBsonType??!1,n=r?{required:[],properties:{}}:{type:"object",required:[],properties:{}};for(let i of Object.keys(this.paths)){let s=this.paths[i];if(s._presplitPath.indexOf("$*")!==-1)continue;let o=s._presplitPath.length>1,u=n;if(o)for(let c=0;c<s._presplitPath.length-1;++c){let l=s._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=s._presplitPath[s._presplitPath.length-1];if(i==="_id"){if(!u.required)u.required=[];u.required.push("_id")}else if(s.options.required&&typeof s.options.required!=="function"){if(!u.required)u.required=[];u.required.push(a)}u.properties[a]=s.toJSONSchema(t)}if(n.required.length===0)delete n.required;return n};/*!
|
|
774
|
+
* Module exports.
|
|
775
|
+
*/FV.exports=UO=Q;Q.Types=mc=Id();/*!
|
|
776
|
+
* ignore
|
|
777
|
+
*/UO.ObjectId=mc.ObjectId});var UE=g(function(NV,IV){/*!
|
|
778
|
+
* Connection states
|
|
779
|
+
*/var du=IV.exports=NV=Object.create(null);du[0]="disconnected";du[1]="connected";du[2]="connecting";du[3]="disconnecting";du[99]="uninitialized";du.disconnected=0;du.connected=1;du.connecting=2;du.disconnecting=3;du.uninitialized=99});var zO=g(function(e6e,$V){/*!
|
|
780
|
+
* Module dependencies.
|
|
781
|
+
*/var lhe=ns();class VO extends lhe{constructor(e,t,r,n){let i=e.map((s)=>s.message).join(", ");if(i.length>200)i=i.slice(0,200)+"...";super(`${n} failed with ${e.length} Mongoose validation errors: ${i}`);this.validationErrors=e,this.results=t,this.rawResult=r,this.operation=n}}Object.defineProperty(VO.prototype,"name",{value:"MongooseBulkWriteError"});/*!
|
|
782
|
+
* exports
|
|
783
|
+
*/$V.exports=VO});var xV=g(function(t6e,RV){/*!
|
|
784
|
+
* Module dependencies.
|
|
785
|
+
*/var hhe=ze();class WO extends hhe{constructor(e,t){super(e);this.errors=t}}Object.defineProperty(WO.prototype,"name",{value:"SyncIndexesError"});RV.exports=WO});var HO=g(function(r6e,vV){vV.exports=function e(t,r,n,i){if(t[i])return;if(t[i]=!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,i),c.Constructor.prototype.$__setSchema(c.schema)}let s=t.discriminators;if(s==null)return;let o=n.applyPluginsToDiscriminators,u=Object.keys(s);for(let a of u){let c=s[a];e(c,r,{skipTopLevel:!o},i)}}});var VE=g(function(n6e,KO){/*!
|
|
786
|
+
* ignore
|
|
787
|
+
*/var kV=null;KO.exports.get=function(){return kV};KO.exports.set=function(e){kV=e}});var GO=g(function(i6e,qV){function fhe(){return{ok:1,nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[],writeErrors:[],insertedIds:[],writeConcernErrors:[]}}qV.exports=fhe});var LV=g(function(s6e,jV){var dhe=ze();class YO extends dhe{constructor(e,t){super(e);this.errors=t}}Object.defineProperty(YO.prototype,"name",{value:"CreateCollectionsError"});jV.exports=YO});var JO=g(function(QO){/*!
|
|
788
|
+
* Module dependencies.
|
|
789
|
+
*/var phe=Te().Binary,UV=Zn(),VV=dd(),mhe=ns(),zV=require("util");QO.flatten=WV;QO.modifiedPaths=HV;/*!
|
|
790
|
+
* ignore
|
|
791
|
+
*/function WV(e,t,r,n){let i;if(e&&VV(e)&&!Buffer.isBuffer(e))i=Object.keys(e.toObject({transform:!1,virtuals:!1})||{});else i=Object.keys(e||{});let s=i.length,o={};t=t?t+".":"";for(let u=0;u<s;++u){let a=i[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(KV(c)){if(r?.skipArrays&&Array.isArray(c))continue;let h=WV(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 HV(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 mhe(`a circular reference in the update value, updateValue:
|
|
794
|
+
${zV.inspect(n.raw.update,{showHidden:!1,depth:1})}
|
|
795
|
+
updatePath: '${n.raw.path}'`);n.trace.add(e);let i=Object.keys(e||{}),s=i.length;r=r||{},t=t?t+".":"";for(let o=0;o<s;++o){let u=i[o],a=e[u],c=t+u;if(r[c]=!0,!Buffer.isBuffer(a)&&VV(a))a=a.toObject({transform:!1,virtuals:!1});if(KV(a))HV(a,t+u,r,n)}return n.trace.delete(e),r}/*!
|
|
796
|
+
* ignore
|
|
797
|
+
*/function KV(e){return e&&typeof e==="object"&&!(e instanceof Date)&&!UV(e,"ObjectId")&&(!Array.isArray(e)||e.length!==0)&&!(e instanceof Buffer)&&!UV(e,"Decimal128")&&!(e instanceof phe)}});var QV=g(function(u6e,YV){var GV=JO().modifiedPaths;YV.exports=function(t){let r=Object.keys(t),n={},i={};for(let s of r){if(s.startsWith("$")){GV(t[s],"",n);continue}i[s]=t[s]}return GV(i,"",n),n}});var XO=g(function(a6e,JV){var yhe=QV();JV.exports=function(t){if(t==null)return{};let r=yhe(t);return Object.keys(r).reduce((n,i)=>{let s=i.match(/\$\[[^\]]+\]/g);if(s==null)return n;for(let o of s){let u=i.indexOf(o);if(u!==i.lastIndexOf(o))throw Error(`Path '${i}' contains the same array filter multiple times`);n[o.substring(2,o.length-1)]=i.substring(0,u-1).replace(/\$\[[^\]]+\]/g,"0")}return n},{})}});var ez=g(function(c6e,ZV){var ghe=Dd(),XV=Dr(),Ehe=Vs(),ZO=jw(),_he=XO();ZV.exports=function(t,r,n,i,s){let o=i.indexOf(".")===-1?[i]:i.split("."),u=null,a="adhocOrUndefined";n=n||{},r=r||{};let c=Array.isArray(s?.arrayFilters)?s.arrayFilters:[],l=_he(r),f=0;for(let h=0;h<o.length;++h){let d=o.slice(f,h+1).join("."),p=ghe(d);if(u=t.path(p),u==null)continue;if(a=t.pathType(p),(u.$isSingleNested||u.$isMongooseDocumentArrayElement)&&u.schema.discriminators!=null){let m=XV(u,"schema.options.discriminatorKey"),E=p+"."+m,y=E.replace(/\.\d+\./,"."),_=null;if(E in n)_=ZO(n[E]);if(y in n)_=ZO(n[y]);let O=p.replace(/\.\d+$/,"");if(u.$isMongooseDocumentArrayElement&&XV(n[O],"$elemMatch."+m)!=null)_=ZO(n[O].$elemMatch[m]);let b=d+"."+m;if(b in r)_=r[b];if(E in r)_=r[E];for(let B of Object.keys(l)){let q=l[B]+"."+m,I=B+"."+m;if(q===y){let we=c.find((Ne)=>Object.hasOwn(Ne,I));if(we!=null)_=we[I]}}if(_==null)continue;let P=Ehe(u.Constructor.discriminators,_)?.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 rz=g(function(l6e,tz){var Ahe=ac();tz.exports=function(t,r,n,i,s,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 Ahe(null,`Field ${s} is immutable and strict = 'throw'`);return delete n[i],!0}});var sz=g(function(h6e,iz){var whe=Dr();iz.exports=function(t,r,n){if(r==null)return;let i=Object.keys(r);for(let s of i){let o=s.startsWith("$");if(s==="$set"){let u=Object.keys(r[s]);for(let a of u)nz(t,r[s],a,r,n)}else if(!o)nz(t,r,s,r,n)}};function nz(e,t,r,n,i){let s=e.path(r);if(s==null)return;let o=whe(s,"options.immutable",null);if(o==null)return;if(typeof o==="function")o=o.call(i,i);if(!o)return;n.$setOnInsert=n.$setOnInsert||{},n.$setOnInsert[r]=t[r],delete t[r]}});var eS=g(function(f6e,oz){var Hh=oc();oz.exports=function(t,r,n){if(r.indexOf(".")===-1){if(Hh.has(r))return;t[r]=n;return}let i=r.split("."),s=i.pop(),o=t;for(let u of i){if(Hh.has(u))continue;if(!Object.hasOwn(o,u)&&u in o)return;if(o[u]==null)o[u]={};o=o[u]}if(!Hh.has(s))o[s]=n}});var uS=g(function(d6e,yz){var zd=ei(),Gh=ze(),uz=NO(),az=ac(),Ohe=Qc(),iS=Pd(),She=ol(),Che=Xn(),tS=os(),rS=Vs(),nS=ez(),bhe=uu(),cz=rz(),lz=Fn(),Dhe=Nh(),The=sz(),pz=Oo().schemaMixedSymbol,Mhe=eS(),Cn=be(),{internalToObjectOptions:hz}=Ao(),sS=new Set(["$currentDate","$inc","$min","$max","$mul","$rename","$set","$setOnInsert","$unset","$addToSet","$pop","$pull","$push","$pullAll","$bit"]);yz.exports=function(t,r,n,i,s){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]=Phe(p,r[h][p])}return r}if(t!=null&&s!=null&&Cn.hasUserDefinedProperty(s,t.options.discriminatorKey)&&typeof s[t.options.discriminatorKey]!=="object"&&t.discriminators!=null){let f=s[t.options.discriminatorKey],h=rS(i.model.discriminators,f);t=tS(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=rS(i.model.discriminators,f);t=tS(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=rS(i.model.discriminators,f);t=tS(t.discriminators,f)||h?.schema||t}if(n.upsert&&!n.overwriteImmutable)The(t,r,i);if(lz(r)&&typeof r.toObject==="function")r=r.toObject(hz);let o=Object.keys(r),u=o.length,a={},c,l=!1;s=s||{};while(u--){let f=o[u];if(!sS.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("$"),lz(c))c=c.toObject(hz),a[f]=c;if(c&&typeof c==="object"&&!Buffer.isBuffer(c)&&sS.has(f))mz(t,c,f,n,i,s);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(s))return{$setOnInsert:{...s}};return a};/*!
|
|
798
|
+
* ignore
|
|
799
|
+
*/function Phe(e,t){if(e==="$unset"){if(typeof t!=="string"&&(!Array.isArray(t)||t.find((r)=>typeof r!=="string")))throw new Gh("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 Gh("Invalid $project in pipeline, must be an object");return t}if(e==="$addFields"||e==="$set"){if(t==null||typeof t!=="object")throw new Gh("Invalid "+e+" in pipeline, must be an object");return t}else if(e==="$replaceRoot"||e==="$replaceWith"){if(t==null||typeof t!=="object")throw new Gh("Invalid "+e+" in pipeline, must be an object");return t}throw new Gh('Invalid update pipeline operator: "'+e+'"')}function mz(e,t,r,n,i,s,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 E=o+h,y=!o&&Dhe(h),_=y?e._getSchema(E):null,O=y&&Object.hasOwn(e.nested,h);if(y&&_==null&&!O)throw new Gh('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._getSchema(E);if(f=_,f==null){let A=nS(e,t,s,o+h,n);if(A.schematype!=null)f=A.schematype}if(f?.schema!=null){try{t[h]=She(f.schema,t[h],n,i)}catch(A){if(A instanceof zd){p=Gu(A,i,h,p);continue}else throw A}l=!0;continue}}let b=o?o+h:h;if(e.discriminatorMapping!=null&&b===e.options.discriminatorKey&&e.discriminatorMapping.value!==t[h]&&!n.overwriteDiscriminatorKey){if(m==="throw"){let A=Error(`Can't modify discriminator key "`+b+'" on discriminator model');p=Gu(A,i,b,p);continue}else if(m){delete t[h];continue}}if(!y&&r!=="$pull")_=e._getSchema(E);if(f=_,Che(d)==="Object"){if(f==null){let A=nS(e,t,s,o+h,n);if(A.schematype!=null)f=A.schematype}if(r!=="$setOnInsert"&&cz(f,u,t,h,o+h,n,i))continue;if(f&&(f.embeddedSchemaType||f.Constructor)&&r in oS)if("$each"in d){l=!0;try{t[h]={$each:Kh(f,d.$each,r,h,i,o+h)}}catch(A){p=Gu(A,i,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=iS(d.$position)}else{if(f?.$isSingleNested){let A=u==null?f.schema.options.strict:u;try{t[h]=f.castForQuery(null,d,i,{strict:A})}catch(P){p=Gu(P,i,h,p)}}else try{t[h]=Kh(f,d,r,h,i,o+h)}catch(A){p=Gu(A,i,h,p)}if(t[h]===void 0){delete t[h];continue}l=!0}else if(r==="$currentDate"||r in oS&&f){try{t[h]=Kh(f,d,r,h,i,o+h)}catch(A){p=Gu(A,i,h,p)}if(t[h]===void 0){delete t[h];continue}l=!0}else if(r==="$rename"){let A=new uz(`${o}${h}.$rename`);try{t[h]=Kh(A,d,r,h,i,o+h)}catch(P){p=Gu(P,i,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 az(A);else if(S){delete t[h];continue}}l|=mz(e,d,r,n,i,s,o+h)||Cn.isObject(d)&&Cn.hasOwnKeys(d)===!1}}else{let A=!O&&f==null&&(h==="$each"||h==="$or"||h==="$and"||h==="$in"),P=A?o:E;if(A)f=e._getSchema(P);if(r!=="$setOnInsert"&&cz(f,u,t,h,o+h,n,i))continue;let S=e._getPathType(P);if(f==null){let I=nS(e,t,s,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"&&bhe(e.virtuals,P)==null)throw new az(o+h);else delete t[h];else{if(r==="$rename"){try{if(t[h]==null)throw new zd("String",t[h],`${o}${h}.$rename`);let I=new uz(`${o}${h}.$rename`,null,null,e);t[h]=I.castForQuery(null,t[h],i)}catch(I){p=Gu(I,i,h,p)}continue}try{if(o.length===0||h.indexOf(".")===-1)t[h]=Kh(f,d,r,h,i,o+h);else if(B!==!1||f!=null)Mhe(t,h,Kh(f,d,r,h,i,o+h)),delete t[h]}catch(I){p=Gu(I,i,h,p)}if(Array.isArray(t[h])&&(r==="$addToSet"||r==="$push")&&h!=="$each"){if(f&&f.embeddedSchemaType&&!f.embeddedSchemaType.$isMongooseArray&&!f.embeddedSchemaType[pz])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 Gu(e,t,r,n){let i=t?.modelName!=null?t:t?.model;if(i!=null&&typeof e.setModel==="function")e.setModel(i);if(typeof t!=="object"||!t.options.multipleCastError)throw e;return n=n||new Ohe,n.addError(r,e),n}var fz={$pop:1,$inc:1},Bhe={$unset:1},oS={$push:1,$addToSet:1,$set:1,$setOnInsert:1};/*!
|
|
802
|
+
* ignore
|
|
803
|
+
*/var dz={$set:1,$setOnInsert:1};function Kh(e,t,r,n,i,s){if(!e){if(r in fz)try{return iS(t)}catch{throw new zd("number",t,s)}return t}if(e.$isMongooseArray&&r in oS&&(Cn.isObject(t)||Array.isArray(t))&&!dz[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],i);for(let d=0;d<f;++d)h=h[0];return h}if(r in Bhe)return t;if(r in fz){if(t==null)throw new zd("number",t,e.path);if(r==="$inc")return e.castForQuery(null,t,i);try{return iS(t)}catch{throw new zd("number",t,e.path)}}if(r==="$currentDate"){if(typeof t==="object")return{$type:t.$type};return Boolean(t)}if(sS.has(n))return e.castForQuery(n,t,i);if(dz[r]){let u=t!=null&&e.$isMongooseArray&&e.$fullPath!=null&&!e.$fullPath.match(/\d+$/),a=e[pz]!=null;if(u||a)return e.applySetters(t,i);return e.castForQuery(null,t,i)}return e.castForQuery(null,t,i)}});var _z=g(function(p6e,Ez){var gz=Nh();Ez.exports=function(t,r,n){if(!Object.keys(n).some(gz))return r.castForQuery(null,n,t);let s=Object.keys(n),o=s.length;while(o--){let u=s[o],a=n[u];if(u==="$not"){if(a&&r&&!r.embeddedSchemaType&&!r.Constructor){let c=Object.keys(a);if(c.length&&gz(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 wz=g(function(m6e,Az){var Fhe=os(),Nhe=/^\d+$/;Az.exports=function(t,r,n){let i=t.path(r);if(i!=null)return i;let s=r.split("."),o="",u=!1;for(let a of s){if(u&&Nhe.test(a))continue;if(o=o.length===0?a:o+"."+a,i=t.path(o),i?.schema){if(t=i.schema,!u&&i.$isMongooseDocumentArray)u=!0;if(n&&n[o])t=Fhe(t.discriminators,n[o])??t;o=""}else if(i?.instance==="Mixed")break}return i}});var cS=g(function(y6e,aS){var Ihe=os(),$he=_z(),Oz=Dd(),Rhe=uu(),Sz=wz(),{logicalOperators:xhe}=Nd(),vhe=XO(),Cz=be();aS.exports=function(t){bz(t.options.arrayFilters,t.getUpdate(),t.schema,t.model,t._mongooseOptions,t)};function bz(e,t,r,n,i,s){if(!Array.isArray(e))return;let o=vhe(t),u=r.options.strict;if(i.strict!=null)u=i.strict;if(n?.base.options.strictQuery!=null)u=n.base.options.strictQuery;if(r._userProvidedOptions.strictQuery!=null)u=r._userProvidedOptions.strictQuery;if(i.strictQuery!=null)u=i.strictQuery;Dz(e,r,u,o,s)}aS.exports.castArrayFiltersForUpdate=bz;function Dz(e,t,r,n,i){let s={};for(let o of e){if(o==null)throw Error(`Got null array filter in ${e}`);let u=Object.keys(o).filter((E)=>o[E]!=null);if(u.length===0)continue;let a=[];for(let E of u)if(xhe.has(E))Dz(o[E],t,r,n,i);else if(E.charAt(0)!=="$")a.push(E);if(a.length===0)continue;let c=a[0],l=c.indexOf("."),f=l===-1?c:c.substring(0,l),h=Rhe(n,f);if(h==null)continue;let d=Oz(h),p=Sz(t,d,s),m=p!=null?p.schema:null;if(m?.discriminators!=null&&o[f+"."+m.options.discriminatorKey])m=Ihe(m.discriminators,o[f+"."+m.options.discriminatorKey])||m,s[d]=o[f+"."+m.options.discriminatorKey];for(let E of a){if(n[E]===null)continue;if(Cz.hasOwnKeys(n)===!1)continue;let y=E.indexOf("."),_=y===-1?null:E.substring(y),O;if(_==null||m==null)O=p;else _=Oz(_),O=Sz(m,_,s);if(O==null){if(!r)continue;let b=_==null?d+".0":d+".0"+_;throw Error(`Could not find path "${b}" in schema`)}if(typeof o[E]==="object")o[E]=$he(i,O,o[E]);else o[E]=O.castForQuery(null,o[E])}}}});var zE=g(function(g6e,Tz){Tz.exports=function(t,r,n){if(!n||!r?.upsert)return;if(r.overwrite){if(!Wd(t,n))t[n]=0}else if(!Wd(t,n)&&!Wd(t?.$set,n)&&!Wd(t?.$inc,n)&&!Wd(t?.$setOnInsert,n)){if(!t.$setOnInsert)t.$setOnInsert={};t.$setOnInsert[n]=0}};function Wd(e,t){if(e==null||typeof e!=="object")return!1;return Object.hasOwn(e,t)}});var lS=g(function(E6e,Pz){var khe=Dr();Pz.exports=function(e,t,r,n,i,s){let o=n?.setDefaultsOnInsert??i?.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=e[m];if(E&&typeof E==="object"){let O=Object.keys(E),b=O.length,A=!1;for(let P=0;P<b;++P)if(O[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("."),_=y[0];for(let O=1;O<y.length;++O)a[_]=!0,_+="."+y[O]}if(n?.overwrite&&!f)return r;return t.eachPath(function(p,m){if(m.path==="_id"&&m.options.auto)return;let E=m.getDefault(null,!0,{context:s});if(typeof E>"u")return;let y=m.splitPath();if(y.includes("$*"))return;if(qhe(r,a,p,y,f))return;if(r=r||{},r.$setOnInsert=r.$setOnInsert||{},khe(r,p)==null)r.$setOnInsert[p]=E;c[p]=E}),r};function qhe(e,t,r,n,i){if(t[r])return!0;let s=n[0];for(let o=1;o<n.length;++o){if(t[s])return!0;s+="."+n[o]}if(i){for(let o in e)if(o.charAt(0)==="$"){if(Mz(e[o],r,n))return!0}}else if(Mz(e,r,n))return!0;return!1}function Mz(e,t,r){if(e==null||typeof e!=="object")return!1;if(Object.hasOwn(e,t))return!0;let n=r[0];for(let s=1;s<r.length;++s){if(Object.hasOwn(e,n))return!0;n+="."+r[s]}let i=t+".";for(let s in e)if(s.startsWith(i))return!0;return!1}});var hS=g(function(_6e,xr){var jhe=ze(),Lhe=Vs(),Bz=Iw(),Fz=Rw(),Uhe=ol(),Nz=uS(),{castArrayFiltersForUpdate:Iz}=cS(),WE=ar(),$z=zE(),{inspect:Vhe}=require("util"),Rz=lS();xr.exports=function(t,r,n){let i,s=t.schema.get("timestamps");if(typeof s?.currentTime==="function")i=s.currentTime();else i=t.base.now();if(r.insertOne)return(o)=>xr.exports.castInsertOne(t,r.insertOne,n).then(()=>o(null),(u)=>o(u));else if(r.updateOne)return(o)=>{try{xr.exports.castUpdateOne(t,r.updateOne,n,i),o(null)}catch(u){o(u)}};else if(r.updateMany)return(o)=>{try{xr.exports.castUpdateMany(t,r.updateMany,n,i),o(null)}catch(u){o(u)}};else if(r.replaceOne)return(o)=>{xr.exports.castReplaceOne(t,r.replaceOne,n).then(()=>o(null),(u)=>o(u))};else if(r.deleteOne)return(o)=>{try{xr.exports.castDeleteOne(t,r.deleteOne),o(null)}catch(u){o(u)}};else if(r.deleteMany)return(o)=>{try{xr.exports.castDeleteMany(t,r.deleteMany),o(null)}catch(u){o(u)}};else return(o)=>{let u=new jhe(`Invalid op passed to \`bulkWrite()\`: ${Vhe(r)}`);o(u,null)}};xr.exports.castInsertOne=async function(t,r,n){let i=Yh(t,r.document),s=new i(r.document);if(i.schema.options.timestamps&&HE(r,n))s.initializeTimestamps();if(n.session!=null)s.$session(n.session);let o=i?.schema?.options?.versionKey;if(o&&s[o]==null)s[o]=0;if(r.document=s,n.skipValidation||r.skipValidation)return r;return await r.document.$validate(),r};xr.exports.castUpdateOne=function(t,r,n,i){if(!r.filter)throw Error("Must provide a filter object.");if(!r.update)throw Error("Must provide an update object.");let s=Yh(t,r.filter),o=s.schema,u=n.strict??s.schema.options.strict,a=WE(r.update);Kd(o,r.filter);let c=HE(r,n);if(s.schema.$timestamps!=null&&c){let h=s.schema.$timestamps.createdAt,d=s.schema.$timestamps.updatedAt;Fz(i,h,d,a,{timestamps:r.timestamps,overwriteImmutable:r.overwriteImmutable},r.upsert)}if(c)Bz(i,a,s.schema);let l=t.base.options.setDefaultsOnInsert;if((r.setDefaultsOnInsert??l)!==!1)Rz(r.filter,s.schema,a,{setDefaultsOnInsert:!0,upsert:r.upsert});if($z(a,r,s.schema.options.versionKey),r.filter=Hd(s,r.filter,{strict:u,upsert:r.upsert}),Array.isArray(r.arrayFilters))r.arrayFilters=WE(r.arrayFilters),Iz(r.arrayFilters,a,o,s,n);return r.update=Nz(s.schema,a,{strict:u,upsert:r.upsert,arrayFilters:r.arrayFilters,overwriteDiscriminatorKey:r.overwriteDiscriminatorKey,overwriteImmutable:r.overwriteImmutable},s,r.filter),r};xr.exports.castUpdateMany=function(t,r,n,i){if(!r.filter)throw Error("Must provide a filter object.");if(!r.update)throw Error("Must provide an update object.");let s=Yh(t,r.filter),o=s.schema,u=n.strict??s.schema.options.strict,a=WE(r.update),c=t.base.options.setDefaultsOnInsert;if((r.setDefaultsOnInsert??c)!==!1)Rz(r.filter,s.schema,a,{setDefaultsOnInsert:!0,upsert:r.upsert});let f=HE(r,n);if(s.schema.$timestamps!=null&&f){let h=s.schema.$timestamps.createdAt,d=s.schema.$timestamps.updatedAt;Fz(i,h,d,a,{timestamps:r.timestamps,overwriteImmutable:r.overwriteImmutable},r.upsert)}if(f)Bz(i,a,s.schema);if(Kd(o,r.filter),$z(a,r,s.schema.options.versionKey),r.filter=Hd(s,r.filter,{strict:u,upsert:r.upsert}),Array.isArray(r.arrayFilters))r.arrayFilters=WE(r.arrayFilters),Iz(r.arrayFilters,a,o,s,n);r.update=Nz(s.schema,a,{strict:u,upsert:r.upsert,arrayFilters:r.arrayFilters,overwriteDiscriminatorKey:r.overwriteDiscriminatorKey,overwriteImmutable:r.overwriteImmutable},s,r.filter)};xr.exports.castReplaceOne=async function(t,r,n){let i=Yh(t,r.filter),s=i.schema,o=n.strict??i.schema.options.strict;Kd(s,r.filter),r.filter=Hd(i,r.filter,{strict:o,upsert:r.upsert});let u=new i(r.replacement,o,{skipId:!0});if(i.schema.options.timestamps&&HE(r,n))u.initializeTimestamps();if(n.session!=null)u.$session(n.session);let a=i?.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()};xr.exports.castDeleteOne=function(t,r){let n=Yh(t,r.filter),i=n.schema;Kd(i,r.filter),r.filter=Hd(n,r.filter)};xr.exports.castDeleteMany=function(t,r){let n=Yh(t,r.filter),i=n.schema;Kd(i,r.filter),r.filter=Hd(n,r.filter)};xr.exports.cast={insertOne:xr.exports.castInsertOne,updateOne:xr.exports.castUpdateOne,updateMany:xr.exports.castUpdateMany,replaceOne:xr.exports.castReplaceOne,deleteOne:xr.exports.castDeleteOne,deleteMany:xr.exports.castDeleteMany};function Hd(e,t,r){try{return Uhe(e.schema,t,r)}catch(n){if(typeof n.setModel==="function")n.setModel(e);throw n}}function Kd(e,t){if(e==null)return;if(e.discriminatorMapping&&!e.discriminatorMapping.isRoot)t[e.discriminatorMapping.key]=e.discriminatorMapping.value}function Yh(e,t){let r=e.schema.options.discriminatorKey;if(t!=null&&Object.hasOwn(t,r))e=Lhe(e.discriminators,t[r])||e;return e}function HE(e,t){let r=e.timestamps,n=t.timestamps;if(r!=null)return r;else if(n!=null)return n;return!0}});var fS=g(function(A6e,xz){xz.exports=function(t,r,n){return t.mongoose=t.mongoose||{},t.mongoose.validationErrors=r,t.mongoose.results=n,t}});var mS=g(function(w6e,Uz){/*!
|
|
804
|
+
* Module dependencies.
|
|
805
|
+
*/var zhe=u4(),pS=require("events").EventEmitter,Whe=nl(),ot=UE(),vz=zO(),Rt=ns(),Hhe=P4(),Khe=xV(),Ghe=HO(),Yhe=ar(),jz=VE(),Qhe=Dr(),Jhe=GO(),kz=uu(),Xhe=ma(),Qh=be(),Zhe=LV(),yc=hS(),{modelSymbol:KE}=de(),efe=X4(),dS=fS(),tfe=de().arrayAtomicsSymbol,Gd=de().sessionNewDocuments,rfe=globalThis.Date,nfe=["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,pS.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"&&rfe.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 Rt("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 Qhe(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 Rt("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,i=this.base.transactionAsyncLocalStorage?.getStore();if((!r||!Object.hasOwn(r,"session"))&&i?.session!=null)r={...r,session:i.session};let s=this.base.now(),o=null;if(n){let u=[];for(let a of t){if(typeof a.model!=="string"&&!a.model?.[KE])throw new Rt("Must specify model in Connection.prototype.bulkWrite() operations");let c=a.model[KE]?a.model:this.model(a.model);if(a.name==null)throw new Rt("Must specify operation name in Connection.prototype.bulkWrite()");if(!Object.hasOwn(yc.cast,a.name))throw new Rt(`Unrecognized bulkWrite() operation name ${a.name}`);await yc.cast[a.name](c,a,r,s),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?.[KE]){let y=new Rt("Must specify model in Connection.prototype.bulkWrite() operations");c.push({index:d,error:y}),f[d]=y;continue}let m;try{m=p.model[KE]?p.model:this.model(p.model)}catch(y){c.push({index:d,error:y});continue}if(p.name==null){let y=new Rt("Must specify operation name in Connection.prototype.bulkWrite()");c.push({index:d,error:y}),f[d]=y;continue}if(!Object.hasOwn(yc.cast,p.name)){let y=new Rt(`Unrecognized bulkWrite() operation name ${p.name}`);c.push({index:d,error:y}),f[d]=y;continue}let E=null;try{E=yc.cast[p.name](m,p,r,s)}catch(y){c.push({index:d,error:y}),f[d]=y;continue}if(efe(E))l.push(E.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 vz(c,f,o,"bulkWrite");let p=new(this.base.driver.get()).BulkWriteResult(Jhe(),!1);return dS(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)dS(h,c,f),h.mongoose=h.mongoose||{},h.mongoose.validationErrors=c;throw h}if(c.length>0)if(r.throwOnValidationError)throw new vz(c,f,o,"bulkWrite");else dS(o,c,f)}return o};ge.prototype.createCollections=async function(t={}){let r={},n={},{continueOnError:i}=t;delete t.continueOnError;for(let s of Object.values(this.models))try{r[s.modelName]=await s.createCollection({})}catch(o){if(!i){n[s.modelName]=o;break}else r[s.modelName]=o}if(!i&&Qh.hasOwnKeys(n)){let s=Object.entries(n).map(([u,a])=>`${u}: ${a.message}`).join(", ");throw new Zhe(s,n)}return r};ge.prototype.withSession=async function(t){if(arguments.length===0)throw new Rt("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 Rt("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[Gd]=new Map,n.withTransaction(()=>ife(t,n,this.base),r).then((i)=>(delete n[Gd],i)).catch((i)=>{throw delete n[Gd],i}).finally(()=>{n.endSession().catch(()=>{})})))};/*!
|
|
808
|
+
* Reset document state in between transaction retries re: gh-13698
|
|
809
|
+
*/async function ife(e,t,r){qz(t);try{return r.transactionAsyncLocalStorage==null?await e(t):await new Promise((i)=>{r.transactionAsyncLocalStorage.run({session:t},()=>i(e(t)))})}catch(n){throw qz(t),n}}/*!
|
|
810
|
+
* If transaction was aborted, we need to reset newly inserted documents' `isNew`.
|
|
811
|
+
*/function qz(e){for(let t of e[Gd].keys()){let r=e[Gd].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 i=t.$__getValue(n);if(i==null)continue;i[tfe]=r.atomics.get(n)}}}ge.prototype.dropCollection=async function(t){if(arguments.length>=2&&typeof arguments[1]==="function")throw new Rt("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,i=!1,s={},o=new Promise((u)=>{s.fn=u,this._queue.push(s)});if(t)await o;else await Promise.race([o,new Promise((u)=>{n=setTimeout(()=>{i=!0,u()},r)})]);if(i){let u=this._queue.indexOf(s);if(u!==-1)this._queue.splice(u,1);let a="Connection operation buffering timed out after "+r+"ms";throw new Rt(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 Rt("listDatabases() not implemented by driver")};ge.prototype.dropDatabase=async function(){if(arguments.length>=1&&typeof arguments[0]==="function")throw new Rt("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{sfe.apply(arguments)}catch(i){if(n)throw i;throw this.$initialConnection=Promise.reject(i),i}this.$initialConnection=this.createClient(t,r).then(()=>this).catch((i)=>{if(this.readyState=ot.disconnected,this.listeners("error").length>0)Xhe(()=>this.emit("error",i));throw i});for(let i of Object.values(this.models))i.init().catch(function(){});if(n)return this;try{await this.$initialConnection}catch(i){throw Lz(i)}return this};ge.prototype.on=function(t,r){if(t==="error"&&this.$initialConnection)this.$initialConnection.catch(()=>{});return pS.prototype.on.call(this,t,r)};ge.prototype.once=function(t,r){if(t==="error"&&this.$initialConnection)this.$initialConnection.catch(()=>{});return pS.prototype.once.call(this,t,r)};/*!
|
|
816
|
+
* ignore
|
|
817
|
+
*/function sfe(e,t,r){if(typeof t==="function"&&r==null)throw new Rt("Connection.prototype.openUri() no longer accepts a callback");else if(typeof r==="function")throw new Rt("Connection.prototype.openUri() no longer accepts a callback")}/*!
|
|
818
|
+
* ignore
|
|
819
|
+
*/function Lz(e){if(e?.name==="MongoServerSelectionError"){let t=e;e=new Hhe,e.assimilateError(t)}return e}ge.prototype.destroy=async function(t){if(typeof t==="function"||arguments.length===2&&typeof arguments[1]==="function")throw new Rt("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 Rt("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,i=this._closeCalled;if(this._closeCalled=!0,this._destroyCalled=r,this.client!=null)this.client._closeCalled=!0,this.client._destroyCalled=r;let s=this;switch(this.readyState){case ot.disconnected:if(r){let o=this.base.connections.indexOf(s);if(o!==-1)this.base.connections.splice(o,1)}if(!i)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(s);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(s)!==-1)this.base.connections.splice(this.base.connections.indexOf(s),1);o()})})}return this};ge.prototype.doClose=function(){throw new Rt("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?Yhe(t):{}),t.$wasForceClosed=this.$wasForceClosed;let n=this.base?.__driver?.Collection||jz.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,i){if(!(this instanceof ge))throw new Rt("`connection.model()` should not be run with `new`. If you are doing `new db.model(foo)(bar)`, use `db.model(foo)(bar)` instead");let s;if(typeof t==="function")s=t,t=s.name;if(typeof r==="string")n=r,r=!1;if(Qh.isObject(r)){if(!r.instanceOfSchema)r=new Whe(r);else if(!(r instanceof this.base.Schema))r=r._clone(this.base.Schema)}if(r&&!r.instanceOfSchema)throw new Rt("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,i,{connection:this}),a=kz(this.models,t);if(a&&!n&&u.overwriteModels!==!0){if(r?.instanceOfSchema&&r!==a.schema)throw new Rt.OverwriteModelError(t);return a}let c;if(r?.instanceOfSchema){if(Ghe(r,this.plugins,null,"$connectionPluginsApplied"),c=this.base._model(s||t,r,n,u),!kz(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 Rt.MissingSchemaError(t);return c}if(!c)throw new Rt.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 i of n)if(r.test(i))this.deleteModel(i)}else throw new Rt('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 zhe(n,t,r)};ge.prototype.asPromise=async function(){try{return await this.$initialConnection,this}catch(t){throw Lz(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 nfe.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 Rt("Connection#setClient not implemented by driver")};/*!
|
|
820
|
+
* Called internally by `openUri()` to create a MongoClient instance.
|
|
821
|
+
*/ge.prototype.createClient=function(){throw new Rt("Connection#createClient not implemented by driver")};ge.prototype.syncIndexes=async function(t={}){let r={},n={},{continueOnError:i}=t;delete t.continueOnError;for(let s of Object.values(this.models))try{r[s.modelName]=await s.syncIndexes(t)}catch(o){if(!i){n[s.modelName]=o;break}else r[s.modelName]=o}if(!i&&Qh.hasOwnKeys(n)){let s=Object.entries(n).map(([u,a])=>`${u}: ${a.message}`).join(", ");throw new Khe(s,n)}return r};/*!
|
|
822
|
+
* Module exports.
|
|
823
|
+
*/ge.STATES=ot;Uz.exports=ge});var yS=g(function(O6e,ofe){ofe.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 zz=g(function(S6e,Vz){var ufe=ar(),afe=ns();function cfe(e,t){let r=t?t:{},n=r.readPreference?dfe(r.readPreference):pfe(e),i=ufe(r);return n&&n!=="primary"&&n!=="primaryPreferred"?lfe(n,i):i}function lfe(e,t){if(hfe(t)&&ffe(e))yfe();else return mfe(t)}function hfe(e){let t=e.config?.autoIndex,{autoCreate:r,autoIndex:n}=e;return!!(t||r||n)}function ffe(e){return e==="secondary"||e==="secondaryPreferred"}function dfe(e){return typeof e==="string"?e:e.mode}function pfe(e){let r=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(e);return r?r[1]:null}function mfe(e){return e.config={autoIndex:!1},e.autoCreate=!1,e.autoIndex=!1,e}function yfe(){throw new afe('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')}Vz.exports=cfe});var Hz=g(function(Wz){Wz.setTimeout=setTimeout});var Yz=g(function(b6e,Gz){/*!
|
|
824
|
+
* Module dependencies.
|
|
825
|
+
*/var GE=mS(),hl=ns(),Bt=UE(),YE=Pa(),Kz=yS(),gfe=zz(),Efe=Hz().setTimeout,pu=be(),_fe=nl(),Afe=globalThis.Date;function To(){GE.apply(this,arguments),this._listening=!1,this._lastHeartbeatAt=null}To.STATES=Bt;/*!
|
|
826
|
+
* Inherits from Connection.
|
|
827
|
+
*/Object.setPrototypeOf(To.prototype,GE.prototype);To.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)i();else this._queue.push({fn:i});function i(){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};To.prototype.aggregate=function(t,r){return new this.base.Aggregate(null,this).append(t).option(r??{})};To.prototype.removeDb=function(t){let r=this.otherDbs.filter((n)=>n.name===t);if(!r.length)throw new hl(`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)};To.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)=>Efe(n,1)),this};To.prototype.listDatabases=async function(){return await this._waitForConnect(),await this.db.admin().listDatabases()};/*!
|
|
828
|
+
* ignore
|
|
829
|
+
*/To.prototype.createClient=async function(t,r){if(typeof t!=="string")throw new hl(`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 hl("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 hl("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=gfe(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,!pu.hasUserDefinedProperty(r,"driverInfo"))r.driverInfo={name:"Mongoose",version:Kz.version};let{schemaMap:i,encryptedFieldsMap:s}=this._buildEncryptionSchemas();if((pu.hasOwnKeys(i)||pu.hasOwnKeys(s))&&!r.autoEncryption)throw Error("Must provide `autoEncryption` when connecting with encrypted schemas.");if(pu.hasOwnKeys(i))r.autoEncryption.schemaMap=i;if(pu.hasOwnKeys(s))r.autoEncryption.encryptedFieldsMap=s;this.readyState=Bt.connecting,this._connectionString=t;let o;try{o=new YE.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};To.prototype._buildEncryptionSchemas=function(){let e={},t={},r=Object.values(this.models).filter((s)=>s.schema._hasEncryptedFields());for(let s of r){let{schema:o,collection:{collectionName:u}}=s,a=`${this.$dbName}.${u}`,c=o.encryptionType()==="csfle"?t:e;if(c[a]??=new _fe({},{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(([s,o])=>[s,o._buildSchemaMap()])),i=Object.fromEntries(Object.entries(e).map(([s,o])=>[s,o._buildEncryptedFields()]));return{schemaMap:n,encryptedFieldsMap:i}};/*!
|
|
830
|
+
* ignore
|
|
831
|
+
*/To.prototype.setClient=function(t){if(!(t instanceof YE.MongoClient))throw new hl("Must call `setClient()` with an instance of MongoClient");if(this.readyState!==Bt.disconnected)throw new hl("Cannot call `setClient()` on a connection that is already connected.");if(t.topology==null)throw new hl("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 i=n!=null?t.db(n):t.db();e.db=i,e.client=t,e.host=t?.s?.options?.hosts?.[0]?.host,e.port=t?.s?.options?.hosts?.[0]?.port,e.name=n!=null?n:i.databaseName,e._closeCalled=t._closeCalled;let s=()=>{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 s()});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")s()});if(e._lastHeartbeatAt=null,t.on("serverHeartbeatSucceeded",()=>{e._lastHeartbeatAt=Afe.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
|
+
*/Gz.exports=To});var Qz=g(function(Yd){/*!
|
|
836
|
+
* Module exports.
|
|
837
|
+
*/Yd.BulkWriteResult=$8();Yd.Collection=hx();Yd.Connection=Yz();Yd.ClientEncryption=Pa().ClientEncryption});var Xz=g(function(T6e,Jz){/*!
|
|
838
|
+
* Valid mongoose options
|
|
839
|
+
*/var wfe=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"]);Jz.exports=wfe});var eW=g(function(M6e,Zz){/*!
|
|
840
|
+
* Module dependencies.
|
|
841
|
+
*/var Ofe=ze();class ES extends Ofe{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(ES.prototype,"name",{value:"EachAsyncMultiError"});/*!
|
|
842
|
+
* exports
|
|
843
|
+
*/Zz.exports=ES});var AS=g(function(P6e,rW){/*!
|
|
844
|
+
* Module dependencies.
|
|
845
|
+
*/var Sfe=eW(),_S=ma();rW.exports=async function(t,r,n){let i=n.parallel||1,{batchSize:s,signal:o,continueOnError:u}=n,a=[],c=Cfe(),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(s!=null){if(typeof s!=="number")throw TypeError("batchSize must be a number");else if(!Number.isInteger(s))throw TypeError("batchSize must be an integer");else if(s<1)throw TypeError("batchSize must be at least 1")}f((m,E)=>{if(m!=null)return p(m);d(E)})});function f(d){let p=0,m=0,E=null;for(let _=0;_<i;++_)c(y());function y(){let _=[],O=!1;return b;function b(A){if(O||l)return A();else if(E)return A();t(function(P,S){if(E!=null)return A();if(P!=null)if(P.name==="MongoCursorExhaustedError")S=null;else if(u)a.push(P);else return E=P,d(P),A();if(S==null){if(O=!0,p<=0){let I=u?tW(a):E;d(I)}else if(s&&_.length)h(_,m++,q);return A()}if(++p,_S(()=>A()),s)_.push(S);if(s&&_.length!==s){_S(()=>c(b));return}let B=s?_:S;function q(I){if(s)p-=_.length,_=[];else--p;if(I!=null)if(u)a.push(I);else return E=I,d(I);if((O||l)&&p<=0){let we=u?tW(a):E;return d(we)}_S(()=>c(b))}h(B,m++,q)})}}}function h(d,p,m){let E;try{E=r(d,p)}catch(y){return m(y)}if(typeof E?.then==="function")E.then(function(){m(null)},function(y){m(y||Error("`eachAsync()` promise rejected without error"))});else m(null)}};function Cfe(){let e=[],t=null,r=0;return function(s){if(t===null&&e.length===0)return t=r++,s(n);e.push(s)};function n(){if(e.length!==0)t=r++,e.shift()(n);else t=null}}function tW(e){if(e.length===0)return null;return new Sfe(e)}});var wS=g(function(B6e,nW){nW.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 Jh=g(function(F6e,sW){var QE;try{QE=typeof process<"u"&&"getBuiltinModule"in process?process.getBuiltinModule("node:diagnostics_channel"):require("node:diagnostics_channel")}catch{}var bfe=!!QE&&typeof QE.tracingChannel==="function";function Dfe(e){return!!e&&e.hasSubscribers!==!1}function iW(e){let t=bfe?QE.tracingChannel(e):void 0;function r(n,i){if(!Dfe(t))return n();return t.tracePromise(n,i())}return{channel:t,trace:r}}sW.exports={createTracedChannel:iW,cursorNextChannel:iW("mongoose:cursor:next")}});var dW=g(function(N6e,fW){/*!
|
|
846
|
+
* Module dependencies.
|
|
847
|
+
*/var Qd=ze(),cW=require("stream").Readable,Tfe=AS(),Mfe=wS(),ZE=Ed(),lW=Gc(),OS=ma(),{once:Pfe}=require("events"),e_=require("util"),{cursorNextChannel:Bfe}=Jh(),{buildMiddlewareFilter:oW}=qu();function Vi(e){cW.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=(i)=>{if(i!=null){if(this._initializationComplete=!0,i instanceof lW.skipWrappedFunction){let a=i.args[0];if(a!=null&&(!Array.isArray(a)||a.length)){let c=new Qd('Cannot `skipMiddlewareFunction()` with a value when using `.find().cursor()`, value must be nullish or empty array, got "'+e_.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(i),this.listeners("error").length>0)this._errorEmitted=!0,this.emit("error",i);return}let s=null;try{s=e._optionsForExec()}catch(a){this._markError(a),this.listeners("error").length>0&&this.emit("error",a);return}let{middleware:o,...u}=s;if(Object.assign(this.options,u),Object.hasOwn(this.options,"middleware"))delete this.options.middleware;if(this._postMiddlewareFilter=oW(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([()=>uW(e,this)]);else uW(e,this)},n=oW(e.options,"pre");t.hooks.execPre("find",e,[],{filter:n}).then(()=>r(null)).catch((i)=>r(i))}e_.inherits(Vi,cW);/*!
|
|
848
|
+
* ignore
|
|
849
|
+
*/function uW(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)}}Vi.prototype._read=function(){t_(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)})};Vi.prototype.getDriverCursor=async function(){if(this.cursor)return this.cursor;if(this._error)throw this._error;return await Pfe(this,"cursor"),this.cursor};Object.defineProperty(Vi.prototype,"map",{value:function(e){return this._transforms.push(e),this},enumerable:!0,configurable:!0,writable:!0});Vi.prototype._markError=function(e){return this._error=e,this};Vi.prototype.close=async function(){if(typeof arguments[0]==="function")throw new Qd("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}};Vi.prototype._destroy=function(t,r){let n=null;if(!this._initializationComplete)n=Mfe(this);else n=Promise.resolve();return n.then(()=>this.cursor?.close()).then(()=>{this._closed=!0;let i=!this._errorEmitted&&this.listeners("error").length>0;r(i?t:null)}).catch((i)=>{r(i)}),this};Vi.prototype.rewind=function(){return hW(this,()=>{this.cursor.rewind()}),this};Vi.prototype.next=async function(){if(typeof arguments[0]==="function")throw new Qd("QueryCursor.prototype.next() no longer accepts a callback");if(this._closed)throw new Qd("Cannot call `next()` on a closed cursor");let t=this;return Bfe.trace(function(){return new Promise((n,i)=>{t_(t,function(s,o){if(s)return i(s);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}}))};Vi.prototype.eachAsync=function(e,t){if(typeof arguments[2]==="function")throw new Qd("QueryCursor.prototype.eachAsync() no longer accepts a callback");if(typeof t==="function")t={};return t=t||{},Tfe((r)=>t_(this,r),e,t)};Vi.prototype.options;Vi.prototype.addCursorFlag=function(e,t){return hW(this,()=>{this.cursor.addCursorFlag(e,t)}),this};if(Symbol.asyncIterator!=null)Vi.prototype[Symbol.asyncIterator]=function(){return this._mongooseOptions._asyncIterator=!0,this};function t_(e,t){let r=t;if(r=function(n,i){if(n)return t(n);if(i===null)if(e._mongooseOptions._asyncIterator)return t(null,{done:!0});else return t(null,null);if(e._transforms.length&&i!==null)i=e._transforms.reduce(function(s,o){return o.call(e,s)},i);if(e._mongooseOptions._asyncIterator)return t(null,{value:i,done:!1});return t(null,i)},e._error)return OS(function(){r(e._error)});if(e.skipped)return OS(()=>r(null,null));if(e.cursor){if(e.query._mongooseOptions.populate&&!e._pop)e._pop=ZE.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 JE(e,e._batchDocs.shift(),e._pop,r);else if(e._batchExhausted)return r(null,null);else{e._batchDocs=[],e.cursor.next().then((n)=>{XE.call({ctx:e,callback:r},null,n)},(n)=>{XE.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 JE(e,n,null,r);JE(e,n,e._pop,(i,s)=>{if(i!=null)return r(i);e.query.model.populate(s,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}t_(e,t)})}/*!
|
|
850
|
+
* ignore
|
|
851
|
+
*/function XE(e,t){if(e)return this.callback(e);if(!t)return this.ctx._batchExhausted=!0,aW.call(this);if(this.ctx._batchDocs.push(t),this.ctx._batchDocs.length<this.ctx.options._populateBatchSize)OS(()=>this.ctx.cursor.next().then((r)=>{XE.call(this,null,r)},(r)=>{XE.call(this,r)}));else aW.call(this)}/*!
|
|
852
|
+
* ignore
|
|
853
|
+
*/function aW(){if(!this.ctx._batchDocs.length)return this.callback(null,null);this.ctx.query.model.populate(this.ctx._batchDocs,this.ctx._pop).then(()=>{JE(this.ctx,this.ctx._batchDocs.shift(),this.ctx._pop,this.callback)},(e)=>{this.callback(e)})}/*!
|
|
854
|
+
* ignore
|
|
855
|
+
*/function JE(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:i,_fields:s,_userProvidedFields:o,options:u}=e.query;ZE.createModelAndInit(i,t,s,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 hW(e,t){if(e.cursor)return t();e.once("cursor",function(r){if(r==null)return;t()})}fW.exports=Vi});var SS=g(function(I6e,mW){var Xh=be();function Ffe(e,t,r){pW(e,t,r,"maxTimeMS")}function Nfe(e,t,r){pW(e,t,r,"allowDiskUse")}mW.exports={applyGlobalMaxTimeMS:Ffe,applyGlobalDiskUse:Nfe};function pW(e,t,r,n){if(Xh.hasUserDefinedProperty(e,n))return;if(Xh.hasUserDefinedProperty(t,n))e[n]=t[n];else if(Xh.hasUserDefinedProperty(r,n))e[n]=r[n]}});var CS=g(function($6e,yW){yW.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 bS=g(function(R6e,EW){var gW=be();EW.exports=function(t,r){if(r.writeConcern!=null)return;if(r?.session?.transaction)return;let n=t.options.writeConcern??{};if(gW.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 SW=g(function(x6e,OW){var _W=tg(),AW=ar(),wW=oc();/*!
|
|
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
|
+
*/OW.exports=function(t){let{populate:r,...n}=t,i=AW(n);if(r!=null){i.populate={};for(let s of Object.keys(r)){if(wW.has(s))continue;i.populate[s]=DS(r[s])}}return i};function DS(e){if(Array.isArray(e))return e.map(DS);if(e==null||typeof e!=="object")return e;let{populate:t,_docs:r,_childDocs:n,...i}=e,s=e instanceof _W?new _W(i):AW(i);if(t!==void 0)s.populate=DS(t);return s}});var r_=g(function(v6e,CW){var Ife=Sh(),$fe=su();/*!
|
|
863
|
+
* ignore
|
|
864
|
+
*/CW.exports=function e(t){if(t==null)return!1;let r=Object.keys(t),n=r.length;if(n===0)return!1;for(let i=0;i<n;++i){let s=r[i];if(s.startsWith("+"))continue;if(Ife(t[s])&&!!t[s])if($fe(t[s]))return e(t[s]);else return!!t[s]}return!1}});var DW=g(function(k6e,bW){bW.exports=function(t,r){return t===r||r.startsWith(t+".")}});var TW=g(function(vr){/*!
|
|
865
|
+
* Module dependencies.
|
|
866
|
+
*/var TS=vr.specialProperties=["__proto__","constructor","prototype"],n_=vr.clone=function e(t,r){if(t===void 0||t===null)return t;if(Array.isArray(t))return vr.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(xfe(t))return vr.cloneObject(t,r);if(t.valueOf)return t.valueOf()};/*!
|
|
867
|
+
* ignore
|
|
868
|
+
*/vr.cloneObject=function(t,r){let n=r&&r.minimize,i={},s=Object.keys(t),o=s.length,u=!1,a,c="",l=0;for(l=0;l<o;++l){if(c=s[l],TS.indexOf(c)!==-1)continue;if(a=n_(t[c],r),!n||typeof a<"u")u||(u=!0),i[c]=a}return n?u&&i:i};vr.cloneArray=function(t,r){let n=[],i=t.length,s=0;for(;s<i;s++)n.push(n_(t[s],r));return n};vr.merge=function e(t,r){let n=Object.keys(r);for(let i of n){if(TS.indexOf(i)!==-1)continue;if(!Object.prototype.hasOwnProperty.call(t,i)||typeof t[i]>"u")t[i]=r[i];else if(vr.isObject(r[i]))e(t[i],r[i]);else t[i]=r[i]}};vr.mergeClone=function e(t,r){let n=Object.keys(r);for(let i of n){if(TS.indexOf(i)!==-1)continue;if(!Object.prototype.hasOwnProperty.call(t,i)||typeof t[i]>"u")t[i]=n_(r[i]);else if(vr.isObject(r[i]))e(t[i],r[i]);else t[i]=n_(r[i])}};vr.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};vr.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 Rfe=Object.prototype.toString;vr.toString=function(e){return Rfe.call(e)};var xfe=vr.isObject=function(e){return vr.toString(e)=="[object Object]"};vr.keys=Object.keys;vr.create=typeof Object.create=="function"?Object.create:vfe;function vfe(e){if(arguments.length>1)throw Error("Adding properties is not supported");function t(){}return t.prototype=e,new t}vr.inherits=function(e,t){e.prototype=vr.create(t.prototype),e.prototype.constructor=e};vr.isArgumentsObject=function(e){return Object.prototype.toString.call(e)==="[object Arguments]"}});var PW=g(function(MW){var cr=MW;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 MS=g(function(Mo,BW){Mo.isNode=typeof process<"u"&&typeof BW=="object"&&typeof global=="object"&&typeof Buffer=="function"&&process.argv;Mo.isMongo=!Mo.isNode&&typeof printjson=="function"&&typeof ObjectId=="function"&&typeof rs=="function"&&typeof sh=="function";Mo.isBrowser=!Mo.isNode&&!Mo.isMongo&&typeof window<"u";Mo.type=Mo.isNode?"node":Mo.isMongo?"mongo":Mo.isBrowser?"browser":"unknown"});var Jd=g(function(FW,NW){var PS=["find","findOne","updateMany","updateOne","replaceOne","countDocuments","estimatedDocumentCount","distinct","findOneAndDelete","findOneAndReplace","findOneAndUpdate","aggregate","findCursor","deleteOne","deleteMany"];function BS(){}for(let e=0,t=PS.length;e<t;++e){let r=PS[e];BS.prototype[r]=kfe(r)}NW.exports=FW=BS;BS.methods=PS;function kfe(e){return function(){throw Error("collection."+e+" not implemented")}}});var xW=g(function($W,RW){var qfe=Jd();class IW extends qfe{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)}}RW.exports=$W=IW});var kW=g(function(L6e,vW){var Zh=MS();if(Zh.type=="unknown")throw Error("Unknown environment");vW.exports=Zh.isNode?xW():Zh.isMongo?Jd():Jd()});var $S=g(function(LW,UW){var jW=require("assert"),i_=require("util"),ne=TW(),Yu=i_.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,i){if(!(this instanceof t))return new t(n,i);U.call(this,n,i)}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 i=Array.isArray(e[r])?e[r]:[e[r]];this[r].apply(this,i)}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(Xd(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=Qu(this._conditions,t),i=n===null||typeof n==="object"?n:this._conditions[t]={};return i["$"+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=Qu(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=Qu(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=Qu(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=Qu(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=Qu(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=Qu(this._conditions,e)||(this._conditions[e]={}),n=t.spherical?"$centerSphere":"$center",i=this._geoComparison||"$geoWithin";if(r[i]={},r[i][n]=[t.center,t.radius],"unique"in t)r[i].$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=Qu(this._conditions,t)||(this._conditions[t]={}),i=r.spherical?"$nearSphere":"$near";if(Array.isArray(r.center)){n[i]=r.center;let s="maxDistance"in r?r.maxDistance:null;if(s!=null)n.$maxDistance=s;if(r.minDistance!=null)n.$minDistance=r.minDistance}else{if(r.center.type!="Point"||!Array.isArray(r.center.coordinates))throw Error(i_.format("Invalid GeoJSON specified for %s",i));if(n[i]={$geometry:r.center},"maxDistance"in r)n[i].$maxDistance=r.maxDistance;if("minDistance"in r)n[i].$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=Qu(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,i,s;if((n=="string"||ne.isArgumentsObject(t))&&typeof t.length=="number"||Array.isArray(t)){if(n=="string")t=t.split(/\s+/);for(i=0,s=t.length;i<s;++i){let o=t[i];if(!o)continue;let u=o[0]=="-"?0:1;if(u===0)o=o.substring(1);Xd(o),r[o]=u}return this}if(ne.isObject(t)){let o=ne.keys(t);for(i=0;i<o.length;++i){if(ne.specialProperties.indexOf(o[i])!==-1)continue;r[o[i]]=t[o[i]]}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 i=Object.keys(n),s=i.length;for(let o=0;o<s;++o){if(ne.specialProperties.indexOf(i[o])!==-1)continue;this.slice(i[o],n[i[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]];Xd(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 i=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");jfe(this.options,e[t][0],e[t][1])}return this}if(arguments.length===1&&i=="string"){e=e.split(/\s+/),r=e.length;for(t=0;t<r;++t){if(n=e[t],!n)continue;let s=n[0]=="-"?-1:1;if(s===-1)n=n.substring(1);Xd(n),qW(this.options,n,s)}return this}if(ne.isObject(e)){let s=ne.keys(e);for(t=0;t<s.length;++t){if(n=s[t],ne.specialProperties.indexOf(n)!==-1)continue;qW(this.options,n,e[n])}return this}if(typeof Map<"u"&&e instanceof Map)return Lfe(this.options,e),this;throw TypeError("Invalid sort() argument. Must be a string, object, or array.")};/*!
|
|
873
|
+
* @ignore
|
|
874
|
+
*/var FS={1:1,"-1":-1,asc:1,ascending:1,desc:-1,descending:-1};function qW(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 i=String(r||1).toLowerCase();if(i=FS[i],!i)throw TypeError("Invalid sort value: { "+t+": "+r+" }");n[t]=i}function jfe(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=FS[n],!n)throw TypeError("Invalid sort value: [ "+t+", "+r+" ]");e.sort.push([t,n])}function Lfe(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 i=String(r||1).toLowerCase();if(i=FS[i],!i)throw TypeError("Invalid sort value: < "+n+": "+r+" >");e.sort.set(n,i)})}/*!
|
|
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 Yu("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 Yu("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 Yu("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 Yu("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 Yu("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 NS(this,"updateMany",t,r,n)};U.prototype._updateMany=async function(){return IS(this,"updateMany")};U.prototype.updateOne=function(t,r,n){return NS(this,"updateOne",t,r,n)};U.prototype._updateOne=async function(){return IS(this,"updateOne")};U.prototype.replaceOne=function(t,r,n){return this.setOptions({overwrite:!0}),NS(this,"replaceOne",t,r,n)};U.prototype._replaceOne=async function(){return IS(this,"replaceOne")};/*!
|
|
881
|
+
* Internal helper for updateMany, updateOne
|
|
882
|
+
*/function NS(e,t,r,n,i){if(e.op=t,U.canMerge(r))e.merge(r);if(n)e._mergeUpdate(n);if(ne.isObject(i))e.setOptions(i);return e}async function IS(e,t){let r=e._optionsForExec(),n=e._conditions,i=e._updateForExec();return Yu(t,e._collection.collectionName,n,i,r),e._collection[t](n,i,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 Yu("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 Yu("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 Yu("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;jW.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 Qu(e,t){return Xd(t),Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Xd(e){if(e!=null&&ne.specialProperties.indexOf(String(e))!==-1)throw Error("Cannot use `"+e+"` as a query path")}/*!
|
|
883
|
+
* Permissions
|
|
884
|
+
*/U.permissions=PW();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=MS();U.Collection=kW();U.BaseCollection=Jd();UW.exports=LW=U});var s_=g(function(U6e,VW){VW.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 i=t.length,s={};for(let o=0;o<i;++o){let u=t[o];if(!u)continue;let a=u.charAt(0)==="-"?0:1;if(!r&&a===0)u=u.slice(1);s[u]=a}return s}});var HW=g(function(V6e,WW){WW.exports=function(t,r){let n=r?.arrayFilters;if(!Array.isArray(n))return;let i=Object.keys(t).map((s)=>Object.keys(t[s])).reduce((s,o)=>s.concat(o),[]);r.arrayFilters=r.arrayFilters.filter((s)=>zW(s,i))};function zW(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((s)=>zW(s,t))!=null}let n=r.indexOf("."),i=n===-1?r:r.slice(0,n);return t.find((s)=>s.includes("$["+i+"]"))!=null}});var o_=g(function(z6e,KW){/*!
|
|
887
|
+
* ignore
|
|
888
|
+
*/KW.exports=function(t){if(typeof t!=="object"||t===null)return!1;let r=Object.keys(t),n=r.length;for(let i=0;i<n;++i)if(r[i][0]==="$")return!0;return!1}});var RS=g(function(W6e,GW){var Ufe=ze(),Vfe=o_(),{logicalOperators:zfe}=Nd(),{trustedSymbol:Wfe}=ph();GW.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 i=t[n];if(i?.[Wfe])continue;if(zfe.has(n)){e(i);continue}else if(n[0]==="$")throw new Ufe(n+" is not allowed with sanitizeFilter");if(Vfe(i)){let s=Object.keys(i);if(s.length===1&&s[0]==="$eq")continue;t[n]={$eq:t[n]}}}return t}});var QW=g(function(H6e,YW){YW.exports=function(t){if(t==null)return;let r=Object.keys(t);for(let n=0;n<r.length;++n){let i=t[r[n]];if(typeof i==="string"){t[r[n]]=1;continue}if(i==null||typeof i!=="object")continue;let s=i.$slice;if(!(i.$meta==="textScore"||i.$elemMatch!=null||typeof s==="number"||Array.isArray(s)&&s.every((u)=>typeof u==="number")))t[r[n]]=1}}});var ZW=g(function(K6e,XW){var Hfe=Xc(),Kfe=r_();/*!
|
|
889
|
+
* ignore
|
|
890
|
+
*/XW.exports=function(t,r,n){if(n==null)return;let i=Object.keys(n);if(r=r||{},Kfe(t))for(let s of i){if(!JW(r,s))t[s]=1;else if(r[s]===0)delete t[s];let o=n[s]?.refPath;if(typeof o==="string"){if(!JW(r,o))t[o]=1;else if(r[o]===0)delete t[o]}}else if(Hfe(t))for(let s of i){if(r[s]==null)delete t[s];let o=n[s]?.refPath;if(typeof o==="string"&&r[o]==null)delete t[o]}};/*!
|
|
891
|
+
* ignore
|
|
892
|
+
*/function JW(e,t){let r=t.split("."),n=r.length,i=r[0];for(let s=1;s<n;++s){if(e[i]!=null||e[i+".$"]!=null)return!0;i+="."+r[s]}return e[i]!=null||e[i+".$"]!=null}});var rH=g(function(G6e,tH){/*!
|
|
893
|
+
* Module dependencies.
|
|
894
|
+
*/var Gfe=Dd(),eH=JO().flatten,Yfe=Fn();tH.exports=async function(t,r,n,i){let s=Object.keys(n||{}),o={},u={},a={},c={},l=s.length,f=!1,h,d;for(let A=0;A<l;++A)if(s[A].startsWith("$")){if(f=!0,s[A]==="$push"||s[A]==="$addToSet"){let q=Object.keys(n[s[A]]);for(let I=0;I<q.length;++I)if(h=n[s[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=eH(n[s[A]],null,null,r),S=Object.keys(P),B=S.length;for(let q=0;q<B;++q){let I=Gfe(S[q]);if(d=s[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=eH(n,null,null,r),o=Object.keys(u);let p=Object.keys(u),m=p.length,E=[],y=[],_=null,O=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]&&Jfe(r,p[A]))continue;if(a[p[A]]&&S.$isMongooseArray)continue;if(P&&Array.isArray(P.$in))P.$in.forEach((B,q)=>{E.push(S.doValidate(B,O,{updateValidator:!0}).catch((I)=>{I.path=p[A]+".$in."+q,y.push(I)}))});else{if(_!=null&&Qfe(_,p[A]))continue;if(S.$isMongooseDocumentArrayElement&&Yfe(P))_??=new Set,_.add(p[A]),E.push(S.doValidate(P,O,{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)_??=new Set,_.add(p[A]);E.push(S.doValidate(P,O,{updateValidator:!0}).catch((B)=>{if(B)B.path=p[A],y.push(B)}))}}}let b=Object.keys(c);for(let A of b){let P=r._getSchema(A);if(P&&P.$isMongooseDocumentArray)E.push(P.doValidate(c[A],i?.context==="query"?t:null).catch((S)=>{S.path=A,y.push(S)}));else{P=r._getSchema(A+".0");for(let S of c[A])E.push(P.doValidate(S,i?.context==="query"?t:null,{updateValidator:!0}).catch((B)=>{B.path=A,y.push(B)}))}}return await Promise.all(E),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 Qfe(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 Jfe(e,t){let r=t.lastIndexOf(".");if(r===-1)return!1;return e._getSchema(t.slice(0,r))?.instance==="Mixed"}});var l_=g(function(Y6e,mH){/*!
|
|
902
|
+
* Module dependencies.
|
|
903
|
+
*/var Zd=ei(),Xfe=Q2(),ep=Gc(),Ot=ze(),Ju=og(),xS=dW(),tp=Qc(),{applyGlobalMaxTimeMS:rp,applyGlobalDiskUse:np}=SS(),Zfe=Bw(),ede=CS(),tde=bS(),rde=ol(),nde=cS(),u_=Pd(),ide=uS(),zi=ar(),kS=SW(),sde=zE(),sH=Vs(),mu=Ed(),ode=Ao().internalToObjectOptions,ude=Xc(),ade=r_(),cde=Fn(),lde=mg(),nH=DW(),{logicalOperators:hde}=Nd(),a_=ss(),ip=$S(),fde=s_(),LS=HW(),dde=RS(),oH=QW(),{buildMiddlewareFilter:uH}=qu(),pde=ZW(),US=lS(),eo=oc(),mde=rH(),to=require("util"),ee=be(),yde=Td().queryMiddlewareFunctions,{createTracedChannel:gde}=Jh(),{trace:Ede}=gde("mongoose:query"),_de=new Set(["allowDiskUse","batchSize","collation","comment","explain","hint","j","lean","limit","maxTimeMS","populate","projection","read","select","skip","slice","sort","tailable","w","writeConcern","wtimeout"]),Ade=new Set(["find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate"]),wde=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 ep,this._execCount=0;let i=Object.keys(t);for(let o of i)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(ip.call(this,null,t),n)this.collection(n);if(e)this.find(e);this.options=this.options||{},this.$useProjection=!0;let s=this?.schema?.options?.collation||null;if(s!=null)this.options.collation=s}function qS(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(qS))continue;if(t==="$or"&&(r.length===0||r.some(qS)))continue;return!1}return!0}function gc(e,t){if(t?.requireFilter&&qS(e))throw new Ot("Empty or invalid filter not allowed with requireFilter enabled")}/*!
|
|
904
|
+
* inherit mquery
|
|
905
|
+
*/L.prototype=new ip;L.prototype.constructor=L;Object.defineProperty(L.prototype,"_update",{configurable:!0,enumerable:!0,get:function(){return fl(this),this[H]},set:function(e){this[H]=e}});L.prototype.count=void 0;L.prototype.findOneAndRemove=void 0;L.base=ip.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=kS(i._mongooseOptions),L.call(this,o,u||null,t,r)};to.inherits(n,t.Query);let i=n.prototype;i.options={};let s=Object.assign({},this.options);if(s.sort!=null)i.sort(s.sort),delete s.sort;return i.setOptions(s),i.op=this.op,i._conditions=zi(this._conditions),i._fields=zi(this._fields),i[H]=zi(this[H],{flattenDecimals:!1}),i._path=this._path,i._distinct=this._distinct,i._collection=this._collection,i._mongooseOptions=kS(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=zi(this._conditions),r._fields=zi(this._fields),r[H]=zi(this[H],{flattenDecimals:!1}),r._path=this._path,r._distinct=this._distinct,r._collection=this._collection,r._mongooseOptions=kS(this._mongooseOptions),r};L.prototype.where=function(t){if(typeof t==="string"&&eo.has(t))throw new Ot(`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 i=e[0];if(typeof i==="object"&&!Array.isArray(i)){let s=Object.keys(i),o=s.length;for(let u=0;u<o;++u)this.slice(s[u],i[s[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 Ode=new Set(yde);L.prototype._validateOp=function(){if(this.op!=null&&!Ode.has(this.op))this.error(Error('Query has invalid `op`: "'+this.op+'"'));if(this.op!=="estimatedDocumentCount"&&this._conditions==null)throw new Ju(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 Ot(`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=u_(t)}catch{throw new Zd("Number",t,"limit")}return this.options.limit=t,this};L.prototype.skip=function(t){if(this._validate("skip"),typeof t==="string")try{t=u_(t)}catch{throw new Zd("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 Ot("Invalid select: select only takes 1 argument");this._validate("select");let r=this._fields||(this._fields={}),n=this._userProvidedFields||(this._userProvidedFields={}),i=void 0;if(this.model!=null&&ee.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))i=this.model.db.options.sanitizeProjection;else if(this.model!=null&&ee.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))i=this.model.base.options.sanitizeProjection;else i=this._mongooseOptions.sanitizeProjection;function s(o){return typeof o==="string"&&i?o=1:o}if(t=fde(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]=s(u)}else Object.keys(n).forEach((a)=>{if(nH(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]=s(u)}else Object.keys(n).forEach((a)=>{if(nH(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]=s(a),n[c]=s(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=Zfe(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&&zi(e)||{},this.options=e||{},"populate"in e)this.populate(this._mongooseOptions);return this}if(e==null)return this;if(typeof e!=="object")throw new Ot('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 i=0;i<n;++i)this.populate(r[i])}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)oH(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=u_(e.limit)}catch{throw new Zd("Number",e.limit,"limit")}if(typeof e.skip==="string")try{e.skip=u_(e.skip)}catch{throw new Zd("Number",e.skip,"skip")}for(let r of Object.keys(e))if(_de.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:zi(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 zi(this._fields)};L.prototype._updateForExec=function(){let e=zi(this[H],{transform:!1,depopulate:!0}),t=Object.keys(e),r=t.length,n={};while(r--){let i=t[r];if(i[0]!=="$"){if(!n.$set)if(e.$set)n.$set=e.$set;else n.$set={};if(n.$set[i]=e[i],t.splice(r,1),!~t.indexOf("$set"))t.push("$set")}else if(i==="$set"){if(!n.$set)n[i]=e[i]}else n[i]=e[i]}return n};L.prototype._optionsForExec=function(e){let t=zi(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&&Ade.has(this.op)){let i=this.schema?.options.defaultSort;if(i&&!aH(this._conditions))t.sort=cH({},i)}ede(e.schema,t),tde(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 i=this._fieldsForExec();if(i!=null)t.projection=i}return t};L.prototype.lean=function(e){return this._mongooseOptions.lean=arguments.length?e:!0,this};L.prototype.set=function(e,t){if(fl(this),typeof e==="object"){let n=Object.keys(e);for(let i of n)this.set(i,e[i]);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 Zd))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)dde(this._conditions);try{this.cast(this.model),this._unsetCastError()}catch(t){this.error(t)}};/*!
|
|
911
|
+
* ignore
|
|
912
|
+
*/function c_(e){try{nde(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,i=this.model.base.options;rp(this.options,n,i),np(this.options,n,i);let s={session:this?.options?.session||null,lean:t.lean||null};if(t.defaults!=null)s.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?hH(this.model.schema,l,null,s):this._completeMany(l,a,r,s)}let f=mu.preparePopulationOptionsMQ(this,t);if(this.options?._deferPopulate)return l=t.lean?l:await this._completeMany(l,a,r,s),this._deferredPopulate=f,l;if(t.lean)return this.model.populate(l,f);return l=await this._completeMany(l,a,r,s),await this.model.populate(l,f),l};L.prototype.find=function(e){if(typeof e==="function"||typeof arguments[1]==="function")throw new Ot("Query.prototype.find() no longer accepts a callback");if(this.op="find",Xu(e))this.merge(e),sp(this);else if(e!=null)this.error(new Ju(e,"filter","find"));return this};L.prototype.findAndCount=async function(){if(this.options.sort==null&&!this.schema?.options.defaultSort)throw new Ot("Query.prototype.findAndCount() requires sort. Use `sort()` to set a sort order before calling `findAndCount()`.");if(ee.isEmptyObject(this.options.sort))throw new Ot("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 Ot("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)fl(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(cde(e))e=e.toObject(ode);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 i=this.model,s=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?jS(i.schema,e,null,t,u,n):iH(i,e,t,u,r,s,null,n)}let a=mu.preparePopulationOptionsMQ(this,this._mongooseOptions);if(o.lean)return i.populate(e,a).then((c)=>{jS(i.schema,c,null,t,u,n)},(c)=>{n(c)});iH(i,e,t,u,r,s,[],(c,l)=>{if(c!=null)return n(c);i.populate(l,a).then((f)=>{n(null,f)},(f)=>{n(f)})})};L.prototype._completeMany=async function(t,r,n,i){let s=this.model;return Promise.all(t.map((o)=>new Promise((u,a)=>{let c=o;if(o=mu.createModel(s,o,r,n,i),i.session!=null)o.$session(i.session);o.$init(c,i,(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;rp(this.options,t,r),np(this.options,t,r);let n=this._optionsForExec(),i=await this.mongooseCollection.findOne(this._conditions,n);return new Promise((s,o)=>{this._completeOne(i,null,n.projection,(u,a)=>{if(u)return o(u);s(a)})})};L.prototype.findOne=function(e,t,r){if(typeof e==="function"||typeof t==="function"||typeof r==="function"||typeof arguments[3]==="function")throw new Ot("Query.prototype.findOne() no longer accepts a callback");if(this.op="findOne",r)this.setOptions(r);if(t)this.select(t);if(Xu(e))this.merge(e),sp(this);else if(e!=null)this.error(new Ju(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;rp(this.options,t,r),np(this.options,t,r);let n=this._optionsForExec(),i=this._conditions;return this.mongooseCollection.countDocuments(i,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(fl(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 Ot("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 Ot("Query.prototype.countDocuments() no longer accepts a callback");if(this.op="countDocuments",Xu(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;rp(this.options,t,r),np(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 Ot("Query.prototype.distinct() no longer accepts a callback");if(this.op="distinct",Xu(t))this.merge(t),sp(this);else if(t!=null)this.error(new Ju(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 Ot("sort() takes at most 2 arguments");if(t!=null&&typeof t!=="object")throw new Ot("sort() options argument must be an object or nullish");if(this.options.sort==null)this.options.sort={};if(t?.override)this.options.sort={};return cH(this.options.sort,e),this};/*!
|
|
916
|
+
* Returns true if `filter` has a `$near` or `$nearSphere` condition, including within logical operators.
|
|
917
|
+
*/function aH(e){for(let t of Object.keys(e)){let r=e[t];if(r==null||typeof r!=="object")continue;if(hde.has(t)){if(Array.isArray(r)&&r.some((n)=>n!=null&&typeof n==="object"&&aH(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 cH(e,t){if(typeof t==="string"){let r=t.indexOf(" ")===-1?[t]:t.split(" ");for(let n of r){let i=n[0]=="-"?-1:1;if(i===-1)n=n.slice(1);if(eo.has(n))continue;e[n]=i}}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]=vS(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]=vS(t[r],r)}else if(t instanceof Map)for(let r of t.keys()){if(r=""+r,eo.has(r))continue;e[r]=vS(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 vS(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 Ot("Query.prototype.deleteOne() no longer accepts a callback");if(this.op="deleteOne",this.setOptions(r),Xu(t))this.merge(t),sp(this);else if(t!=null)this.error(new Ju(t,"filter","deleteOne"));return this};L.prototype._deleteOne=async function(){if(this._applyTranslateAliases(),this._castConditions(),gc(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 Ot("Query.prototype.deleteMany() no longer accepts a callback");if(this.setOptions(t),this.op="deleteMany",Xu(e))this.merge(e),sp(this);else if(e!=null)this.error(new Ju(e,"filter","deleteMany"));return this};L.prototype._deleteMany=async function(){if(this._applyTranslateAliases(),this._castConditions(),gc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this._optionsForExec();return this.mongooseCollection.deleteMany(this._conditions,t)};function iH(e,t,r,n,i,s,o,u){if(n.includeResultMetadata&&t==null)return a(null),null;mu.createModelAndInit(e,t,i,s,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 sp(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 Ot("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(Xu(e))this.merge(e);else if(e!=null)this.error(new Ju(e,"filter","findOneAndUpdate"));if(r=r?zi(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,i=this?.model?.base?.options?.returnOriginal;if(r.new==null&&r.returnDocument==null&&r.returnOriginal==null){if(n!=null)r.returnDocument=n;else if(i!=null)r.returnOriginal=i}let s=this?.model?.base?.options?.updatePipeline;if(r.updatePipeline==null&&s!=null)r.updatePipeline=s;if(!r.updatePipeline&&Array.isArray(t))throw new Ot("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(),gc(this._conditions,this.options),c_(this),this.error())throw this.error();let t=this.model.db.options,r=this.model.base.options;rp(this.options,t,r),np(this.options,t,r);let n=this._optionsForExec(this.model);if(lH(n),this[H]=this._castUpdate(this[H]),this._updateIsShared=!1,sde(this[H],n,this.schema.options.versionKey),this[H]=US(this._conditions,this.model.schema,this[H],n,this._mongooseOptions,this),!this[H]||ee.hasOwnKeys(this[H])===!1)if(n.upsert){let u=zi(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(op(this,"runValidators",!1))await this.validate(this[H],n,!1);if(typeof this[H].toBSON==="function")this[H]=this[H].toBSON();let s=await this.mongooseCollection.findOneAndUpdate(this._conditions,this[H],n);for(let u of this._transforms)s=u(s);let o=!n.includeResultMetadata?s:s.value;return new Promise((u,a)=>{this._completeOne(o,s,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 Ot("Query.prototype.findOneAndDelete() no longer accepts a callback");if(this.op="findOneAndDelete",this._validate(),Xu(e))this.merge(e);return t&&this.setOptions(t),this};L.prototype._findOneAndDelete=async function(){if(this._applyTranslateAliases(),this._castConditions(),gc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this.options.includeResultMetadata,r=this._conditions,n=this._optionsForExec(this.model),i=await this.mongooseCollection.findOneAndDelete(r,n);for(let o of this._transforms)i=o(i);let s=!t?i:i.value;return new Promise((o,u)=>{this._completeOne(s,i,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 Ot("Query.prototype.findOneAndReplace() no longer accepts a callback");if(this.op="findOneAndReplace",this._validate(),Xu(e))this.merge(e);else if(e!=null)this.error(new Ju(e,"filter","findOneAndReplace"));if(t!=null)this._mergeUpdate(t);r=r||{};let n=this?.model?.base?.options?.returnDocument,i=this?.model?.base?.options?.returnOriginal;if(r.new==null&&r.returnDocument==null&&r.returnOriginal==null){if(n!=null)r.returnDocument=n;else if(i!=null)r.returnOriginal=i}return this.setOptions(r),this};L.prototype._findOneAndReplace=async function(){if(this._applyTranslateAliases(),this._castConditions(),gc(this._conditions,this.options),this.error()!=null)throw this.error();let t=this._conditions,r=this._optionsForExec();lH(r);let n=this.options.includeResultMetadata,i={skipId:!0};if("strict"in this._mongooseOptions)i.strict=this._mongooseOptions.strict;let s=op(this,"runValidators",!1);try{let a=new this.model(this[H],null,i);if(s)await a.validate();else if(a.$__.validationError)throw a.$__.validationError;this[H]=a.toBSON()}catch(a){if(a instanceof tp)throw a;let c=new tp;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 lH(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 op(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 jS(e,t,r,n,i,s){if(i.lean&&typeof i.lean.transform==="function"){i.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=a_.get(u,t);if(c==null)continue;if(Array.isArray(c))for(let l=0;l<c.length;l++)i.lean.transform(c[l]);else i.lean.transform(c);jS(a,c,u,n,i)}if(s)return s(null,t);else return}if(i.includeResultMetadata)return s(null,n);return s(null,t)}/*!
|
|
924
|
+
* ignore
|
|
925
|
+
*/function hH(e,t,r,n){if(n.lean&&typeof n.lean.transform==="function"){for(let i of t)n.lean.transform(i);for(let i=0;i<e.childSchemas.length;i++){let s=r?r+"."+e.childSchemas[i].model.path:e.childSchemas[i].model.path,o=e.childSchemas[i].schema,u=a_.get(s,t);if(u==null)continue;u=u.flat();for(let a=0;a<u.length;a++)n.lean.transform(u[a]);hH(o,u,s,n)}}return t}L.prototype._mergeUpdate=function(e){if(fl(this),!this._mongooseOptions.updatePipeline&&Array.isArray(e))throw new Ot("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 Ot(`Cannot mix array and object updates (current: ${ef(this[H])}, incoming: ${ef(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 Ot(`Cannot mix array and object updates (current: ${ef(this[H])}, incoming: ${ef(e)})`);this[H]=this[H].concat(e)}else{if(Array.isArray(this[H]))throw new Ot(`Cannot mix array and object updates (current: ${ef(this[H])}, incoming: ${ef(e)})`);ee.mergeClone(this[H],e)}};function ef(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 Ot("Query.prototype.validate() no longer accepts a callback");if(await dH(this,"validate"),n)await t.$validate();else{let i=await mde(this,this.model.schema,t,r);if(i.length>0){let s=new tp(null);for(let o of i)s.addError(o.path,o);throw s}}await fH(this,null,null,"validate")};L.prototype._updateMany=async function(){if(this._applyTranslateAliases(),this._castConditions(),gc(this._conditions,this.options),c_(this),this.error()!=null)throw this.error();let t=this._optionsForExec(this.model);if(fl(this),this[H]=this._castUpdate(this[H]),this[H]==null||ee.hasOwnKeys(this[H])===!1)return{acknowledged:!1};if(LS(this[H],t),this[H]=US(this._conditions,this.model.schema,this[H],t,this._mongooseOptions,this),op(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(),gc(this._conditions,this.options),c_(this),this.error()!=null)throw this.error();let t=this._optionsForExec(this.model);if(fl(this),this[H]=this._castUpdate(this[H]),this[H]==null||ee.hasOwnKeys(this[H])===!1)return{acknowledged:!1};if(LS(this[H],t),this[H]=US(this._conditions,this.model.schema,this[H],t,this._mongooseOptions,this),op(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(),gc(this._conditions,this.options),c_(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=op(this,"runValidators",!1);try{if(this[H]=new this.model(this[H],null,r),LS(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(i){if(i instanceof tp)throw i;let s=new tp;throw s.errors[i.path]=i,s}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 VS(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 VS(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 VS(this,"replaceOne",e,t,r,n)};function VS(e,t,r,n,i,s){if(e.op=t,n=n||{},!(r instanceof L)&&r!=null&&r.toString()!=="[object Object]")e.error(new Ju(r,"filter",t));else e.merge(r);let o=e?.model?.base?.options?.updatePipeline;if(o!=null&&i?.updatePipeline==null)i=i||{},i.updatePipeline=o;if(!i?.updatePipeline&&Array.isArray(n))throw new Ot("Cannot pass an array to query updates unless the `updatePipeline` option is set.");if(ee.isObject(i))e.setOptions(i);if(e[H]==null||ee.isEmptyObject(e[H]))e[H]=n,e._updateIsShared=!0;else e._mergeUpdate(n);if(s)return e.exec(s),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 tf(e,this);break;case"findOne":if(t==null)throw tf(e,this);break;case"replaceOne":case"updateMany":case"updateOne":if(t?.matchedCount===0)throw tf(e,this);break;case"findOneAndDelete":case"findOneAndUpdate":case"findOneAndReplace":if(this.options.includeResultMetadata&&t!=null&&t.value==null)throw tf(e,this);if(!this.options.includeResultMetadata&&t==null)throw tf(e,this);break;case"deleteMany":case"deleteOne":if(t.deletedCount===0)throw tf(e,this);break;default:break}return t}),this};function tf(e,t){if(typeof e==="function")e=e.call(t);if(e==null)e=new Xfe(t.getQuery(),t.model.modelName);return e}L.prototype.isPathSelectedInclusive=function(e){return lde(this._fields,e)};L.prototype.exec=async function(t){if(typeof t==="function"||arguments.length>=2&&typeof arguments[1]==="function")throw new Ot("Query.prototype.exec() no longer accepts a callback");if(this._validateOp(),typeof t==="string")this.op=t;if(this.op==null)throw new Ot("Query must have `op` before executing");if(this.model==null)throw new Ot("Query must have an associated model before executing");let r=wde.get(this.op);if(!r)throw new Ot('Query has invalid `op`: "'+this.op+'"');if(this.options?.sort&&typeof this.options.sort==="object"&&Object.hasOwn(this.options.sort,""))throw new Ot('Invalid field "" passed to sort()');if(this._execCount>0){let i=this.toString();if(i.length>60)i=i.slice(0,60)+"...";throw new Ot("Query was already executed: "+i)}this._execCount++;let n=this;return Ede(async function(){let s=null;try{await n._hooks.execPre("exec",n,[])}catch(a){if(a instanceof ep.skipWrappedFunction)s=a;else throw a}let o,u=null;try{await dH(n),o=s?s.args[0]:await n[r]();for(let a of n._transforms)o=a(o)}catch(a){if(a instanceof ep.skipWrappedFunction)o=a.args[0];else u=a;u=n.model.schema._transformDuplicateKeyError(u)}return o=await fH(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 fH(e,t,r,n){if(e._queryMiddleware==null){if(r!=null)throw r;return t}let s={filter:uH(e.options,"post")};if(r)s.error=r;let[o]=await e._queryMiddleware.execPost(n||e.op,e,[t],s);return o}/*!
|
|
928
|
+
* ignore
|
|
929
|
+
*/function dH(e,t){if(e._queryMiddleware==null)return;let r=uH(e.options,"pre");return e._queryMiddleware.execPre(t||e.op,e,[],{filter:r})}function fl(e){if(!e._updateIsShared)return;if(e.mongooseOptions().cloneUpdate===!1)return;e[H]=zi(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,i=r._baseSchema||r;if(this._mongooseOptions.overwriteDiscriminatorKey&&t[n]!=null&&i.discriminators){let o=Object.values(i.discriminators).find((u)=>u.discriminatorMapping.value===t[n]);if(o!=null)r=o}let s;if("upsert"in this.options)s=this.options.upsert;return ide(r,t,{strict:this._mongooseOptions.strict,upsert:s,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 i=r.lean;for(let s of t)if(s?.options?.lean==null)s.options=s.options||{},s.options.lean=i}if(!ee.isObject(r.populate))r.populate={};let n=r.populate;for(let i of t){let s=i.path;if(n[s]?.populate&&i.populate)i.populate=n[s].populate.concat(i.populate);n[i.path]=i}return this};L.prototype.getPopulatedPaths=function(){let t=this._mongooseOptions.populate||{},r=Object.keys(t);for(let n of Object.keys(t)){let i=t[n];if(!Array.isArray(i.populate))continue;pH(r,i.populate,n+".")}return r};/*!
|
|
930
|
+
* ignore
|
|
931
|
+
*/function pH(e,t,r){for(let n of t){if(e.push(r+n.path),!Array.isArray(n.populate))continue;pH(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=sH(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 rde(e.schema,t,n,this)}catch(i){if(typeof i.setModel==="function")i.setModel(e);throw i}};L.prototype._castFields=function(t){let r,n,i,s,o;if(t){i=Object.keys(t),n=[];for(let u=0;u<i.length;++u)if(s=i[u],t[s].$elemMatch)r||(r={}),r[s]=t[s],n.push(s)}if(r){o=this.cast(this.model,r);for(let u=0;u<n.length;++u)s=n[u],t[s]=o[s]}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)oH(this._fields);if(this._mongooseOptions.schemaLevelProjections??!0){let i=this.model.schema,s=i.options.discriminatorKey;if(this._conditions!=null&&Object.hasOwn(this._conditions,s))i=sH(this.model.discriminators,this._conditions[s])?.schema??i;mu.applyPaths(this._fields,i,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)pde(this._fields,this._userProvidedFields,this._mongooseOptions.populate)};L.prototype.cursor=function(t){if(t)this.setOptions(t);try{this._castConditions()}catch(r){return new xS(this)._markError(r)}if(this.error())return new xS(this)._markError(this.error());return new xS(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 ade(this._fields)};L.prototype.selectedExclusively=function(){return ude(this._fields)};L.prototype.model;function Xu(e){return e instanceof L||ee.isObject(e)||e===null}/*!
|
|
932
|
+
* Export
|
|
933
|
+
*/mH.exports=L});var wH=g(function(Q6e,AH){/*!
|
|
934
|
+
* Module dependencies.
|
|
935
|
+
*/var up=ze(),EH=require("stream").Readable,Sde=AS(),Cde=wS(),bde=ma(),_H=Gc(),h_=require("util"),{cursorNextChannel:Dde}=Jh(),{buildMiddlewareFilter:Tde}=qu();function Wi(e){EH.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:i,...s}=n;n=s}this.cursor=t.db.aggregate(e._pipeline,n),this._initializationComplete=!0,setImmediate(()=>this.emit("cursor",this.cursor))}else Mde(r,this,e)}h_.inherits(Wi,EH);/*!
|
|
936
|
+
* ignore
|
|
937
|
+
*/function Mde(e,t,r){let n=Tde(r.options,"pre");e.hooks.execPre("aggregate",r,[],{filter:n}).then(()=>i(null),(s)=>i(s));function i(s){if(s!=null){Pde(t,s);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([()=>yH(e,t,r)]);else yH(e,t,r)}}/*!
|
|
938
|
+
* ignore
|
|
939
|
+
*/function yH(e,t,r){try{let n=r.options;if(Object.hasOwn(n,"middleware")){let{middleware:s,...o}=n;n=o}let i=e.collection.aggregate(r._pipeline,n);t.cursor=i,t._initializationComplete=!0,t.emit("cursor",i)}catch(n){if(t._initializationComplete=!0,t._markError(n),t.listeners("error").length>0)t._errorEmitted=!0,t.emit("error",t._error)}}function Pde(e,t){if(e._initializationComplete=!0,t instanceof _H.skipWrappedFunction){let r=t.args[0];if(r!=null&&(!Array.isArray(r)||r.length)){let n=new up('Cannot `skipMiddlewareFunction()` with a value when using `.aggregate().cursor()`, value must be nullish or empty array, got "'+h_.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)}Wi.prototype._read=function(){let e=this;f_(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";Wi.prototype[Symbol.asyncIterator]=function(){throw new up(e)}}Object.defineProperty(Wi.prototype,"map",{value:function(e){return this._transforms.push(e),this},enumerable:!0,configurable:!0,writable:!0});Wi.prototype._markError=function(e){return this._error=e,this};Wi.prototype.close=async function(){if(typeof arguments[0]==="function")throw new up("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")};Wi.prototype._destroy=function(t,r){let n=null;if(!this._initializationComplete)n=Cde(this);else n=Promise.resolve();return n.then(()=>this.cursor?.close()).then(()=>{this._closed=!0;let i=!this._errorEmitted&&this.listeners("error").length>0;r(i?t:null)}).catch((i)=>{r(i)}),this};Wi.prototype.next=async function(){if(typeof arguments[0]==="function")throw new up("AggregationCursor.prototype.next() no longer accepts a callback");let t=this,r=this.agg._model;return Dde.trace(function(){return new Promise((i,s)=>{f_(t,(o,u)=>{if(o!=null)return s(o);i(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}}))};Wi.prototype.eachAsync=function(e,t){if(typeof arguments[2]==="function")throw new up("AggregationCursor.prototype.eachAsync() no longer accepts a callback");let r=this;if(typeof t==="function")t={};return t=t||{},Sde(function(n){return f_(r,n)},e,t)};if(Symbol.asyncIterator!=null)Wi.prototype[Symbol.asyncIterator]=function(){return this.transformNull()._transformForAsyncIterator()};/*!
|
|
940
|
+
* ignore
|
|
941
|
+
*/Wi.prototype._transformForAsyncIterator=function(){if(this._transforms.indexOf(gH)===-1)this.map(gH);return this};/*!
|
|
942
|
+
* ignore
|
|
943
|
+
*/Wi.prototype.transformNull=function(e){if(arguments.length===0)e=!0;return this._mongooseOptions.transformNull=e,this};/*!
|
|
944
|
+
* ignore
|
|
945
|
+
*/function gH(e){return e==null?{done:!0}:{value:e,done:!1}}Wi.prototype.addCursorFlag=function(e,t){let r=this;return Bde(this,function(){r.cursor.addCursorFlag(e,t)}),this};/*!
|
|
946
|
+
* ignore
|
|
947
|
+
*/function Bde(e,t){if(e.cursor)return t();e.once("cursor",function(){t()})}function f_(e,t){let r=t;if(e._transforms.length)r=function(n,i){if(n||i===null&&!e._mongooseOptions.transformNull)return t(n,i);t(n,e._transforms.reduce(function(s,o){return o(s)},i))};if(e._error)return bde(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(){f_(e,t)})}AH.exports=Wi});var zS=g(function(J6e,OH){OH.exports=function(t,r,n){let i=r?.discriminatorMapping;if(n=n||"",i&&!i.isRoot){let s=t,o=(n.length>0?n+".":n)+i.key,u=i.value;if(s[0]!=null&&s[0].$match&&(s[0].$match[o]===void 0||s[0].$match[o]===u))s[0].$match[o]=u;else if(s[0]?.$geoNear)s[0].$geoNear.query=s[0].$geoNear.query||{},s[0].$geoNear.query[o]=u;else if(s[0]?.$search)if(s[1]?.$match!=null)s[1].$match[o]=s[1].$match[o]||u;else{let a={};a[o]=u,s.splice(1,0,{$match:a})}else{let a={};a[o]=u,s.unshift({$match:a})}}}});var CH=g(function(X6e,SH){SH.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 s of Object.keys(n))Fde(n[s]);let i=Object.keys(r)[0];if(i&&typeof r[i]==="object"){let s=r[i];for(let o of Object.keys(s))if(s[o]!=null&&s[o].$function!=null&&typeof s[o].$function.body==="function")s[o].$function.body=s[o].$function.body.toString()}if(r.$facet!=null)for(let s of Object.keys(r.$facet))e(r.$facet[s])}};function Fde(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 HS=g(function(Z6e,MH){/*!
|
|
948
|
+
* Module dependencies
|
|
949
|
+
*/var TH=wH(),Ai=ze(),p_=l_(),{applyGlobalMaxTimeMS:Nde,applyGlobalDiskUse:Ide}=SS(),$de=ar(),Rde=Xn(),WS=zS(),{buildMiddlewareFilter:d_}=qu(),xde=CH(),rf=be(),{modelSymbol:vde}=de(),{createTracedChannel:kde}=Jh(),{trace:bH}=kde("mongoose:aggregate"),qde=p_.prototype.read,jde=p_.prototype.readConcern,DH=new Set(["$$DESCEND","$$PRUNE","$$KEEP"]);function Ze(e,t){if(this._pipeline=[],t==null||t[vde])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(Lde))throw new Ai("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 Ai("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 Ai("Invalid project() argument. Must be string or object");return this.append({$project:t})};Ze.prototype.near=function(e){if(e==null)throw new Ai("Aggregate `near()` must be called with non-nullish argument");if(e.near==null)throw new Ai("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 Ai(`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 Ai('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(!rf.isObject(e))throw TypeError("Invalid graphLookup() argument. Must be an object.");rf.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(Rde(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 qde.call(this,e,t),this};Ze.prototype.readConcern=function(e){return jde.call(this,e),this};Ze.prototype.redact=function(e,t,r){if(arguments.length===3){if(typeof t==="string"&&!DH.has(t)||typeof r==="string"&&!DH.has(r))throw new Ai("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 Ai("Aggregate.prototype.explain() no longer accepts a callback");let r=this._model;if(!this._pipeline.length)throw new Ai("Aggregate has empty pipeline");WS(this._pipeline,this._model.schema);let n=d_(this.options,"pre"),i=d_(this.options,"post"),{middleware:s,...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:i})}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:i})}return await r.hooks.execPost("aggregate",this,[a],{error:null,filter:i}),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(),rf.hasUserDefinedProperty(e,"middleware")){let{middleware:t,...r}=e;this.options.middleware=t,e=r}return this.options.cursor=e||{},new TH(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 Ai("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 Ai("Aggregate not bound to any Model");if(typeof arguments[0]==="function")throw new Ai("Aggregate.prototype.exec() no longer accepts a callback");if(this._connection){if(!this._pipeline.length)throw new Ai("Aggregate has empty pipeline");this._optionsForExec();let i=this;return bH(async function(){return await(await i._connection.client.db().aggregate(i._pipeline,i.options)).toArray()},()=>({operation:"aggregate",database:i._connection.name,serverAddress:i._connection.host,serverPort:i._connection.port,args:{pipeline:i._pipeline,options:i.options}}))}let t=this._model,r=this._model.collection;if(Nde(this.options,t.db.options,t.base.options),Ide(this.options,t.db.options,t.base.options),this._optionsForExec(),this.options?.cursor)return new TH(this);WS(this._pipeline,this._model.schema),xde(this._pipeline);let n=this;return bH(async function(){let s=d_(n.options,"pre"),o=d_(n.options,"post");try{await t.hooks.execPre("aggregate",n,[],{filter:s})}catch(l){return await t.hooks.execPost("aggregate",n,[null],{error:l,filter:o})}if(!n._pipeline.length)throw new Ai("Aggregate has empty pipeline");let{middleware:u,...a}=$de(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 Lde(e){if(typeof e!=="object"||e===null)return!1;let t=Object.keys(e);return t.length===1&&t[0][0]==="$"}Ze._prepareDiscriminatorPipeline=WS;/*!
|
|
954
|
+
* Exports
|
|
955
|
+
*/MH.exports=Ze});var BH=g(function(eAe,PH){var Ude=ar();class KS{constructor(e){if(e==null)return;Object.assign(this,Ude(e))}}KS.prototype.__subdocs=null;PH.exports=KS});var NH=g(function(tAe,FH){FH.exports=function e(t,r){let n=Object.keys(r.paths),i=n.length;for(let s=0;s<i;++s){let o="",u=n[s],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 YS=g(function(rAe,IH){IH.exports=GS;function GS(e,t=new WeakSet,r=!1){if(t.has(e))return;t.add(e);for(let n of Object.keys(e.paths)){let i=e.paths[n];if(!i.schema)continue;if(GS(i.schema,t),!i.schema._applyDiscriminators)continue;if(i._appliedDiscriminators&&!r)continue;for(let s of i.schema._applyDiscriminators.keys()){let{schema:o,options:u}=i.schema._applyDiscriminators.get(s);GS(o,t),i.discriminator(s,o,r?{...u,overwriteExisting:!0}:u)}i._appliedDiscriminators=!0}}});var xH=g(function(nAe,RH){var{buildMiddlewareFilter:$H,middlewareFiltersFromLastArg:Vde}=qu();/*!
|
|
956
|
+
* ignore
|
|
957
|
+
*/RH.exports=ap;/*!
|
|
958
|
+
* ignore
|
|
959
|
+
*/ap.middlewareFunctions=["deleteOne","remove","save","updateOne","validate","init"];/*!
|
|
960
|
+
* ignore
|
|
961
|
+
*/var zde=new Set(ap.middlewareFunctions.flatMap((e)=>[e,`$__${e}`]));function ap(e,t,r){r=r||{};let n={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0,contextParameter:!0},i=r.decorateDoc?e:e.prototype;e.$appliedHooks=!0;for(let c of Object.keys(t.paths)){let l=t.paths[c],f=null,h=QS(l);if(h)f=h.childModel,l=h.type;else continue;if(f.$appliedHooks)continue;if(ap(f,l.schema,{...r,decorateDoc:!1,isChildSchema:!0}),f.discriminators!=null){let d=Object.keys(f.discriminators);for(let p of d)ap(f.discriminators[p],f.discriminators[p].schema,r)}}let s=t._getDocumentMiddleware(e.prototype.$isSubdocument);e._middleware=s;let o=i.$__init;if(s.hasHooks("init"))i.$__init=s.createWrapperSync("init",o,null,{...n,getOptions:(c)=>{let l=c[1];return{pre:{filter:$H(l,"pre")},post:{filter:$H(l,"post")}}}});else i.$__init=o;let u=Object.keys(t.methods),a=Object.assign({},n,{checkForPromise:!0});for(let c of u){if(zde.has(c))continue;if(!s.hasHooks(c))continue;let l=i[c];i[`$__${c}`]=i[c];let f=l.supportsMiddlewareOption===!0?{...a,getOptions:Vde}:a;i[c]=s.createWrapper(c,l,null,f)}}function QS(e){if(e.$isSingleNested||e.$isMongooseDocumentArray)return{childModel:e.Constructor,type:e};if(e.instance==="Array"){let t=e.getEmbeddedSchemaType();if(t)return QS(t)}if(e.instance==="Map"){let t=e.getEmbeddedSchemaType();if(t)return QS(t)}return null}});var qH=g(function(iAe,kH){var Wde=Dr(),vH=be();kH.exports=function e(t,r){let n=JS();function i(s,o){Object.defineProperty(t.prototype,s,{get:function(){let u={};for(let a in o.methods[s])u[a]=o.methods[s][a].bind(this);return u},configurable:!0})}for(let s of Object.keys(r.methods)){let o=r.methods[s];if(Object.hasOwn(r.tree,s))throw Error('You have a method and a property in your schema both named "'+s+'"');if(typeof o==="function"&&n.prototype[s]===o){delete r.methods[s];continue}if(r.reserved[s]&&!Wde(r,`methodOptions.${s}.suppressWarning`,!1))vH.warn(`mongoose: the method name "${s}" 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('${s}', fn, { suppressWarning: true })\`.`);if(typeof o==="function")t.prototype[s]=o;else i(s,r)}t.$appliedMethods=!0;for(let s of Object.keys(r.paths)){let o=r.paths[s];if(o.$isSingleNested&&!o.Constructor.$appliedMethods)e(o.Constructor,o.schema);if(o.$isMongooseDocumentArray&&!o.Constructor.$appliedMethods)e(o.Constructor,o.schema)}}});var UH=g(function(sAe,LH){var jH=j4(),Hde=Xc(),Kde=r_(),g_=be().isPOJO;LH.exports=function(t,r,n){if(r==null)return t;if(t==null)return t;let i=null;if(Kde(r))i=!1;else if(Hde(r))i=!0;if(i==null)return t;else if(i)return n=n||jH(r),m_(t,r,n);else return n=n||jH(r),y_(t,r,n)};function m_(e,t,r,n,i){if(e==null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>m_(o,t,r,n,i));let s={...e};n=i?n||{}:t;for(let o of Object.keys(s)){let u=i?i+"."+o:o;if(Object.hasOwn(t,u)||Object.hasOwn(n,o))if(g_(t[u])||g_(n[o]))s[o]=m_(s[o],t,r,n[o],u);else delete s[o];else if(r[u])s[o]=m_(s[o],t,r,n[o],u)}return s}function y_(e,t,r,n,i){if(e==null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>y_(o,t,r,n,i));let s={...e};n=i?n||{}:t;for(let o of Object.keys(s)){let u=i?i+"."+o:o;if(Object.hasOwn(t,u)||Object.hasOwn(n,o)){if(g_(t[u])||g_(n[o]))s[o]=y_(s[o],t,r,n[o],u);continue}else if(r[u])s[o]=y_(s[o],t,r,n[o],u);else delete s[o]}return s}});var zH=g(function(oAe,VH){VH.exports=function(t){let r=!1;for(let n of Object.keys(t))if(t[n]==="text")r=!0;return r}});var HH=g(function(uAe,WH){var Gde=zH();WH.exports=function(t,r,n){if(Gde(t))return;if(Object.hasOwn(n,"collation")&&!Object.hasOwn(r,"collation"))r.collation=n.collation}});var GH=g(function(aAe,KH){var{middlewareFiltersFromLastArg:Yde}=qu(),{queryMiddlewareFunctions:Qde,aggregateMiddlewareFunctions:Jde,modelMiddlewareFunctions:Xde,documentMiddlewareFunctions:Zde}=Td(),epe=Array.from(new Set([...Qde,...Jde,...Xde,...Zde]));KH.exports=function(t,r,n){r=r.filter((i)=>{if(epe.indexOf(i.name)!==-1)return!!i.model;return i.model!==!1});for(let i of Object.keys(n))if(r.hasHooks(i)){let s=t[i],o=s.supportsMiddlewareOption===!0?{getOptions:Yde}:void 0;t[i]=r.createWrapper(i,s,null,o)}}});var QH=g(function(cAe,YH){YH.exports=function(t,r){for(let n in r.statics)t[n]=r.statics[n]}});var nK=g(function(lAe,rK){var JH=jg(),XH=ss(),ZH=be();rK.exports=eK;function eK(e,t,r){if(t==null)return t;return tpe(e,t,r),tK(e,t,r)}function tpe(e,t,r){for(let n of e.childSchemas){let i=n.model.path,s=n.schema;if(!i)continue;let o=XH.get(i,t);if(o==null||Array.isArray(o)&&o.flat(1/0).length===0)continue;eK(s,o,r)}}function tK(e,t,r){if(t==null||typeof t!=="object")return;if(Array.isArray(t)){for(let u of t)tK(e,u,r);return}if(e.discriminators&&ZH.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=JH(e.options.timestamps,"createdAt"),i=JH(e.options.timestamps,"updatedAt"),s=r?.currentTime,o=null;if(s!=null)o=s();else if(e.base?.now)o=e.base.now();else o=new Date;if(n&&t[n]==null&&!r?.isUpdate)t[n]=o;if(i)t[i]=o}});var aK=g(function(hAe,uK){var iK=ss(),sK=be();uK.exports=oK;function oK(e,t,r){if(t==null)return t;let n=r,i=null;if(Array.isArray(r)){n=[],i=[];for(let s of r)if(s.length===1)i.push(s[0]);else n.push(s)}return rpe(e,t,n),XS(e,t,i)}function rpe(e,t,r){let n=!1;for(let i of e.childSchemas){let s=i.model.path,o=i.schema;if(!s)continue;let u=iK.get(s,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]==s)a.push(c.slice(1));if(a.length===0)continue}oK(o,u,a),n=!0}if(r?.length&&!n)XS(e,t,r)}function XS(e,t,r){if(t==null||typeof t!=="object")return;if(Array.isArray(t)){for(let n of t)XS(e,n,r);return}if(e.discriminators&&sK.hasOwnKeys(e.discriminators))for(let n of Object.keys(e.discriminators)){let i=e.discriminators[n],s=i.discriminatorMapping.key,o=i.discriminatorMapping.value;if(t[s]==o){e=i;break}}if(r==null)r=Object.keys(e.virtuals);for(let n of r){if(e.virtuals[n]==null)continue;let i=e.virtuals[n],s=Array.isArray(n)?n:n.indexOf(".")===-1?[n]:n.split("."),o=t;for(let c=0;c<s.length-1;++c)o[s[c]]=s[c]in o?o[s[c]]:{},o=o[s[c]];let u=i.applyGetters(o[s[s.length-1]],t);if((i.options?.ref||i.options?.refPath)&&u===void 0)if(i.options.justOne)u=null;else u=[];o[s[s.length-1]]=u}}});var E_=g(function(fAe,cK){cK.exports=function e(t){if(!(this instanceof e))return new e(t);return this.val=t,this}});var cp=g(function(dAe,lK){/*!
|
|
962
|
+
* ignore
|
|
963
|
+
*/lK.exports=new WeakMap});var pK=g(function(pAe,dK){var npe=ar(),A_=cp(),ipe=de().modelSymbol,hK=be();dK.exports=fK;var __=Symbol("mongoose#assignRawDocsToIdStructure#hasArray");function fK(e,t,r,n,i){let s=[],o=n.isVirtual&&n.justOne&&e.length>1?!1:n.sort&&e.length>1,u=n.$nullIfNotFound,a,c,l;if(hK.isMongooseArray(e))e=e.__array;let f=0,h=e.length;if(o&&i&&n[__]===void 0){n[__]=!1;for(let d in r)if(Array.isArray(r[d])){n[__]=!0;break}}for(f=0;f<h;++f){if(l=e[f],Array.isArray(l)){fK(l,t,r,n,!0),s.push(l);continue}if(l===null&&o===!1){s.push(l);continue}if(c=String(l),a=t[c],n.clone&&a!=null)if(n.lean){let d=A_.get(a);a=npe(a),A_.set(a,d)}else a=a.constructor.hydrate(a._doc);if(i)if(a)if(o){let d=r[c];if(n[__])s.push(a);else s[d]=a}else s.push(a);else if(l?.[ipe]!=null)s.push(l);else s.push(n.retainNullValues||u?null:l);else s[f]=a||null}if(e.length=0,s.length)s.forEach(function(d,p){e[p]=d})}});var ZS=g(function(mAe,mK){mK.exports=w_;/*!
|
|
964
|
+
* ignore
|
|
965
|
+
*/function w_(e,t){if(e.virtuals[t])return{virtual:e.virtuals[t],path:void 0};let r=t.split("."),n="",i="";for(let s=0;s<r.length;++s){if(n+=(n.length>0?".":"")+r[s],e.virtuals[n]){if(s===r.length-1)return{virtual:e.virtuals[n],path:i};continue}if(e.nested[n])continue;if(e.paths[n]&&e.paths[n].schema){e=e.paths[n].schema;let o=r.slice(s+1).join(".");if(e.virtuals[o]){if(s===r.length-2)return{virtual:e.virtuals[o],nestedSchemaPath:[i,n].filter((u)=>!!u).join(".")};continue}if(s+1<r.length&&e.discriminators)for(let u of Object.keys(e.discriminators)){let a=w_(e.discriminators[u],o);if(a!=null){let c=[i,n,a.nestedSchemaPath].filter((l)=>!!l).join(".");return{virtual:a.virtual,nestedSchemaPath:c}}}i+=(i.length>0?".":"")+n,n="";continue}else if(e.paths[n]?.$isSchemaMap&&e.paths[n].$__schemaType?.schema){e=e.paths[n].$__schemaType.schema,++s;let o=r.slice(s+1).join(".");if(e.virtuals[o]){if(s===r.length-2)return{virtual:e.virtuals[o],nestedSchemaPath:[i,n,"$*"].filter((u)=>!!u).join(".")};continue}if(s+1<r.length&&e.discriminators)for(let u of Object.keys(e.discriminators)){let a=w_(e.discriminators[u],o);if(a!=null){let c=[i,n,a.nestedSchemaPath,"$*"].filter((l)=>!!l).join(".");return{virtual:a.virtual,nestedSchemaPath:c}}}i+=(i.length>0?".":"")+"$*"+n,n=""}if(e.discriminators)for(let o of Object.keys(e.discriminators)){let u=w_(e.discriminators[o],t);if(u)return u}return null}}});var gK=g(function(O_,yK){(function(e,t){typeof O_==="object"&&typeof yK<"u"?t(O_):typeof define==="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.sift={}))})(O_,function(e){var t=function(C,D){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,k){T.__proto__=k}||function(T,k){for(var J in k)if(Object.prototype.hasOwnProperty.call(k,J))T[J]=k[J]},t(C,D)};function r(C,D){if(typeof D!=="function"&&D!==null)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");t(C,D);function T(){this.constructor=C}C.prototype=D===null?Object.create(D):(T.prototype=D.prototype,new T)}typeof SuppressedError==="function"&&SuppressedError;var n=function(C){var D="[object "+C+"]";return function(T){return i(T)===D}},i=function(C){return Object.prototype.toString.call(C)},s=function(C){if(C instanceof Date)return C.getTime();else if(u(C))return C.map(s);else if(C&&typeof C.toJSON==="function")return C.toJSON();return C},o=function(C){return C==null?null:C},u=n("Array"),a=n("Object"),c=n("Function"),l=function(C,D){return C.hasOwnProperty(D)&&!c(C[D])},f=function(C,D){return Array.isArray(D)&&!(C in D)&&isNaN(Number(C))},h=function(C,D){var T=C[D],k=Object.prototype[D];return k===void 0||T!==k||Object.prototype.hasOwnProperty.call(C,D)?T:void 0},d=function(C){return C&&(C.constructor===Object||C.constructor===Array||C.constructor.toString()==="function Object() { [native code] }"||C.constructor.toString()==="function Array() { [native code] }")&&!h(C,"toJSON")},p=function(C,D){if(C==null&&C==D)return!0;if(C===D)return!0;if(Object.prototype.toString.call(C)!==Object.prototype.toString.call(D))return!1;if(u(C)){if(C.length!==D.length)return!1;for(var T=0,k=C.length;T<k;T++)if(!p(C[T],D[T]))return!1;return!0}else if(a(C)){if(Object.keys(C).length!==Object.keys(D).length)return!1;for(var J in C){if(!Object.prototype.hasOwnProperty.call(C,J))continue;if(!p(C[J],D[J]))return!1}return!0}return!1},m=function(C,D,T,k,J,fe,Ee){if(Ee===void 0)Ee=!0;var et=D[k];if(u(C)&&isNaN(Number(et))&&!l(C,et)){for(var Jr=0,kr=C.length;Jr<kr;Jr++)if(!m(C[Jr],D,T,k,Jr,C,Ee))return!1}if(k===D.length||C==null)return T(C,J,fe,k===0,k===D.length&&(k>0||Ee));return m(C[et],D,T,k+1,et,C)},E=function(){function C(D,T,k,J){this.params=D,this.owneryQuery=T,this.options=k,this.name=J,this.init()}return C.prototype.init=function(){},C.prototype.reset=function(){this.done=!1,this.keep=!1},C}(),y=function(C){r(D,C);function D(T,k,J,fe){var Ee=C.call(this,T,k,J)||this;return Ee.children=fe,Ee}return D.prototype.reset=function(){this.keep=!1,this.done=!1;for(var T=0,k=this.children.length;T<k;T++)this.children[T].reset()},D.prototype.childrenNext=function(T,k,J,fe,Ee){var et=!0,Jr=!0;for(var kr=0,df=this.children.length;kr<df;kr++){var so=this.children[kr];if(!so.done)so.next(T,k,J,fe,Ee);if(!so.keep)Jr=!1;if(so.done){if(!so.keep)break}else et=!1}this.done=et,this.keep=Jr},D}(E),_=function(C){r(D,C);function D(T,k,J,fe,Ee){var et=C.call(this,T,k,J,fe)||this;return et.name=Ee,et}return D}(y),O=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.next=function(T,k,J,fe,Ee){this.childrenNext(T,k,J,fe,Ee)},D}(y),b=function(C){r(D,C);function D(T,k,J,fe,Ee){var et=C.call(this,k,J,fe,Ee)||this;return et.keyPath=T,et.propop=!0,et._nextNestedValue=function(Jr,kr,df,so,aY){return et.childrenNext(Jr,kr,df,so,aY),!et.done},et}return D.prototype.next=function(T,k,J,fe,Ee){m(T,this.keyPath,this._nextNestedValue,0,k,J,Ee!==!1)},D}(y),A=function(C,D){if(C instanceof Function)return C;if(C instanceof RegExp)return function(k){var J=typeof k==="string"&&C.test(k);return C.lastIndex=0,J};var T=s(C);return function(k){return D(T,s(k))}},P=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){this._test=A(this.params,this.options.compare)},D.prototype.next=function(T,k,J){if(!Array.isArray(J)||J.hasOwnProperty(k)){if(this._test(T,k,J))this.done=!0,this.keep=!0}},D}(E),S=function(C,D,T){return new P(C,D,T)},B=function(C){return function(D,T,k,J){return C(D,T,k,J)}},q=function(C){return B(function(D,T,k,J){var fe=typeof s(D),Ee=C(D);return new P(function(et){var Jr=o(et);return typeof s(Jr)===fe&&Ee(Jr)},T,k,J)})},I=function(C,D,T,k){var J=k.operations[C];if(!J)we(C);return J(D,T,k,C)},we=function(C){throw Error("Unsupported operation: ".concat(C))},Ne=function(C,D){for(var T in C){if(!Object.prototype.hasOwnProperty.call(C,T))continue;if(D.operations.hasOwnProperty(T)||T.charAt(0)==="$")return!0}return!1},ae=function(C,D,T,k,J){if(Ne(D,J)){var fe=G(D,T,J),Ee=fe[0],et=fe[1];if(et.length)throw Error("Property queries must contain only operations, or exact objects.");return new b(C,D,k,J,Ee)}return new b(C,D,k,J,[new P(D,k,J)])},ir=function(C,D,T){if(D===void 0)D=null;if(T===void 0)T={};var k=h(T,"compare"),J=h(T,"operations"),fe={compare:k||p,operations:Object.assign({},J||{})},Ee=G(C,null,fe),et=Ee[0],Jr=Ee[1],kr=[];if(et.length)kr.push(new b([],C,D,fe,et));if(kr.push.apply(kr,Jr),kr.length===1)return kr[0];return new O(C,D,fe,kr)},G=function(C,D,T){var k=[],J=[];if(!d(C))return k.push(new P(C,C,T)),[k,J];for(var fe in C){if(!Object.prototype.hasOwnProperty.call(C,fe))continue;if(T.operations.hasOwnProperty(fe)){var Ee=I(fe,C[fe],C,T);if(Ee){if(!Ee.propop&&D&&!T.operations[D])throw Error("Malformed query. ".concat(fe," cannot be matched against property."))}if(Ee!=null)k.push(Ee)}else if(fe.charAt(0)==="$")we(fe);else J.push(ae(fe.split("."),C[fe],fe,C,T))}return[k,J]},De=function(C){return function(D,T,k){return C.reset(),C.next(D,T,k),C.keep}},gt=function(C,D){if(D===void 0)D={};return De(ir(C,null,D))},wi=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){this._test=A(this.params,this.options.compare)},D.prototype.reset=function(){C.prototype.reset.call(this),this.keep=!0},D.prototype.next=function(T,k,J){if(!f(k,J)&&this._test(T))this.done=!0,this.keep=!1},D}(E),Qe=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){if(!this.params||typeof this.params!=="object")throw Error("Malformed query. $elemMatch must by an object.");this._queryOperation=ir(this.params,this.owneryQuery,this.options)},D.prototype.reset=function(){C.prototype.reset.call(this),this._queryOperation.reset()},D.prototype.next=function(T,k,J){if(u(T)){for(var fe=0,Ee=T.length;fe<Ee;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(J)}else this.done=!1,this.keep=!1},D}(E),xn=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){this._queryOperation=ir(this.params,this.owneryQuery,this.options)},D.prototype.reset=function(){C.prototype.reset.call(this),this._queryOperation.reset()},D.prototype.next=function(T,k,J,fe,Ee){this._queryOperation.next(T,k,J,fe,Ee),this.done=this._queryOperation.done,this.keep=!this._queryOperation.keep},D}(E),Hi=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){},D.prototype.next=function(T){if(u(T)&&T.length===this.params)this.done=!0,this.keep=!0},D}(E),Ki=function(C){if(C.length===0)throw Error("$and/$or/$nor must be a nonempty array")},ra=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!1,T}return D.prototype.init=function(){var T=this;Ki(this.params),this._ops=this.params.map(function(k){return ir(k,null,T.options)})},D.prototype.reset=function(){this.done=!1,this.keep=!1;for(var T=0,k=this._ops.length;T<k;T++)this._ops[T].reset()},D.prototype.next=function(T,k,J,fe,Ee){var et=!1,Jr=!1;for(var kr=0,df=this._ops.length;kr<df;kr++){var so=this._ops[kr];if(so.next(T,k,J,fe,Ee),so.keep){et=!0,Jr=so.keep;break}}this.keep=Jr,this.done=et},D}(E),eY=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!1,T}return D.prototype.next=function(T,k,J,fe,Ee){C.prototype.next.call(this,T,k,J,fe,Ee),this.keep=!this.keep},D}(ra),MC=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.init=function(){var T=this,k=Array.isArray(this.params)?this.params:[this.params];this._testers=k.map(function(J){if(Ne(J,T.options))throw Error("cannot nest $ under ".concat(T.name.toLowerCase()));return A(J,T.options.compare)})},D.prototype.next=function(T,k,J){if(f(k,J))return;var fe=!1,Ee=!1;for(var et=0,Jr=this._testers.length;et<Jr;et++){var kr=this._testers[et];if(kr(T)){fe=!0,Ee=!0;break}}this.keep=Ee,this.done=fe},D}(E),tY=function(C){r(D,C);function D(T,k,J,fe){var Ee=C.call(this,T,k,J,fe)||this;return Ee.propop=!0,Ee._in=new MC(T,k,J,fe),Ee}return D.prototype.next=function(T,k,J,fe){if(this._in.next(T,k,J),this._in.keep)this.keep=!1,this.done=!0},D.prototype.reset=function(){C.prototype.reset.call(this),this.keep=!0,this._in.reset()},D}(E),rY=function(C){r(D,C);function D(){var T=C!==null&&C.apply(this,arguments)||this;return T.propop=!0,T}return D.prototype.reset=function(){C.prototype.reset.call(this),this.keep=!this.params},D.prototype.next=function(T,k,J,fe,Ee){if(Ee&&(J==null?T!==void 0:Object.prototype.hasOwnProperty.call(J,k)))this.done=!0,this.keep=Boolean(this.params)},D}(E),nY=function(C){r(D,C);function D(T,k,J,fe){var Ee=C.call(this,T,k,J,T.map(function(et){return ir(et,k,J)}),fe)||this;return Ee.propop=!1,Ki(T),Ee}return D.prototype.next=function(T,k,J,fe,Ee){this.childrenNext(T,k,J,fe,Ee)},D}(_),iY=function(C){r(D,C);function D(T,k,J,fe){var Ee=C.call(this,T,k,J,T.map(function(et){return ir(et,k,J)}),fe)||this;return Ee.propop=!0,Ee}return D.prototype.next=function(T,k,J,fe,Ee){this.childrenNext(T,k,J,fe,Ee)},D}(_),PC=function(C,D,T){return new P(C,D,T)},BC=function(C,D,T,k){return new wi(C,D,T,k)},FC=function(C,D,T,k){return new ra(C,D,T,k)},NC=function(C,D,T,k){return new eY(C,D,T,k)},IC=function(C,D,T,k){return new Qe(C,D,T,k)},$C=function(C,D,T,k){return new tY(C,D,T,k)},RC=function(C,D,T,k){return new MC(C,D,T,k)},xC=q(function(C){return function(D){return D!=null&&D<C}}),vC=q(function(C){return function(D){return D===C||D<=C}}),kC=q(function(C){return function(D){return D!=null&&D>C}}),qC=q(function(C){return function(D){return D===C||D>=C}}),jC=function(C,D,T){var k=C[0],J=C[1];return new P(function(fe){return s(fe)%k===J},D,T)},LC=function(C,D,T,k){return new rY(C,D,T,k)},UC=function(C,D,T){return new P(new RegExp(C,Object.prototype.hasOwnProperty.call(D,"$options")?D.$options:void 0),D,T)},VC=function(C,D,T,k){return new xn(C,D,T,k)},zC={number:function(C){return typeof C==="number"},string:function(C){return typeof C==="string"},bool:function(C){return typeof C==="boolean"},array:function(C){return Array.isArray(C)},null:function(C){return C===null},timestamp:function(C){return C instanceof Date}},WC=function(C,D,T){return new P(function(k){if(typeof C==="string"){if(!Object.prototype.hasOwnProperty.call(zC,C))throw Error("Type alias does not exist");return zC[C](k)}return k!=null?k instanceof C||k.constructor===C:!1},D,T)},HC=function(C,D,T,k){return new nY(C,D,T,k)},KC=function(C,D,T,k){return new iY(C,D,T,k)},GC=function(C,D,T){return new Hi(C,D,T,"$size")},YC=function(){return null},sY=function(){try{return Boolean(process.env.CSP_ENABLED)}catch(C){return!1}},QC=function(C,D,T){var k;if(c(C))k=C;else if(!sY())k=Function("obj","return "+C);else throw Error('In CSP mode, sift does not support strings in "$where" condition');return new P(function(J){return k.bind(J)(J)},D,T)},oY=Object.freeze({__proto__:null,$Size:Hi,$all:KC,$and:HC,$elemMatch:IC,$eq:PC,$exists:LC,$gt:kC,$gte:qC,$in:RC,$lt:xC,$lte:vC,$mod:jC,$ne:BC,$nin:$C,$nor:NC,$not:VC,$options:YC,$or:FC,$regex:UC,$size:GC,$type:WC,$where:QC}),JC=function(C,D,T){if(T===void 0)T={};return ir(C,D,{compare:h(T,"compare"),operations:Object.assign({},oY,h(T,"operations")||{})})},uY=function(C,D){if(D===void 0)D={};var T=JC(C,null,D);return De(T)};e.$Size=Hi,e.$all=KC,e.$and=HC,e.$elemMatch=IC,e.$eq=PC,e.$exists=LC,e.$gt=kC,e.$gte=qC,e.$in=RC,e.$lt=xC,e.$lte=vC,e.$mod=jC,e.$ne=BC,e.$nin=$C,e.$nor=NC,e.$not=VC,e.$options=YC,e.$or=FC,e.$regex=UC,e.$size=GC,e.$type=WC,e.$where=QC,e.EqualsOperation=P,e.createDefaultQueryOperation=JC,e.createEqualsOperation=S,e.createOperationTester=De,e.createQueryOperation=ir,e.createQueryTester=gt,e.default=uY,Object.defineProperty(e,"__esModule",{value:!0})})});var _K=g(function(yAe,eC){var EK=gK();eC.exports=EK.default;Object.assign(eC.exports,EK)});var CK=g(function(gAe,SK){var spe=Gg(),ope=E_(),upe=pK(),tC=Dr(),ape=dh(),cpe=ZS(),S_=cp(),hp=Fn(),AK=Rg(),lpe=H4(),nf=ss(),wK=_K().default,Ec=be(),{populateModelSymbol:hpe}=de();SK.exports=function(t){let r=Object.assign({},tC(t,"allOptions.options.options"),tC(t,"allOptions.options")),n=Object.assign({},t.options,r,{justOne:t.justOne,isVirtual:t.isVirtual});n.$nullIfNotFound=t.isVirtual;let i=t.populatedModel,s=[].concat(t.rawIds);t.allIds=[].concat(t.allIds),upe(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 ope)return d.val;if(d===void 0)return d;let p=t.allIds[l];if(t.path.endsWith(".$*"))return lp(d,a,n,p);if(t.justOne===!0&&Array.isArray(d)){let m=[];for(let E of d){let y=S_.get(E);if(y==null||y===i)m.push(E)}while(d.length>m.length)Array.prototype.pop.apply(d,[]);for(let E=0;E<m.length;++E)d[E]=m[E];return lp(d[0],a,n,p)}else if(t.justOne===!1&&!Array.isArray(d))return lp([d],a,n,p);else if(t.justOne===!0&&!Array.isArray(d)&&Array.isArray(p))return lp(d,a,n,d==null?d:p[f-1]);return lp(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=nf.get(d,o[l],AK);if(p==null&&!cpe(t.originalModel.schema,d))continue;let m;if(c)m=fpe(u[l]);else if(Array.isArray(t.match))m=Array.isArray(u[l])?u[l].filter((A)=>A==null||wK(t.match[l])(A)):[u[l]].filter((A)=>A==null||wK(t.match[l])(A))[0];else m=u[l];let E=t.originalModel.schema,y=hp(o[l]),_=y?p instanceof Map:Ec.isPOJO(p);if(_=_&&tC(E._getSchema(d),"$isSchemaMap"),!t.isVirtual&&_){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(hp(A))A.$__.parent=o[l]}else if(y&&hp(m))m.$__.parent=o[l];if(t.isVirtual&&y){if(o[l].$populated(d,t.justOne?s[0]:s,t.allOptions),Array.isArray(m))m=m.map((A)=>A==null?void 0:A);nf.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 O=d.split("."),b=o[l];for(let A=0;A<O.length-1;++A){if(Array.isArray(b)&&!Ec.isArrayIndex(O[A]))break;if(O[A]==="$*")break;if(b[O[A]]==null){let P=O.slice(0,A+1).join("."),S=E._getSchema(P);if(m==null&&S?.$isMongooseArray)break;b[O[A]]={}}if(b=b[O[A]],typeof b!=="object")break}if(y){if(t.allOptions.options[hpe]=t.allOptions.model,o[l].$populated(d,t.unpopulatedValues[l],t.allOptions.options),hp(m))m.$__.wasPopulated={value:t.unpopulatedValues[l]};if(m instanceof Map&&!m.$isMongooseMap)m=new spe(m,d,o[l],o[l].schema.path(d).$__schemaType)}if(nf.set(d,m,o[l],AK,h,!1),y)lpe(o[l],[t.allOptions.options])}};function fpe(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 lp(e,t,r,n){let i=typeof r.transform==="function",s=i?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(!rC(f)&&(!r.retainNullValues||f!=null)&&!i)continue;else if(!r.retainNullValues&&f==null)continue;else if(i)f=s(rC(f)?f:null,h);if(OK(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(Ec.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(rC(e)||Ec.isPOJO(e))return OK(e,t),s(e,n);if(e instanceof Map)return e;if(r.justOne===!1)return[];return e==null?s(e,n):s(null,n)}function OK(e,t){if(e!=null&&t.excludeId)if(typeof e.$__setValue==="function")delete e._doc._id;else delete e._id}function rC(e){if(e==null)return!1;return Array.isArray(e)||ape(e,"$isMongooseMap")||hp(e)||S_.has(e)}});var DK=g(function(EAe,bK){var dpe=Qc();bK.exports=function(t){if(t instanceof dpe)return Object.keys(t.errors).map((r)=>({message:t.errors[r].message,path:r.split(".").map((i)=>{let s=+i;return Number.isInteger(s)&&String(s)===i?s:i})}));return[{message:t.message}]}});var nC=g(function(_Ae,PK){var ppe=E_(),mpe=G4(),{trusted:C_}=ph(),TK=o_();PK.exports=function(t,r,n,i,s){let o=ype(r);if(n.size===1){let u=Array.from(n)[0],a=i.schema.path(u);if(u!=="_id"||!o._id)t=MK(t,a,s),o[u]=C_({$in:t});else if(u==="_id"&&o._id){let l=TK(o[u])?o[u]:{$eq:o[u]};o[u]={...C_({$in:t}),...l}}let c=mpe(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)]:C_({$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=i.schema.path(a);t=MK(t,c,s),u.push({[a]:{$in:t}})}else if(a==="_id"&&o._id){let c=TK(o[a])?o[a]:{$eq:o[a]};o[a]={...C_({$in:t}),...c}}}return o};function MK(e,t,r){if(e=e.filter((n)=>!(n instanceof ppe)),!r)return e;return e.filter((n)=>{try{return t.cast(n),!0}catch{return!1}})}function ype(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 FK=g(function(AAe,BK){BK.exports=function(t,r,n){if(t.length===0)return n();let i=t.length,s=null;for(let o of t)r(o,function(u){if(s!=null)return;if(u!=null)return s=u,n(s);if(--i<=0)return n()})}});var $K=g(function(wAe,IK){/*!
|
|
966
|
+
* ignore
|
|
967
|
+
*/var NK=Ph(),gpe=Dr(),Epe=Vs(),_pe=Fn(),b_=cp(),ro=ss(),Ape=de().populateModelSymbol;IK.exports=function e(t,r,n,i,s){let o=r.path(i),u=n;if(o)return o;let a=r.discriminatorMapping?.key;if(a&&t!=null){if(n?.[a]!=null)r=Epe(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,i))},[])}function c(l,f,h,d){let p=l.length+1,m,E;while(p--){if(E=l.slice(0,p).join("."),m=f.path(E),m==null)continue;if(m.embeddedSchemaType||m.schema){if(m.embeddedSchemaType instanceof NK)return m.embeddedSchemaType;let O=null;if(m.schema?.discriminators!=null){let b=m.schema.discriminators,A=E+"."+m.schema.options.discriminatorKey,P=h?ro.get(A,h)||[]:[];O=Object.keys(b).reduce(function(S,B){let q=b[B].discriminatorMapping.value;if(n==null||P.indexOf(B)!==-1||P.indexOf(q)!==-1)S.push(b[B]);return S},[])}if(p!==l.length&&m.schema){let b;if(l[p]==="$"){if(p+1===l.length)return m;if(b=c(l.slice(p+1),f,h?ro.get(E,h):null,d.concat(l.slice(0,p))),b)b.$parentSchemaDocArray=b.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m);return b}if(O!=null&&O.length>0){b=[];for(let A of O){let P=c(l.slice(p),A,h?ro.get(E,h):null,d.concat(l.slice(0,p)));if(P!=null){if(P.$parentSchemaDocArray=P.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m),P.$parentSchemaDocArray)b.$parentSchemaDocArray=P.$parentSchemaDocArray;b.push(P)}}return b}else{if(b=c(l.slice(p),m.schema,h?ro.get(E,h):null,d.concat(l.slice(0,p))),b)b.$parentSchemaDocArray=b.$parentSchemaDocArray||(m.schema.$isSingleNested?null:m);return b}}else if(p!==l.length&&m.$isMongooseArray&&m.embeddedSchemaType.$isMongooseArray){let b=m;while(b.$isMongooseArray&&!b.$isMongooseDocumentArray)b=b.embeddedSchemaType;let A=c(l.slice(p),b.schema,null,d.concat(l.slice(0,p)));if(A!=null)return A;if(b.schema.discriminators){let P=[];for(let S of Object.keys(b.schema.discriminators)){let B=b.schema.discriminators[S]||b.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 NK)return m.$__schemaType;let y=d.concat([E]).join(".");if(_pe(u)&&u.$populated(y,!0)&&p<l.length){let O=u.$populated(y,!0).options[Ape];if(O!=null)return c(l.slice(p),O.schema,h?ro.get(E,h):null,d.concat(l.slice(0,p)))}let _=gpe(u,E);if(_!=null){let b=(Array.isArray(_)&&_.length>0?b_.get(_[0]):b_.get(_))?.schema??null;if(b!=null){let A=c(l.slice(p),b,h?ro.get(E,h):null,d.concat(l.slice(0,p)));if(A!=null)return A.$parentSchemaDocArray=A.$parentSchemaDocArray||(b.$isSingleNested?null:b),A}}return m}}s=s||i.split(".");for(let l=0;l<s.length;++l)if(s[l]==="$")s[l]="0";return c(s,r,n,[])}});var UK=g(function(OAe,LK){var cC=ns(),wpe=E_(),Ope=ar(),Po=Dr(),Spe=os(),Cpe=Vs(),bpe=Xn(),vK=uu(),RK=$K(),Dpe=ZS(),fp=Fn(),lC=Rg(),yu=ss(),dp=Dw(),Pt=be(),oC=de().modelSymbol,iC=de().populateModelSymbol,uC=Oo().schemaMixedSymbol,Tpe=$4(),Mpe=new RegExp("\\.\\d+(?=\\.|$)"),Ppe=new RegExp("\\.\\d+(?=\\.|$)","g");LK.exports=function(t,r,n){let i,s=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=Dpe(t.schema,n.path);if((p==null?null:p.virtual)!=null)return Fpe(t,r,n,p);let E=d.paths[n.path]?.splitPath()??n.path.split("."),y=RK(t,d,null,n.path,E);if(y=Array.isArray(y)?y:[y].filter((b)=>b!=null),!(n.strictPopulate===!1||n.options?.strictPopulate===!1)&&y.length===0&&n._localModel!=null)return new Tpe(n._fullPath||n.path);for(let b=0;b<s;b++){i=r[b];let A=null;if(fp(i)&&i.populated(n.path)){if((n.forceRepopulate??i.constructor.base.options.forceRepopulate)===!1)continue}let P=fp(i)?i.$__schema:d;if(a=RK(t,P,i,n.path,E),a!=null&&a.$isMongooseDocumentArray&&a.options.ref==null&&a.options.refPath==null)continue;if(a?.$parentSchemaDocArray&&Po(n,"options.sort")!=null)return new cC("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,we=null;if(a?.instance==="Embedded"){if(a.options.ref){let Qe={localField:n.path+"._id",foreignField:"_id",justOne:!0},xn=O(i,a,u,t),Hi=yu.get(n.path,i),Ki=yu.get("_id",Hi);aC(t,o,h,xn.modelNames,n,Qe,Ki,i,I,Hi)}continue}if(Array.isArray(a)){let Qe=a;for(let xn of Qe){let Hi,Ki;try{Ki=O(i,xn,u,t),Hi=Ki.modelNames,B=B||Ki.isRefPath,q=q||Ki.refPath,A=Ki.justOne}catch(ra){return ra}if(B&&!Ki.isRefPath)continue;if(!Hi)continue;l=l||[],f=f||new Set;for(let ra of Hi)if(f.has(ra)===!1)f.add(ra),l.push(ra)}}else{try{let Qe=O(i,a,u,t);if(l=Qe.modelNames,B=Qe.isRefPath,q=q||Qe.refPath,A=Qe.justOne,I=Po(a,"options.populate",null),B)we=l,l=Array.from(new Set(l))}catch(Qe){return Qe}if(!l)continue}let Ne={},ae=n.path,ir="_id";if("justOne"in n&&n.justOne!==void 0)A=n.justOne;else if(a&&!a[uC]){if(n.path.endsWith("."+a.path)||n.path===a.path)A=Array.isArray(a)?a.every((Qe)=>!Qe.$isMongooseArray):!a.$isMongooseArray}if(!l)continue;Ne.isVirtual=!1,Ne.justOne=A,Ne.localField=ae,Ne.foreignField=ir;let G=qK(i,ae,t,n,null,a),De=String(Pt.getValue(ir,i));n._docs[De]=Array.isArray(G)?G.slice():G;let gt=Po(n,"match",null),wi=typeof gt==="function";if(wi)gt=gt.call(i,i);if(fC(gt),Ne.match=gt,Ne.hasMatchFunction=wi,Ne.isRefPath=B,Ne.modelNamesInOrder=we,B){let Qe=typeof q==="string"?q.replace(Ppe,""):q;l=Npe(i,d,Ne,n,Qe,G)||l}try{aC(t,o,h,l,n,Ne,G,i,I)}catch(Qe){return Qe}}return o;function O(b,A,P,S){let B,q=!1,I=null,we=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[uC]&&!Ne&&!c&&!P)return{modelNames:null};if(P)B=[P];else if(c!=null){if(typeof c==="function"){let ae=xK(c,b,A,n.path,d,n._queryProjection);B=ae.modelNames,c=ae.refPath}else B=dp(c,b,n.path,d,n._queryProjection);q=!0}else{let ae,ir,G,De,gt=S,wi=S.schema.options.discriminatorKey;if(!A&&wi&&(De=Pt.getValue(wi,b))){let Qe=Cpe(S.discriminators,De)||S;if(Qe!=null)gt=Qe;else try{gt=hC(S.db,De)}catch(xn){return xn}if(G=gt.schema._getSchema(n.path),G?.embeddedSchemaType)G=G.embeddedSchemaType}else G=A;if(we&&we.path.endsWith(".$*"))I=!we.$isMongooseArray&&!we._arrayPath;else if(G!=null)I=!G.$isMongooseArray&&!G._arrayPath;if((ae=Po(G,"options.ref"))!=null)if(G!=null&&typeof ae==="function"&&n.path.endsWith("."+G.path)){B=new Set;let Qe=n.path.slice(0,n.path.length-G.path.length-1),xn=yu.get(Qe,b,lC),Hi=Array.isArray(xn)?Pt.array.flatten(xn):xn?[xn]:[];for(let Ki of Hi)B.add(sC(ae,Ki));if(Hi.length===0)B=[sC(ae,b)];else B=Array.from(B)}else ae=sC(ae,b),B=[ae];else if((ir=Po(G,"options.refPath"))!=null)if(q=!0,typeof ir==="function"){let Qe=xK(ir,b,G,n.path,d,n._queryProjection);B=Qe.modelNames,ir=Qe.refPath}else B=dp(ir,b,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 xK(e,t,r,n,i,s){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,E){if(p==null)return;if(E>=f.length){h=!0;let A=m+"."+a,P=e.call(p,p,A);u=u||P,o.push(...Bpe(P,t,n,A,i,s));return}let y=f[E],_=p?._doc??p;if(y==="$*"){if(_ instanceof Map){for(let[A,P]of _.entries())if(P!=null){let S=m.length===0?A:m+"."+A;d(P,S,E+1)}return}if(_!=null&&typeof _==="object")for(let A of Object.keys(_)){let P=_[A];if(P!=null){let S=m.length===0?A:m+"."+A;d(P,S,E+1)}}return}let O=_[y],b=m.length===0?y:m+"."+y;if(Array.isArray(O)){for(let A=0;A<O.length;++A)if(O[A]!=null)d(O[A],b+"."+A,E+1)}else if(O!=null)d(O,b,E+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(...dp(c,t,n,i,s)),{modelNames:o,refPath:u}}function Bpe(e,t,r,n,i,s){let o=typeof e==="string"&&Mpe.test(e)?r:n;try{return dp(e,t,o,i,s)}catch(u){if(o===n&&typeof u?.message==="string"&&u.message.startsWith("Could not normalize ref path"))return dp(e,t,r,i,s);throw u}}/*!
|
|
968
|
+
* ignore
|
|
969
|
+
*/function Fpe(e,t,r,n){let i=[],s={},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((_)=>f+_);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 cC(`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 _=Pt.getValue(n.nestedSchemaPath,u);a=Array.isArray(_)?_.flatMap((O)=>o._getModelNamesForPopulate(O)):o._getModelNamesForPopulate(_)}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=Po(c,"virtual.options.match",null)||Po(c,"virtual.options.options.match",null),m=Po(r,"match",null)||p,E=typeof m==="function";if(E)m=m.call(u,u,c.virtual);if(Array.isArray(l)&&Array.isArray(h)&&l.length===h.length){m=Object.assign({},m);for(let _=1;_<l.length;++_)m[h[_]]=jK(yu.get(l[_],u,lC),e.schema),E=!0;l=l[0],h=h[0]}c.localField=l,c.foreignField=h,c.match=m,c.hasMatchFunction=E,fC(m);let y=qK(u,l,e,r,o);try{aC(e,i,s,a,r,c,y,u)}catch(_){return _}}return i}/*!
|
|
970
|
+
* ignore
|
|
971
|
+
*/function aC(e,t,r,n,i,s,o,u,a,c){let l=i.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(i.model&&i.model[oC])p=i.model;else if(d[oC])p=d,d=p.modelName;else try{p=hC(l,d)}catch(y){if(o!==void 0)throw y;p=null}let m=o,E=s.modelNamesInOrder||n;if(s.isRefPath&&Array.isArray(o)&&o.length===E.length)m=kK(o,E,d);if(!vK(r,d)){let y={model:p};if(s.isVirtual&&Po(s.virtual,"options.options"))y.options=Ope(s.virtual.options.options);else if(a!=null)y.options=Object.assign({},a);Pt.merge(y,i),i[iC]=p,y[iC]=p,r[d]={model:p,options:y,match:s.hasMatchFunction?[s.match]:s.match,docs:[u],ids:[m],allIds:[o],unpopulatedValues:[c],localField:new Set([s.localField]),foreignField:new Set([s.foreignField]),justOne:s.justOne,isVirtual:s.isVirtual,virtual:s.virtual,count:s.count,isRefPath:!!s.isRefPath,[iC]:p},t.push(r[d])}else if(r[d].localField.add(s.localField),r[d].foreignField.add(s.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||!!s.isRefPath,s.hasMatchFunction)r[d].match.push(s.match)}}function hC(e,t){if(vK(e.models,t)==null&&e._parent!=null)return hC(e._parent,t);return e.model(t)}function kK(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,i)=>kK(n,t[i],r));return[]}/*!
|
|
972
|
+
* ignore
|
|
973
|
+
*/function sC(e,t){if(typeof e==="function"&&!e[oC])return e.call(t,t);return e}/*!
|
|
974
|
+
* ignore
|
|
975
|
+
*/function qK(e,t,r,n,i,s){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=Po(n,"options",{}),l="getters"in c?c.getters:Po(i,"options.getters",!1);if(a.length!==0&&l){let f=fp(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 jK(yu.get(t,e,lC),s)}function jK(e,t){if(fp(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(fp(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(bpe(e)==="Object"&&t?.[uC]==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 Npe(e,t,r,n,i,s){if(!r.isRefPath||i==null)return;let o=i.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 E=Pt.getValue(p,m),_=Spe(f.Constructor.discriminators,E)?.schema;if(_==null)continue;let O=_.path(d);if(O==null||O.options.refPath==null){let A=Pt.getValue(r.localField.substring(u.length+1),m);s.forEach((P,S)=>{if(P===A)s[S]=wpe(P)});continue}let b=Pt.getValue(o.slice(c+1).join("."),m);a.push(b)}}}return a}function fC(e){if(e==null)return;if(typeof e!=="object")return;for(let t of Object.keys(e)){if(t==="$where")throw new cC("Cannot use $where filter with populate() match");if(e[t]!=null&&typeof e[t]==="object")fC(e[t])}}});var zK=g(function(SAe,VK){var Ipe=Dr();VK.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=Ipe(t,"key",{});return Object.keys(r).length===1&&Object.hasOwn(r,"_id")}});var GK=g(function(CAe,KK){var WK=Dr(),D_=be(),HK=Object.freeze({locale:"simple"});KK.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!==WK(r,"weights."+a)&&!(c===1&&WK(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 i=["unique","partialFilterExpression","sparse","expireAfterSeconds","collation"];for(let u of i){if(!(u in r)&&!(u in n))continue;if(u==="collation"){let a=r.collation??HK,c=n.collation??HK;for(let l of Object.keys(a))if(a[l]!==c[l])return!1}else if(!D_.deepEqual(r[u],n[u]))return!1}let s=Object.keys(t),o=Object.keys(n.key);if(s.length!==o.length)return!1;for(let u=0;u<s.length;++u){if(s[u]!==o[u])return!1;if(!D_.deepEqual(t[s[u]],n.key[o[u]]))return!1}return!0}});var QK=g(function(bAe,YK){YK.exports=function(t,r){if(r.timeseries==null)return!1;let{timeField:n,metaField:i}=r.timeseries;if(typeof n!=="string"||typeof i!=="string")return!1;return Object.keys(t.key).length===2&&t.key[n]===1&&t.key[i]===1}});var eG=g(function(DAe,ZK){var $pe=o_();function Rpe(e,t){return XK({baseModelName:e.baseModelName,discriminatorMapping:e.schema.discriminatorMapping,indexes:t,indexesType:"schema"})}function xpe(e,t){return XK({baseModelName:e.baseModelName,discriminatorMapping:e.schema.discriminatorMapping,indexes:t,indexesType:"db"})}ZK.exports={getRelatedSchemaIndexes:Rpe,getRelatedDBIndexes:xpe};function XK({baseModelName:e,discriminatorMapping:t,indexes:r,indexesType:n}){let i=t?.key,s=t?.value;if(!i)return r;if(Boolean(e))return r.filter((u)=>{let a=JK(u,n);return a&&a[i]===s});return r.filter((u)=>{let a=JK(u,n);return!a||!a[i]||$pe(a[i])&&!("$eq"in a[i])})}function JK(e,t){if(t==="schema")return e[1]?.partialFilterExpression;return e.partialFilterExpression}});var rG=g(function(TAe,tG){tG.exports=vpe;/*!
|
|
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 vpe(e,t,r){if(!(r>0))throw Error("Limit must be positive");let n=e.length;if(n===0)return[];let i=Array(n);if(r>=n){for(let l=0;l<n;++l)try{i[l]=t(e[l],l)}catch(f){i[l]=Promise.reject(f),i.length=l+1;break}return Promise.all(i)}let s=0,o=!1,u=null;function a(){if(s>=n||o)return;let l=s++,f;try{f=Promise.resolve(t(e[l],l))}catch(h){if(!o)o=!0,u=h;return}return f.then((h)=>(i[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 i}});var iG=g(function(MAe,nG){nG.exports=function e(t,r,n){if(r==null)return;for(let i=0;i<r.length;++i)if(Array.isArray(r[i]))e(t,r[i],n+"."+i);else t.push(n+"."+i)}});var aG=g(function(PAe,uG){var sG=Dr(),kpe=Fn(),T_=ss(),oG=s_();/*!
|
|
982
|
+
* ignore
|
|
983
|
+
*/uG.exports=function(t,r,n){let i=oG(sG(r,"select",null),!0)||oG(sG(r,"options.select",null),!0);if(i==null)return;for(let s of t){if(!Object.hasOwn(i,"-"+s))continue;for(let o of n)if(kpe(o))T_.unset(s,o._doc);else T_.unset(s,o)}}});var lG=g(function(BAe,cG){var qpe=nC(),jpe=Dr(),sf=be();cG.exports=dC;/*!
|
|
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
|
+
*/dC.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 dC(e,t,r,n){if(e.docs.length<=1)return null;let i=e.options.perDocumentLimit==null?jpe(e.options,"options.perDocumentLimit",null):e.options.perDocumentLimit,s=t.length*e.foreignField.size;if(i==null&&(s<=dC.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=sf.array.flatten(a.ids,Lpe);c=sf.array.unique(c);let l=c.length===0||c.every(sf.isNullOrUndefined)?null:qpe(c,a.match,a.foreignField,a.model,a.options.skipInvalidIds);return[a,l,r,n]})}/*!
|
|
1012
|
+
* ignore
|
|
1013
|
+
*/function Lpe(e){return e!==void 0}});var JS=g(function(MG,PG){/*!
|
|
1014
|
+
* Module dependencies.
|
|
1015
|
+
*/var Upe=HS(),Vpe=u4(),no=ou(),{createTracedChannel:_C}=Jh(),{trace:zpe}=_C("mongoose:model:save"),{trace:Wpe}=_C("mongoose:model:insertMany"),{trace:Hpe}=_C("mongoose:model:bulkWrite"),Kpe=Q2(),yC=require("events").EventEmitter,gu=Gc(),P_=zO(),Se=ns(),gG=og(),Gpe=C4(),dl=l_(),Ype=BH(),gC=nl(),M_=Qc(),EG=A4(),Qpe=O4(),Jpe=ag(),Xpe=L4(),Zpe=NH(),eme=YS(),tme=xH(),_G=qH(),rme=UH(),nme=CS(),AG=HH(),ime=GH(),wG=QH(),sme=nK(),OG=bS(),ome=aK(),ume=CK(),ame=hS(),_c=ar(),cme=DK(),lme=nC(),hme=zE(),pC=GO(),SG=dg(),fme=OE(),dme=FK(),mp=Dr(),pme=uu(),mme=Xn(),yp=Fn(),of=os(),uf=Vs(),yme=UK(),hG=ma(),AC=Ao().internalToObjectOptions,wC=zK(),CG=GK(),gme=Fw(),Eme=QK(),{getRelatedDBIndexes:_me,getRelatedSchemaIndexes:Ame}=eG(),OC=Mw(),wme=mg(),bG=cp(),Ome=rG(),Sme=s_(),Cme=zS(),DG=iG(),bme=aG(),Dme=eS(),Tme=Y4(),Mme=lG(),{buildMiddlewareFilter:Eu}=qu(),B_=require("util"),le=be(),Pme=K4(),Bme=T4(),Fme=sg(),pl=fS(),ml=Symbol("mongoose#Model#collection"),yl=Symbol("mongoose#Model#db"),{arrayAtomicsBackupSymbol:mC,arrayAtomicsSymbol:Nme,modelSymbol:TG}=de(),pp=Symbol("mongoose#Model#subclassed"),{VERSION_INC:F_,VERSION_WHERE:fG,VERSION_ALL:Ime}=no,$me=Object.assign({},AC,{bson:!0});function W(e,t,r){if(t instanceof gC)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 Se("`useConnection()` requires a Mongoose connection.");if(this.db?.base?.version&&this.db?.base?.version!==t.base?.version)throw new Se(`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[yl],delete this.prototype.collection,delete this.prototype.$collection,delete this.prototype[ml];this.db=t;let r=t.collection(this.collection.collectionName,t.options);return this.prototype.collection=r,this.prototype.$collection=r,this.prototype[ml]=r,this.prototype.db=t,this.prototype[yl]=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 EC(e,t){if(e.$where==null)return;for(let r of Object.keys(e.$where))t[r]=e.$where[r]}/*!
|
|
1018
|
+
* ignore
|
|
1019
|
+
*/function Rme(e,t){let r={};if(OG(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(),i=e[yl].base.transactionAsyncLocalStorage?.getStore();if(n!=null)r.session=n;else if(!Object.hasOwn(t,"session")&&i?.session!=null)r.session=i.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=Rme(this,t);if(this.$isNew){let u=this.$__hasOnlyPrimitiveValues(),a=u?this.$__toObjectShallow():this.toObject($me);if((a||{})._id===void 0)throw new Se("document must have an _id before saving");this.$__version(!0,a),this.$__reset(),af(this,!1,u),this.$__.inserting=!0,r=await this[ml].insertOne(a,o).catch((c)=>{throw af(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)=>!Xpe(h,a,u)):null;if(c){n=this.$__where(c[0]),EC(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(Pme(d[p]),le.hasOwnKeys(d[p])===!1)delete d[p],h.$unset=h.$unset||{},h.$unset[p]=1}}this.$__.modifiedPaths=this.modifiedPaths(),this.$__reset(),xme(this,l,f),af(this,!1),r=await this[ml].updateOne(n,h,o).catch((d)=>{throw this.$__undoReset(),d})}else{if(n=this.$__where(),EC(this,n),this.$__.version)this.$__version(n,c);nme(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 i=0;if((t!=null?t.writeConcern!=null?t.writeConcern.w:t.w:0)!==0){if(r!=null)if(Array.isArray(r))i=r.length;else if(r.matchedCount!=null)i=r.matchedCount;else i=r;if(this.$__.version&&!this.$__.inserting){let u=F_===(F_&this.$__.version);this.$__.version=void 0;let a=this.$__schema.options.versionKey,c=this.$__getValue(a)||0;if(i<=0){this.$__undoReset();let l=this.$__.$versionError||new EG(this,c,this.$__.modifiedPaths);await this._execDocumentPostHooks("save",t,l);return}if(u)this.$__setValue(a,c+1)}if(r!=null&&i<=0){this.$__undoReset();let u=new Kpe(n,this.constructor.modelName,i,r);await this._execDocumentPostHooks("save",t,u);return}}this.$__.saving=void 0,this.$__.savedState={},this.$emit("save",this,i),this.constructor.emit("save",this,i),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 xme(e,t,r){if(t==null)return;for(let n of t)if(e.$__.activePaths.modify(n.path),n.value?.[mC])n.value[Nme]=n.value[mC],n.value[mC]=null;for(let n of r)e.$__.activePaths.default(n)}/*!
|
|
1029
|
+
* ignore
|
|
1030
|
+
*/function vme(e,t,r){let n=e.$__schema.options.versionKey;if(!n)return null;let i=e.$__getValue(n)||0;return new EG(e,i,t.concat(r))}W.prototype.save=async function(t){if(typeof t==="function"||typeof arguments[1]==="function")throw new Se("Model.prototype.save() no longer accepts a callback");let r;if(this.$op="save",this.$__.saving)r=new Qpe(this);else this.$__.saving=!0;if(t=new Ype(t),Object.hasOwn(t,"session"))this.$session(t.session);if(this.$__.timestamps!=null)t.timestamps=this.$__.timestamps;if(!this.$isNew)this.$__.$versionError=vme(this,this.modifiedPaths(),Object.keys(this.$__.activePaths.getStatePaths("default")));if(r)throw this.$__handleReject(r),r;this.$__.saveOptions=t;let n=this;return zpe(async function(){try{await n.$__save(t)}catch(s){throw n.$__handleReject(s),s}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)Dme(t,r,0),this.$__setValue(r,0);return}if(r===!1)return;if(!this.$__isSelected(r))return;if(fG===(fG&this.$__.version)){let n=this.$__getValue(r);if(n!=null)e[r]=n}if(F_===(F_&this.$__.version))if(mp(t.$set,r,null)!=null)++t.$set[r];else t.$inc=t.$inc||{},t.$inc[r]=1};W.prototype.increment=function(){return this.$__.version=Ime,this};W.prototype.$__where=function(t){if(t||(t={}),!t._id)t._id=this._doc._id;if(this._doc._id===void 0)throw new Se("No _id found on document!");return t};W.prototype.deleteOne=function(t){if(typeof t==="function"||typeof arguments[1]==="function")throw new Se("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(),i=r.constructor.deleteOne();if(this.$session()!=null){if(!("session"in i.options))i.options.session=this.$session()}let s=Eu(t,"pre"),o=Eu(t,"post");return i.pre(async function(){let a=await r.constructor._middleware.execPre("deleteOne",r,[r,t],{filter:s});if(a[0]!==r||a[1]!==t)throw new Se("Document deleteOne pre hooks cannot overwrite arguments");if(i.deleteOne(n,t),r.$where!=null)this.where(r.$where);return a}),i.pre(function(){return Promise.all(r.$getAllSubdocs().map((a)=>a.constructor._middleware.execPre("deleteOne",a,[a],{filter:s})))}),i.pre(function(){if(r.$__.isDeleted)throw new gu.skipWrappedFunction}),i.post(function(){return Promise.all(r.$getAllSubdocs().map((a)=>a.constructor._middleware.execPost("deleteOne",a,[a],{filter:o})))}),i.post(function(){return r.constructor._middleware.execPost("deleteOne",r,[r],{filter:o})}),i.transform(function(a){if(a?.deletedCount>0)r.$isDeleted(!0);return a}),i};W.prototype.$model=function(t){if(arguments.length===0)return this.constructor;return this[yl].model(t)};W.prototype.model=W.prototype.$model;W.exists=function(t,r){if(Le(this,"exists"),typeof arguments[2]==="function")throw new Se("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 Se("The provided class "+e+" must extend Model")}r=r||{};let i=le.isPOJO(r)?r.value:r,s=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 gC(t);if(t instanceof gC&&s)t=t.clone();if(t=fme(this,e,t,i,o,r.mergeHooks,u),pme(this.db.models,e)&&!t.options.overwriteModels&&!u)throw new Gpe(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}),_G(a,t),wG(a,t),this[pp]!=null)for(let c of this[pp])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 Se("`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[TG]==null)throw new Se("`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 yC.prototype)W[e]=yC.prototype[e];W.init=function(){if(Le(this,"init"),typeof arguments[0]==="function")throw new Se("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()},i=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=i().then(()=>r()).then(()=>n());let s=this.$init.catch,o=this;return this.$init.catch=function(){return o.$caught=!0,s.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 Se("Model.createCollection() no longer accepts a callback");let r=Eu(t,"pre"),n=Eu(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 gu.skipWrappedFunction)return[c];throw c});let i=this?.schema?.options?.collectionOptions;if(i!=null)t=Object.assign({},i,t);let s=this?.schema?.options?.collation;if(s!=null)t=Object.assign({collation:s},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 gu.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 Se("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(s){if(s!=null&&(s.name!=="MongoServerError"||s.code!==48))throw s}let n=await this.diffIndexes({indexOptionsToCreate:!0}),i=await this.cleanIndexes({...t,toDrop:n.toDrop});return await this.createIndexes({...t,toCreate:n.toCreate}),i};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 Se("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=_me(r,n);let i=r.schema,s=Ame(r,i.indexes()),o=qme(i,s,n),u=kme(i,s,n,o,t);return{toDrop:o,toCreate:u}};function kme(e,t,r,n,i){let s=[],o=i?.indexOptionsToCreate??!1;for(let[u,a]of t){let c=!1,l=OC(e,_c(a));for(let f of r){if(wC(f))continue;if(CG(u,l,f)&&!n.includes(f.name)){c=!0;break}}if(!c)if(o)s.push([u,a]);else s.push(u)}return s}function qme(e,t,r){let n=[];for(let i of r){let s=!1;if(wC(i))continue;if(Eme(i,e.options))continue;for(let[o,u]of t){let a=OC(e,_c(u));if(AG(o,a,e.options),CG(o,a,i)){s=!0;break}}if(s)continue;n.push(i.name)}return n}W.cleanIndexes=async function(t){if(Le(this,"cleanIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new Se("Model.cleanIndexes() no longer accepts a callback");let r=this;if(Array.isArray(t?.toDrop))return await dG(t.toDrop,r,t);let n=await r.diffIndexes();return await dG(n.toDrop,r,t)};async function dG(e,t,r){if(e.length===0)return[];let n=t.$__collection;if(r?.hideIndexes)await Promise.all(e.map((i)=>t.db.db.command({collMod:n.collectionName,index:{name:i,hidden:!0}})));else await Promise.all(e.map((i)=>n.dropIndex(i)));return e}W.listIndexes=async function(){if(Le(this,"listIndexes"),typeof arguments[0]==="function")throw new Se("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 Se("Model.ensureIndexes() no longer accepts a callback");await new Promise((r,n)=>{jme(this,t,(i)=>{if(i!=null)return n(i);r()})})};W.createIndexes=async function(t){if(Le(this,"createIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new Se("Model.createIndexes() no longer accepts a callback");return this.ensureIndexes(t)};/*!
|
|
1033
|
+
* ignore
|
|
1034
|
+
*/function jme(e,t,r){let n=Array.isArray(t?.toCreate)?t.toCreate:e.schema.indexes(),i;t=t||{};let s=function(h){if(h&&!e.$caught)e.emit("error",h);e.emit("index",h||i),r&&r(h||i)};for(let h of n)if(wC(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&&gme(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){hG(function(){s()});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():[];hG(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 s()}let h=n.shift();if(!h)return s();if(t._automatic&&h[1]._autoIndex===!1)return f();if(l.find((E)=>le.deepEqual(E,h)))return f();let d=_c(h[0]),p=_c(h[1]);delete p._autoIndex,OC(e.schema,p),OG(e.schema,p),AG(d,p,e.schema.options),a(d,p);let m=null;try{m=e.collection.createIndex(d,p)}catch(E){if(!i)i=E;if(!e.$caught)e.emit("error",E);u(E,d,p),f();return}m.then((E)=>{u(null,d,p,E),f()},(E)=>{if(!i)i=E;if(!e.$caught)e.emit("error",E);u(E,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=(i,s)=>{let o,u=[],a=i.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 Se(`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,s);else t[l]=s;if(l!==i)if(t instanceof Map)t.delete(i);else delete t[i];return t};if(typeof t==="object"){if(t instanceof Map)for(let i of new Map(t))t=n(i[0],i[1]);else for(let i of Object.keys(t))if(t=n(i,t[i]),i[0]==="$")if(Array.isArray(t[i]))for(let s in t[i])t[i][s]=this.translateAliases(t[i][s]);else this.translateAliases(t[i]);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 Se("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 Se("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 Se("Model.find() no longer accepts a callback");let i=new this.Query({},{},this,this.$__collection);return i.select(r),i.setOptions(n),i.find(t)};W.findAndCount=async function(t,r,n){if(Le(this,"findAndCount"),n==null)throw new Se("Model.findAndCount() requires an `options` argument with `sort` and `limit`");let i=this.find(t,r,n);if(n.sort==null&&!this.schema.options.defaultSort)throw new Se("Model.findAndCount() requires `options.sort`");if(le.isEmptyObject(i.options.sort))throw new Se("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 Se("Model.findAndCount() requires `options.limit`");let s=i.clone().countDocuments().skip(0).limit(null);return Promise.all([i.exec(),s.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 Se("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 Se("Model.findOne() no longer accepts a callback");let i=new this.Query({},{},this,this.$__collection);return i.select(r),i.setOptions(n),i.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 Se("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 Se("Model.distinct() no longer accepts a callback");let i=new this.Query({},{},this,this.$__collection);if(n!=null)i.setOptions(n);return i.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 Se("Model.findOneAndUpdate() no longer accepts a callback");let n;if(r)n=r.fields||r.projection;let i=new this.Query({},{},this,this.$__collection);return i.select(n),i.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 Se("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 Se("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 Se("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 Se("Model.findOneAndReplace() no longer accepts a callback");let n;if(r)n=r.select,r.select=void 0;let i=new this.Query({},{},this,this.$__collection);return i.select(n),i.findOneAndReplace(e,t,r)};W.create=async function(t,r){if(typeof r==="function"||typeof arguments[2]==="function")throw new Se("Model.create() no longer accepts a callback");Le(this,"create");let n,i=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 Se("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&&mme(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 s=[],o=typeof r.aggregateErrors==="boolean"?!r.aggregateErrors:!0;if(delete r.aggregateErrors,r.session&&!r.ordered&&n.length>1)throw new Se("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[i]!=null?of(this.discriminators,t[i])||uf(this.discriminators,t[i]):this;if(a==null)throw new Se(`Discriminator "${t[i]}" 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[i]!=null?of(this.discriminators,a[i])||uf(this.discriminators,a[i]):this;if(c==null)throw new Se(`Discriminator "${a[i]}" not found for model "${this.modelName}"`);let l=a;if(!(l instanceof c))l=new c(l);await l.$save(r),s.push(l)}catch(a){if(!o)s.push(a);else throw a}return s}else if(!o)s=await Promise.allSettled(n.map(async(u)=>{let a=this.discriminators&&u[i]!=null?of(this.discriminators,u[i])||uf(this.discriminators,u[i]):this;if(a==null)throw new Se(`Discriminator "${u[i]}" not found for model "${this.modelName}"`);let c=u;if(!(c instanceof a))c=new a(c);return await c.$save(r),c})),s=s.map((u)=>u.status==="fulfilled"?u.value:u.reason);else{let u=null;if(s=await Promise.all(n.map(async(a)=>{let c=this.discriminators&&a[i]!=null?of(this.discriminators,a[i])||uf(this.discriminators,a[i]):this;if(c==null)throw new Se(`Discriminator "${a[i]}" 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 s};W.insertOne=async function(t,r){if(Le(this,"insertOne"),t==null||typeof t!=="object")throw new gG(t,"doc","insertOne");let n=this.schema.options.discriminatorKey,i=this.discriminators&&t[n]!=null?of(this.discriminators,t[n])||uf(this.discriminators,t[n]):this;if(i==null)throw new Se(`Discriminator "${t[n]}" not found for model "${this.modelName}"`);if(!(t instanceof i))t=new i(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||[],Cme(e,this.schema,"fullDocument");let n=this.db._waitForConnect().then(()=>this.$__collection.watch(e,r));return new Vpe(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 Se("Model.insertMany() no longer accepts a callback");let n=this;return Wpe(function(){return Lme.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 Lme(e,t){t=t||{};let r=this._middleware.hasHooks("insertMany"),n=r?Eu(t,"pre"):null,i=r?Eu(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:i})}let s=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 s)){if(S!=null&&typeof S!=="object")return Promise.reject(new gG(S,"arr."+B,"insertMany"));S=new s(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 E=await Ome(e,m,o),y={},_=[],O=l?_:[],b=s.schema.options.versionKey?s.schema.paths[s.schema.options.versionKey]?.splitPath():null,A=t.timestamps;for(let S=0;S<E.length;++S){let B=E[S];if(B==null)continue;if(y[_.length]=S,_.push(B),l)continue;if(b)B.$__setValue(b,0);if(A!==!1&&B.initializeTimestamps&&(!B.$__||B.$__.timestamps!==!1))B.initializeTimestamps(A);O.push(B.$__hasOnlyPrimitiveValues()?B.$__toObjectShallow():B.toObject(AC))}if(h.length>0&&a===!1)h.sort((S,B)=>S.index-B.index);if(_.length===0){if(c)throw new P_(h,d,null,"insertMany");if(u){let S={acknowledged:!0,insertedCount:0,insertedIds:{}};return pl(S,h,h),S}return[]}let P;try{P=await this.$__collection.insertMany(O,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((we)=>we.index));if(S.writeErrors!=null)for(let we=0;we<S.writeErrors.length;++we){let Ne=S.writeErrors[we],ae=y[Ne.index];if(Ne.err!=null)Ne.err.index=ae;if(!a)d[ae]=S.writeErrors[we]}if(!a){for(let we=0;we<d.length;++we)if(d[we]===void 0)d[we]=E[we];S.results=d}let I=-1;if(S.insertedDocs=_.filter((we,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),af(Ne,!1),Ne}),u&&a===!1)pl(S,h,d);if(r)await this._middleware.execPost("insertMany",this,[e],{error:S,filter:i});else throw S}if(!l)for(let S of _){let B=S.$__hasOnlyPrimitiveValues();S.$__reset(!0,B),af(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]=E[S];throw new P_(h,d,P,"insertMany")}if(u){if(a===!1){for(let S=0;S<d.length;++S)if(d[S]===void 0)d[S]=E[S];pl(P,h,d)}return P}if(t.populate!=null)return this.populate(_,t.populate).catch((S)=>{if(S!=null)S.insertedDocs=_;throw S});if(r){let[S]=await this._middleware.execPost("insertMany",this,[_],{filter:i});return S}return _}/*!
|
|
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 af(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 i of n)i.$isNew=t,i.$emit("isNew",t)}W.bulkWrite=async function(t,r){if(Le(this,"bulkWrite"),typeof r==="function"||typeof arguments[2]==="function")throw new Se("Model.bulkWrite() no longer accepts a callback");let n=this;return Hpe(function(){return Ume.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 Ume(e,t){t=t||{};let r=Eu(t,"pre"),n=Eu(t,"post");try{[e,t]=await this.hooks.execPre("bulkWrite",this,[e,t],{filter:r})}catch(a){if(a instanceof gu.skipWrappedFunction)e=a;else await this.hooks.execPost("bulkWrite",this,[null],{error:a,filter:n})}if(e instanceof gu.skipWrappedFunction)return e.args[0];let i=t.ordered==null?!0:t.ordered;if(e.length===0){let c=new(this.base.driver.get()).BulkWriteResult(pC(),!1);return c.n=0,pl(c,[],[]),c}let s=t?._skipCastBulkWrite?[]:e.map((a)=>ame(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(i){await new Promise((a,c)=>{dme(s,(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(s.length>0)a=await Promise.all(e.map((p,m)=>{if(m>=s.length)return m;return new Promise((E)=>{s[m]((y)=>{if(y==null)E(m);else c.push({index:m,error:y}),l[m]=y;E()})})})),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 P_(c,l,u,"bulkWrite");let m=new(this.base.driver.get()).BulkWriteResult(pC(),!1);return m.result=pC(),pl(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)pl(h,c,l);await this.hooks.execPost("bulkWrite",this,[null],{error:h,filter:n})}if(c.length>0)if(t.throwOnValidationError)throw new P_(c,l,u,"bulkWrite");else pl(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)=>Vme(h,r)));let n=[],i=this.buildBulkWriteOperations(t,r,n),s={skipValidation:!0,_skipCastBulkWrite:!0,...r},{bulkWriteResult:o,bulkWriteError:u}=await this.bulkWrite(i,s).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(i.length>0&&a+c<i.length&&!u)throw new Bme(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)=>zme(h,r))),u!=null)throw u;return o};async function Vme(e,t){let r=Eu(t,"pre"),[n]=await e.schema.s.hooks.execPre("save",e,[t],{filter:r});if(n!==t)throw new Se('Cannot overwrite options in pre("save") hook on bulkSave()')}async function zme(e,t){let r=e.$isNew;if(r)af(e,!1);if(e.$__reset(),!r)e._applyVersionIncrement();let n=Eu(t,"post");return e.schema.s.hooks.execPost("save",e,[e],{filter:n})}W.applyDefaults=function e(t){if(t==null)return t;if(yp(t)){Jpe(t,t.$__.fields,t.$__.exclude);for(let r of t.$getAllSubdocs())e(r,r.$__.fields,r.$__.exclude);return t}return Zpe(t,this.schema),t};W.applyVirtuals=function(t,r){if(t==null)return t;if(yp(t))return t;return ome(this.schema,t,r),t};W.applyTimestamps=function(t,r){if(t==null)return t;if(yp(t))return t;return sme(this.schema,t,r),t};W.castObject=function(t,r){r=r||{};let n={},i=this.schema,s=i.options.discriminatorKey;if(i.discriminators!=null&&t!=null&&t[s]!=null)i=SG(i,t[s])||i;let o=Object.keys(i.paths);for(let a of o){if(!i.path(a)?.$isMongooseArray)continue;let l=mp(t,a);DG(o,l,a)}let u=null;for(let a of o){let c=i.path(a);if(c==null)continue;let l=mp(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 M_,u.addError(a,new Fme(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 M_,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 M_,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 Se(`bulkSave expects an array of documents to be passed, received \`${t}\` instead`);return s(),t.map((o,u)=>{if(!r.skipValidation){if(!(o instanceof no))throw new Se(`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];EC(o,f);let d=this.schema.options.shardKey;if(d){let m=Object.keys(d),E=m.length;for(let y=0;y<E;++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 s(){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 Se("Cannot set `hydratedPopulatedDocs` option to false if `virtuals` option is truthy because `virtuals: true` also sets populated virtuals");if(r!=null){if(yp(t))t=t.toObject(AC);r=Sme(r),t=rme(t,r)}let i=Ed().createModel(this,t,r,r,n);return i.$init(t,n),i};W.updateMany=function(t,r,n){if(Le(this,"updateMany"),r==null)throw new Se("updateMany `update` parameter cannot be nullish");return SC(this,"updateMany",t,r,n)};W.updateOne=function(t,r,n){return Le(this,"updateOne"),SC(this,"updateOne",t,r,n)};W.replaceOne=function(t,r,n){Le(this,"replaceOne");let i=this?.schema?.options?.versionKey||null;if(i&&!r[i])r[i]=0;return SC(this,"replaceOne",t,r,n)};function SC(e,t,r,n,i){let s=new e.Query({},{},e,e.collection);if(r instanceof no)r=r.toObject();else r=_c(r);i=typeof i==="function"?i:_c(i);let o=e?.schema?.options?.versionKey??null;return hme(n,i,o),s[t](r,n,i)}W.aggregate=function(t,r){if(Le(this,"aggregate"),typeof r==="function"||typeof arguments[2]==="function")throw new Se("Model.aggregate() no longer accepts a callback");let n=new Upe(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 Se("Model.validate() no longer accepts a callback");let i=this.schema,s=i.options.discriminatorKey;if(i.discriminators!=null&&t!=null&&t[s]!=null)i=SG(i,t[s])||i;let o=Object.keys(i.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=i.path(c);if(!l?.$isMongooseArray||l.$isMongooseDocumentArray)continue;let f=mp(t,c);DG(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=i.path(c);if(l==null)continue;let f=mp(t,c,void 0);a.push(l.doValidate(f,n,{path:c}).catch((h)=>{u=u||new M_,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:cme(r)}))}}});W.populate=async function(t,r){if(Le(this,"populate"),typeof r==="function"||typeof arguments[2]==="function")throw new Se("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 pG(this,t,n);else{let n=[];for(let i of r)n.push(pG(this,t,i));await Promise.all(n)}return t};/*!
|
|
1040
|
+
* Populates `docs` for a single `populateOptions` instance.
|
|
1041
|
+
*/var Wme=/\s?-_id\s?/,Hme=/\s?-_id\s?/g;async function pG(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=yme(e,t,r);if(n instanceof Error)throw n;let i=n.length,s=[];function o(f){return f!==void 0}let u=!1,a=[];for(let f=0;f<i;++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=Wme.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)){yG(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(Hme," ");else if(Array.isArray(d))d=d.filter((_)=>_!=="-_id");else{let{_id:_,...O}=d;d=O}if(h.options.options?.limit!=null)m.originalLimit=h.options.options.limit;else if(h.options.limit!=null)m.originalLimit=h.options.limit;let E=Mme(h,p,d,m);if(E!=null){a.push(...E);continue}let y=lme(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 mG.apply(null,h);if(l.push(d),!h[0]._assignFromOwnResults)s=s.concat(d);if(p.length>0)c.set(f,p)}else{let f=[];for(let d of a)f.push(mG.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)s=s.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]:s;for(let E of m)d.options._childDocs.push(E);yG(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 E of d.docs){let y=yp(E)?E.get(d.options.path):le.getValue(d.options.path,E);if(Array.isArray(y))m.push(...y);else if(y!=null)m.push(y)}if(m.length>0)for(let E of p)await d.model.populate(m,E)}for(let f=0;f<a.length;f++){let h=a[f][0];bme(h.foreignField,h.options,h._assignFromOwnResults?l[f]:s)}for(let f=0;f<a.length;f++){let h=a[f][0];if(h.options?.options?._leanTransform){let d=h._assignFromOwnResults?l[f]:s;for(let p of d)h.options.options._leanTransform(p)}}}/*!
|
|
1042
|
+
* ignore
|
|
1043
|
+
*/function mG(e,t,r){if(t==null)return Promise.resolve({docs:[],deferredPopulates:[]});let n=_c(e.options.populate),i={};if(e.options.skip!==void 0)i.skip=e.options.skip;if(e.options.limit!==void 0)i.limit=e.options.limit;if(e.options.perDocumentLimit!==void 0)i.perDocumentLimit=e.options.perDocumentLimit;if(Object.assign(i,e.options.options),i.readPreference==null&&e.options._inheritedReadPreference!=null)i.readPreference=e.options._inheritedReadPreference;if(i.readConcern==null&&e.options._inheritedReadConcern!=null)i.readConcern=e.options._inheritedReadConcern;if(e.count)delete i.skip,i.sort??={};if(i.perDocumentLimit!=null)i.limit=i.perDocumentLimit,delete i.perDocumentLimit;else if(i.limit!=null)i.limit=i.limit*e.ids.length;if(Array.isArray(e.match))i._deferPopulate=!0;let s=e.model.find(t,r,i);for(let u of e.foreignField)if(u!=="_id"&&s.selectedInclusively()&&!wme(s._fields,u))s.select(u);if(e.count)for(let u of e.foreignField)s.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)s.populate(n);return s.exec().then((u)=>{for(let c of u)bG.set(c,e.model);let a=[];if(s._deferredPopulate)a.push(...s._deferredPopulate),delete s._deferredPopulate;if(o)n=le.populate(n),Tme(s,n),a.push(n);return{docs:u,deferredPopulates:a}})}/*!
|
|
1044
|
+
* ignore
|
|
1045
|
+
*/function yG(e,t,r,n){let{options:i,isVirtual:s,justOne:o}=r,u,a=i&&i.options&&i.options.lean||!1,c=t.length,l={},f={},h,d,p=_c(r.allIds);for(let m=0;m<c;m++){if(d=t[m],d==null)continue;for(let E of r.foreignField){if(u=le.getValue(E,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(s&&!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(s||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}}}ume({originalModel:e,rawIds:r.isVirtual?p:r.allIds,allIds:p,unpopulatedValues:r.unpopulatedValues,foreignField:r.foreignField,rawDocs:f,rawOrder:l,docs:r.docs,path:i.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,i,s){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 E=of(f.discriminators,h[m])||uf(f.discriminators,h[m]);if(E!=null)return new E(h,d,p);W.call(this,h,d,p)};if(u.hooks=r.s.hooks.clone(),u.base=s,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=i,u.prototype.db=i,u.prototype[yl]=i,u.discriminators=u.prototype.discriminators=void 0,u[TG]=!0,u.events=new yC,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=i.collection(n,c);return u.prototype.collection=l,u.prototype.$collection=l,u.prototype[ml]=l,u.prototype.$__setSchema(r),_G(u,r),wG(u,r),tme(u,r),ime(u,r.s.hooks,r.statics),u.schema=u.prototype.$__schema,u.collection=l,u.$__collection=l,u.Query=function(){dl.apply(this,arguments)},Object.setPrototypeOf(u.Query.prototype,dl.prototype),u.Query.base=dl.base,u.Query.prototype.constructor=dl,u._applyQueryMiddleware(),Kme(u,r.query),u};W.clientEncryption=function(){let t=this.base.driver.get().ClientEncryption;if(!t)throw new Se("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:i,keyVaultClient:s,kmsProviders:o,credentialProviders:u,proxyOptions:a,tlsOptions:c}=n;return new t(s??r,{keyVaultNamespace:i,kmsProviders:o,credentialProviders:u,proxyOptions:a,tlsOptions:c})};W.$__updateConnection=function(t){this.db=t,this.prototype.db=t,this.prototype[yl]=t;let r=t.collection(this.collection.collectionName,this.collection.opts);this.prototype.collection=r,this.prototype.$collection=r,this.prototype[ml]=r,this.collection=r,this.$__collection=r};function Kme(e,t){for(let r in t)e.Query.prototype[r]=t[r]}W.__subclass=function(t,r,n){let i=this,s=function l(f,h,d){if(!(this instanceof l))return new l(f,h,d);i.call(this,f,h,d)};if(Object.setPrototypeOf(s,i),Object.setPrototypeOf(s.prototype,i.prototype),s.db=t,s.prototype.db=t,s.prototype[yl]=t,i[pp]=i[pp]||[],i[pp].push(s),i.discriminators!=null){s.discriminators={};for(let l of Object.keys(i.discriminators))s.discriminators[l]=i.discriminators[l].__subclass(i.db,i.discriminators[l].schema,n)}let o=r&&typeof r!=="string"?r:i.prototype.$__schema,u=o.options||{},a=o._userProvidedOptions||{};if(!n)n=i.prototype.$__schema.get("collection")||le.toCollectionName(i.modelName,this.base.pluralize());let c={schemaUserProvidedOptions:a,capped:o&&u.capped};return s.prototype.collection=t.collection(n,c),s.prototype.$collection=s.prototype.collection,s.prototype[ml]=s.prototype.collection,s.collection=s.prototype.collection,s.$__collection=s.collection,s.init().catch(()=>{}),s};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,eme(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(B_.inspect.custom)W[B_.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 i=Gme(n);if(n.name==="validate")return!!i.query;if(n.name==="deleteOne"||n.name==="updateOne")return!!i.query||le.hasOwnKeys(i)===!1;if(n.query!=null||n.document!=null)return!!n.query;return!0});t.prototype._queryMiddleware=r};function Gme(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
|
+
*/PG.exports=MG=W});var FG=g(function(gp,BG){BG.exports=Jme;gp.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 Yme=gp.pluralization;gp.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 Qme=gp.uncountables;function Jme(e){let t;if(e=e.toLowerCase(),!~Qme.indexOf(e)){if(t=Yme.filter(function(r){return e.match(r[0])}),t[0])return e.replace(t[0][0],t[0][1])}return e}});var xG=g(function(FAe,RG){/*!
|
|
1051
|
+
* Module requirements
|
|
1052
|
+
*/var IG=ze(),N_=require("util"),NG=y4();class Ac extends IG{constructor(){super("");this.errors={}}toString(){return NG(this)}inspect(){return Object.assign(Error(this.message),this)}addError(e,t){if(t instanceof Ac){let{errors:r}=t;for(let n of Object.keys(r))this.addError(n,r[n]);return}this.errors[e]=t,this.message=NG(this)}}if(N_.inspect.custom)Ac.prototype[N_.inspect.custom]=Ac.prototype.inspect;Object.defineProperty(Ac.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}});Object.defineProperty(Ac.prototype,"name",{value:"SetOptionError"});class $G extends IG{constructor(e){super(`"${e}" is not a valid option to set`)}}Ac.SetOptionInnerError=$G;/*!
|
|
1053
|
+
* Module exports
|
|
1054
|
+
*/RG.exports=Ac});var vG=g(function(){var I_=be();if(typeof jest<"u"&&!process.env.SUPPRESS_JEST_WARNINGS){if(typeof window<"u")I_.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")I_.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 WG=g(function(VG,zG){/*!
|
|
1055
|
+
* Module dependencies.
|
|
1056
|
+
*/var Xme=ou(),Zme=require("events").EventEmitter,cf=Gc(),as=nl(),e0e=Mr(),Au=Id(),t0e=kg(),lf=UE(),$_=Xz(),r0e=Bh(),n0e=l_(),kG=JS(),i0e=HO(),s0e=pO(),CC=VE(),o0e=FG(),_u=be(),qG=yS(),u0e=ol(),a0e=HS(),c0e=ph().trusted,l0e=RS(),h0e=Zn(),f0e=uu(),ea=ze(),Zu=xG(),d0e=YS(),jG=Symbol.for("mongoose:default"),LG=Symbol("mongoose:defaultConnection");vG();var p0e=/^[0-9A-Fa-f]{24}$/,{AsyncLocalStorage:UG}=require("async_hooks");function ie(e){if(this.connections=[],this.nextConnectionId=0,this.models={},this.events=new Zme,this.__driver=CC.get(),this.options=Object.assign({pluralization:!0,autoIndex:!0,autoCreate:!0,autoSearchIndex:!1},e),(_u.getOption("createInitialConnection",this.options)??!0)&&this.__driver!=null)bC(this);if(this.options.pluralization)this._pluralize=o0e;if(!e?.[jG]){let r=this;this.Schema=function(){return this.base=r,as.apply(this,arguments)},this.Schema.prototype=Object.create(as.prototype),Object.assign(this.Schema,as),this.Schema.base=this,this.Schema.Types=Object.assign({},as.Types)}else for(let r of["Schema","model"])this[r]=ie.prototype[r];if(this.Schema.prototype.base=this,e?.transactionAsyncLocalStorage)this.transactionAsyncLocalStorage=new UG;Object.defineProperty(this,"plugins",{configurable:!1,enumerable:!0,writable:!1,value:Object.values(s0e).map((r)=>[r,{deduplicate:!0}])})}ie.prototype.cast=u0e;ie.prototype.STATES=lf;ie.prototype.ConnectionStates=lf;ie.prototype.driver=CC;ie.prototype.setDriver=function(t){let r=this instanceof ie?this:ui;if(r.__driver===t)return r;if(r.connections&&r.connections.find((o)=>o.readyState!==lf.disconnected))throw new ea("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(ui.Schema.Types,t.SchemaTypes);let i=t.Connection,s=r.connections[0];if(r.connections=[new i(r)],r.connections[0].models=r.models,s==null)return r;for(let o of Object.values(r.models)){if(o.db!==s)continue;o.$__updateConnection(r.connections[0])}return r};ie.prototype.set=function(t,r){let n=this instanceof ie?this:ui;if(t==null){let o=new Zu;throw o.addError(String(t),new Zu.SetOptionInnerError(String(t))),o}if(arguments.length===1&&typeof t!=="object"){if($_.indexOf(t)===-1){let o=new Zu;throw o.addError(t,new Zu.SetOptionInnerError(t)),o}return n.options[t]}let i={};if(arguments.length===2)i={[t]:r};if(arguments.length===1&&typeof t==="object")i=t;let s=void 0;for(let[o,u]of Object.entries(i)){if($_.indexOf(o)===-1){if(!s)s=new Zu;s.addError(o,new Zu.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 UG;else if(!u&&n.transactionAsyncLocalStorage)delete n.transactionAsyncLocalStorage}else if(o==="createInitialConnection"){if(u&&!n.connection)bC(n);else if(u===!1&&n.connection?.[LG]){if(n.connection.readyState===lf.disconnected&&_u.hasOwnKeys(n.connection.models)===!1)n.connections.shift()}}else if(o==="returnOriginal"){if(n.options.returnDocument!=null)throw new ea("Cannot set `returnOriginal` when `returnDocument` is already set. Use `returnDocument` instead.");_u.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 ea("Cannot set `returnDocument` when `returnOriginal` is already set. Use `returnDocument` instead of `returnOriginal`.")}}if(s)throw s;return n};ie.prototype.get=ie.prototype.set;ie.prototype.createConnection=function(t,r){let n=this instanceof ie?this:ui,s=new n.__driver.Connection(n);if(n.connections.push(s),n.nextConnectionId++,n.events.emit("createConnection",s),arguments.length>0)s.openUri(t,{...r,_fireAndForget:!0});return s};ie.prototype.connect=async function(t,r){if(typeof r==="function"||arguments.length>=3&&typeof arguments[2]==="function")throw new ea("Mongoose.prototype.connect() no longer accepts a callback");let n=this instanceof ie?this:ui;if(n.connection==null)bC(n);return n.connection.openUri(t,r).then(()=>n)};ie.prototype.disconnect=async function(){if(arguments.length>=1&&typeof arguments[0]==="function")throw new ea("Mongoose.prototype.disconnect() no longer accepts a callback");let t=this instanceof ie?this:ui;if(t.connections.length<=0)return;await Promise.all(t.connections.map((n)=>n.close()))};ie.prototype.startSession=function(){let t=this instanceof ie?this:ui;return t.connection.startSession.apply(t.connection,arguments)};ie.prototype.pluralize=function(t){let r=this instanceof ie?this:ui;if(arguments.length>0)r._pluralize=t;return r._pluralize};ie.prototype.model=function(t,r,n,i){let s=this instanceof ie?this:ui;if(typeof r==="string")n=r,r=!1;if(arguments.length===1){let c=f0e(s.models,t);if(!c)throw new s.Error.MissingSchemaError(t);return c}if(_u.isObject(r)&&!(r instanceof as))r=new as(r);if(r&&!(r instanceof as))throw new s.Error("The 2nd parameter to `mongoose.model()` should be a schema or a POJO");i=i||{};let o=r;if(r){if(s.get("cloneSchemas"))r=r.clone();s._applyPlugins(r)}let u=Object.hasOwn(s.options,"overwriteModels")?s.options.overwriteModels:i.overwriteModels;if(Object.hasOwn(s.models,t)&&i.cache!==!1&&u!==!0){if(o?.instanceOfSchema&&o!==s.models[t].schema)throw new s.Error.OverwriteModelError(t);if(n&&n!==s.models[t].collection.name){let c=s.models[t];return r=c.prototype.schema,c.__subclass(s.connection,r,n)}return s.models[t]}if(r==null)throw new s.Error.MissingSchemaError(t);let a=s._model(t,r,n,i);return s.connection.models[t]=a,s.models[t]=a,a};/*!
|
|
1057
|
+
* ignore
|
|
1058
|
+
*/ie.prototype._model=function(t,r,n,i){let s=this instanceof ie?this:ui,o;if(typeof t==="function"){if(o=t,t=o.name,!(o.prototype instanceof kG))throw new s.Error("The provided class "+t+" must extend Model")}if(t==="__proto__")throw new s.Error('Model name "__proto__" is not allowed');if(r){if(s.get("cloneSchemas"))r=r.clone();s._applyPlugins(r)}if(r==null||!("pluralization"in r.options))r.options.pluralization=s.options.pluralization;if(!n)n=r.get("collection")||_u.toCollectionName(t,s.pluralize());d0e(r);let u=i.connection||s.connection;if(o=s.Model.compile(o||t,r,n,u,s),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};ie.prototype.deleteModel=function(t){let r=this instanceof ie?this:ui;return r.connection.deleteModel(t),delete r.models[t],r};ie.prototype.modelNames=function(){let t=this instanceof ie?this:ui;return Object.keys(t.models)};ie.prototype._applyPlugins=function(t,r){let n=this instanceof ie?this:ui;r=r||{},r.applyPluginsToDiscriminators=n.options?.applyPluginsToDiscriminators||!1,r.applyPluginsToChildSchemas=typeof n.options?.applyPluginsToChildSchemas==="boolean"?n.options.applyPluginsToChildSchemas:!0,i0e(t,n.plugins,r,"$globalPluginsApplied")};ie.prototype.plugin=function(t,r){let n=this instanceof ie?this:ui;return n.plugins.push([t,r]),n};ie.prototype.__defineGetter__("connection",function(){return this.connections[0]});ie.prototype.__defineSetter__("connection",function(e){if(e instanceof this.__driver.Connection)this.connections[0]=e,this.models=e.models});ie.prototype.connections;ie.prototype.nextConnectionId;ie.prototype.Aggregate=a0e;ie.prototype.BaseCollection=R3();Object.defineProperty(ie.prototype,"Collection",{get:function(){return this.__driver.Collection},set:function(e){this.__driver.Collection=e}});Object.defineProperty(ie.prototype,"Connection",{get:function(){return this.__driver.Connection},set:function(e){if(e===this.__driver.Connection)return;this.__driver.Connection=e}});ie.prototype.BaseConnection=mS();ie.prototype.version=qG.version;ie.prototype.Mongoose=ie;ie.prototype.Schema=as;ie.prototype.SchemaType=e0e;ie.prototype.SchemaTypes=as.Types;ie.prototype.VirtualType=t0e;ie.prototype.Types=r0e;ie.prototype.Query=n0e;ie.prototype.Model=kG;ie.prototype.Document=Xme;ie.prototype.ObjectId=Au.ObjectId;ie.prototype.isValidObjectId=function(t){return(this instanceof ie?this:ui).Types.ObjectId.isValid(t)};ie.prototype.isObjectIdOrHexString=function(t){return h0e(t,"ObjectId")||typeof t==="string"&&p0e.test(t)};ie.prototype.syncIndexes=function(t){return(this instanceof ie?this:ui).connection.syncIndexes(t)};ie.prototype.Decimal128=Au.Decimal128;ie.prototype.Mixed=Au.Mixed;ie.prototype.Date=Au.Date;ie.prototype.Number=Au.Number;ie.prototype.Error=ea;ie.prototype.MongooseError=ea;ie.prototype.now=function(){return new Date};ie.prototype.CastError=ea.CastError;ie.prototype.SchemaTypeOptions=qi();ie.prototype.mongo=null;ie.prototype.mquery=$S();ie.prototype.sanitizeFilter=l0e;ie.prototype.trusted=c0e;ie.prototype.skipMiddlewareFunction=cf.skipWrappedFunction;ie.prototype.overwriteMiddlewareResult=cf.overwriteResult;ie.prototype.overwriteMiddlewareArguments=cf.overwriteArguments;ie.prototype.omitUndefined=kw();/*!
|
|
1059
|
+
* Create a new default connection (`mongoose.connection`) for a Mongoose instance.
|
|
1060
|
+
* No-op if there is already a default connection.
|
|
1061
|
+
*/function bC(e){if(e.connection)return;let t=e.createConnection();t[LG]=!0,t.models=e.models}var ui=zG.exports=VG=new ie({[jG]:!0})});var GG=g(function($Ae,KG){/*!
|
|
1062
|
+
* Module dependencies.
|
|
1063
|
+
*/var HG=Qz();VE().set(HG);var Ep=WG();Ep.setDriver(HG);Ep.Mongoose.prototype.mongo=Pa();KG.exports=Ep});var YG=g(function(RAe,Re){var Y=GG();Re.exports=Y;Re.exports.default=Y;Re.exports.mongoose=Y;Re.exports.cast=Y.cast;Re.exports.STATES=Y.STATES;Re.exports.setDriver=Y.setDriver;Re.exports.set=Y.set;Re.exports.get=Y.get;Re.exports.createConnection=Y.createConnection;Re.exports.connect=Y.connect;Re.exports.disconnect=Y.disconnect;Re.exports.startSession=Y.startSession;Re.exports.pluralize=Y.pluralize;Re.exports.model=Y.model;Re.exports.deleteModel=Y.deleteModel;Re.exports.modelNames=Y.modelNames;Re.exports.plugin=Y.plugin;Re.exports.connections=Y.connections;Re.exports.version=Y.version;Re.exports.Aggregate=Y.Aggregate;Re.exports.Mongoose=Y.Mongoose;Re.exports.Schema=Y.Schema;Re.exports.SchemaType=Y.SchemaType;Re.exports.SchemaTypes=Y.SchemaTypes;Re.exports.VirtualType=Y.VirtualType;Re.exports.Types=Y.Types;Re.exports.Query=Y.Query;Re.exports.Model=Y.Model;Re.exports.Document=Y.Document;Re.exports.ObjectId=Y.ObjectId;Re.exports.isValidObjectId=Y.isValidObjectId;Re.exports.isObjectIdOrHexString=Y.isObjectIdOrHexString;Re.exports.syncIndexes=Y.syncIndexes;Re.exports.Decimal128=Y.Decimal128;Re.exports.Mixed=Y.Mixed;Re.exports.Date=Y.Date;Re.exports.Number=Y.Number;Re.exports.Error=Y.Error;Re.exports.MongooseError=Y.MongooseError;Re.exports.now=Y.now;Re.exports.CastError=Y.CastError;Re.exports.SchemaTypeOptions=Y.SchemaTypeOptions;Re.exports.mongo=Y.mongo;Re.exports.mquery=Y.mquery;Re.exports.sanitizeFilter=Y.sanitizeFilter;Re.exports.trusted=Y.trusted;Re.exports.skipMiddlewareFunction=Y.skipMiddlewareFunction;Re.exports.overwriteMiddlewareResult=Y.overwriteMiddlewareResult});var w0e={};wp(w0e,{DuplicateError:()=>ta,InvalidConfigError:()=>wu,Noxium:()=>A0e,NoxiumError:()=>wc,RequiredConfigError:()=>hf,ValidationError:()=>Oc});module.exports=Ap(w0e);var y0e={};wp(y0e,{createMongoModelClient:()=>DC});var m0e={};wp(m0e,{DuplicateError:()=>ta,InvalidConfigError:()=>wu,NoxiumError:()=>wc,RequiredConfigError:()=>hf,ValidationError:()=>Oc});var E0e={};wp(E0e,{createSqliteModelClient:()=>TC});var QG=v_(Rb(),1),JG=require("fs"),XG=v_(require("path"),1);var io=v_(YG(),1);class wc 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 ta extends wc{column;value;constructor(e,t){super(`Duplicate unique value: ${e} = ${t}`,"DUPLICATE_ENTRY");this.column=e,this.value=t}}class Oc extends wc{column;constructor(e){super(`Missing required field: ${e}`,"VALIDATION_ERROR");this.column=e}}class hf extends wc{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 wu extends wc{constructor(e){super(e,"INVALID_CONFIG")}}var R_=(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)},_p=(e,t)=>{if(!e)return e;let r={...e,id:R_(e._id??e.id)};if(t)for(let[n,i]of Object.entries(t)){let s=r[n];if(s&&typeof s==="object"&&!Array.isArray(s)){let o={id:R_(s._id??s.id)};for(let u of i)if(u in s)o[u]=s[u];r[n]=o,r.ownerId=o.id}else if(s)r[n]=R_(s)}else if(r.owner&&typeof r.owner==="object")r.owner=R_(r.owner._id??r.owner.id);return r};function DC(e,t,r){if(io.default.connection.readyState===0)io.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=io.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 i=new io.Schema(n,{timestamps:t.timestamps!==!1});if(t.ttl)i.index({[t.ttl.field]:1},{expireAfterSeconds:t.ttl.seconds});let s=io.default.models[e]||io.default.model(e,i),o=async(u)=>{if(!t.hooks?.afterFind||u.length===0)return;await t.hooks.afterFind(u)};return{async insert(u){try{let a=await s.create(u);return _p(a.toObject())}catch(a){if(a?.code===11000){let c=a.keyValue??a.keyPattern??{},l=Object.keys(c)[0]??"unknown";throw new ta(l,c[l])}if(a?.errors){let c=Object.keys(a.errors)[0]??"unknown";throw new Oc(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=io.default.Types.ObjectId.isValid(String(d))?new io.default.Types.ObjectId(String(d)):d;else c[h]=d}else c._id=io.default.Types.ObjectId.isValid(String(u))?new io.default.Types.ObjectId(String(u)):u;let l=await s.findOneAndUpdate(c,{$set:a},{new:!0}).lean();return l?_p(l):null},async findAll(u){let a=s.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)=>_p(l,u?.populate))},async findUnique(u,a){let c=s.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]),_p(l,a?.populate)},async findMany(u={},a){let c=s.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)=>_p(f,a?.populate))},async deleteMany(u){let a=await s.deleteMany(u);return Number(a.deletedCount??0)}}}var g0e=(e)=>{if(e===Number)return"REAL";if(e===Boolean)return"INTEGER";if(e===Date)return"INTEGER";return"TEXT"},ff=(e,t,r)=>{if(e===void 0||e===null)return null;if(t===Date)return e instanceof Date?e.getTime():new Date(e).getTime();if(t===Boolean)return e?1:0;if(typeof e==="string"){let n=r.trim?e.trim():e;if(r.lowercase)n=n.toLowerCase();return n}return e};function TC(e,t,r){let n=r.timestamps!==!1,i=["id TEXT PRIMARY KEY"];for(let[c,l]of Object.entries(r.fields)){let f=`${c} ${g0e(l.type)}`;if(l.unique)f+=" UNIQUE";if(l.required)f+=" NOT NULL";if(l.default!==void 0){let h=typeof l.default==="string"?`'${l.default.replace(/'/g,"''")}'`:typeof l.default==="boolean"?l.default?1:0:l.default;f+=` DEFAULT ${h}`}i.push(f)}if(n){if(!("createdAt"in r.fields))i.push("createdAt INTEGER NOT NULL DEFAULT 0");if(!("updatedAt"in r.fields))i.push("updatedAt INTEGER NOT NULL DEFAULT 0")}e.exec(`CREATE TABLE IF NOT EXISTS ${t} (${i.join(", ")})`);let s=(c,l)=>{if(!c)return null;let f={id:String(c.id)};for(let[h,d]of Object.entries(r.fields)){let p=c[h];if(d.type===Date)f[h]=p!==null&&p!==void 0?new Date(Number(p)):null;else if(d.type===Boolean)f[h]=Boolean(p);else f[h]=p}if(n)f.createdAt=c.createdAt!==void 0?new Date(Number(c.createdAt)):new Date,f.updatedAt=c.updatedAt!==void 0?new Date(Number(c.updatedAt)):new Date;if(l)for(let[h,d]of Object.entries(l)){let p=c[`__pop_${h}_id`];if(p!==null&&p!==void 0){let m={id:String(p)};for(let E of d)m[E]=c[`__pop_${h}_${E}`];f[h]=m}}return f},o=(c,l)=>{let f=[];for(let h of c){let d=s(h,l);if(d!==null)f.push(d)}return f},u=async(c)=>{let l=Date.now();if(r.ttl){let f=l-r.ttl.seconds*1000;e.prepare(`DELETE FROM ${t} WHERE ${r.ttl.field} < ?`).run(f)}if(r.hooks?.afterFind){let f=o(c);await r.hooks.afterFind(f);for(let h of f)if(h&&h.__dirty){let{id:d,__dirty:p,...m}=h,E=Object.entries(m);if(E.length>0){let y=E.map(([O])=>`${O} = ?`).join(", "),_=E.map(([O,b])=>{let A=r.fields[O];if(A)return ff(b,A.type,A);if(b instanceof Date)return b.getTime();return b});e.prepare(`UPDATE ${t} SET ${y} WHERE id = ?`).run(..._,d)}}}},a=(c,l,f=!1)=>{let h=[],d=[];if(l?.populate)for(let[y,_]of Object.entries(l.populate)){let b=r.fields[y]?.ref??`${y}s`,A=`pop_${y}`;h.push(`LEFT JOIN ${b} ${A} ON ${A}.id = t.${y}`),d.push(`${A}.id AS __pop_${y}_id`);for(let P of _)d.push(`${A}.${P} AS __pop_${y}_${P}`)}let m=`SELECT ${["t.*",...d].join(", ")} FROM ${t} t ${h.join(" ")}`,E=[];if(c.length>0){let y=c.map(([_])=>`t.${_} = ?`);m+=` WHERE ${y.join(" AND ")}`;for(let[_,O]of c){let b=r.fields[_];E.push(b?ff(O,b.type,b):O)}}if(f)m+=" LIMIT 1";return{sql:m,params:E}};return{async insert(c){let l=Date.now(),f={id:c.id?String(c.id):crypto.randomUUID()};for(let[E,y]of Object.entries(r.fields)){let _=c[E]!==void 0?c[E]:y.default;if(y.required&&(_===void 0||_===null||_===""))throw new Oc(E);if(_!==void 0)f[E]=ff(_,y.type,y)}if(n)f.createdAt=c.createdAt instanceof Date?c.createdAt.getTime():l,f.updatedAt=c.updatedAt instanceof Date?c.updatedAt.getTime():l;let h=Object.keys(f),d=h.map(()=>"?").join(", ");try{e.prepare(`INSERT INTO ${t} (${h.join(", ")}) VALUES (${d})`).run(...h.map((E)=>f[E]))}catch(E){let y=String(E?.message??"");if(y.includes("UNIQUE constraint failed")){let O=y.split("UNIQUE constraint failed: ")[1]?.split(".")[1]??Object.keys(r.fields).find((b)=>r.fields[b]?.unique)??"unknown";throw new ta(O,f[O])}throw E}let p=e.prepare(`SELECT * FROM ${t} WHERE id = ? LIMIT 1`).get(f.id),m=s(p);if(!m)throw Error(`Gagal mengambil data yang baru di-insert ke tabel ${t}.`);return m},async update(c,l){if(!l)return null;let f=Date.now(),h=typeof c==="object"&&c!==null?Object.entries(c).filter(([,y])=>y!==void 0):[["id",c]];if(h.length===0)return null;let d=[];for(let[y,_]of Object.entries(l)){if(y==="id"||_===void 0)continue;let O=r.fields[y];d.push([y,O?ff(_,O.type,O):_])}if(n)d.push(["updatedAt",f]);if(d.length===0)return null;let p=h.map(([y])=>`${y} = ?`).join(" AND "),m=h.map(([y,_])=>{let O=r.fields[y];return O?ff(_,O.type,O):_});try{let y=d.map(([_])=>`${_} = ?`).join(", ");e.prepare(`UPDATE ${t} SET ${y} WHERE ${p}`).run(...d.map(([,_])=>_),...m)}catch(y){let _=String(y?.message??"");if(_.includes("UNIQUE constraint failed")){let O=_.split("UNIQUE constraint failed: ")[1]?.split(".")[1]??"unknown";throw new ta(O,l[O])}throw y}let E=e.prepare(`SELECT * FROM ${t} WHERE ${p} LIMIT 1`).get(...m);return E?s(E):null},async findAll(c){let{sql:l,params:f}=a([],c,!1),h=e.prepare(l).all(...f);await u(h);let d=e.prepare(l).all(...f);return o(d,c?.populate)},async findUnique(c,l){let f=Object.entries(c),{sql:h,params:d}=a(f,l,!0),p=e.prepare(h).get(...d);if(!p)return null;await u([p]);let m=e.prepare(h).get(...d);return m?s(m,l?.populate):null},async findMany(c={},l){let f=Object.entries(c),{sql:h,params:d}=a(f,l,!1),p=e.prepare(h).all(...d);await u(p);let m=e.prepare(h).all(...d);return o(m,l?.populate)},async deleteMany(c){let l=Object.entries(c);if(l.length===0)return 0;let f=l.map(([p])=>`${p} = ?`),h=l.map(([p,m])=>{let E=r.fields[p];return E?ff(m,E.type,E):m}),d=e.prepare(`DELETE FROM ${t} WHERE ${f.join(" AND ")}`).run(...h);return Number(d.changes??0)}}}function _0e(){let e=XG.default.resolve(process.cwd(),"noxium.config.ts");if(!JG.existsSync(e))throw new hf;let t=require(e),r=t?.default??t,n=typeof r==="function"?r():r;if(!n?.database)throw new wu("Konfigurasi `database` wajib ada di noxium.config.ts.");return n}class ZG{config;models=new Map;constructor(e){this.config=e??_0e();let t=this.config.schemas??{},r=this.config.database,n=null;if(r.type==="sqlite"){if(!r.sqlite?.path||r.sqlite.path.trim()==="")throw new wu("Konfigurasi SQLite tidak valid: field `path` wajib diisi.");n=new QG.default(r.sqlite.path),n.pragma("journal_mode = WAL;")}else if(r.type==="mongo"){if(!r.mongo?.uri||r.mongo.uri.trim()==="")throw new wu("Konfigurasi MongoDB tidak valid: field `uri` wajib diisi.")}else throw new wu("Tipe database tidak dikenali.");for(let[i,s]of Object.entries(t)){let o=r.type==="sqlite"?TC(n,i,s):DC(i,s,r);this.models.set(i,o),this[i]=o}return new Proxy(this,{get(i,s,o){if(typeof s==="string"&&i.models.has(s))return i.models.get(s);return Reflect.get(i,s,o)}})}model(e){let t=this.models.get(String(e));if(!t)throw new wu(`Model "${String(e)}" tidak terdaftar di schemas.`);return t}}var A0e=ZG;
|
|
1078
|
+
|
|
1079
|
+
//# debugId=10A24A1FC2C0555A64756E2164756E21
|
|
1080
|
+
//# sourceMappingURL=noxium.cjs.map
|