@fnlb-project/database 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -201,6 +201,7 @@ export declare const CategoryModel: import("mongoose").Model<{
201
201
  setCosmeticsWithoutCommands?: boolean | null | undefined;
202
202
  setCosmeticsWithPrefix?: boolean | null | undefined;
203
203
  acceptInvites?: boolean | null | undefined;
204
+ startBannedBots?: boolean | null | undefined;
204
205
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
205
206
  _id?: unknown;
206
207
  triggers?: string[] | null | undefined;
@@ -669,6 +670,7 @@ export declare const CategoryModel: import("mongoose").Model<{
669
670
  setCosmeticsWithoutCommands?: boolean | null | undefined;
670
671
  setCosmeticsWithPrefix?: boolean | null | undefined;
671
672
  acceptInvites?: boolean | null | undefined;
673
+ startBannedBots?: boolean | null | undefined;
672
674
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
673
675
  _id?: unknown;
674
676
  triggers?: string[] | null | undefined;
@@ -1137,6 +1139,7 @@ export declare const CategoryModel: import("mongoose").Model<{
1137
1139
  setCosmeticsWithoutCommands?: boolean | null | undefined;
1138
1140
  setCosmeticsWithPrefix?: boolean | null | undefined;
1139
1141
  acceptInvites?: boolean | null | undefined;
1142
+ startBannedBots?: boolean | null | undefined;
1140
1143
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
1141
1144
  _id?: unknown;
1142
1145
  triggers?: string[] | null | undefined;
@@ -1609,6 +1612,7 @@ export declare const CategoryModel: import("mongoose").Model<{
1609
1612
  setCosmeticsWithoutCommands?: boolean | null | undefined;
1610
1613
  setCosmeticsWithPrefix?: boolean | null | undefined;
1611
1614
  acceptInvites?: boolean | null | undefined;
1615
+ startBannedBots?: boolean | null | undefined;
1612
1616
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
1613
1617
  _id?: unknown;
1614
1618
  triggers?: string[] | null | undefined;
@@ -2077,6 +2081,7 @@ export declare const CategoryModel: import("mongoose").Model<{
2077
2081
  setCosmeticsWithoutCommands?: boolean | null | undefined;
2078
2082
  setCosmeticsWithPrefix?: boolean | null | undefined;
2079
2083
  acceptInvites?: boolean | null | undefined;
2084
+ startBannedBots?: boolean | null | undefined;
2080
2085
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
2081
2086
  _id?: unknown;
2082
2087
  triggers?: string[] | null | undefined;
@@ -2545,6 +2550,7 @@ export declare const CategoryModel: import("mongoose").Model<{
2545
2550
  setCosmeticsWithoutCommands?: boolean | null | undefined;
2546
2551
  setCosmeticsWithPrefix?: boolean | null | undefined;
2547
2552
  acceptInvites?: boolean | null | undefined;
2553
+ startBannedBots?: boolean | null | undefined;
2548
2554
  usernameTriggers?: import("mongoose").Types.DocumentArray<{
2549
2555
  _id?: unknown;
2550
2556
  triggers?: string[] | null | undefined;
package/dist/index.js CHANGED
@@ -508,7 +508,7 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
508
508
  * ignore
509
509
  */function wW(){let F=this.$__schema.options.shardKey||this.$__schema.options.shardkey;if(!o_.isPOJO(F))return;let A=this.$__.shardval={},B=Object.keys(F),D=B.length,Z;for(let J=0;J<D;++J)if(Z=this.$__getValue(B[J]),Z==null)A[B[J]]=Z;else if(o_.isMongooseObject(Z))A[B[J]]=Z.toObject({depopulate:!0,_isNested:!0});else if(Z instanceof Date||Z[Q$1])A[B[J]]=Z;else if(typeof Z.valueOf==="function")A[B[J]]=Z.valueOf();else A[B[J]]=Z}});var Dg=K((bN1,Bg)=>{var C8=o().arrayAtomicsSymbol,PW=o().sessionNewDocuments,V$1=X1();Bg.exports=function F(A){A.pre("save",function B(){let D=this.$session();if(D==null)return;if(D.transaction==null||D[PW]==null)return;if(!D[PW].has(this)){let Z={};if(this.isNew)Z.isNew=!0;if(this.$__schema.options.versionKey)Z.versionKey=this.get(this.$__schema.options.versionKey);Z.modifiedPaths=new Set(Object.keys(this.$__.activePaths.getStatePaths("modify"))),Z.atomics=L$1(this),D[PW].set(this,Z)}})};function L$1(F,A){let B=new Map;A=A||new Map;let D=Object.keys(F.$__.activePaths.init).concat(Object.keys(F.$__.activePaths.modify));for(let J of D){let X=F.$__getValue(J);if(X!=null&&Array.isArray(X)&&V$1.isMongooseDocumentArray(X)&&X.length&&X[C8]!=null&&Object.keys(X[C8]).length!==0){let E=A.get(J)||{};B.set(J,Ag(E,X[C8]))}}let Z=F.$__dirty();for(let J of Z){let{path:X,value:E}=J;if(E!=null&&E[C8]!=null&&Object.keys(E[C8]).length!==0){let Y=A.get(X)||{};B.set(X,Ag(Y,E[C8]))}}return B}function Ag(F,A){if(F=F||{},A.$pullAll!=null)F.$pullAll=(F.$pullAll||[]).concat(A.$pullAll);if(A.$push!=null)F.$push=F.$push||{},F.$push.$each=(F.$push.$each||[]).concat(A.$push.$each);if(A.$addToSet!=null)F.$addToSet=(F.$addToSet||[]).concat(A.$addToSet);if(A.$set!=null)F.$set=Array.isArray(A.$set)?[...A.$set]:Object.assign({},A.$set);return F}});var Jg=K((yN1,Zg)=>{/*!
510
510
  * ignore
511
- */Zg.exports=function F(A){A.pre("save",!1,function D(Z,J){let X=this;if(this.$isSubdocument)return Z();let E=J&&typeof J==="object"&&"validateBeforeSave"in J,Y;if(E)Y=!!J.validateBeforeSave;else Y=this.$__schema.options.validateBeforeSave;if(Y){let G=J&&typeof J==="object"&&"validateModifiedOnly"in J?{validateModifiedOnly:J.validateModifiedOnly}:null;this.$validate(G).then(()=>{this.$op="save",Z()},(C)=>{X.$__schema.s.hooks.execPost("save:error",X,[X],{error:C},function(W){X.$op="save",Z(W)})})}else Z()},null,!0)}});var NW=K((R$1)=>{R$1.saveSubdocs=t_();R$1.sharding=Fg();R$1.trackTransaction=Dg();R$1.validateBeforeSave=Jg()});var Yg=K((vN1,Eg)=>{var Xg=NW();Eg.exports=function F(A){for(let B of Object.values(Xg))B(A,{deduplicate:!0});A.plugins=Object.values(Xg).map((B)=>({fn:B,opts:{deduplicate:!0}})).concat(A.plugins)}});var Cg=K((mN1,Gg)=>{var M$1=DD(),T$1=z9(),j$1=s0(),u$1=_3(),$g=M4();Gg.exports=function F(A,B,D,Z){let J=Object.keys(B),X=0,E=J.length,Y;if(D=D||"",Z=Z||new WeakSet,Z.has(B))return;Z.add(B);while(X<E){if(Y=J[X++],!D){if(Y==="discriminators"||Y==="base"||Y==="_applyDiscriminators"||Y==="_userProvidedOptions"||Y==="options"||Y==="tree")continue}if(D==="tree"&&B!=null&&B.instanceOfSchema)continue;if(T$1.has(Y))continue;if(A[Y]==null)A[Y]=B[Y];else if($g(B[Y])){if(!$g(A[Y]))A[Y]={};if(B[Y]!=null){if(B[Y].$isSingleNested&&A[Y].$isMongooseDocumentArray||B[Y].$isMongooseDocumentArray&&A[Y].$isSingleNested||B[Y].$isMongooseDocumentArrayElement&&A[Y].$isMongooseDocumentArrayElement)continue;else if(B[Y].instanceOfSchema){if(A[Y].instanceOfSchema)M$1(A[Y],B[Y].clone(),!0);else A[Y]=B[Y].clone();continue}else if(j$1(B[Y],"ObjectId")){A[Y]=new u$1(B[Y]);continue}}F(A[Y],B[Y],D?D+"."+Y:Y,Z)}}if(B!=null&&B.instanceOfSchema)A.tree=Object.assign({},B.tree,A.tree)}});var ZZ=K((dN1,qg)=>{var Wg=R9(),k$1=Yg(),O$1=$0(),S$1=GD().defineKey,x$1=q0(),MW=X1(),f$1=Cg(),Hg={toJSON:!0,toObject:!0,_id:!0,id:!0,virtuals:!0,methods:!0};function _$1(F,A){if(F.encryptionType()==null&&A.encryptionType()==null)return;let B=Z(D(F),D(A));for(let J of B){if(F._hasEncryptedField(J)&&A._hasEncryptedField(J))throw new Error(`encrypted fields cannot be declared on both the base schema and the child schema in a discriminator. path=${J}`);if(F._hasEncryptedField(J)||A._hasEncryptedField(J))throw new Error(`encrypted fields cannot have the same path as a non-encrypted field for discriminators. path=${J}`)}function D(J){return[...Object.keys(J.paths),...Object.keys(J.singleNestedPaths)]}function*Z(J,X){let E=new Set(J);for(let Y of X)if(E.has(Y))yield Y}}/*!
511
+ */Zg.exports=function F(A){A.pre("save",!1,function D(Z,J){let X=this;if(this.$isSubdocument)return Z();let E=J&&typeof J==="object"&&"validateBeforeSave"in J,Y;if(E)Y=!!J.validateBeforeSave;else Y=this.$__schema.options.validateBeforeSave;if(Y){let G=J&&typeof J==="object"&&"validateModifiedOnly"in J?{validateModifiedOnly:J.validateModifiedOnly}:null;this.$validate(G).then(()=>{this.$op="save",Z()},(C)=>{X.$__schema.s.hooks.execPost("save:error",X,[X],{error:C},function(W){X.$op="save",Z(W)})})}else Z()},null,!0)}});var NW=K((R$1)=>{R$1.saveSubdocs=t_();R$1.sharding=Fg();R$1.trackTransaction=Dg();R$1.validateBeforeSave=Jg()});var Yg=K((vN1,Eg)=>{var Xg=NW();Eg.exports=function F(A){for(let B of Object.values(Xg))B(A,{deduplicate:!0});A.plugins=Object.values(Xg).map((B)=>({fn:B,opts:{deduplicate:!0}})).concat(A.plugins)}});var Cg=K((mN1,Gg)=>{var M$1=DD(),T$1=z9(),j$1=s0(),u$1=_3(),$g=M4();Gg.exports=function F(A,B,D,Z){let J=Object.keys(B),X=0,E=J.length,Y;if(D=D||"",Z=Z||new WeakSet,Z.has(B))return;Z.add(B);while(X<E){if(Y=J[X++],!D){if(Y==="discriminators"||Y==="base"||Y==="_applyDiscriminators"||Y==="_userProvidedOptions"||Y==="options"||Y==="tree")continue}if(D==="tree"&&B!=null&&B.instanceOfSchema)continue;if(T$1.has(Y))continue;if(A[Y]==null)A[Y]=B[Y];else if($g(B[Y])){if(!$g(A[Y]))A[Y]={};if(B[Y]!=null){if(B[Y].$isSingleNested&&A[Y].$isMongooseDocumentArray||B[Y].$isMongooseDocumentArray&&A[Y].$isSingleNested||B[Y].$isMongooseDocumentArrayElement&&A[Y].$isMongooseDocumentArrayElement)continue;else if(B[Y].instanceOfSchema){if(A[Y].instanceOfSchema)M$1(A[Y],B[Y].clone(),!0);else A[Y]=B[Y].clone();continue}else if(j$1(B[Y],"ObjectId")){A[Y]=new u$1(B[Y]);continue}}F(A[Y],B[Y],D?D+"."+Y:Y,Z)}}if(B!=null&&B.instanceOfSchema)A.tree=Object.assign({},B.tree,A.tree)}});var ZZ=K((dN1,qg)=>{var Wg=R9(),k$1=Yg(),O$1=$0(),S$1=GD().defineKey,x$1=q0(),MW=X1(),f$1=Cg(),Hg={toJSON:!0,toObject:!0,_id:!0,id:!0,virtuals:!0,methods:!0,statics:!0};function _$1(F,A){if(F.encryptionType()==null&&A.encryptionType()==null)return;let B=Z(D(F),D(A));for(let J of B){if(F._hasEncryptedField(J)&&A._hasEncryptedField(J))throw new Error(`encrypted fields cannot be declared on both the base schema and the child schema in a discriminator. path=${J}`);if(F._hasEncryptedField(J)||A._hasEncryptedField(J))throw new Error(`encrypted fields cannot have the same path as a non-encrypted field for discriminators. path=${J}`)}function D(J){return[...Object.keys(J.paths),...Object.keys(J.singleNestedPaths)]}function*Z(J,X){let E=new Set(J);for(let Y of X)if(E.has(Y))yield Y}}/*!
512
512
  * ignore
513
513
  */qg.exports=function F(A,B,D,Z,J,X,E){if(!(D&&D.instanceOfSchema))throw new Error("You must pass a valid discriminator Schema");if(X=X==null?!0:X,A.schema.discriminatorMapping&&!A.schema.discriminatorMapping.isRoot)throw new Error('Discriminator "'+B+'" can only be a discriminator of the root model');if(J){let W=x$1(A.base,"options.applyPluginsToDiscriminators",!1)||!X;A.base._applyPlugins(D,{skipTopLevel:!W})}else if(!X)k$1(D);let Y=A.schema.options.discriminatorKey,$=A.schema.path(Y);if($!=null){if(!MW.hasUserDefinedProperty($.options,"select"))$.options.select=!0;$.options.$skipDiscriminatorCheck=!0}else{let W={};W[Y]={default:void 0,select:!0,$skipDiscriminatorCheck:!0},W[Y][A.schema.options.typeKey]=String,A.schema.add(W),S$1({prop:Y,prototype:A.prototype,options:A.schema.options})}if(D.path(Y)&&D.path(Y).options.$skipDiscriminatorCheck!==!0)throw new Error('Discriminator "'+B+'" cannot have field with name "'+Y+'"');let G=B;if(typeof Z==="string"&&Z.length||Z!=null)G=Z;_$1(A.schema,D);function C(W,H){if(W._baseSchema=H,H.paths._id&&H.paths._id.options&&!H.paths._id.options.auto)W.remove("_id");let q=Object.keys(H.paths),z=[];for(let k of q){if(W.nested[k]){z.push(k);continue}if(k.indexOf(".")===-1)continue;let S=k.split(".").slice(0,-1),b="";for(let j of S)if(b+=(b.length?".":"")+j,W.paths[b]instanceof Wg||W.singleNestedPaths[b]instanceof Wg)z.push(k)}W.obj={...W.obj},f$1(W,H),W._gatherChildSchemas();for(let k of z)delete W.paths[k];W.childSchemas.forEach((k)=>{k.model.prototype.$__setSchema(k.schema)});let U={};if(U[Y]={default:G,select:!0,set:function(k){if(k===G||Array.isArray(G)&&MW.deepEqual(k,G))return G;throw new Error(`Can't set discriminator key "`+Y+'"')},$skipDiscriminatorCheck:!0},U[Y][W.options.typeKey]=$?$.options[W.options.typeKey]:String,W.add(U),W.discriminatorMapping={key:Y,value:G,isRoot:!1},H.options.collection)W.options.collection=H.options.collection;let Q=W.options.toJSON,V=W.options.toObject,L=W.options._id,w=W.options.id,M=Object.keys(W.options);W.options.discriminatorKey=H.options.discriminatorKey;let T=W._userProvidedOptions;for(let k of M)if(!Hg[k]){if(k in T&&!MW.deepEqual(W.options[k],H.options[k]))throw new Error("Can't customize discriminator option "+k+" (can only modify "+Object.keys(Hg).join(", ")+")")}W.options=O$1(H.options);for(let k of Object.keys(T))W.options[k]=T[k];if(Q)W.options.toJSON=Q;if(V)W.options.toObject=V;if(typeof L!=="undefined")W.options._id=L;if(W.options.id=w,X)W.s.hooks=A.schema.s.hooks.merge(W.s.hooks);if(J)W.plugins=Array.prototype.slice.call(H.plugins);W.callQueue=H.callQueue.concat(W.callQueue),delete W._requiredpaths}if(C(D,A.schema),!A.discriminators)A.discriminators={};if(!A.schema.discriminatorMapping)A.schema.discriminatorMapping={key:Y,value:null,isRoot:!0};if(!A.schema.discriminators)A.schema.discriminators={};if(A.schema.discriminators[B]=D,A.discriminators[B]&&!D.options.overwriteModels&&!E)throw new Error('Discriminator with name "'+B+'" already exists');return D}});var JZ=K((cN1,zg)=>{var g$1=k6();zg.exports=function F(A,B,D){let Z=A.schema.options.discriminatorKey,J=B!=null&&B[Z];if(J==null)J=D;if(A.discriminators&&J!=null)if(A.discriminators[J])A=A.discriminators[J];else{let X=g$1(A.discriminators,J);if(X)A=X}return A}});var TW=K((lN1,Kg)=>{var b$1=cC();Kg.exports=function F(A,B){if(B==null||B._id==null)return A;if(A=A.clone(),!B._id)A.remove("_id"),A.options._id=!1;else if(!A.paths._id)b$1(A),A.options._id=!0;return A}});var uW=K((pN1,Ug)=>{/*!
514
514
  * Module dependencies.
@@ -715,7 +715,7 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
715
715
  * Called internally by `openUri()` to create a MongoClient instance.
716
716
  */A1.prototype.createClient=function F(){throw new K0("Connection#createClient not implemented by driver")};A1.prototype.syncIndexes=async function F(A={}){let B={},D={},{continueOnError:Z}=A;delete A.continueOnError;for(let J of Object.values(this.models))try{B[J.modelName]=await J.syncIndexes(A)}catch(X){if(!Z){D[J.modelName]=X;break}else B[J.modelName]=X}if(!Z&&Object.keys(D).length){let J=Object.entries(D).map(([E,Y])=>`${E}: ${Y.message}`).join(", ");throw new JW1(J,D)}return B};/*!
717
717
  * Module exports.
718
- */A1.STATES=N0;Ky.exports=A1});var MH=K((TM1,QW1)=>{QW1.exports={name:"mongoose",description:"Mongoose MongoDB ODM",version:"8.17.0",author:"Guillermo Rauch <guillermo@learnboost.com>",keywords:["mongodb","document","model","schema","database","odm","data","datastore","query","nosql","orm","db"],type:"commonjs",license:"MIT",dependencies:{bson:"^6.10.4",kareem:"2.6.3",mongodb:"~6.18.0",mpath:"0.9.0",mquery:"5.0.0",ms:"2.1.3",sift:"17.1.3"},devDependencies:{"@babel/core":"7.27.7","@babel/preset-env":"7.27.2","@mongodb-js/mongodb-downloader":"^0.4.2","@typescript-eslint/eslint-plugin":"^8.19.1","@typescript-eslint/parser":"^8.19.1",acquit:"1.4.0","acquit-ignore":"0.2.1","acquit-require":"0.1.1",ajv:"8.17.1","assert-browserify":"2.0.0","babel-loader":"8.2.5","broken-link-checker":"^0.7.8",buffer:"^5.6.0",cheerio:"1.1.0","crypto-browserify":"3.12.1",dox:"1.0.0",eslint:"8.57.1","eslint-plugin-markdown":"^5.1.0","eslint-plugin-mocha-no-only":"1.2.0",express:"^4.19.2","fs-extra":"~11.3.0","highlight.js":"11.11.1","lodash.isequal":"4.5.0","lodash.isequalwith":"4.4.0","markdownlint-cli2":"^0.18.1",marked:"15.0.12",mkdirp:"^3.0.1",mocha:"11.7.1",moment:"2.30.1","mongodb-memory-server":"10.1.4","mongodb-runner":"^5.8.2",ncp:"^2.0.0",nyc:"15.1.0",pug:"3.0.3",q:"1.5.1",sinon:"21.0.0","stream-browserify":"3.0.0",tsd:"0.32.0",typescript:"5.8.3",uuid:"11.1.0",webpack:"5.99.9"},directories:{lib:"./lib/mongoose"},scripts:{"docs:clean":"npm run docs:clean:stable","docs:clean:stable":"rimraf index.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/api && rimraf -rf ./docs/tutorials/*.html && rimraf -rf ./docs/typescript/*.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:5x":"rimraf index.html && rimraf -rf ./docs/5.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:6x":"rimraf index.html && rimraf -rf ./docs/6.x && rimraf -rf ./docs/source/_docs && rimraf -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/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/api ./tmp/docs/api && cp index.html ./tmp && cp docs/*.html ./tmp/docs/","docs:copy:tmp:5x":"rimraf ./docs/5.x && ncp ./tmp ./docs/5.x","docs:copy:tmp:6x":"rimraf ./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 && 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 && rimraf ./docs/7.x && mv ./tmp ./docs/7.x","docs:check-links":"blc http://127.0.0.1:8089 -ro",lint:"eslint .","lint-js":"eslint . --ext .js --ext .cjs","lint-ts":"eslint . --ext .ts","lint-md":'markdownlint-cli2 "**/*.md" "#node_modules" "#benchmarks"',"build-browser":"(rm ./dist/* || true) && node ./scripts/build-browser.js",prepublishOnly:"npm run build-browser",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 ./test/*.test.js","test-deno":"deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.mjs","test-rs":"START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js","test-tsd":"node ./test/types/check-types-filename && tsd","setup-test-encryption":"node scripts/setup-encryption-tests.js","test-encryption":"mocha --exit ./test/encryption/*.test.js",tdd:"mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}","test-coverage":"nyc --reporter=html --reporter=text npm test","ts-benchmark":"cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"},main:"./index.js",types:"./types/index.d.ts",engines:{node:">=16.20.1"},bugs:{url:"https://github.com/Automattic/mongoose/issues/new"},repository:{type:"git",url:"git://github.com/Automattic/mongoose.git"},homepage:"https://mongoosejs.com",browser:"./dist/browser.umd.js",config:{mongodbMemoryServer:{disablePostinstall:!0}},funding:{type:"opencollective",url:"https://opencollective.com/mongoose"},tsd:{directory:"test/types",compilerOptions:{esModuleInterop:!1,strict:!0,allowSyntheticDefaultImports:!0,strictPropertyInitialization:!1,noImplicitAny:!1,strictNullChecks:!0,module:"commonjs",target:"ES2017"}}}});var Qy=K((jM1,Uy)=>{var VW1=$0(),LW1=h2();function RW1(F,A){let B=A?A:{},D=B.readPreference?B.readPreference:NW1(F),Z=VW1(B);return D&&D!=="primary"&&D!=="primaryPreferred"?wW1(D,Z):Z}function wW1(F,A){if(IW1(A)&&PW1(F))TW1();else return MW1(A)}function IW1(F){let A=F.config&&F.config.autoIndex,{autoCreate:B,autoIndex:D}=F;return!!(A||B||D)}function PW1(F){return F==="secondary"||F==="secondaryPreferred"}function NW1(F){let B=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(F);return B?B[1]:null}function MW1(F){return F.config={autoIndex:!1},F.autoCreate=!1,F.autoIndex=!1,F}function TW1(){throw new LW1('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')}Uy.exports=RW1});var Vy=K((jW1)=>{jW1.setTimeout=setTimeout});var Py=K((kM1,Iy)=>{/*!
718
+ */A1.STATES=N0;Ky.exports=A1});var MH=K((TM1,QW1)=>{QW1.exports={name:"mongoose",description:"Mongoose MongoDB ODM",version:"8.17.1",author:"Guillermo Rauch <guillermo@learnboost.com>",keywords:["mongodb","document","model","schema","database","odm","data","datastore","query","nosql","orm","db"],type:"commonjs",license:"MIT",dependencies:{bson:"^6.10.4",kareem:"2.6.3",mongodb:"~6.18.0",mpath:"0.9.0",mquery:"5.0.0",ms:"2.1.3",sift:"17.1.3"},devDependencies:{"@babel/core":"7.28.0","@babel/preset-env":"7.28.0","@mongodb-js/mongodb-downloader":"^0.4.2","@typescript-eslint/eslint-plugin":"^8.19.1","@typescript-eslint/parser":"^8.19.1",acquit:"1.4.0","acquit-ignore":"0.2.1","acquit-require":"0.1.1",ajv:"8.17.1","assert-browserify":"2.0.0","babel-loader":"8.2.5","broken-link-checker":"^0.7.8",buffer:"^5.6.0",cheerio:"1.1.2","crypto-browserify":"3.12.1",dox:"1.0.0",eslint:"8.57.1","eslint-plugin-markdown":"^5.1.0","eslint-plugin-mocha-no-only":"1.2.0",express:"^4.19.2","fs-extra":"~11.3.0","highlight.js":"11.11.1","lodash.isequal":"4.5.0","lodash.isequalwith":"4.4.0","markdownlint-cli2":"^0.18.1",marked:"15.0.12",mkdirp:"^3.0.1",mocha:"11.7.1",moment:"2.30.1","mongodb-memory-server":"10.1.4","mongodb-runner":"^5.8.2",ncp:"^2.0.0",nyc:"15.1.0",pug:"3.0.3",q:"1.5.1",sinon:"21.0.0","stream-browserify":"3.0.0",tsd:"0.32.0",typescript:"5.8.3",uuid:"11.1.0",webpack:"5.101.0"},directories:{lib:"./lib/mongoose"},scripts:{"docs:clean":"npm run docs:clean:stable","docs:clean:stable":"rimraf index.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/api && rimraf -rf ./docs/tutorials/*.html && rimraf -rf ./docs/typescript/*.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:5x":"rimraf index.html && rimraf -rf ./docs/5.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:6x":"rimraf index.html && rimraf -rf ./docs/6.x && rimraf -rf ./docs/source/_docs && rimraf -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/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/api ./tmp/docs/api && cp index.html ./tmp && cp docs/*.html ./tmp/docs/","docs:copy:tmp:5x":"rimraf ./docs/5.x && ncp ./tmp ./docs/5.x","docs:copy:tmp:6x":"rimraf ./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 && 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 && rimraf ./docs/7.x && mv ./tmp ./docs/7.x","docs:check-links":"blc http://127.0.0.1:8089 -ro",lint:"eslint .","lint-js":"eslint . --ext .js --ext .cjs","lint-ts":"eslint . --ext .ts","lint-md":'markdownlint-cli2 "**/*.md" "#node_modules" "#benchmarks"',"build-browser":"(rm ./dist/* || true) && node ./scripts/build-browser.js",prepublishOnly:"npm run build-browser",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 ./test/*.test.js","test-deno":"deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.mjs","test-rs":"START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js","test-tsd":"node ./test/types/check-types-filename && tsd","setup-test-encryption":"node scripts/setup-encryption-tests.js","test-encryption":"mocha --exit ./test/encryption/*.test.js",tdd:"mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}","test-coverage":"nyc --reporter=html --reporter=text npm test","ts-benchmark":"cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"},main:"./index.js",types:"./types/index.d.ts",engines:{node:">=16.20.1"},bugs:{url:"https://github.com/Automattic/mongoose/issues/new"},repository:{type:"git",url:"git://github.com/Automattic/mongoose.git"},homepage:"https://mongoosejs.com",browser:"./dist/browser.umd.js",config:{mongodbMemoryServer:{disablePostinstall:!0}},funding:{type:"opencollective",url:"https://opencollective.com/mongoose"},tsd:{directory:"test/types",compilerOptions:{esModuleInterop:!1,strict:!0,allowSyntheticDefaultImports:!0,strictPropertyInitialization:!1,noImplicitAny:!1,strictNullChecks:!0,module:"commonjs",target:"ES2017"}}}});var Qy=K((jM1,Uy)=>{var VW1=$0(),LW1=h2();function RW1(F,A){let B=A?A:{},D=B.readPreference?B.readPreference:NW1(F),Z=VW1(B);return D&&D!=="primary"&&D!=="primaryPreferred"?wW1(D,Z):Z}function wW1(F,A){if(IW1(A)&&PW1(F))TW1();else return MW1(A)}function IW1(F){let A=F.config&&F.config.autoIndex,{autoCreate:B,autoIndex:D}=F;return!!(A||B||D)}function PW1(F){return F==="secondary"||F==="secondaryPreferred"}function NW1(F){let B=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(F);return B?B[1]:null}function MW1(F){return F.config={autoIndex:!1},F.autoCreate=!1,F.autoIndex=!1,F}function TW1(){throw new LW1('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')}Uy.exports=RW1});var Vy=K((jW1)=>{jW1.setTimeout=setTimeout});var Py=K((kM1,Iy)=>{/*!
719
719
  * Module dependencies.
720
720
  */var Ly=NH(),S9=h2(),l2=c5(),Ry=W9(),kW1=MH(),OW1=Qy(),SW1=Vy().setTimeout,wy=X1(),xW1=P9();function F3(){Ly.apply(this,arguments),this._listening=!1,this._lastHeartbeatAt=null}F3.STATES=l2;/*!
721
721
  * Inherits from Connection.
@@ -794,7 +794,7 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
794
794
  * to store the field to apply distinct on.
795
795
  */Object.defineProperty(h.prototype,"_distinct",{configurable:!0,writable:!0,enumerable:!0,value:void 0});h.use$geoWithin=$6.use$geoWithin;h.prototype.toConstructor=function F(){let A=this.model,B=this.mongooseCollection,D=function(X,E){if(!(this instanceof D))return new D(X,E);this._mongooseOptions=i2(Z._mongooseOptions),h.call(this,X,E||null,A,B)};OF.inherits(D,A.Query);let Z=D.prototype;Z.options={};let J=Object.assign({},this.options);if(J.sort!=null)Z.sort(J.sort),delete J.sort;return Z.setOptions(J),Z.op=this.op,Z._validateOp(),Z._conditions=i2(this._conditions),Z._fields=i2(this._fields),Z._update=i2(this._update,{flattenDecimals:!1}),Z._path=this._path,Z._distinct=this._distinct,Z._collection=this._collection,Z._mongooseOptions=this._mongooseOptions,D};h.prototype.clone=function(){let F=this.model,A=this.mongooseCollection,B=new this.model.Query({},{},F,A),D=Object.assign({},this.options);if(D.sort!=null)B.sort(D.sort),delete D.sort;return B.setOptions(D),B.op=this.op,B._validateOp(),B._conditions=i2(this._conditions),B._fields=i2(this._fields),B._update=i2(this._update,{flattenDecimals:!1}),B._path=this._path,B._distinct=this._distinct,B._collection=this._collection,B._mongooseOptions=this._mongooseOptions,B};h.prototype.slice=function(){if(arguments.length===0)return this;this._validate("slice");let F,A;if(arguments.length===1){let D=arguments[0];if(typeof D==="object"&&!Array.isArray(D)){let Z=Object.keys(D),J=Z.length;for(let X=0;X<J;++X)this.slice(Z[X],D[Z[X]]);return this}this._ensurePath("slice"),F=this._path,A=arguments[0]}else if(arguments.length===2)if(typeof arguments[0]==="number")this._ensurePath("slice"),F=this._path,A=[arguments[0],arguments[1]];else F=arguments[0],A=arguments[1];else if(arguments.length===3)F=arguments[0],A=[arguments[1],arguments[2]];let B={};return B[F]={$slice:A},this.select(B),this};/*!
796
796
  * ignore
797
- */var Rq1=new Set(Qq1);h.prototype._validateOp=function(){if(this.op!=null&&!Rq1.has(this.op))this.error(new Error('Query has invalid `op`: "'+this.op+'"'))};h.prototype.mod=function(){let F,A;if(arguments.length===1)this._ensurePath("mod"),F=arguments[0],A=this._path;else if(arguments.length===2&&!Array.isArray(arguments[1]))this._ensurePath("mod"),F=[arguments[0],arguments[1]],A=this._path;else if(arguments.length===3)F=[arguments[1],arguments[2]],A=arguments[0];else F=arguments[1],A=arguments[0];let B=this._conditions[A]||(this._conditions[A]={});return B.$mod=F,this};h.prototype.limit=function F(A){if(this._validate("limit"),typeof A==="string")try{A=_Z(A)}catch(B){throw new SF("Number",A,"limit")}return this.options.limit=A,this};h.prototype.skip=function F(A){if(this._validate("skip"),typeof A==="string")try{A=_Z(A)}catch(B){throw new SF("Number",A,"skip")}return this.options.skip=A,this};h.prototype.projection=function(F){if(arguments.length===0)return this._fields;return this._fields={},this._userProvidedFields={},this.select(F),this._fields};h.prototype.select=function F(){let A=arguments[0];if(!A)return this;if(arguments.length!==1)throw new Error("Invalid select: select only takes 1 argument");this._validate("select");let B=this._fields||(this._fields={}),D=this._userProvidedFields||(this._userProvidedFields={}),Z=void 0;if(this.model!=null&&r1.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))Z=this.model.db.options.sanitizeProjection;else if(this.model!=null&&r1.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))Z=this.model.base.options.sanitizeProjection;else Z=this._mongooseOptions.sanitizeProjection;function J(X){return typeof X==="string"&&Z?X=1:X}if(A=Wq1(A,!0),r1.isObject(A)){if(this.selectedInclusively())Object.entries(A).forEach(([X,E])=>{if(E){if(B["-"+X]!=null)delete B["-"+X];B[X]=D[X]=J(E)}else Object.keys(D).forEach((Y)=>{if(ah(X,Y))delete B[Y],delete D[Y]})});else if(this.selectedExclusively())Object.entries(A).forEach(([X,E])=>{if(!E){if(B["+"+X]!=null)delete B["+"+X];B[X]=D[X]=J(E)}else Object.keys(D).forEach((Y)=>{if(ah(X,Y))delete B[Y],delete D[Y]})});else{let X=Object.keys(A);for(let E=0;E<X.length;++E){let Y=A[X[E]],$=X[E];B[$]=J(Y),D[$]=J(Y)}}return this}throw new TypeError("Invalid select() argument. Must be string or object.")};h.prototype.schemaLevelProjections=function F(A){return this._mongooseOptions.schemaLevelProjections=A,this};h.prototype.sanitizeProjection=function F(A){return this._mongooseOptions.sanitizeProjection=A,this};h.prototype.read=function F(A,B){if(typeof A==="string")A=Aq1(A),this.options.readPreference={mode:A,tags:B};else this.options.readPreference=A;return this};h.prototype.toString=function F(){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}(${OF.inspect(this._conditions)})`;if(this.op==="distinct")return`${this.model.modelName}.distinct('${this._distinct}', ${OF.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}(${OF.inspect(this._conditions)}, ${OF.inspect(this._update)})`;return`${this.model.modelName}.${this.op}()`};h.prototype.session=function F(A){if(A==null)delete this.options.session;return this.options.session=A,this};h.prototype.writeConcern=function F(A){if(A==null)return delete this.options.writeConcern,this;return this.options.writeConcern=A,this};h.prototype.w=function F(A){if(A==null)delete this.options.w;if(this.options.writeConcern!=null)this.options.writeConcern.w=A;else this.options.w=A;return this};h.prototype.j=function F(A){if(A==null)delete this.options.j;if(this.options.writeConcern!=null)this.options.writeConcern.j=A;else this.options.j=A;return this};h.prototype.wtimeout=function F(A){if(A==null)delete this.options.wtimeout;if(this.options.writeConcern!=null)this.options.writeConcern.wtimeout=A;else this.options.wtimeout=A;return this};h.prototype.getOptions=function(){return this.options};h.prototype.setOptions=function(F,A){if(A){if(this._mongooseOptions=F&&i2(F)||{},this.options=F||{},"populate"in F)this.populate(this._mongooseOptions);return this}if(F==null)return this;if(typeof F!=="object")throw new Error('Options must be an object, got "'+F+'"');if(F=Object.assign({},F),Array.isArray(F.populate)){let B=F.populate;delete F.populate;let D=B.length;for(let Z=0;Z<D;++Z)this.populate(B[Z])}if("setDefaultsOnInsert"in F)this._mongooseOptions.setDefaultsOnInsert=F.setDefaultsOnInsert,delete F.setDefaultsOnInsert;if("overwriteDiscriminatorKey"in F)this._mongooseOptions.overwriteDiscriminatorKey=F.overwriteDiscriminatorKey,delete F.overwriteDiscriminatorKey;if("overwriteImmutable"in F)this._mongooseOptions.overwriteImmutable=F.overwriteImmutable,delete F.overwriteImmutable;if("sanitizeProjection"in F){if(F.sanitizeProjection&&!this._mongooseOptions.sanitizeProjection)zq1(this._fields);this._mongooseOptions.sanitizeProjection=F.sanitizeProjection,delete F.sanitizeProjection}if("sanitizeFilter"in F)this._mongooseOptions.sanitizeFilter=F.sanitizeFilter,delete F.sanitizeFilter;if("timestamps"in F)this._mongooseOptions.timestamps=F.timestamps,delete F.timestamps;if("defaults"in F)this._mongooseOptions.defaults=F.defaults;if("translateAliases"in F)this._mongooseOptions.translateAliases=F.translateAliases,delete F.translateAliases;if("schemaLevelProjections"in F)this._mongooseOptions.schemaLevelProjections=F.schemaLevelProjections,delete F.schemaLevelProjections;if(F.lean==null&&this.schema&&"lean"in this.schema.options)this._mongooseOptions.lean=this.schema.options.lean;if(typeof F.limit==="string")try{F.limit=_Z(F.limit)}catch(B){throw new SF("Number",F.limit,"limit")}if(typeof F.skip==="string")try{F.skip=_Z(F.skip)}catch(B){throw new SF("Number",F.skip,"skip")}for(let B of Object.keys(F))if(Vq1.has(B)){let D=Array.isArray(F[B])?F[B]:[F[B]];this[B].apply(this,D)}else this.options[B]=F[B];return this};h.prototype.explain=function F(A){if(arguments.length===0)this.options.explain=!0;else if(A===!1)delete this.options.explain;else this.options.explain=A;return this};h.prototype.allowDiskUse=function(F){if(arguments.length===0)this.options.allowDiskUse=!0;else if(F===!1)delete this.options.allowDiskUse;else this.options.allowDiskUse=F;return this};h.prototype.maxTimeMS=function(F){return this.options.maxTimeMS=F,this};h.prototype.getFilter=function(){return this._conditions};h.prototype.getQuery=function(){return this._conditions};h.prototype.setQuery=function(F){this._conditions=F};h.prototype.getUpdate=function(){return this._update};h.prototype.setUpdate=function(F){this._update=F};h.prototype._fieldsForExec=function(){if(this._fields==null)return null;if(Object.keys(this._fields).length===0)return null;return i2(this._fields)};h.prototype._updateForExec=function(){let F=i2(this._update,{transform:!1,depopulate:!0}),A=Object.keys(F),B=A.length,D={};while(B--){let Z=A[B];if(Z[0]!=="$"){if(!D.$set)if(F.$set)D.$set=F.$set;else D.$set={};if(D.$set[Z]=F[Z],A.splice(B,1),!~A.indexOf("$set"))A.push("$set")}else if(Z==="$set"){if(!D.$set)D[Z]=F[Z]}else D[Z]=F[Z]}return D};h.prototype._optionsForExec=function(F){let A=i2(this.options);if(delete A.populate,F=F||this.model,!F)return A;Bq1(F.schema,A),Dq1(F.schema,A);let B=this.model?.db?.base.transactionAsyncLocalStorage?.getStore();if(!this.options.hasOwnProperty("session")&&B?.session!=null)A.session=B.session;let D=F&&F.schema&&F.schema.options&&F.schema.options.read;if(!("readPreference"in A)&&D)A.readPreference=D;if(A.upsert!==void 0)A.upsert=!!A.upsert;if(A.writeConcern){if(A.j)A.writeConcern.j=A.j,delete A.j;if(A.w)A.writeConcern.w=A.w,delete A.w;if(A.wtimeout)A.writeConcern.wtimeout=A.wtimeout,delete A.wtimeout}if(this._applyPaths(),this._fields!=null){this._fields=this._castFields(this._fields);let Z=this._fieldsForExec();if(Z!=null)A.projection=Z}return A};h.prototype.lean=function(F){return this._mongooseOptions.lean=arguments.length?F:!0,this};h.prototype.set=function(F,A){if(typeof F==="object"){let B=Object.keys(F);for(let D of B)this.set(D,F[D]);return this}if(this._update=this._update||{},F in this._update)delete this._update[F];return this._update.$set=this._update.$set||{},this._update.$set[F]=A,this};h.prototype.get=function F(A){let B=this._update;if(B==null)return;let D=B.$set;if(D==null)return B[A];if(r1.hasUserDefinedProperty(B,A))return B[A];if(r1.hasUserDefinedProperty(D,A))return D[A];return};h.prototype.error=function F(A){if(arguments.length===0)return this._error;return this._error=A,this};h.prototype._unsetCastError=function F(){if(this._error==null||!(this._error instanceof SF))return;return this.error(null)};h.prototype.mongooseOptions=function(F){if(arguments.length>0)this._mongooseOptions=F;return this._mongooseOptions};h.prototype._castConditions=function(){let F=void 0;if(this.model?.db.options?.sanitizeFilter!=null)F=this.model.db.options.sanitizeFilter;else if(this.model?.base.options?.sanitizeFilter!=null)F=this.model.base.options.sanitizeFilter;else F=this._mongooseOptions.sanitizeFilter;if(F)qq1(this._conditions);try{this.cast(this.model),this._unsetCastError()}catch(A){this.error(A)}};/*!
797
+ */var Rq1=new Set(Qq1);h.prototype._validateOp=function(){if(this.op!=null&&!Rq1.has(this.op))this.error(new Error('Query has invalid `op`: "'+this.op+'"'))};h.prototype.mod=function(){let F,A;if(arguments.length===1)this._ensurePath("mod"),F=arguments[0],A=this._path;else if(arguments.length===2&&!Array.isArray(arguments[1]))this._ensurePath("mod"),F=[arguments[0],arguments[1]],A=this._path;else if(arguments.length===3)F=[arguments[1],arguments[2]],A=arguments[0];else F=arguments[1],A=arguments[0];let B=this._conditions[A]||(this._conditions[A]={});return B.$mod=F,this};h.prototype.limit=function F(A){if(this._validate("limit"),typeof A==="string")try{A=_Z(A)}catch(B){throw new SF("Number",A,"limit")}return this.options.limit=A,this};h.prototype.skip=function F(A){if(this._validate("skip"),typeof A==="string")try{A=_Z(A)}catch(B){throw new SF("Number",A,"skip")}return this.options.skip=A,this};h.prototype.projection=function(F){if(arguments.length===0)return this._fields;return this._fields={},this._userProvidedFields={},this.select(F),this._fields};h.prototype.select=function F(){let A=arguments[0];if(!A)return this;if(arguments.length!==1)throw new Error("Invalid select: select only takes 1 argument");this._validate("select");let B=this._fields||(this._fields={}),D=this._userProvidedFields||(this._userProvidedFields={}),Z=void 0;if(this.model!=null&&r1.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))Z=this.model.db.options.sanitizeProjection;else if(this.model!=null&&r1.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))Z=this.model.base.options.sanitizeProjection;else Z=this._mongooseOptions.sanitizeProjection;function J(X){return typeof X==="string"&&Z?X=1:X}if(A=Wq1(A,!0),r1.isObject(A)){if(this.selectedInclusively())Object.entries(A).forEach(([X,E])=>{if(E){if(B["-"+X]!=null)delete B["-"+X];B[X]=D[X]=J(E)}else Object.keys(D).forEach((Y)=>{if(ah(X,Y))delete B[Y],delete D[Y]})});else if(this.selectedExclusively())Object.entries(A).forEach(([X,E])=>{if(!E){if(B["+"+X]!=null)delete B["+"+X];B[X]=D[X]=J(E)}else Object.keys(D).forEach((Y)=>{if(ah(X,Y))delete B[Y],delete D[Y]})});else{let X=Object.keys(A);for(let E=0;E<X.length;++E){let Y=A[X[E]],$=X[E];B[$]=J(Y),D[$]=J(Y)}}return this}throw new TypeError("Invalid select() argument. Must be string or object.")};h.prototype.schemaLevelProjections=function F(A){return this._mongooseOptions.schemaLevelProjections=A,this};h.prototype.sanitizeProjection=function F(A){return this._mongooseOptions.sanitizeProjection=A,this};h.prototype.read=function F(A,B){if(typeof A==="string")A=Aq1(A),this.options.readPreference={mode:A,tags:B};else this.options.readPreference=A;return this};h.prototype.toString=function F(){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}(${OF.inspect(this._conditions)})`;if(this.op==="distinct")return`${this.model.modelName}.distinct('${this._distinct}', ${OF.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}(${OF.inspect(this._conditions)}, ${OF.inspect(this._update)})`;return`${this.model.modelName}.${this.op}()`};h.prototype.session=function F(A){if(A==null)delete this.options.session;return this.options.session=A,this};h.prototype.writeConcern=function F(A){if(A==null)return delete this.options.writeConcern,this;return this.options.writeConcern=A,this};h.prototype.w=function F(A){if(A==null)delete this.options.w;if(this.options.writeConcern!=null)this.options.writeConcern.w=A;else this.options.w=A;return this};h.prototype.j=function F(A){if(A==null)delete this.options.j;if(this.options.writeConcern!=null)this.options.writeConcern.j=A;else this.options.j=A;return this};h.prototype.wtimeout=function F(A){if(A==null)delete this.options.wtimeout;if(this.options.writeConcern!=null)this.options.writeConcern.wtimeout=A;else this.options.wtimeout=A;return this};h.prototype.getOptions=function(){return this.options};h.prototype.setOptions=function(F,A){if(A){if(this._mongooseOptions=F&&i2(F)||{},this.options=F||{},"populate"in F)this.populate(this._mongooseOptions);return this}if(F==null)return this;if(typeof F!=="object")throw new Error('Options must be an object, got "'+F+'"');if(F=Object.assign({},F),Array.isArray(F.populate)){let B=F.populate;delete F.populate;let D=B.length;for(let Z=0;Z<D;++Z)this.populate(B[Z])}if("setDefaultsOnInsert"in F)this._mongooseOptions.setDefaultsOnInsert=F.setDefaultsOnInsert,delete F.setDefaultsOnInsert;if("overwriteDiscriminatorKey"in F)this._mongooseOptions.overwriteDiscriminatorKey=F.overwriteDiscriminatorKey,delete F.overwriteDiscriminatorKey;if("overwriteImmutable"in F)this._mongooseOptions.overwriteImmutable=F.overwriteImmutable,delete F.overwriteImmutable;if("sanitizeProjection"in F){if(F.sanitizeProjection&&!this._mongooseOptions.sanitizeProjection)zq1(this._fields);this._mongooseOptions.sanitizeProjection=F.sanitizeProjection,delete F.sanitizeProjection}if("sanitizeFilter"in F)this._mongooseOptions.sanitizeFilter=F.sanitizeFilter,delete F.sanitizeFilter;if("timestamps"in F)this._mongooseOptions.timestamps=F.timestamps,delete F.timestamps;if("defaults"in F)this._mongooseOptions.defaults=F.defaults;if("translateAliases"in F)this._mongooseOptions.translateAliases=F.translateAliases,delete F.translateAliases;if("schemaLevelProjections"in F)this._mongooseOptions.schemaLevelProjections=F.schemaLevelProjections,delete F.schemaLevelProjections;if(F.lean==null&&this.schema&&"lean"in this.schema.options)this._mongooseOptions.lean=this.schema.options.lean;if(typeof F.limit==="string")try{F.limit=_Z(F.limit)}catch(B){throw new SF("Number",F.limit,"limit")}if(typeof F.skip==="string")try{F.skip=_Z(F.skip)}catch(B){throw new SF("Number",F.skip,"skip")}for(let B of Object.keys(F))if(Vq1.has(B)){let D=Array.isArray(F[B])?F[B]:[F[B]];this[B].apply(this,D)}else this.options[B]=F[B];return this};h.prototype.explain=function F(A){if(arguments.length===0)this.options.explain=!0;else if(A===!1)delete this.options.explain;else this.options.explain=A;return this};h.prototype.allowDiskUse=function(F){if(arguments.length===0)this.options.allowDiskUse=!0;else if(F===!1)delete this.options.allowDiskUse;else this.options.allowDiskUse=F;return this};h.prototype.maxTimeMS=function(F){return this.options.maxTimeMS=F,this};h.prototype.getFilter=function(){return this._conditions};h.prototype.getQuery=function(){return this._conditions};h.prototype.setQuery=function(F){this._conditions=F};h.prototype.getUpdate=function(){return this._update};h.prototype.setUpdate=function(F){this._update=F};h.prototype._fieldsForExec=function(){if(this._fields==null)return null;if(Object.keys(this._fields).length===0)return null;return i2(this._fields)};h.prototype._updateForExec=function(){let F=i2(this._update,{transform:!1,depopulate:!0}),A=Object.keys(F),B=A.length,D={};while(B--){let Z=A[B];if(Z[0]!=="$"){if(!D.$set)if(F.$set)D.$set=F.$set;else D.$set={};if(D.$set[Z]=F[Z],A.splice(B,1),!~A.indexOf("$set"))A.push("$set")}else if(Z==="$set"){if(!D.$set)D[Z]=F[Z]}else D[Z]=F[Z]}return D};h.prototype._optionsForExec=function(F){let A=i2(this.options);if(delete A.populate,F=F||this.model,!F)return A;Bq1(F.schema,A),Dq1(F.schema,A);let B=this.model?.db?.base.transactionAsyncLocalStorage?.getStore();if(!this.options.hasOwnProperty("session")&&B?.session!=null)A.session=B.session;let D=F&&F.schema&&F.schema.options&&F.schema.options.read;if(!("readPreference"in A)&&D)A.readPreference=D;if(A.upsert!==void 0)A.upsert=!!A.upsert;if(A.writeConcern){if(A.j)A.writeConcern.j=A.j,delete A.j;if(A.w)A.writeConcern.w=A.w,delete A.w;if(A.wtimeout)A.writeConcern.wtimeout=A.wtimeout,delete A.wtimeout}if(this._applyPaths(),this._fields!=null){this._fields=this._castFields(this._fields);let Z=this._fieldsForExec();if(Z!=null)A.projection=Z}if(this._mongooseOptions.populate){if(A.readPreference){for(let Z of Object.values(this._mongooseOptions.populate))if(Z.options?.readPreference===void 0){if(!Z.options)Z.options={};Z.options.readPreference=A.readPreference}}if(A.readConcern){for(let Z of Object.values(this._mongooseOptions.populate))if(Z.options?.readConcern===void 0){if(!Z.options)Z.options={};Z.options.readConcern=A.readConcern}}}return A};h.prototype.lean=function(F){return this._mongooseOptions.lean=arguments.length?F:!0,this};h.prototype.set=function(F,A){if(typeof F==="object"){let B=Object.keys(F);for(let D of B)this.set(D,F[D]);return this}if(this._update=this._update||{},F in this._update)delete this._update[F];return this._update.$set=this._update.$set||{},this._update.$set[F]=A,this};h.prototype.get=function F(A){let B=this._update;if(B==null)return;let D=B.$set;if(D==null)return B[A];if(r1.hasUserDefinedProperty(B,A))return B[A];if(r1.hasUserDefinedProperty(D,A))return D[A];return};h.prototype.error=function F(A){if(arguments.length===0)return this._error;return this._error=A,this};h.prototype._unsetCastError=function F(){if(this._error==null||!(this._error instanceof SF))return;return this.error(null)};h.prototype.mongooseOptions=function(F){if(arguments.length>0)this._mongooseOptions=F;return this._mongooseOptions};h.prototype._castConditions=function(){let F=void 0;if(this.model?.db.options?.sanitizeFilter!=null)F=this.model.db.options.sanitizeFilter;else if(this.model?.base.options?.sanitizeFilter!=null)F=this.model.base.options.sanitizeFilter;else F=this._mongooseOptions.sanitizeFilter;if(F)qq1(this._conditions);try{this.cast(this.model),this._unsetCastError()}catch(A){this.error(A)}};/*!
798
798
  * ignore
799
799
  */function Fv(F){try{Jq1(F)}catch(A){F.error(A)}}h.prototype._find=async function F(){if(this._applyTranslateAliases(),this._castConditions(),this.error()!=null)throw this.error();let A=this._mongooseOptions,B=this._userProvidedFields||{};xF(this.options,this.model.db.options,this.model.base.options),fF(this.options,this.model.db.options,this.model.base.options);let D={session:this&&this.options&&this.options.session||null,lean:A.lean||null},Z=this._optionsForExec(),J=this._conditions,X=Z.projection,E=await this.mongooseCollection.find(J,Z);if(Z.explain)return E.explain();let Y=await E.toArray();if(Y.length===0)return Y;if(!A.populate){let G=this.schema.options.versionKey;if(A.lean&&A.lean.versionKey===!1&&G)Y.forEach((C)=>{if(G in C)delete C[G]});return A.lean?Bv(this.model.schema,Y,null,D):this._completeMany(Y,X,B,D)}let $=_F.preparePopulationOptionsMQ(this,A);if(A.lean)return this.model.populate(Y,$);return Y=await this._completeMany(Y,X,B,D),await this.model.populate(Y,$),Y};h.prototype.find=function(F){if(typeof F==="function"||typeof arguments[1]==="function")throw new U2("Query.prototype.find() no longer accepts a callback");if(this.op="find",$6.canMerge(F))this.merge(F),gF(this);else if(F!=null)this.error(new f4(F,"filter","find"));return this};h.prototype.merge=function(F){if(!F)return this;let A={overwrite:!0};if(F instanceof h){if(F._conditions){if(A.omit={},this._conditions&&this._conditions.$and&&F._conditions.$and)A.omit.$and=!0,this._conditions.$and=this._conditions.$and.concat(F._conditions.$and);if(this._conditions&&this._conditions.$or&&F._conditions.$or)A.omit.$or=!0,this._conditions.$or=this._conditions.$or.concat(F._conditions.$or);r1.merge(this._conditions,F._conditions,A)}if(F._fields)this._fields||(this._fields={}),r1.merge(this._fields,F._fields,A);if(F.options)this.options||(this.options={}),r1.merge(this.options,F.options,A);if(F._update)this._update||(this._update={}),r1.mergeClone(this._update,F._update);if(F._distinct)this._distinct=F._distinct;return r1.merge(this._mongooseOptions,F._mongooseOptions),this}else if(this.model!=null&&F instanceof this.model.base.Types.ObjectId)return r1.merge(this._conditions,{_id:F},A),this;else if(F&&F.$__)F=F.toObject(Yq1);if(A.omit={},Array.isArray(F.$and)){if(A.omit.$and=!0,!this._conditions)this._conditions={};this._conditions.$and=(this._conditions.$and||[]).concat(F.$and.map((B)=>r1.isPOJO(B)?r1.merge({},B):B))}if(Array.isArray(F.$or)){if(A.omit.$or=!0,!this._conditions)this._conditions={};this._conditions.$or=(this._conditions.$or||[]).concat(F.$or.map((B)=>r1.isPOJO(B)?r1.merge({},B):B))}return r1.merge(this._conditions,F,A),this};h.prototype.collation=function(F){if(this.options==null)this.options={};return this.options.collation=F,this};h.prototype._completeOne=function(F,A,B,D){if(!F&&!this.options.includeResultMetadata)return D(null,null);let Z=this.model,J=this._userProvidedFields||{},X=this._mongooseOptions,E=this.options;if(!E.lean&&X.lean)E.lean=X.lean;if(E.explain)return D(null,F);if(!X.populate){let $=this.schema.options.versionKey;if(X.lean&&X.lean.versionKey===!1&&$){if($ in F)delete F[$]}return X.lean?oH(Z.schema,F,null,A,E,D):rh(Z,F,A,E,B,J,null,D)}let Y=_F.preparePopulationOptionsMQ(this,this._mongooseOptions);if(X.lean)return Z.populate(F,Y).then(($)=>{oH(Z.schema,$,null,A,E,D)},($)=>{D($)});rh(Z,F,A,E,B,J,[],($,G)=>{if($!=null)return D($);Z.populate(G,Y).then((C)=>{D(null,C)},(C)=>{D(C)})})};h.prototype._completeMany=async function F(A,B,D,Z){let J=this.model;return Promise.all(A.map((X)=>new Promise((E,Y)=>{let $=X;if(X=_F.createModel(J,X,B,D),Z.session!=null)X.$session(Z.session);X.$init($,Z,(G)=>{if(G!=null)return Y(G);E(X)})})))};h.prototype._findOne=async function F(){if(this._applyTranslateAliases(),this._castConditions(),this.error())throw this.error();xF(this.options,this.model.db.options,this.model.base.options),fF(this.options,this.model.db.options,this.model.base.options);let A=this._optionsForExec(),B=await this.mongooseCollection.findOne(this._conditions,A);return new Promise((D,Z)=>{this._completeOne(B,null,A.projection,(J,X)=>{if(J)return Z(J);D(X)})})};h.prototype.findOne=function(F,A,B){if(typeof F==="function"||typeof A==="function"||typeof B==="function"||typeof arguments[3]==="function")throw new U2("Query.prototype.findOne() no longer accepts a callback");if(this.op="findOne",this._validateOp(),B)this.setOptions(B);if(A)this.select(A);if($6.canMerge(F))this.merge(F),gF(this);else if(F!=null)this.error(new f4(F,"filter","findOne"));return this};h.prototype._countDocuments=async function F(){this._applyTranslateAliases();try{this.cast(this.model)}catch(D){this.error(D)}if(this.error())throw this.error();xF(this.options,this.model.db.options,this.model.base.options),fF(this.options,this.model.db.options,this.model.base.options);let A=this._optionsForExec(),B=this._conditions;return this.mongooseCollection.countDocuments(B,A)};/*!
800
800
  * If `translateAliases` option is set, call `Model.translateAliases()`
@@ -815,7 +815,7 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
815
815
  * ignore
816
816
  */function Iq1(F){return new Promise((A,B)=>{F._hooks.execPre("exec",F,[],(D)=>{if(D!=null)return B(D);A()})})}/*!
817
817
  * ignore
818
- */function Zv(F,A){if(F._queryMiddleware==null)return;return new Promise((B,D)=>{F._queryMiddleware.execPre(A||F.op,F,[],(Z)=>{if(Z!=null)return D(Z);B()})})}h.prototype.then=function(F,A){return this.exec().then(F,A)};h.prototype.catch=function(F){return this.exec().then(null,F)};h.prototype.finally=function(F){return this.exec().finally(F)};h.prototype[Symbol.toStringTag]=function F(){return`Query { ${this.op} }`};h.prototype.pre=function(F){return this._hooks.pre("exec",F),this};h.prototype.post=function(F){return this._hooks.post("exec",F),this};h.prototype._castUpdate=function F(A){let B=this.schema,D=B.options.discriminatorKey,Z=B._baseSchema?B._baseSchema:B;if(this._mongooseOptions.overwriteDiscriminatorKey&&A[D]!=null&&Z.discriminators){let X=Object.values(Z.discriminators).find((E)=>E.discriminatorMapping.value===A[D]);if(X!=null)B=X}let J;if("upsert"in this.options)J=this.options.upsert;return Xq1(B,A,{strict:this._mongooseOptions.strict,upsert:J,arrayFilters:this.options.arrayFilters,overwriteDiscriminatorKey:this._mongooseOptions.overwriteDiscriminatorKey,overwriteImmutable:this._mongooseOptions.overwriteImmutable},this,this._conditions)};h.prototype.populate=function(){let F=Array.from(arguments);if(!F.some(Boolean))return this;let A=r1.populate.apply(null,F);if(this.options!=null){let Z=this.options.readConcern,J=this.options.readPreference;for(let X of A){if(Z!=null&&(X&&X.options&&X.options.readConcern)==null)X.options=X.options||{},X.options.readConcern=Z;if(J!=null&&(X&&X.options&&X.options.readPreference)==null)X.options=X.options||{},X.options.readPreference=J}}let B=this._mongooseOptions;if(B.lean!=null){let Z=B.lean;for(let J of A)if((J&&J.options&&J.options.lean)==null)J.options=J.options||{},J.options.lean=Z}if(!r1.isObject(B.populate))B.populate={};let D=B.populate;for(let Z of A){let J=Z.path;if(D[J]&&D[J].populate&&Z.populate)Z.populate=D[J].populate.concat(Z.populate);D[Z.path]=Z}return this};h.prototype.getPopulatedPaths=function F(){let A=this._mongooseOptions.populate||{},B=Object.keys(A);for(let D of Object.keys(A)){let Z=A[D];if(!Array.isArray(Z.populate))continue;Jv(B,Z.populate,D+".")}return B};/*!
818
+ */function Zv(F,A){if(F._queryMiddleware==null)return;return new Promise((B,D)=>{F._queryMiddleware.execPre(A||F.op,F,[],(Z)=>{if(Z!=null)return D(Z);B()})})}h.prototype.then=function(F,A){return this.exec().then(F,A)};h.prototype.catch=function(F){return this.exec().then(null,F)};h.prototype.finally=function(F){return this.exec().finally(F)};h.prototype[Symbol.toStringTag]=function F(){return`Query { ${this.op} }`};h.prototype.pre=function(F){return this._hooks.pre("exec",F),this};h.prototype.post=function(F){return this._hooks.post("exec",F),this};h.prototype._castUpdate=function F(A){let B=this.schema,D=B.options.discriminatorKey,Z=B._baseSchema?B._baseSchema:B;if(this._mongooseOptions.overwriteDiscriminatorKey&&A[D]!=null&&Z.discriminators){let X=Object.values(Z.discriminators).find((E)=>E.discriminatorMapping.value===A[D]);if(X!=null)B=X}let J;if("upsert"in this.options)J=this.options.upsert;return Xq1(B,A,{strict:this._mongooseOptions.strict,upsert:J,arrayFilters:this.options.arrayFilters,overwriteDiscriminatorKey:this._mongooseOptions.overwriteDiscriminatorKey,overwriteImmutable:this._mongooseOptions.overwriteImmutable},this,this._conditions)};h.prototype.populate=function(){let F=Array.from(arguments);if(!F.some(Boolean))return this;let A=r1.populate.apply(null,F),B=this._mongooseOptions;if(B.lean!=null){let Z=B.lean;for(let J of A)if((J&&J.options&&J.options.lean)==null)J.options=J.options||{},J.options.lean=Z}if(!r1.isObject(B.populate))B.populate={};let D=B.populate;for(let Z of A){let J=Z.path;if(D[J]&&D[J].populate&&Z.populate)Z.populate=D[J].populate.concat(Z.populate);D[Z.path]=Z}return this};h.prototype.getPopulatedPaths=function F(){let A=this._mongooseOptions.populate||{},B=Object.keys(A);for(let D of Object.keys(A)){let Z=A[D];if(!Array.isArray(Z.populate))continue;Jv(B,Z.populate,D+".")}return B};/*!
819
819
  * ignore
820
820
  */function Jv(F,A,B){for(let D of A){if(F.push(B+D.path),!Array.isArray(D.populate))continue;Jv(F,D.populate,B+D.path+".")}}h.prototype.cast=function(F,A){A||(A=this._conditions),F=F||this.model;let B=F.schema.options.discriminatorKey;if(A!=null&&A.hasOwnProperty(B))F=Eq1(F.discriminators,A[B])||F;let D={upsert:this.options&&this.options.upsert};if(this.options){if("strict"in this.options)D.strict=this.options.strict;if("strictQuery"in this.options)D.strictQuery=this.options.strictQuery}if("sanitizeFilter"in this._mongooseOptions)D.sanitizeFilter=this._mongooseOptions.sanitizeFilter;try{return Zq1(F.schema,A,D,this)}catch(Z){if(typeof Z.setModel==="function")Z.setModel(F);throw Z}};h.prototype._castFields=function F(A){let B,D,Z,J,X;if(A){Z=Object.keys(A),D=[];for(let E=0;E<Z.length;++E)if(J=Z[E],A[J].$elemMatch)B||(B={}),B[J]=A[J],D.push(J)}if(B){try{X=this.cast(this.model,B)}catch(E){return E}for(let E=0;E<D.length;++E)J=D[E],A[J]=X[J]}return A};h.prototype._applyPaths=function F(){if(!this.model)return;this._fields=this._fields||{};let A=void 0;if(this.model!=null&&r1.hasUserDefinedProperty(this.model.db.options,"sanitizeProjection"))A=this.model.db.options.sanitizeProjection;else if(this.model!=null&&r1.hasUserDefinedProperty(this.model.base.options,"sanitizeProjection"))A=this.model.base.options.sanitizeProjection;else A=this._mongooseOptions.sanitizeProjection;if(this._mongooseOptions.schemaLevelProjections??!0)_F.applyPaths(this._fields,this.model.schema,A);let D=!0;if("selectPopulatedPaths"in this.model.base.options)D=this.model.base.options.selectPopulatedPaths;if("selectPopulatedPaths"in this.model.schema.options)D=this.model.schema.options.selectPopulatedPaths;if(D)Kq1(this._fields,this._userProvidedFields,this._mongooseOptions.populate)};h.prototype.cursor=function F(A){if(A)this.setOptions(A);try{this.cast(this.model)}catch(B){return new ih(this)._markError(B)}return new ih(this)};h.prototype.tailable=function(F,A){if(F!=null&&typeof F.constructor==="function"&&F.constructor.name==="Object")A=F,F=!0;if(F===void 0)F=!0;if(A&&typeof A==="object")for(let B of Object.keys(A))if(B==="awaitData"||B==="awaitdata")this.options.awaitData=!!A[B];else this.options[B]=A[B];return this.options.tailable=arguments.length?!!F:!0,this};h.prototype.near=function(){let F=[],A=this._mongooseOptions.nearSphere;if(arguments.length===1)if(Array.isArray(arguments[0]))F.push({center:arguments[0],spherical:A});else if(typeof arguments[0]==="string")F.push(arguments[0]);else if(r1.isObject(arguments[0])){if(typeof arguments[0].spherical!=="boolean")arguments[0].spherical=A;F.push(arguments[0])}else throw new TypeError("invalid argument");else if(arguments.length===2)if(typeof arguments[0]==="number"&&typeof arguments[1]==="number")F.push({center:[arguments[0],arguments[1]],spherical:A});else if(typeof arguments[0]==="string"&&Array.isArray(arguments[1]))F.push(arguments[0]),F.push({center:arguments[1],spherical:A});else if(typeof arguments[0]==="string"&&r1.isObject(arguments[1])){if(F.push(arguments[0]),typeof arguments[1].spherical!=="boolean")arguments[1].spherical=A;F.push(arguments[1])}else throw new TypeError("invalid argument");else if(arguments.length===3)if(typeof arguments[0]==="string"&&typeof arguments[1]==="number"&&typeof arguments[2]==="number")F.push(arguments[0]),F.push({center:[arguments[1],arguments[2]],spherical:A});else throw new TypeError("invalid argument");else throw new TypeError("invalid argument");return h.base.near.apply(this,F)};h.prototype.nearSphere=function(){return this._mongooseOptions.nearSphere=!0,this.near.apply(this,arguments),this};if(Symbol.asyncIterator!=null)h.prototype[Symbol.asyncIterator]=function F(){return this._mongooseOptions._asyncIterator=!0,this.cursor()};h.prototype.box=function(F,A){if(!Array.isArray(F)&&r1.isObject(F))A=F.ur,F=F.ll;return h.base.box.call(this,F,A)};h.prototype.center=h.base.circle;h.prototype.centerSphere=function(){if(arguments[0]!=null&&typeof arguments[0].constructor==="function"&&arguments[0].constructor.name==="Object")arguments[0].spherical=!0;if(arguments[1]!=null&&typeof arguments[1].constructor==="function"&&arguments[1].constructor.name==="Object")arguments[1].spherical=!0;h.base.circle.apply(this,arguments)};h.prototype.selectedInclusively=function F(){return Gq1(this._fields)};h.prototype.selectedExclusively=function F(){return $q1(this._fields)};h.prototype.model;/*!
821
821
  * Export
@@ -871,9 +871,9 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
871
871
  * ignore
872
872
  */function CK1(F,A,B){let D=F.$__schema.options.versionKey;if(!D)return null;let Z=F.$__getValue(D)||0;return new tm(F,Z,A.concat(B))}m.prototype.save=async function F(A){if(typeof A==="function"||typeof arguments[1]==="function")throw new E1("Model.prototype.save() no longer accepts a callback");let B;if(this.$op="save",this.$__.saving)B=new lm(this);else this.$__.saving=new lm(this);if(A=new _z1(A),A.hasOwnProperty("session"))this.$session(A.session);if(this.$__.timestamps!=null)A.timestamps=this.$__.timestamps;if(this.$__.$versionError=CK1(this,this.modifiedPaths(),Object.keys(this.$__.activePaths.getStatePaths("default"))),B)throw this.$__handleReject(B),B;return this.$__.saveOptions=A,await new Promise((D,Z)=>{this.$__save(A,(J)=>{if(this.$__.saving=null,this.$__.saveOptions=null,this.$__.$versionError=null,this.$op=null,J!=null)return this.$__handleReject(J),Z(J);D()})}),this};m.prototype.$save=m.prototype.save;m.prototype.$__version=function(F,A){let B=this.$__schema.options.versionKey;if(F===!0){if(B)JK1(A,B,0),this.$__setValue(B,0);return}if(B===!1)return;if(!this.$__isSelected(B))return;if(im===(im&this.$__.version)){let D=this.$__getValue(B);if(D!=null)F[B]=D}if(eZ===(eZ&this.$__.version))if(cF(A.$set,B,null)!=null)++A.$set[B];else A.$inc=A.$inc||{},A.$inc[B]=1};m.prototype.increment=function F(){return this.$__.version=$K1,this};m.prototype.$__where=function F(A){if(A||(A={}),!A._id)A._id=this._doc._id;if(this._doc._id===void 0)return new E1("No _id found on document!");return A};m.prototype.deleteOne=function F(A){if(typeof A==="function"||typeof arguments[1]==="function")throw new E1("Model.prototype.deleteOne() no longer accepts a callback");if(!A)A={};if(A.hasOwnProperty("session"))this.$session(A.session);let B=this,D=this.$__where();if(D instanceof Error)throw D;let Z=B.constructor.deleteOne(D,A);if(this.$session()!=null){if(!("session"in Z.options))Z.options.session=this.$session()}return Z.pre(function J(X){B.constructor._middleware.execPre("deleteOne",B,[B],X)}),Z.pre(function J(X){Nq(B.$getAllSubdocs(),(E,Y)=>{E.constructor._middleware.execPre("deleteOne",E,[E],Y)},X)}),Z.pre(function J(X){if(B.$__.isDeleted)return X(Mq.skipWrappedFunction());return X()}),Z.post(function J(X){Nq(B.$getAllSubdocs(),(E,Y)=>{E.constructor._middleware.execPost("deleteOne",E,[E],{},Y)},X)}),Z.post(function J(X){B.constructor._middleware.execPost("deleteOne",B,[B],{},X)}),Z};m.prototype.$model=function F(A){if(arguments.length===0)return this.constructor;return this[h9].model(A)};m.prototype.model=m.prototype.$model;m.exists=function F(A,B){if(H1(this,"exists"),typeof arguments[2]==="function")throw new E1("Model.exists() no longer accepts a callback");return this.findOne(A).select({_id:1}).lean().setOptions(B)};m.discriminator=function(F,A,B){let D;if(typeof F==="function"){if(D=F,F=l1.getFunctionName(D),!(D.prototype instanceof m))throw new E1("The provided class "+F+" must extend Model")}B=B||{};let Z=l1.isPOJO(B)?B.value:B,J=typeof B.clone==="boolean"?B.clone:!0,X=typeof B.mergePlugins==="boolean"?B.mergePlugins:!0,E=typeof B.overwriteModels==="boolean"?B.overwriteModels:!1;if(H1(this,"discriminator"),l1.isObject(A)&&!A.instanceOfSchema)A=new Pq(A);if(A instanceof Pq&&J)A=A.clone();if(A=az1(this,F,A,Z,X,B.mergeHooks,E),this.db.models[F]&&!A.options.overwriteModels&&!E)throw new fz1(F);A.$isRootDiscriminator=!0,A.$globalPluginsApplied=!0,D=this.db.model(D||F,A,this.$__collection.name),this.discriminators[F]=D;let Y=this.discriminators[F];if(Object.setPrototypeOf(Y.prototype,this.prototype),Object.defineProperty(Y,"baseModelName",{value:this.modelName,configurable:!0,writable:!1}),om(Y,A),Fd(Y,A),this[dF]!=null)for(let $ of this[dF])$.discriminators=$.discriminators||{},$.discriminators[F]=D.__subclass(D.db,A,$.collection.name);return Y};function H1(F,A){if(F==null||F===global)throw new E1("`Model."+A+"()` cannot run without a model as `this`. Make sure you are calling `MyModel."+A+"()` where `MyModel` is a Mongoose model.");else if(F[Xd]==null)throw new E1("`Model."+A+"()` cannot run without a model as `this`. Make sure you are not calling `new Model."+A+"()`")}/*!
873
873
  * Give the constructor the ability to emit events.
874
- */for(let F in Iq.prototype)m[F]=Iq.prototype[F];m.init=function F(){if(H1(this,"init"),typeof arguments[0]==="function")throw new E1("Model.init() no longer accepts a callback");if(this.schema.emit("init",this),this.$init!=null)return this.$init;let A=this.db,B=async()=>{if(!l1.getOption("autoIndex",this.schema.options,A.config,A.base.options))return;return await this.ensureIndexes({_automatic:!0})},D=async()=>{if(!l1.getOption("autoSearchIndex",this.schema.options,A.config,A.base.options))return;return await this.ensureSearchIndexes()},Z=async()=>{let E=l1.getOption("autoCreate",this.schema.options,A.config);if(E==null)await A._waitForConnect(!0),E=l1.getOption("autoCreate",this.schema.options,A.config,A.base.options);if(!E)return;return await this.createCollection()};this.$init=Z().then(()=>B()).then(()=>D());let J=this.$init.catch,X=this;return this.$init.catch=function(){return X.$caught=!0,J.apply(X.$init,arguments)},this.$init};m.createCollection=async function F(A){if(H1(this,"createCollection"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.createCollection() no longer accepts a callback");let B=await new Promise((Y,$)=>{this.hooks.execPre("createCollection",this,[A],(G)=>{if(G!=null){if(G instanceof Mq.skipWrappedFunction)return Y(!0);return $(G)}Y()})}),D=this&&this.schema&&this.schema.options&&this.schema.options.collectionOptions;if(D!=null)A=Object.assign({},D,A);let Z=this&&this.schema&&this.schema.options&&this.schema.options.collation;if(Z!=null)A=Object.assign({collation:Z},A);let J=this&&this.schema&&this.schema.options&&this.schema.options.capped;if(J!=null){if(typeof J==="number")A=Object.assign({capped:!0,size:J},A);else if(typeof J==="object")A=Object.assign({capped:!0},J,A)}let X=this&&this.schema&&this.schema.options&&this.schema.options.timeseries;if(X!=null){if(A=Object.assign({timeseries:X},A),A.expireAfterSeconds!=null);else if(A.expires!=null)l1.expires(A);else if(this.schema.options.expireAfterSeconds!=null)A.expireAfterSeconds=this.schema.options.expireAfterSeconds;else if(this.schema.options.expires!=null)A.expires=this.schema.options.expires,l1.expires(A)}let E=this&&this.schema&&this.schema.options&&this.schema.options.clusteredIndex;if(E!=null)A=Object.assign({clusteredIndex:{...E,unique:!0}},A);try{if(!B)await this.db.createCollection(this.$__collection.collectionName,A)}catch(Y){if(Y!=null&&(Y.name!=="MongoServerError"||Y.code!==48))await new Promise(($,G)=>{let C={error:Y};this.hooks.execPost("createCollection",this,[null],C,(W)=>{if(W!=null)return G(W);$()})})}return await new Promise((Y,$)=>{this.hooks.execPost("createCollection",this,[this.$__collection],(G)=>{if(G!=null)return $(G);Y()})}),this.$__collection};m.syncIndexes=async function F(A){if(H1(this,"syncIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.syncIndexes() no longer accepts a callback");if(A?.autoCreate??this.schema.options?.autoCreate??this.db.config.autoCreate??!0)try{await this.createCollection()}catch(J){if(J!=null&&(J.name!=="MongoServerError"||J.code!==48))throw J}let D=await this.diffIndexes({indexOptionsToCreate:!0}),Z=await this.cleanIndexes({...A,toDrop:D.toDrop});return await this.createIndexes({...A,toCreate:D.toCreate}),Z};m.createSearchIndex=async function F(A){return H1(this,"createSearchIndex"),await this.$__collection.createSearchIndex(A)};m.updateSearchIndex=async function F(A,B){return H1(this,"updateSearchIndex"),await this.$__collection.updateSearchIndex(A,B)};m.dropSearchIndex=async function F(A){return H1(this,"dropSearchIndex"),await this.$__collection.dropSearchIndex(A)};m.listSearchIndexes=async function F(A){return H1(this,"listSearchIndexes"),await(await this.$__collection.listSearchIndexes(A)).toArray()};m.diffIndexes=async function F(A){if(typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.syncIndexes() no longer accepts a callback");let B=this,D=await B.listIndexes().catch((Y)=>{if(Y.codeName=="NamespaceNotFound")return;throw Y});if(D===void 0)D=[];D=oz1(B,D);let Z=B.schema,J=ez1(B,Z.indexes()),X=HK1(Z,J,D),E=WK1(Z,J,D,X,A);return{toDrop:X,toCreate:E}};function WK1(F,A,B,D,Z){let J=[],X=Z?.indexOptionsToCreate??!1;for(let[E,Y]of A){let $=!1,G=uq(F,t3(Y));for(let C of B){if(jq(C))continue;if(Zd(E,G,C)&&!D.includes(C.name)){$=!0;break}}if(!$)if(X)J.push([E,Y]);else J.push(E)}return J}function HK1(F,A,B){let D=[];for(let Z of B){let J=!1;if(jq(Z))continue;if(tz1(Z,F.options))continue;for(let[X,E]of A){let Y=uq(F,t3(E));if(em(X,Y,F.options),Zd(X,Y,Z)){J=!0;break}}if(J)continue;D.push(Z.name)}return D}m.cleanIndexes=async function F(A){if(H1(this,"cleanIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.cleanIndexes() no longer accepts a callback");let B=this;if(Array.isArray(A&&A.toDrop))return await nm(A.toDrop,B,A);let D=await B.diffIndexes();return await nm(D.toDrop,B,A)};async function nm(F,A,B){if(F.length===0)return[];let D=A.$__collection;if(B&&B.hideIndexes)await Promise.all(F.map((Z)=>{return A.db.db.command({collMod:D.collectionName,index:{name:Z,hidden:!0}})}));else await Promise.all(F.map((Z)=>D.dropIndex(Z)));return F}m.listIndexes=async function F(){if(H1(this,"listIndexes"),typeof arguments[0]==="function")throw new E1("Model.listIndexes() no longer accepts a callback");if(this.$__collection.buffer)await new Promise((A)=>{this.$__collection.addQueue(A)});return this.$__collection.listIndexes().toArray()};m.ensureIndexes=async function F(A){if(H1(this,"ensureIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.ensureIndexes() no longer accepts a callback");await new Promise((B,D)=>{qK1(this,A,(Z)=>{if(Z!=null)return D(Z);B()})})};m.createIndexes=async function F(A){if(H1(this,"createIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.createIndexes() no longer accepts a callback");return this.ensureIndexes(A)};/*!
874
+ */for(let F in Iq.prototype)m[F]=Iq.prototype[F];m.init=function F(){if(H1(this,"init"),typeof arguments[0]==="function")throw new E1("Model.init() no longer accepts a callback");if(this.schema.emit("init",this),this.$init!=null)return this.$init;let A=this.db,B=async()=>{if(!l1.getOption("autoIndex",this.schema.options,A.config,A.base.options))return;return await this.ensureIndexes({_automatic:!0})},D=async()=>{if(!l1.getOption("autoSearchIndex",this.schema.options,A.config,A.base.options))return;return await this.createSearchIndexes()},Z=async()=>{let E=l1.getOption("autoCreate",this.schema.options,A.config);if(E==null)await A._waitForConnect(!0),E=l1.getOption("autoCreate",this.schema.options,A.config,A.base.options);if(!E)return;return await this.createCollection()};this.$init=Z().then(()=>B()).then(()=>D());let J=this.$init.catch,X=this;return this.$init.catch=function(){return X.$caught=!0,J.apply(X.$init,arguments)},this.$init};m.createCollection=async function F(A){if(H1(this,"createCollection"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.createCollection() no longer accepts a callback");let B=await new Promise((Y,$)=>{this.hooks.execPre("createCollection",this,[A],(G)=>{if(G!=null){if(G instanceof Mq.skipWrappedFunction)return Y(!0);return $(G)}Y()})}),D=this&&this.schema&&this.schema.options&&this.schema.options.collectionOptions;if(D!=null)A=Object.assign({},D,A);let Z=this&&this.schema&&this.schema.options&&this.schema.options.collation;if(Z!=null)A=Object.assign({collation:Z},A);let J=this&&this.schema&&this.schema.options&&this.schema.options.capped;if(J!=null){if(typeof J==="number")A=Object.assign({capped:!0,size:J},A);else if(typeof J==="object")A=Object.assign({capped:!0},J,A)}let X=this&&this.schema&&this.schema.options&&this.schema.options.timeseries;if(X!=null){if(A=Object.assign({timeseries:X},A),A.expireAfterSeconds!=null);else if(A.expires!=null)l1.expires(A);else if(this.schema.options.expireAfterSeconds!=null)A.expireAfterSeconds=this.schema.options.expireAfterSeconds;else if(this.schema.options.expires!=null)A.expires=this.schema.options.expires,l1.expires(A)}let E=this&&this.schema&&this.schema.options&&this.schema.options.clusteredIndex;if(E!=null)A=Object.assign({clusteredIndex:{...E,unique:!0}},A);try{if(!B)await this.db.createCollection(this.$__collection.collectionName,A)}catch(Y){if(Y!=null&&(Y.name!=="MongoServerError"||Y.code!==48))await new Promise(($,G)=>{let C={error:Y};this.hooks.execPost("createCollection",this,[null],C,(W)=>{if(W!=null)return G(W);$()})})}return await new Promise((Y,$)=>{this.hooks.execPost("createCollection",this,[this.$__collection],(G)=>{if(G!=null)return $(G);Y()})}),this.$__collection};m.syncIndexes=async function F(A){if(H1(this,"syncIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.syncIndexes() no longer accepts a callback");if(A?.autoCreate??this.schema.options?.autoCreate??this.db.config.autoCreate??!0)try{await this.createCollection()}catch(J){if(J!=null&&(J.name!=="MongoServerError"||J.code!==48))throw J}let D=await this.diffIndexes({indexOptionsToCreate:!0}),Z=await this.cleanIndexes({...A,toDrop:D.toDrop});return await this.createIndexes({...A,toCreate:D.toCreate}),Z};m.createSearchIndex=async function F(A){return H1(this,"createSearchIndex"),await this.$__collection.createSearchIndex(A)};m.updateSearchIndex=async function F(A,B){return H1(this,"updateSearchIndex"),await this.$__collection.updateSearchIndex(A,B)};m.dropSearchIndex=async function F(A){return H1(this,"dropSearchIndex"),await this.$__collection.dropSearchIndex(A)};m.listSearchIndexes=async function F(A){return H1(this,"listSearchIndexes"),await(await this.$__collection.listSearchIndexes(A)).toArray()};m.diffIndexes=async function F(A){if(typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.syncIndexes() no longer accepts a callback");let B=this,D=await B.listIndexes().catch((Y)=>{if(Y.codeName=="NamespaceNotFound")return;throw Y});if(D===void 0)D=[];D=oz1(B,D);let Z=B.schema,J=ez1(B,Z.indexes()),X=HK1(Z,J,D),E=WK1(Z,J,D,X,A);return{toDrop:X,toCreate:E}};function WK1(F,A,B,D,Z){let J=[],X=Z?.indexOptionsToCreate??!1;for(let[E,Y]of A){let $=!1,G=uq(F,t3(Y));for(let C of B){if(jq(C))continue;if(Zd(E,G,C)&&!D.includes(C.name)){$=!0;break}}if(!$)if(X)J.push([E,Y]);else J.push(E)}return J}function HK1(F,A,B){let D=[];for(let Z of B){let J=!1;if(jq(Z))continue;if(tz1(Z,F.options))continue;for(let[X,E]of A){let Y=uq(F,t3(E));if(em(X,Y,F.options),Zd(X,Y,Z)){J=!0;break}}if(J)continue;D.push(Z.name)}return D}m.cleanIndexes=async function F(A){if(H1(this,"cleanIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.cleanIndexes() no longer accepts a callback");let B=this;if(Array.isArray(A&&A.toDrop))return await nm(A.toDrop,B,A);let D=await B.diffIndexes();return await nm(D.toDrop,B,A)};async function nm(F,A,B){if(F.length===0)return[];let D=A.$__collection;if(B&&B.hideIndexes)await Promise.all(F.map((Z)=>{return A.db.db.command({collMod:D.collectionName,index:{name:Z,hidden:!0}})}));else await Promise.all(F.map((Z)=>D.dropIndex(Z)));return F}m.listIndexes=async function F(){if(H1(this,"listIndexes"),typeof arguments[0]==="function")throw new E1("Model.listIndexes() no longer accepts a callback");if(this.$__collection.buffer)await new Promise((A)=>{this.$__collection.addQueue(A)});return this.$__collection.listIndexes().toArray()};m.ensureIndexes=async function F(A){if(H1(this,"ensureIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.ensureIndexes() no longer accepts a callback");await new Promise((B,D)=>{qK1(this,A,(Z)=>{if(Z!=null)return D(Z);B()})})};m.createIndexes=async function F(A){if(H1(this,"createIndexes"),typeof arguments[0]==="function"||typeof arguments[1]==="function")throw new E1("Model.createIndexes() no longer accepts a callback");return this.ensureIndexes(A)};/*!
875
875
  * ignore
876
- */function qK1(F,A,B){let D=Array.isArray(A?.toCreate)?A.toCreate:F.schema.indexes(),Z;A=A||{};let J=function(C){if(C&&!F.$caught)F.emit("error",C);F.emit("index",C||Z),B&&B(C||Z)};for(let C of D)if(jq(C))l1.warn('mongoose: Cannot specify a custom index on `_id` for model name "'+F.modelName+'", MongoDB does not allow overwriting the default `_id` index. See https://bit.ly/mongodb-id-index');if(!D.length){lF(function(){J()});return}let X=function(C,W,H,q){F.emit("index-single-done",C,W,H,q)},E=function(C,W){F.emit("index-single-start",C,W)},Y=F.schema._baseSchema,$=Y?Y.indexes():[];lF(function(){if(A._automatic&&!F.collection.collection)F.collection.addQueue(G,[]);else G()});function G(){if(A._automatic){if(F.schema.options.autoIndex===!1||F.schema.options.autoIndex==null&&F.db.config.autoIndex===!1)return J()}let C=D.shift();if(!C)return J();if(A._automatic&&C[1]._autoIndex===!1)return G();if($.find((z)=>l1.deepEqual(z,C)))return G();let W=t3(C[0]),H=t3(C[1]);if(delete H._autoIndex,uq(F.schema,H),Ad(F.schema,H),em(W,H,F.schema.options),E(W,A),"background"in A)H.background=A.background;let q=null;try{q=F.collection.createIndex(W,H)}catch(z){if(!Z)Z=z;if(!F.$caught)F.emit("error",z);X(z,W,H),G();return}q.then((z)=>{X(null,W,H,z),G()},(z)=>{if(!Z)Z=z;if(!F.$caught)F.emit("error",z);X(z,W,H),G()})}}m.createSearchIndexes=async function F(){H1(this,"createSearchIndexes");let A=[];for(let B of this.schema._searchIndexes)A.push(await this.createSearchIndex(B));return A};m.schema;m.db;m.collection;m.$__collection;m.base;m.discriminators;m.translateAliases=function F(A,B){H1(this,"translateAliases");let D=(Z,J)=>{let X,E=[],Y=Z.split("."),$=this.schema;for(let C in Y){let W=Y[C];if($&&$.aliases[W]){if(X=$.aliases[W],B&&X in A)throw new E1(`Provided object has both field "${W}" and its alias "${X}"`);E.push(X)}else X=W,E.push(W);if($&&$.paths[X])$=$.paths[X].schema;else $=null}let G=E.join(".");if(A instanceof Map)A.set(G,J);else A[G]=J;if(G!==Z)if(A instanceof Map)A.delete(Z);else delete A[Z];return A};if(typeof A==="object"){if(A instanceof Map)for(let Z of new Map(A))A=D(Z[0],Z[1]);else for(let Z of Object.keys(A))if(A=D(Z,A[Z]),Z[0]==="$")if(Array.isArray(A[Z]))for(let J in A[Z])A[Z][J]=this.translateAliases(A[Z][J]);else this.translateAliases(A[Z]);return A}else return A};m.deleteOne=function F(A,B){if(H1(this,"deleteOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.prototype.deleteOne() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);return D.setOptions(B),D.deleteOne(A)};m.deleteMany=function F(A,B){if(H1(this,"deleteMany"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.deleteMany() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);return D.setOptions(B),D.deleteMany(A)};m.find=function F(A,B,D){if(H1(this,"find"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.find() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);return Z.select(B),Z.setOptions(D),Z.find(A)};m.findById=function F(A,B,D){if(H1(this,"findById"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findById() no longer accepts a callback");if(typeof A==="undefined")A=null;return this.findOne({_id:A},B,D)};m.findOne=function F(A,B,D){if(H1(this,"findOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findOne() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);return Z.select(B),Z.setOptions(D),Z.findOne(A)};m.estimatedDocumentCount=function F(A){return H1(this,"estimatedDocumentCount"),new this.Query({},{},this,this.$__collection).estimatedDocumentCount(A)};m.countDocuments=function F(A,B){if(H1(this,"countDocuments"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.countDocuments() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);if(B!=null)D.setOptions(B);return D.countDocuments(A)};m.distinct=function F(A,B,D){if(H1(this,"distinct"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.distinct() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);if(D!=null)Z.setOptions(D);return Z.distinct(A,B)};m.where=function F(A,B){H1(this,"where");let D=new this.Query({},{},this,this.$__collection).find({});return D.where.apply(D,arguments)};m.$where=function F(){H1(this,"$where");let A=new this.Query({},{},this,this.$__collection).find({});return A.$where.apply(A,arguments)};m.findOneAndUpdate=function(F,A,B){if(H1(this,"findOneAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findOneAndUpdate() no longer accepts a callback");let D;if(B)D=B.fields||B.projection;A=t3(A,{depopulate:!0,_isNested:!0}),Bd(A,B,this.schema.options.versionKey);let Z=new this.Query({},{},this,this.$__collection);return Z.select(D),Z.findOneAndUpdate(F,A,B)};m.findByIdAndUpdate=function(F,A,B){if(H1(this,"findByIdAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findByIdAndUpdate() no longer accepts a callback");if(F instanceof K3)F=F._doc._id;return this.findOneAndUpdate.call(this,{_id:F},A,B)};m.findOneAndDelete=function(F,A){if(H1(this,"findOneAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findOneAndDelete() no longer accepts a callback");let B;if(A)B=A.select,A.select=void 0;let D=new this.Query({},{},this,this.$__collection);return D.select(B),D.findOneAndDelete(F,A)};m.findByIdAndDelete=function(F,A){if(H1(this,"findByIdAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findByIdAndDelete() no longer accepts a callback");return this.findOneAndDelete({_id:F},A)};m.findOneAndReplace=function(F,A,B){if(H1(this,"findOneAndReplace"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findOneAndReplace() no longer accepts a callback");let D;if(B)D=B.select,B.select=void 0;let Z=new this.Query({},{},this,this.$__collection);return Z.select(D),Z.findOneAndReplace(F,A,B)};m.create=async function F(A,B){if(typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.create() no longer accepts a callback");H1(this,"create");let D,Z=this.schema.options.discriminatorKey;if(Array.isArray(A))D=A,B=B!=null&&typeof B==="object"?B:{};else{let E=arguments[arguments.length-1];if(B={},typeof E==="function"||typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.create() no longer accepts a callback");else if(D=[...arguments],D.length>1&&!E)D.pop();if(D.length===2&&D[0]!=null&&D[1]!=null&&D[0].session==null&&E&&sz1(E.session)==="ClientSession"&&!this.schema.path("session"))l1.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(D.length===0)return Array.isArray(A)?[]:null;let J=[],X=typeof B.aggregateErrors==="boolean"?!B.aggregateErrors:!0;if(delete B.aggregateErrors,B.session&&!B.ordered&&D.length>1)throw new E1("Cannot call `create()` with a session and multiple documents unless `ordered: true` is set");if(B.ordered){for(let E=0;E<D.length;E++)try{let Y=D[E],$=this.discriminators&&Y[Z]!=null?this.discriminators[Y[Z]]||mF(this.discriminators,Y[Z]):this;if($==null)throw new E1(`Discriminator "${Y[Z]}" not found for model "${this.modelName}"`);let G=Y;if(!(G instanceof $))G=new $(G);await G.$save(B),J.push(G)}catch(Y){if(!X)J.push(Y);else throw Y}return J}else if(!X)J=await Promise.allSettled(D.map(async(E)=>{let Y=this.discriminators&&E[Z]!=null?this.discriminators[E[Z]]||mF(this.discriminators,E[Z]):this;if(Y==null)throw new E1(`Discriminator "${E[Z]}" not found for model "${this.modelName}"`);let $=E;if(!($ instanceof Y))$=new Y($);return await $.$save(B),$})),J=J.map((E)=>E.status==="fulfilled"?E.value:E.reason);else{let E=null;if(J=await Promise.all(D.map(async(Y)=>{let $=this.discriminators&&Y[Z]!=null?this.discriminators[Y[Z]]||mF(this.discriminators,Y[Z]):this;if($==null)throw new E1(`Discriminator "${Y[Z]}" not found for model "${this.modelName}"`);try{let G=Y;if(!(G instanceof $))G=new $(G);return await G.$save(B),G}catch(G){if(!E)E=G}})),E)throw E}if(!Array.isArray(A)&&D.length===1)return J[0];return J};m.insertOne=async function F(A,B){H1(this,"insertOne");let D=this.schema.options.discriminatorKey,Z=this.discriminators&&A[D]!=null?this.discriminators[A[D]]||mF(this.discriminators,A[D]):this;if(Z==null)throw new E1(`Discriminator "${A[D]}" not found for model "${this.modelName}"`);if(!(A instanceof Z))A=new Z(A);return await A.$save(B)};m.watch=function(F,A){H1(this,"watch");let B=(D)=>{if(F=F||[],DK1(F,this.schema,"fullDocument"),this.$__collection.buffer)this.$__collection.addQueue(()=>{if(this.closed)return;let Z=this.$__collection.watch(F,A);D(null,Z)});else{let Z=this.$__collection.watch(F,A);D(null,Z)}};return A=A||{},A.model=this,new Oz1(B,F,A)};m.startSession=function(){return H1(this,"startSession"),this.db.startSession.apply(this.db,arguments)};m.insertMany=async function F(A,B){if(H1(this,"insertMany"),typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.insertMany() no longer accepts a callback");return new Promise((D,Z)=>{this.$__insertMany(A,B,(J,X)=>{if(J!=null)return Z(J);D(X)})})};m.$__insertMany=function(F,A,B){let D=this;if(typeof A==="function")B=A,A=null;B=B||l1.noop,A=A||{};let Z=A.limit||1000,J=!!A.rawResult,X=typeof A.ordered==="boolean"?A.ordered:!0,E=typeof A.throwOnValidationError==="boolean"?A.throwOnValidationError:!1,Y=!!A.lean,$=this.db.base.transactionAsyncLocalStorage?.getStore();if((!A||!A.hasOwnProperty("session"))&&$?.session!=null)A={...A,session:$.session};if(!Array.isArray(F))F=[F];let G=[],C=new Map,W=X?null:new Array(F.length),H=F.map((q,z)=>(U)=>{if(Y)return lF(()=>U(null,q));let Q=!1;if(!(q instanceof D)){if(q!=null&&typeof q!=="object")return U(new xz1(q,"arr."+z,"insertMany"));try{q=new D(q),Q=!0}catch(V){return U(V)}}if(A.session!=null)q.$session(A.session);if(Y)return lF(()=>U(null,q));q.$validate(Q?{_skipParallelValidateCheck:!0}:null).then(()=>{U(null,q)},(V)=>{if(X===!1)return G.push(V),C.set(V,z),W[z]=V,U(null,null);U(V)})});BK1(H,Z,function(q,z){if(q){B(q,null);return}let U=new Map,Q=new Map;for(let w=0;w<z.length;++w)U.set(z[w],w);let V=z.filter(function(w){return w!=null});for(let w=0;w<V.length;++w)Q.set(w,U.get(V[w]));if(G.length>0)G.sort((w,M)=>{return C.get(w)-C.get(M)});if(V.length===0){if(E)return B(new oZ(G,W,null,"insertMany"));if(J){let w={acknowledged:!0,insertedCount:0,insertedIds:{}};return b9(w,G,G),B(null,w)}B(null,[]);return}let L=Y?V:V.map(function(w){if(w.$__schema.options.versionKey)w[w.$__schema.options.versionKey]=0;if((!A||A.timestamps!==!1)&&w.initializeTimestamps&&(!w.$__||w.$__.timestamps!==!1))w.initializeTimestamps();if(w.$__hasOnlyPrimitiveValues())return w.$__toObjectShallow();return w.toObject(Tq)});D.$__collection.insertMany(L,A).then((w)=>{if(!Y)for(let M of V)M.$__reset(),R8(M,!1);if(X===!1&&E&&G.length>0){for(let M=0;M<W.length;++M)if(W[M]===void 0)W[M]=z[M];return B(new oZ(G,W,w,"insertMany"))}if(J){if(X===!1){for(let M=0;M<W.length;++M)if(W[M]===void 0)W[M]=z[M];b9(w,G,W)}return B(null,w)}if(A.populate!=null)return D.populate(V,A.populate).then((M)=>{B(null,M)},(M)=>{if(M!=null)M.insertedDocs=V;throw M});B(null,V)},(w)=>{if(w.writeErrors==null&&(w.result&&w.result.result&&w.result.result.writeErrors)!=null)w.writeErrors=w.result.result.writeErrors;let M=w&&w.writeErrors,T=new Set((w&&w.writeErrors||[]).map((S)=>S.index));if(w.writeErrors!=null)for(let S=0;S<w.writeErrors.length;++S){let b=Q.get(w.writeErrors[S].index);if(w.writeErrors[S]={...w.writeErrors[S],index:b},!X)W[b]=w.writeErrors[S]}if(!X){for(let S=0;S<W.length;++S)if(W[S]===void 0)W[S]=z[S];w.results=W}let k=-1;if(w.insertedDocs=V.filter((S,b)=>{let j=!M||T.has(b);if(X){if(k>-1)return b<k;if(j)k=b}return!j}).map(function S(b){if(Y)return b;return b.$__reset(),R8(b,!1),b}),J&&X===!1)b9(w,G,W);B(w,null)})})};/*!
876
+ */function qK1(F,A,B){let D=Array.isArray(A?.toCreate)?A.toCreate:F.schema.indexes(),Z;A=A||{};let J=function(C){if(C&&!F.$caught)F.emit("error",C);F.emit("index",C||Z),B&&B(C||Z)};for(let C of D)if(jq(C))l1.warn('mongoose: Cannot specify a custom index on `_id` for model name "'+F.modelName+'", MongoDB does not allow overwriting the default `_id` index. See https://bit.ly/mongodb-id-index');if(!D.length){lF(function(){J()});return}let X=function(C,W,H,q){F.emit("index-single-done",C,W,H,q)},E=function(C,W){F.emit("index-single-start",C,W)},Y=F.schema._baseSchema,$=Y?Y.indexes():[];lF(function(){if(A._automatic&&!F.collection.collection)F.collection.addQueue(G,[]);else G()});function G(){if(A._automatic){if(F.schema.options.autoIndex===!1||F.schema.options.autoIndex==null&&F.db.config.autoIndex===!1)return J()}let C=D.shift();if(!C)return J();if(A._automatic&&C[1]._autoIndex===!1)return G();if($.find((z)=>l1.deepEqual(z,C)))return G();let W=t3(C[0]),H=t3(C[1]);if(delete H._autoIndex,uq(F.schema,H),Ad(F.schema,H),em(W,H,F.schema.options),E(W,A),"background"in A)H.background=A.background;let q=null;try{q=F.collection.createIndex(W,H)}catch(z){if(!Z)Z=z;if(!F.$caught)F.emit("error",z);X(z,W,H),G();return}q.then((z)=>{X(null,W,H,z),G()},(z)=>{if(!Z)Z=z;if(!F.$caught)F.emit("error",z);X(z,W,H),G()})}}m.createSearchIndexes=async function F(){H1(this,"createSearchIndexes");let A=[];for(let B of this.schema._searchIndexes)A.push(await this.createSearchIndex(B));return A};m.schema;m.db;m.collection;m.$__collection;m.base;m.discriminators;m.translateAliases=function F(A,B){H1(this,"translateAliases");let D=(Z,J)=>{let X,E=[],Y=Z.split("."),$=this.schema;for(let C in Y){let W=Y[C];if($&&$.aliases[W]){if(X=$.aliases[W],B&&X in A)throw new E1(`Provided object has both field "${W}" and its alias "${X}"`);E.push(X)}else X=W,E.push(W);if($&&$.paths[X])$=$.paths[X].schema;else $=null}let G=E.join(".");if(A instanceof Map)A.set(G,J);else A[G]=J;if(G!==Z)if(A instanceof Map)A.delete(Z);else delete A[Z];return A};if(typeof A==="object"){if(A instanceof Map)for(let Z of new Map(A))A=D(Z[0],Z[1]);else for(let Z of Object.keys(A))if(A=D(Z,A[Z]),Z[0]==="$")if(Array.isArray(A[Z]))for(let J in A[Z])A[Z][J]=this.translateAliases(A[Z][J]);else this.translateAliases(A[Z]);return A}else return A};m.deleteOne=function F(A,B){if(H1(this,"deleteOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.prototype.deleteOne() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);return D.setOptions(B),D.deleteOne(A)};m.deleteMany=function F(A,B){if(H1(this,"deleteMany"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.deleteMany() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);return D.setOptions(B),D.deleteMany(A)};m.find=function F(A,B,D){if(H1(this,"find"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.find() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);return Z.select(B),Z.setOptions(D),Z.find(A)};m.findById=function F(A,B,D){if(H1(this,"findById"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findById() no longer accepts a callback");return this.findOne({_id:A},B,D)};m.findOne=function F(A,B,D){if(H1(this,"findOne"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findOne() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);return Z.select(B),Z.setOptions(D),Z.findOne(A)};m.estimatedDocumentCount=function F(A){return H1(this,"estimatedDocumentCount"),new this.Query({},{},this,this.$__collection).estimatedDocumentCount(A)};m.countDocuments=function F(A,B){if(H1(this,"countDocuments"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.countDocuments() no longer accepts a callback");let D=new this.Query({},{},this,this.$__collection);if(B!=null)D.setOptions(B);return D.countDocuments(A)};m.distinct=function F(A,B,D){if(H1(this,"distinct"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.distinct() no longer accepts a callback");let Z=new this.Query({},{},this,this.$__collection);if(D!=null)Z.setOptions(D);return Z.distinct(A,B)};m.where=function F(A,B){H1(this,"where");let D=new this.Query({},{},this,this.$__collection).find({});return D.where.apply(D,arguments)};m.$where=function F(){H1(this,"$where");let A=new this.Query({},{},this,this.$__collection).find({});return A.$where.apply(A,arguments)};m.findOneAndUpdate=function(F,A,B){if(H1(this,"findOneAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findOneAndUpdate() no longer accepts a callback");let D;if(B)D=B.fields||B.projection;A=t3(A,{depopulate:!0,_isNested:!0}),Bd(A,B,this.schema.options.versionKey);let Z=new this.Query({},{},this,this.$__collection);return Z.select(D),Z.findOneAndUpdate(F,A,B)};m.findByIdAndUpdate=function(F,A,B){if(H1(this,"findByIdAndUpdate"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findByIdAndUpdate() no longer accepts a callback");if(F instanceof K3)F=F._doc._id;return this.findOneAndUpdate.call(this,{_id:F},A,B)};m.findOneAndDelete=function(F,A){if(H1(this,"findOneAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findOneAndDelete() no longer accepts a callback");let B;if(A)B=A.select,A.select=void 0;let D=new this.Query({},{},this,this.$__collection);return D.select(B),D.findOneAndDelete(F,A)};m.findByIdAndDelete=function(F,A){if(H1(this,"findByIdAndDelete"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function")throw new E1("Model.findByIdAndDelete() no longer accepts a callback");return this.findOneAndDelete({_id:F},A)};m.findOneAndReplace=function(F,A,B){if(H1(this,"findOneAndReplace"),typeof arguments[0]==="function"||typeof arguments[1]==="function"||typeof arguments[2]==="function"||typeof arguments[3]==="function")throw new E1("Model.findOneAndReplace() no longer accepts a callback");let D;if(B)D=B.select,B.select=void 0;let Z=new this.Query({},{},this,this.$__collection);return Z.select(D),Z.findOneAndReplace(F,A,B)};m.create=async function F(A,B){if(typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.create() no longer accepts a callback");H1(this,"create");let D,Z=this.schema.options.discriminatorKey;if(Array.isArray(A))D=A,B=B!=null&&typeof B==="object"?B:{};else{let E=arguments[arguments.length-1];if(B={},typeof E==="function"||typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.create() no longer accepts a callback");else if(D=[...arguments],D.length>1&&!E)D.pop();if(D.length===2&&D[0]!=null&&D[1]!=null&&D[0].session==null&&E&&sz1(E.session)==="ClientSession"&&!this.schema.path("session"))l1.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(D.length===0)return Array.isArray(A)?[]:null;let J=[],X=typeof B.aggregateErrors==="boolean"?!B.aggregateErrors:!0;if(delete B.aggregateErrors,B.session&&!B.ordered&&D.length>1)throw new E1("Cannot call `create()` with a session and multiple documents unless `ordered: true` is set");if(B.ordered){for(let E=0;E<D.length;E++)try{let Y=D[E],$=this.discriminators&&Y[Z]!=null?this.discriminators[Y[Z]]||mF(this.discriminators,Y[Z]):this;if($==null)throw new E1(`Discriminator "${Y[Z]}" not found for model "${this.modelName}"`);let G=Y;if(!(G instanceof $))G=new $(G);await G.$save(B),J.push(G)}catch(Y){if(!X)J.push(Y);else throw Y}return J}else if(!X)J=await Promise.allSettled(D.map(async(E)=>{let Y=this.discriminators&&E[Z]!=null?this.discriminators[E[Z]]||mF(this.discriminators,E[Z]):this;if(Y==null)throw new E1(`Discriminator "${E[Z]}" not found for model "${this.modelName}"`);let $=E;if(!($ instanceof Y))$=new Y($);return await $.$save(B),$})),J=J.map((E)=>E.status==="fulfilled"?E.value:E.reason);else{let E=null;if(J=await Promise.all(D.map(async(Y)=>{let $=this.discriminators&&Y[Z]!=null?this.discriminators[Y[Z]]||mF(this.discriminators,Y[Z]):this;if($==null)throw new E1(`Discriminator "${Y[Z]}" not found for model "${this.modelName}"`);try{let G=Y;if(!(G instanceof $))G=new $(G);return await G.$save(B),G}catch(G){if(!E)E=G}})),E)throw E}if(!Array.isArray(A)&&D.length===1)return J[0];return J};m.insertOne=async function F(A,B){H1(this,"insertOne");let D=this.schema.options.discriminatorKey,Z=this.discriminators&&A[D]!=null?this.discriminators[A[D]]||mF(this.discriminators,A[D]):this;if(Z==null)throw new E1(`Discriminator "${A[D]}" not found for model "${this.modelName}"`);if(!(A instanceof Z))A=new Z(A);return await A.$save(B)};m.watch=function(F,A){H1(this,"watch");let B=(D)=>{if(F=F||[],DK1(F,this.schema,"fullDocument"),this.$__collection.buffer)this.$__collection.addQueue(()=>{if(this.closed)return;let Z=this.$__collection.watch(F,A);D(null,Z)});else{let Z=this.$__collection.watch(F,A);D(null,Z)}};return A=A||{},A.model=this,new Oz1(B,F,A)};m.startSession=function(){return H1(this,"startSession"),this.db.startSession.apply(this.db,arguments)};m.insertMany=async function F(A,B){if(H1(this,"insertMany"),typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.insertMany() no longer accepts a callback");return new Promise((D,Z)=>{this.$__insertMany(A,B,(J,X)=>{if(J!=null)return Z(J);D(X)})})};m.$__insertMany=function(F,A,B){let D=this;if(typeof A==="function")B=A,A=null;B=B||l1.noop,A=A||{};let Z=A.limit||1000,J=!!A.rawResult,X=typeof A.ordered==="boolean"?A.ordered:!0,E=typeof A.throwOnValidationError==="boolean"?A.throwOnValidationError:!1,Y=!!A.lean,$=this.db.base.transactionAsyncLocalStorage?.getStore();if((!A||!A.hasOwnProperty("session"))&&$?.session!=null)A={...A,session:$.session};if(!Array.isArray(F))F=[F];let G=[],C=new Map,W=X?null:new Array(F.length),H=F.map((q,z)=>(U)=>{if(Y)return lF(()=>U(null,q));let Q=!1;if(!(q instanceof D)){if(q!=null&&typeof q!=="object")return U(new xz1(q,"arr."+z,"insertMany"));try{q=new D(q),Q=!0}catch(V){return U(V)}}if(A.session!=null)q.$session(A.session);if(Y)return lF(()=>U(null,q));q.$validate(Q?{_skipParallelValidateCheck:!0}:null).then(()=>{U(null,q)},(V)=>{if(X===!1)return G.push(V),C.set(V,z),W[z]=V,U(null,null);U(V)})});BK1(H,Z,function(q,z){if(q){B(q,null);return}let U=new Map,Q=new Map;for(let w=0;w<z.length;++w)U.set(z[w],w);let V=z.filter(function(w){return w!=null});for(let w=0;w<V.length;++w)Q.set(w,U.get(V[w]));if(G.length>0)G.sort((w,M)=>{return C.get(w)-C.get(M)});if(V.length===0){if(E)return B(new oZ(G,W,null,"insertMany"));if(J){let w={acknowledged:!0,insertedCount:0,insertedIds:{}};return b9(w,G,G),B(null,w)}B(null,[]);return}let L=Y?V:V.map(function(w){if(w.$__schema.options.versionKey)w[w.$__schema.options.versionKey]=0;if((!A||A.timestamps!==!1)&&w.initializeTimestamps&&(!w.$__||w.$__.timestamps!==!1))w.initializeTimestamps();if(w.$__hasOnlyPrimitiveValues())return w.$__toObjectShallow();return w.toObject(Tq)});D.$__collection.insertMany(L,A).then((w)=>{if(!Y)for(let M of V)M.$__reset(),R8(M,!1);if(X===!1&&E&&G.length>0){for(let M=0;M<W.length;++M)if(W[M]===void 0)W[M]=z[M];return B(new oZ(G,W,w,"insertMany"))}if(J){if(X===!1){for(let M=0;M<W.length;++M)if(W[M]===void 0)W[M]=z[M];b9(w,G,W)}return B(null,w)}if(A.populate!=null)return D.populate(V,A.populate).then((M)=>{B(null,M)},(M)=>{if(M!=null)M.insertedDocs=V;throw M});B(null,V)},(w)=>{if(w.writeErrors==null&&(w.result&&w.result.result&&w.result.result.writeErrors)!=null)w.writeErrors=w.result.result.writeErrors;let M=w&&w.writeErrors,T=new Set((w&&w.writeErrors||[]).map((S)=>S.index));if(w.writeErrors!=null)for(let S=0;S<w.writeErrors.length;++S){let b=Q.get(w.writeErrors[S].index);if(w.writeErrors[S]={...w.writeErrors[S],index:b},!X)W[b]=w.writeErrors[S]}if(!X){for(let S=0;S<W.length;++S)if(W[S]===void 0)W[S]=z[S];w.results=W}let k=-1;if(w.insertedDocs=V.filter((S,b)=>{let j=!M||T.has(b);if(X){if(k>-1)return b<k;if(j)k=b}return!j}).map(function S(b){if(Y)return b;return b.$__reset(),R8(b,!1),b}),J&&X===!1)b9(w,G,W);B(w,null)})})};/*!
877
877
  * ignore
878
878
  */function R8(F,A){F.$isNew=A,F.$emit("isNew",A),F.constructor.emit("isNew",A);let B=F.$getAllSubdocs({useCache:!0});for(let D of B)D.$isNew=A,D.$emit("isNew",A)}m.bulkWrite=async function F(A,B){if(H1(this,"bulkWrite"),typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.bulkWrite() no longer accepts a callback");B=B||{};let D=await new Promise((Y,$)=>{this.hooks.execPre("bulkWrite",this,[A,B],(G)=>{if(G!=null){if(G instanceof Mq.skipWrappedFunction)return Y(G);return $(G)}Y()})});if(D)return D.args[0];let Z=B.ordered==null?!0:B.ordered;if(A.length===0){let $=new(this.base.driver.get()).BulkWriteResult(wq(),!1);return $.n=0,b9($,[],[]),$}let J=B?._skipCastBulkWrite?[]:A.map((Y)=>iz1(this,Y,B)),X=this.db.base.transactionAsyncLocalStorage?.getStore();if((!B||!B.hasOwnProperty("session"))&&X?.session!=null)B={...B,session:X.session};let E=null;if(Z){await new Promise((Y,$)=>{Nq(J,(G,C)=>G(C),(G)=>{if(G)return $(G);Y()})});try{E=await this.$__collection.bulkWrite(A,B)}catch(Y){await new Promise(($,G)=>{let C={error:Y};this.hooks.execPost("bulkWrite",this,[null],C,(W)=>{if(W!=null)return G(W);$()})})}}else{let Y=[],$=[],G=[];if(J.length>0)Y=await Promise.all(A.map((q,z)=>{if(z>=J.length)return z;return new Promise((U)=>{J[z]((Q)=>{if(Q==null)U(z);else $.push({index:z,error:Q}),G[z]=Q;U()})})})),Y=Y.filter((q)=>q!=null);else Y=A.map((q,z)=>z);$=$.sort((q,z)=>q.index-z.index).map((q)=>q.error);let C=Y.sort().map((q)=>A[q]);if(C.length===0){if(B.throwOnValidationError&&$.length)throw new oZ($,G,E,"bulkWrite");let z=new(this.base.driver.get()).BulkWriteResult(wq(),!1);return z.result=wq(),b9(z,$,G),z}let W;[E,W]=await this.$__collection.bulkWrite(C,B).then((q)=>[q,null]).catch((q)=>[null,q]);let H={};if(W?.writeErrors)for(let q of W.writeErrors)H[q.err.index]=q;for(let q=0;q<Y.length;++q)G[Y[q]]=H[q]??null;if(W){if($.length>0)b9(W,$,G);await new Promise((q,z)=>{let U={error:W};this.hooks.execPost("bulkWrite",this,[null],U,(Q)=>{if(Q!=null)return z(Q);q()})})}if($.length>0)if(B.throwOnValidationError)throw new oZ($,G,E,"bulkWrite");else b9(E,$,G)}return await new Promise((Y,$)=>{this.hooks.execPost("bulkWrite",this,[E],(G)=>{if(G!=null)return $(G);Y()})}),E};m.bulkSave=async function F(A,B){if(B=B||{},B.timestamps!=null)for(let G of A)G.$__.saveOptions=G.$__.saveOptions||{},G.$__.saveOptions.timestamps=B.timestamps;else for(let G of A)if(G.$__.timestamps!=null)G.$__.saveOptions=G.$__.saveOptions||{},G.$__.saveOptions.timestamps=G.$__.timestamps;await Promise.all(A.map((G)=>zK1(G,B)));let D=this.buildBulkWriteOperations(A,B),Z={skipValidation:!0,_skipCastBulkWrite:!0,...B},{bulkWriteResult:J,bulkWriteError:X}=await this.bulkWrite(D,Z).then((G)=>({bulkWriteResult:G,bulkWriteError:null}),(G)=>({bulkWriteResult:null,bulkWriteError:G}));if(X!=null&&X.name!=="MongoBulkWriteError")throw X;let E=J?.matchedCount??0,Y=J?.insertedCount??0;if(D.length>0&&E+Y<D.length&&!X)throw new EK1(this.modelName,A,J);let $=[];for(let G=0;G<A.length;G++){let C=A[G];if((X&&X.writeErrors.find((H)=>{return(H.err.op._id||H.err.op.q._id).toString()===C._doc._id.toString()}))==null)$.push(C)}if(await Promise.all($.map((G)=>KK1(G))),X!=null)throw X;return J};function zK1(F,A){return new Promise((B,D)=>{F.schema.s.hooks.execPre("save",F,[A],(Z)=>{if(Z){D(Z);return}B()})})}function KK1(F){return new Promise((A,B)=>{if(F.$isNew)R8(F,!1);F.$__reset(),F.schema.s.hooks.execPost("save",F,[F],{},(D)=>{if(D){B(D);return}A()})})}m.applyDefaults=function F(A){if(A==null)return A;if(A.$__!=null){gz1(A,A.$__.fields,A.$__.exclude);for(let B of A.$getAllSubdocs())F(B,B.$__.fields,B.$__.exclude);return A}return bz1(A,this.schema),A};m.applyVirtuals=function F(A,B){if(A==null)return A;if(A.$__!=null)return A;return lz1(this.schema,A,B),A};m.applyTimestamps=function F(A,B){if(A==null)return A;if(A.$__!=null)return A;return cz1(this.schema,A,B),A};m.castObject=function F(A,B){B=B||{};let D={},Z=this.schema,J=Z.options.discriminatorKey;if(Z.discriminators!=null&&A!=null&&A[J]!=null)Z=Dd(Z,A[J])||Z;let X=Object.keys(Z.paths);for(let Y of X){let $=Z.path(Y);if(!$||!$.$isMongooseArray)continue;let G=cF(A,Y);Jd(X,G,Y)}let E=null;for(let Y of X){let $=Z.path(Y);if($==null)continue;let G=cF(A,Y,void 0);if(G==null)continue;let C=Y.indexOf(".")===-1?[Y]:Y.split("."),W=D;for(let H=0;H<C.length-1;++H){if(W[C[H]]==null)W[C[H]]=isNaN(C[H+1])?{}:[];W=W[C[H]]}if($.$isMongooseDocumentArray){let H=$.options?.castNonArrays??$.constructor.options.castNonArrays;if(!Array.isArray(G)){if(!H){if(!B.ignoreCastErrors)E=E||new tZ,E.addError(Y,new YK1(Y,G))}else W[C[C.length-1]]=[m.castObject.call($.caster,G)];continue}}if($.$isSingleNested||$.$isMongooseDocumentArrayElement){try{G=m.castObject.call($.caster,G)}catch(H){if(!B.ignoreCastErrors)E=E||new tZ,E.addError(Y,H);continue}W[C[C.length-1]]=G;continue}try{G=$.cast(G),W[C[C.length-1]]=G}catch(H){if(!B.ignoreCastErrors)E=E||new tZ,E.addError(Y,H);continue}}if(E!=null)throw E;return D};m.buildBulkWriteOperations=function F(A,B){if(!Array.isArray(A))throw new Error(`bulkSave expects an array of documents to be passed, received \`${A}\` instead`);return Z(),A.map((J,X)=>{if(!B.skipValidation){if(!(J instanceof K3))throw new Error(`documents.${X} was not a mongoose document, documents must be an array of mongoose documents (instanceof mongoose.Document).`);if(B.validateBeforeSave==null||B.validateBeforeSave){let G=J.validateSync();if(G!=null)throw G}}if(J.isNew){let G={insertOne:{document:J}};return l1.injectTimestampsOption(G.insertOne,B.timestamps),G}let Y=J.$__delta();if(Y!=null&&!l1.isEmptyObject(Y[0])){let G=J.$__where(Y[0]),C=Y[1];Ed(J,G);let W=this.schema.options.shardKey;if(W){let q=Object.keys(W),z=q.length;for(let U=0;U<z;++U)G[q[U]]=J[q[U]]}J.$__version(G,Y);let H={updateOne:{filter:G,update:C}};return l1.injectTimestampsOption(H.updateOne,B.timestamps),H}return null}).filter((J)=>J!==null);function Z(){if(B=B||{},B.skipValidation==null)B.skipValidation=!1}};m.hydrate=function(F,A,B){if(H1(this,"hydrate"),A!=null){if(F!=null&&F.$__!=null)F=F.toObject(Tq);F=vz1(F,A)}let D=o5().createModel(this,F,A);return D.$init(F,B),D};m.updateMany=function F(A,B,D){if(H1(this,"updateMany"),B==null)throw new E1("updateMany `update` parameter cannot be nullish");return kq(this,"updateMany",A,B,D)};m.updateOne=function F(A,B,D){return H1(this,"updateOne"),kq(this,"updateOne",A,B,D)};m.replaceOne=function F(A,B,D){H1(this,"replaceOne");let Z=this&&this.schema&&this.schema.options&&this.schema.options.versionKey||null;if(Z&&!B[Z])B[Z]=0;return kq(this,"replaceOne",A,B,D)};function kq(F,A,B,D,Z){let J=new F.Query({},{},F,F.collection);if(B instanceof K3)B=B.toObject();else B=t3(B);Z=typeof Z==="function"?Z:t3(Z);let X=F&&F.schema&&F.schema.options&&F.schema.options.versionKey||null;return Bd(D,Z,X),J[A](B,D,Z)}m.aggregate=function F(A,B){if(H1(this,"aggregate"),typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.aggregate() no longer accepts a callback");let D=new kz1(A||[]);if(D.model(this),B!=null)D.option(B);return D};m.validate=async function F(A,B,D){if(arguments.length<3||arguments.length===3&&typeof arguments[2]==="function")D=A;if(typeof D==="function"||typeof arguments[3]==="function")throw new E1("Model.validate() no longer accepts a callback");let Z=this.schema,J=Z.options.discriminatorKey;if(Z.discriminators!=null&&A!=null&&A[J]!=null)Z=Dd(Z,A[J])||Z;let X=Object.keys(Z.paths);if(B!=null){let $=typeof B==="string"?new Set(B.split(" ")):Array.isArray(B)?new Set(B):new Set(X);X=X.filter((G)=>{if(B.pathsToSkip){if(Array.isArray(B.pathsToSkip)){if(B.pathsToSkip.find((H)=>H==G))return!1}else if(typeof B.pathsToSkip=="string"){if(B.pathsToSkip.includes(G))return!1}}let C=G.split("."),W=C[0];for(let H of C){if($.has(W))return!0;W+="."+H}return $.has(G)})}for(let $ of X){let G=Z.path($);if(!G||!G.$isMongooseArray||G.$isMongooseDocumentArray)continue;let C=cF(A,$);Jd(X,C,$)}let E=null;X=new Set(X);try{A=this.castObject(A)}catch($){E=$;for(let G of Object.keys(E.errors||{}))X.delete(G)}let Y=X.size;return new Promise(($,G)=>{for(let W of X){let H=Z.path(W);if(H==null){C();continue}let q=W.indexOf(".")===-1?[W]:W.split("."),z=A;for(let Q=0;Q<q.length-1;++Q)z=z[q[Q]];let U=cF(A,W,void 0);H.doValidate(U,(Q)=>{if(Q)E=E||new tZ,E.addError(W,Q);C()},D,{path:W})}function C(){if(--Y<=0)if(E)G(E);else $(A)}})};m.populate=async function F(A,B){if(H1(this,"populate"),typeof B==="function"||typeof arguments[2]==="function")throw new E1("Model.populate() no longer accepts a callback");if(B=l1.populate(B),B.length===0)return A;if(B.find((D)=>D.ordered))for(let D of B)await am(this,A,D);else{let D=[];for(let Z of B)D.push(am(this,A,Z));await Promise.all(D)}return A};/*!
879
879
  * Populates `docs` for a single `populateOptions` instance.
@@ -913,4 +913,4 @@ updatePath: '${D.raw.path}'`);D.trace.add(F);let Z=Object.keys(F||{}),J=Z.length
913
913
  * No-op if there is already a default connection.
914
914
  */function xq(F){if(F.connection)return;let A=F.createConnection();A[xd]=!0,A.models=F.models}var V2=gd.exports=_d=new a({[Sd]:!0})});var vd=K((mT1,hd)=>{/*!
915
915
  * Module dependencies.
916
- */var yd=Ny();VZ().set(yd);var fq=bd();fq.setDriver(yd);fq.Mongoose.prototype.mongo=W9();hd.exports=fq});var nF=K((dT1,D1)=>{var Z1=vd();D1.exports=Z1;D1.exports.default=Z1;D1.exports.mongoose=Z1;D1.exports.cast=Z1.cast;D1.exports.STATES=Z1.STATES;D1.exports.setDriver=Z1.setDriver;D1.exports.set=Z1.set;D1.exports.get=Z1.get;D1.exports.createConnection=Z1.createConnection;D1.exports.connect=Z1.connect;D1.exports.disconnect=Z1.disconnect;D1.exports.startSession=Z1.startSession;D1.exports.pluralize=Z1.pluralize;D1.exports.model=Z1.model;D1.exports.deleteModel=Z1.deleteModel;D1.exports.modelNames=Z1.modelNames;D1.exports.plugin=Z1.plugin;D1.exports.connections=Z1.connections;D1.exports.version=Z1.version;D1.exports.Aggregate=Z1.Aggregate;D1.exports.Mongoose=Z1.Mongoose;D1.exports.Schema=Z1.Schema;D1.exports.SchemaType=Z1.SchemaType;D1.exports.SchemaTypes=Z1.SchemaTypes;D1.exports.VirtualType=Z1.VirtualType;D1.exports.Types=Z1.Types;D1.exports.Query=Z1.Query;D1.exports.Model=Z1.Model;D1.exports.Document=Z1.Document;D1.exports.ObjectId=Z1.ObjectId;D1.exports.isValidObjectId=Z1.isValidObjectId;D1.exports.isObjectIdOrHexString=Z1.isObjectIdOrHexString;D1.exports.syncIndexes=Z1.syncIndexes;D1.exports.Decimal128=Z1.Decimal128;D1.exports.Mixed=Z1.Mixed;D1.exports.Date=Z1.Date;D1.exports.Number=Z1.Number;D1.exports.Error=Z1.Error;D1.exports.MongooseError=Z1.MongooseError;D1.exports.now=Z1.now;D1.exports.CastError=Z1.CastError;D1.exports.SchemaTypeOptions=Z1.SchemaTypeOptions;D1.exports.mongo=Z1.mongo;D1.exports.mquery=Z1.mquery;D1.exports.sanitizeFilter=Z1.sanitizeFilter;D1.exports.trusted=Z1.trusted;D1.exports.skipMiddlewareFunction=Z1.skipMiddlewareFunction;D1.exports.overwriteMiddlewareResult=Z1.overwriteMiddlewareResult});var BJ=sF(nF(),1);class md{async connect(F){if(!F)throw new Error("DB URI is not valid.");console.log("Connecting to database..."),await BJ.default.connect(F).catch((A)=>console.error("Unable to connect to the database:",A)),BJ.default.connection.on("open",()=>{console.log("Database connection is ready.")}),BJ.default.connection.on("error",(A)=>{console.error("Database connection error:",A)})}}var aK1;((F)=>{F[F.Offline=0]="Offline",F[F.Booting=1]="Booting",F[F.Available=2]="Available",F[F.Busy=3]="Busy",F[F.Disconnected=4]="Disconnected"})(aK1||={});var sK1;((F)=>{F[F.Neutral=0]="Neutral",F[F.Success=1]="Success",F[F.Info=2]="Info",F[F.Warn=3]="Warn",F[F.Error=4]="Error"})(sK1||={});var _q;((F)=>{F.Win="WIN",F.Mac="MAC",F.Psn="PSN",F.Xbl="XBL",F.Swt="SWT",F.Swt2="SWT2",F.Ios="IOS",F.And="AND",F.Ps5="PS5",F.Xsx="XSX"})(_q||={});var gq;((F)=>{F[F.Public=0]="Public",F[F.Private=1]="Private"})(gq||={});var g4;((F)=>{F[F.Equals=0]="Equals",F[F.Includes=1]="Includes",F[F.StartsWith=2]="StartsWith",F[F.EndsWith=3]="EndsWith"})(g4||={});var b4;((F)=>{F[F.Blacklist=0]="Blacklist",F[F.Whitelist=1]="Whitelist",F[F.Kick=2]="Kick",F[F.Block=3]="Block",F[F.RemoveFriend=4]="RemoveFriend",F[F.AddFriend=5]="AddFriend",F[F.Promote=6]="Promote",F[F.Copy=7]="Copy",F[F.Mimic=8]="Mimic",F[F.Hide=9]="Hide",F[F.Show=10]="Show"})(b4||={});var DJ;((F)=>{F.Default="en",F.EnUS="en-US",F.Es="es",F.Es419="es-419",F.Ar="ar",F.De="de",F.Fr="fr",F.Id="id",F.It="it",F.Ja="ja",F.Ko="ko",F.Pl="pl",F.Pt="pt",F.PtBR="pt-BR",F.Ru="ru",F.Th="th",F.Tr="tr",F.Vi="vi",F.Zh="zh",F.ZhHant="zh-Hant"})(DJ||={});var rK1;((F)=>{F.Default="en",F.Ar="ar",F.De="de",F.Es="es",F.Es419="es-419",F.Fr="fr",F.Id="id",F.It="it",F.Ja="ja",F.Ko="ko",F.Pl="pl",F.PtBR="pt-BR",F.Ru="ru",F.Th="th",F.Tr="tr",F.Vi="vi",F.ZhHans="zh-Hans",F.ZhHant="zh-Hant"})(rK1||={});var tK1;((F)=>{F[F.RequiredParam=0]="RequiredParam",F[F.OptionalParam=1]="OptionalParam",F[F.RequiredSelect=2]="RequiredSelect",F[F.OptionalSelect=3]="OptionalSelect",F[F.RequiredNumericParam=4]="RequiredNumericParam",F[F.OptionalNumericParam=5]="OptionalNumericParam"})(tK1||={});var dd;((F)=>{F.GenericUnknown="net.fnlb.errors.generic.unknown",F.GenericInternalError="net.fnlb.errors.generic.internal_error",F.GenericValidationFailed="net.fnlb.errors.generic.validation_failed",F.GenericParseFailed="net.fnlb.errors.generic.parse_failed",F.GenericNotFound="net.fnlb.errors.generic.not_found",F.GenericAlreadyExists="net.fnlb.errors.generic.already_exists",F.CommonInvalidRequest="net.fnlb.errors.common.invalid_request",F.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request",F.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length",F.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded",F.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded",F.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database",F.CommonUpdateRequired="net.fnlb.errors.common.update_required",F.AuthInvalidToken="net.fnlb.errors.auth.invalid_token",F.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token",F.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token",F.AuthUnauthorized="net.fnlb.errors.auth.unauthorized",F.AuthForbidden="net.fnlb.errors.auth.forbidden",F.AuthUserBanned="net.fnlb.errors.auth.user_banned",F.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code",F.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope",F.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid",F.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user",F.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections",F.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection",F.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified",F.ReleaseNotFound="net.fnlb.errors.release.no_release_found",F.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(dd||={});var cd;((F)=>{F.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials",F.LoginInvalidEmail="net.fnlb.errors.login.invalid_email",F.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email",F.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(cd||={});var v9={...dd,...cd},oK1;((F)=>{F.Username="username",F.Email="email",F.Password="password",F.Shared="shared"})(oK1||={});var eK1;((F)=>{F.General="general",F.Input="input"})(eK1||={});var FU1;((F)=>{F[F.Disabled=1]="Disabled",F[F.Public=2]="Public"})(FU1||={});var AU1;((F)=>{F[F.Disabled=1]="Disabled",F[F.Managed=2]="Managed"})(AU1||={});var BU1;((F)=>{F[F.Staff=1]="Staff",F[F.Admin=2]="Admin",F[F.Vip=4]="Vip",F[F.Verified=8]="Verified",F[F.Banned=16]="Banned"})(BU1||={});var bq;((J)=>{J[J.InternalError=1]="InternalError";J[J.BadValue=2]="BadValue";J[J.NoSuchKey=4]="NoSuchKey";J[J.KeyNotFound=211]="KeyNotFound";J[J.DuplicateKey=11000]="DuplicateKey"})(bq||={});class ld{static handleError(F,A){if(!F)return!1;switch(F.code){case 11000:return A.sendError(400,v9.GenericAlreadyExists);case 2:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 211:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 4:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 1:return console.error("Internal MongoDB error:",F),A.sendError(500,v9.CommonUnableToSaveToDatabase);default:return console.error("Unhandled MongoError code:",F.code,F),A.sendError(500,v9.CommonUnableToSaveToDatabase)}}}var I8=sF(nF(),1);class m9{static transformSchemaToJSON(F,A){A.id=A._id,delete A._id,delete A.__v,delete A.password}}var pd=new I8.Schema({owner:{type:I8.Schema.Types.ObjectId,ref:"user",required:!0,index:!0},parent:{type:I8.Schema.Types.ObjectId,ref:"category",required:!1,index:!0,sparse:!0},nickname:{type:String,required:!0,trim:!0},flags:{type:Number,required:!1},email:{type:String,lowercase:!0,required:!1,trim:!0},deviceAuth:{required:!0,type:{accountId:{type:String,required:!0,unique:!0,lowercase:!0,trim:!0},deviceId:{type:String,required:!0,lowercase:!0,trim:!0},secret:{type:String,required:!0,trim:!0}},_id:!1},mmsBannedUntil:{type:Number,required:!1}});pd.set("toJSON",{transform:m9.transformSchemaToJSON});var DU1=I8.model("bot",pd);var aF=sF(nF(),1);function G6(F){return Object.values(F).filter((A)=>typeof A==="number")}var id=new aF.Schema({owner:{type:aF.Schema.Types.ObjectId,ref:"user",required:!0,index:!0},name:{type:String,required:!0,trim:!0},flags:{type:Number,required:!1},managed:{type:Boolean,required:!1,index:!0,sparse:!0},config:{replyLangs:{type:[String],enum:Object.values(DJ),default:void 0},searchLangs:{type:[String],enum:Object.values(DJ),default:void 0},platform:{type:[String],enum:Object.values(_q),default:void 0},privacy:{type:Number,enum:G6(gq),default:void 0},prefixes:{type:[String],default:void 0},statusText:{type:[String],default:void 0},statusInterval:{type:Number,default:void 0},level:{type:[Number],default:void 0},bpLevel:{type:[Number],default:void 0},extraOwners:{type:[{id:String,name:String,_id:!1}],default:void 0},admins:{type:[{id:String,name:String,_id:!1}],default:void 0},whitelistUsers:{type:[{id:String,name:String,_id:!1}],default:void 0},blacklistUsers:{type:[{id:String,name:String,_id:!1}],default:void 0},excludedAutoAddFriends:{type:[{id:String,name:String,_id:!1}],default:void 0},otherBots:{type:[{id:String,name:String,_id:!1}],default:void 0},inviteTimeout:{type:Number,default:void 0},maxBotsPerLobby:{type:Number,default:void 0},maxBotsPerLobbyWithOwner:{type:Number,default:void 0},maxBotsPerLobbyWithAdmin:{type:Number,default:void 0},maxBotsPerLobbyWithWhitelistUser:{type:Number,default:void 0},allowMatchmaking:{type:Boolean,default:void 0},leaveAfterMatchmaking:{type:Boolean,default:void 0},disableMatchmakingChecks:{type:Boolean,default:void 0},disablePlaylistChecks:{type:Boolean,default:void 0},disableJoinMessages:{type:Boolean,default:void 0},disableAutomaticMessages:{type:Boolean,default:void 0},acceptFriendRequests:{type:Boolean,default:void 0},sendFriendRequestOnJoinParty:{type:Boolean,default:void 0},sendFriendRequestOnMemberJoinParty:{type:Boolean,default:void 0},runCommandsWithoutPrefix:{type:Boolean,default:void 0},setCosmeticsWithoutCommands:{type:Boolean,default:void 0},setCosmeticsWithPrefix:{type:Boolean,default:void 0},acceptInvites:{type:Boolean,default:void 0},usernameTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},messageContentTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},cosmeticTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},addFriendTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},memberJoinTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},changeCosmeticTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},onlyOwnerCommands:{type:[String],default:void 0},onlyAdminCommands:{type:[String],default:void 0},onlyWhitelistUsersCommands:{type:[String],default:void 0},onlyFriendsCommands:{type:[String],default:void 0},onlyPartyMembersCommands:{type:[String],default:void 0},onlyWhisperCommands:{type:[String],default:void 0},startOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startBanner:{type:[{id:String,_id:!1}],default:void 0},startBannerColor:{type:[{id:String,_id:!1}],default:void 0},joinOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinEmote:{type:[{id:String,_id:!1}],default:void 0},joinShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinBanner:{type:[{id:String,_id:!1}],default:void 0},joinBannerColor:{type:[{id:String,_id:!1}],default:void 0},memberJoinOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinEmote:{type:[{id:String,_id:!1}],default:void 0},memberJoinShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinBanner:{type:[{id:String,_id:!1}],default:void 0},memberJoinBannerColor:{type:[{id:String,_id:!1}],default:void 0}}});id.set("toJSON",{transform:m9.transformSchemaToJSON});var ZU1=aF.model("category",id);var ZJ=sF(nF(),1);var yq=new ZJ.Schema({token:{type:String,required:!0,unique:!1},username:{type:String,required:!0,trim:!0},email:{type:String,index:!0,required:!0,unique:!0,trim:!0},password:{type:String,required:!0},apiToken:{type:String,required:!0,index:!1,unique:!1,trim:!0},flags:{type:Number,required:!1},connections:{discord:{id:{type:String,index:!0,unique:!0,sparse:!0},username:{type:String},verified:{type:Boolean,required:!1}},epic:{id:{type:String,index:!0,unique:!0,sparse:!0},username:{type:String},verified:{type:Boolean,required:!1}}}},{statics:{async verifyPassword(F,A){return Bun.password.verify(F,A)},async findByToken(F,A){let B=await this.findById(F);if(!B?.token||B.token!==A)return null;return B},async findByAPIToken(F,A){let B=await this.findById(F);if(!B?.apiToken||B.apiToken!==A)return null;return B}}});yq.pre("save",async function(F){if(!this.isModified("password"))return F();try{return this.password=await Bun.password.hash(this.password,{algorithm:process.env.SAVE_ACCOUNT_ALGORITHM||"argon2id",timeCost:parseInt(process.env.SAVE_ACCOUNT_TIME_COST||"3"),cost:parseInt(process.env.SAVE_ACCOUNT_ALGORITHM_COST||"12")}),F()}catch(A){return F(A)}});yq.set("toJSON",{transform:m9.transformSchemaToJSON});var JU1=ZJ.model("user",yq);export{JU1 as UserModel,bq as DatabaseErrors,ld as DatabaseErrorHandler,md as DatabaseClient,ZU1 as CategoryModel,DU1 as BotModel};
916
+ */var yd=Ny();VZ().set(yd);var fq=bd();fq.setDriver(yd);fq.Mongoose.prototype.mongo=W9();hd.exports=fq});var nF=K((dT1,D1)=>{var Z1=vd();D1.exports=Z1;D1.exports.default=Z1;D1.exports.mongoose=Z1;D1.exports.cast=Z1.cast;D1.exports.STATES=Z1.STATES;D1.exports.setDriver=Z1.setDriver;D1.exports.set=Z1.set;D1.exports.get=Z1.get;D1.exports.createConnection=Z1.createConnection;D1.exports.connect=Z1.connect;D1.exports.disconnect=Z1.disconnect;D1.exports.startSession=Z1.startSession;D1.exports.pluralize=Z1.pluralize;D1.exports.model=Z1.model;D1.exports.deleteModel=Z1.deleteModel;D1.exports.modelNames=Z1.modelNames;D1.exports.plugin=Z1.plugin;D1.exports.connections=Z1.connections;D1.exports.version=Z1.version;D1.exports.Aggregate=Z1.Aggregate;D1.exports.Mongoose=Z1.Mongoose;D1.exports.Schema=Z1.Schema;D1.exports.SchemaType=Z1.SchemaType;D1.exports.SchemaTypes=Z1.SchemaTypes;D1.exports.VirtualType=Z1.VirtualType;D1.exports.Types=Z1.Types;D1.exports.Query=Z1.Query;D1.exports.Model=Z1.Model;D1.exports.Document=Z1.Document;D1.exports.ObjectId=Z1.ObjectId;D1.exports.isValidObjectId=Z1.isValidObjectId;D1.exports.isObjectIdOrHexString=Z1.isObjectIdOrHexString;D1.exports.syncIndexes=Z1.syncIndexes;D1.exports.Decimal128=Z1.Decimal128;D1.exports.Mixed=Z1.Mixed;D1.exports.Date=Z1.Date;D1.exports.Number=Z1.Number;D1.exports.Error=Z1.Error;D1.exports.MongooseError=Z1.MongooseError;D1.exports.now=Z1.now;D1.exports.CastError=Z1.CastError;D1.exports.SchemaTypeOptions=Z1.SchemaTypeOptions;D1.exports.mongo=Z1.mongo;D1.exports.mquery=Z1.mquery;D1.exports.sanitizeFilter=Z1.sanitizeFilter;D1.exports.trusted=Z1.trusted;D1.exports.skipMiddlewareFunction=Z1.skipMiddlewareFunction;D1.exports.overwriteMiddlewareResult=Z1.overwriteMiddlewareResult});var BJ=sF(nF(),1);class md{async connect(F){if(!F)throw new Error("DB URI is not valid.");console.log("Connecting to database..."),await BJ.default.connect(F).catch((A)=>console.error("Unable to connect to the database:",A)),BJ.default.connection.on("open",()=>{console.log("Database connection is ready.")}),BJ.default.connection.on("error",(A)=>{console.error("Database connection error:",A)})}}var aK1;((F)=>{F[F.Offline=0]="Offline",F[F.Booting=1]="Booting",F[F.Available=2]="Available",F[F.Busy=3]="Busy",F[F.Disconnected=4]="Disconnected"})(aK1||={});var sK1;((F)=>{F[F.Neutral=0]="Neutral",F[F.Success=1]="Success",F[F.Info=2]="Info",F[F.Warn=3]="Warn",F[F.Error=4]="Error"})(sK1||={});var _q;((F)=>{F.Win="WIN",F.Mac="MAC",F.Psn="PSN",F.Xbl="XBL",F.Swt="SWT",F.Swt2="SWT2",F.Ios="IOS",F.And="AND",F.Ps5="PS5",F.Xsx="XSX"})(_q||={});var gq;((F)=>{F[F.Public=0]="Public",F[F.Private=1]="Private"})(gq||={});var g4;((F)=>{F[F.Equals=0]="Equals",F[F.Includes=1]="Includes",F[F.StartsWith=2]="StartsWith",F[F.EndsWith=3]="EndsWith"})(g4||={});var b4;((F)=>{F[F.Blacklist=0]="Blacklist",F[F.Whitelist=1]="Whitelist",F[F.Kick=2]="Kick",F[F.Block=3]="Block",F[F.RemoveFriend=4]="RemoveFriend",F[F.AddFriend=5]="AddFriend",F[F.Promote=6]="Promote",F[F.Copy=7]="Copy",F[F.Mimic=8]="Mimic",F[F.Hide=9]="Hide",F[F.Show=10]="Show"})(b4||={});var DJ;((F)=>{F.Default="en",F.EnUS="en-US",F.Es="es",F.Es419="es-419",F.Ar="ar",F.De="de",F.Fr="fr",F.Id="id",F.It="it",F.Ja="ja",F.Ko="ko",F.Pl="pl",F.Pt="pt",F.PtBR="pt-BR",F.Ru="ru",F.Th="th",F.Tr="tr",F.Vi="vi",F.Zh="zh",F.ZhHant="zh-Hant"})(DJ||={});var rK1;((F)=>{F.Default="en",F.Ar="ar",F.De="de",F.Es="es",F.Es419="es-419",F.Fr="fr",F.Id="id",F.It="it",F.Ja="ja",F.Ko="ko",F.Pl="pl",F.PtBR="pt-BR",F.Ru="ru",F.Th="th",F.Tr="tr",F.Vi="vi",F.ZhHans="zh-Hans",F.ZhHant="zh-Hant"})(rK1||={});var tK1;((F)=>{F[F.RequiredParam=0]="RequiredParam",F[F.OptionalParam=1]="OptionalParam",F[F.RequiredSelect=2]="RequiredSelect",F[F.OptionalSelect=3]="OptionalSelect",F[F.RequiredNumericParam=4]="RequiredNumericParam",F[F.OptionalNumericParam=5]="OptionalNumericParam"})(tK1||={});var dd;((F)=>{F.GenericUnknown="net.fnlb.errors.generic.unknown",F.GenericInternalError="net.fnlb.errors.generic.internal_error",F.GenericValidationFailed="net.fnlb.errors.generic.validation_failed",F.GenericParseFailed="net.fnlb.errors.generic.parse_failed",F.GenericNotFound="net.fnlb.errors.generic.not_found",F.GenericAlreadyExists="net.fnlb.errors.generic.already_exists",F.CommonInvalidRequest="net.fnlb.errors.common.invalid_request",F.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request",F.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length",F.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded",F.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded",F.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database",F.CommonUpdateRequired="net.fnlb.errors.common.update_required",F.AuthInvalidToken="net.fnlb.errors.auth.invalid_token",F.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token",F.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token",F.AuthUnauthorized="net.fnlb.errors.auth.unauthorized",F.AuthForbidden="net.fnlb.errors.auth.forbidden",F.AuthUserBanned="net.fnlb.errors.auth.user_banned",F.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code",F.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope",F.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid",F.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user",F.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections",F.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection",F.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified",F.ReleaseNotFound="net.fnlb.errors.release.no_release_found",F.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(dd||={});var cd;((F)=>{F.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials",F.LoginInvalidEmail="net.fnlb.errors.login.invalid_email",F.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email",F.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(cd||={});var v9={...dd,...cd},oK1;((F)=>{F.Username="username",F.Email="email",F.Password="password",F.Shared="shared"})(oK1||={});var eK1;((F)=>{F.General="general",F.Input="input"})(eK1||={});var FU1;((F)=>{F[F.Disabled=1]="Disabled",F[F.Public=2]="Public",F[F.InvalidAuth=4]="InvalidAuth"})(FU1||={});var AU1;((F)=>{F[F.Disabled=1]="Disabled",F[F.Managed=2]="Managed"})(AU1||={});var BU1;((F)=>{F[F.Staff=1]="Staff",F[F.Admin=2]="Admin",F[F.Vip=4]="Vip",F[F.Verified=8]="Verified",F[F.Banned=16]="Banned"})(BU1||={});var bq;((J)=>{J[J.InternalError=1]="InternalError";J[J.BadValue=2]="BadValue";J[J.NoSuchKey=4]="NoSuchKey";J[J.KeyNotFound=211]="KeyNotFound";J[J.DuplicateKey=11000]="DuplicateKey"})(bq||={});class ld{static handleError(F,A){if(!F)return!1;switch(F.code){case 11000:return A.sendError(400,v9.GenericAlreadyExists);case 2:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 211:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 4:return A.sendError(500,v9.CommonUnableToSaveToDatabase);case 1:return console.error("Internal MongoDB error:",F),A.sendError(500,v9.CommonUnableToSaveToDatabase);default:return console.error("Unhandled MongoError code:",F.code,F),A.sendError(500,v9.CommonUnableToSaveToDatabase)}}}var I8=sF(nF(),1);class m9{static transformSchemaToJSON(F,A){A.id=A._id,delete A._id,delete A.__v,delete A.password}}var pd=new I8.Schema({owner:{type:I8.Schema.Types.ObjectId,ref:"user",required:!0,index:!0},parent:{type:I8.Schema.Types.ObjectId,ref:"category",required:!1,index:!0,sparse:!0},nickname:{type:String,required:!0,trim:!0},flags:{type:Number,required:!1},email:{type:String,lowercase:!0,required:!1,trim:!0},deviceAuth:{required:!0,type:{accountId:{type:String,required:!0,unique:!0,lowercase:!0,trim:!0},deviceId:{type:String,required:!0,lowercase:!0,trim:!0},secret:{type:String,required:!0,trim:!0}},_id:!1},mmsBannedUntil:{type:Number,required:!1}});pd.set("toJSON",{transform:m9.transformSchemaToJSON});var DU1=I8.model("bot",pd);var aF=sF(nF(),1);function G6(F){return Object.values(F).filter((A)=>typeof A==="number")}var id=new aF.Schema({owner:{type:aF.Schema.Types.ObjectId,ref:"user",required:!0,index:!0},name:{type:String,required:!0,trim:!0},flags:{type:Number,required:!1},managed:{type:Boolean,required:!1,index:!0,sparse:!0},config:{replyLangs:{type:[String],enum:Object.values(DJ),default:void 0},searchLangs:{type:[String],enum:Object.values(DJ),default:void 0},platform:{type:[String],enum:Object.values(_q),default:void 0},privacy:{type:Number,enum:G6(gq),default:void 0},prefixes:{type:[String],default:void 0},statusText:{type:[String],default:void 0},statusInterval:{type:Number,default:void 0},level:{type:[Number],default:void 0},bpLevel:{type:[Number],default:void 0},extraOwners:{type:[{id:String,name:String,_id:!1}],default:void 0},admins:{type:[{id:String,name:String,_id:!1}],default:void 0},whitelistUsers:{type:[{id:String,name:String,_id:!1}],default:void 0},blacklistUsers:{type:[{id:String,name:String,_id:!1}],default:void 0},excludedAutoAddFriends:{type:[{id:String,name:String,_id:!1}],default:void 0},otherBots:{type:[{id:String,name:String,_id:!1}],default:void 0},inviteTimeout:{type:Number,default:void 0},maxBotsPerLobby:{type:Number,default:void 0},maxBotsPerLobbyWithOwner:{type:Number,default:void 0},maxBotsPerLobbyWithAdmin:{type:Number,default:void 0},maxBotsPerLobbyWithWhitelistUser:{type:Number,default:void 0},allowMatchmaking:{type:Boolean,default:void 0},leaveAfterMatchmaking:{type:Boolean,default:void 0},disableMatchmakingChecks:{type:Boolean,default:void 0},disablePlaylistChecks:{type:Boolean,default:void 0},disableJoinMessages:{type:Boolean,default:void 0},disableAutomaticMessages:{type:Boolean,default:void 0},acceptFriendRequests:{type:Boolean,default:void 0},sendFriendRequestOnJoinParty:{type:Boolean,default:void 0},sendFriendRequestOnMemberJoinParty:{type:Boolean,default:void 0},runCommandsWithoutPrefix:{type:Boolean,default:void 0},setCosmeticsWithoutCommands:{type:Boolean,default:void 0},setCosmeticsWithPrefix:{type:Boolean,default:void 0},acceptInvites:{type:Boolean,default:void 0},startBannedBots:{type:Boolean,default:void 0},usernameTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},messageContentTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},cosmeticTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},addFriendTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},memberJoinTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},changeCosmeticTriggers:{type:[{triggers:{type:[String],default:void 0},detectionMethods:{type:[Number],enum:G6(g4),default:void 0},actions:{type:[Number],enum:G6(b4),default:void 0},messages:{type:[String],default:void 0},_id:!1}],default:void 0},onlyOwnerCommands:{type:[String],default:void 0},onlyAdminCommands:{type:[String],default:void 0},onlyWhitelistUsersCommands:{type:[String],default:void 0},onlyFriendsCommands:{type:[String],default:void 0},onlyPartyMembersCommands:{type:[String],default:void 0},onlyWhisperCommands:{type:[String],default:void 0},startOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},startBanner:{type:[{id:String,_id:!1}],default:void 0},startBannerColor:{type:[{id:String,_id:!1}],default:void 0},joinOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinEmote:{type:[{id:String,_id:!1}],default:void 0},joinShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},joinBanner:{type:[{id:String,_id:!1}],default:void 0},joinBannerColor:{type:[{id:String,_id:!1}],default:void 0},memberJoinOutfit:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinBackpack:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinPickaxe:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinEmote:{type:[{id:String,_id:!1}],default:void 0},memberJoinShoes:{type:[{id:String,variants:[Number],_id:!1}],default:void 0},memberJoinBanner:{type:[{id:String,_id:!1}],default:void 0},memberJoinBannerColor:{type:[{id:String,_id:!1}],default:void 0}}});id.set("toJSON",{transform:m9.transformSchemaToJSON});var ZU1=aF.model("category",id);var ZJ=sF(nF(),1);var yq=new ZJ.Schema({token:{type:String,required:!0,unique:!1},username:{type:String,required:!0,trim:!0},email:{type:String,index:!0,required:!0,unique:!0,trim:!0},password:{type:String,required:!0},apiToken:{type:String,required:!0,index:!1,unique:!1,trim:!0},flags:{type:Number,required:!1},connections:{discord:{id:{type:String,index:!0,unique:!0,sparse:!0},username:{type:String},verified:{type:Boolean,required:!1}},epic:{id:{type:String,index:!0,unique:!0,sparse:!0},username:{type:String},verified:{type:Boolean,required:!1}}}},{statics:{async verifyPassword(F,A){return Bun.password.verify(F,A)},async findByToken(F,A){let B=await this.findById(F);if(!B?.token||B.token!==A)return null;return B},async findByAPIToken(F,A){let B=await this.findById(F);if(!B?.apiToken||B.apiToken!==A)return null;return B}}});yq.pre("save",async function(F){if(!this.isModified("password"))return F();try{return this.password=await Bun.password.hash(this.password,{algorithm:process.env.SAVE_ACCOUNT_ALGORITHM||"argon2id",timeCost:parseInt(process.env.SAVE_ACCOUNT_TIME_COST||"3"),cost:parseInt(process.env.SAVE_ACCOUNT_ALGORITHM_COST||"12")}),F()}catch(A){return F(A)}});yq.set("toJSON",{transform:m9.transformSchemaToJSON});var JU1=ZJ.model("user",yq);export{JU1 as UserModel,bq as DatabaseErrors,ld as DatabaseErrorHandler,md as DatabaseClient,ZU1 as CategoryModel,DU1 as BotModel};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fnlb-project/database",
3
3
  "description": "FNLB Database Client",
4
- "version": "1.0.37",
4
+ "version": "1.0.38",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -19,8 +19,8 @@
19
19
  "author": "FNLB-Project",
20
20
  "files": ["dist"],
21
21
  "dependencies": {
22
- "@fnlb-project/shared": "^1.5.60",
23
- "mongoose": "^8.17.0"
22
+ "@fnlb-project/shared": "^1.5.63",
23
+ "mongoose": "^8.17.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "^1.9.4",