@mongodb-js/compass-shell 3.14.0 → 3.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/766.browser.js +1 -1
- package/dist/766.index.js +1 -1
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +18 -18
package/dist/766.browser.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
return err;
|
|
21
21
|
}
|
|
22
|
-
`,{placeholderPattern:!1,placeholderWhitelist:new Set(["DE_IDENTIFIER"])}),x=a.template.expression("(\n SYNC_RETURN_VALUE_IDENTIFIER = NODE,\n FUNCTION_STATE_IDENTIFIER === 'async' ? SYNC_RETURN_VALUE_IDENTIFIER : null\n )");return{pre(e){this.file=e},visitor:{BlockStatement(n){var a,m,y,x,v,E,P,T,S,A;if(!n.parentPath.isFunction())return;if(n.parentPath.getData(o))return;if(n.parentPath.node[t])return;if(n.parentPath.node[r])return;const w=void 0!==n.parent.start?this.file.code.slice(null!==(a=n.parent.start)&&void 0!==a?a:void 0,null!==(m=n.parent.end)&&void 0!==m?m:void 0):"function () { [unknown code] }",C=encodeURIComponent(w),I=e.expressionStatement(e.stringLiteral(`<async_rewriter>${C}</>`)),_=null===(y=n.findParent((e=>!!e.getData(o))))||void 0===y?void 0:y.getData(o),k=n.scope.generateUidIdentifier("fs"),N=n.scope.generateUidIdentifier("srv"),O=n.scope.generateUidIdentifier("arv"),D=null!==(x=null==_?void 0:_.expressionHolder)&&void 0!==x?x:n.scope.generateUidIdentifier("ex"),M=null!==(v=null==_?void 0:_.markSyntheticPromise)&&void 0!==v?v:n.scope.generateUidIdentifier("msp"),F=null!==(E=null==_?void 0:_.isSyntheticPromise)&&void 0!==E?E:n.scope.generateUidIdentifier("isp"),L=null!==(P=null==_?void 0:_.assertNotSyntheticPromise)&&void 0!==P?P:n.scope.generateUidIdentifier("ansp"),R=null!==(T=null==_?void 0:_.syntheticPromiseSymbol)&&void 0!==T?T:n.scope.generateUidIdentifier("sp"),j=null!==(S=null==_?void 0:_.demangleError)&&void 0!==S?S:n.scope.generateUidIdentifier("de"),B={functionState:k,synchronousReturnValue:N,asynchronousReturnValue:O,expressionHolder:D,markSyntheticPromise:M,isSyntheticPromise:F,assertNotSyntheticPromise:L,syntheticPromiseSymbol:R,demangleError:j};n.parentPath.setData(o,B);const U=_?[]:[Object.assign(l({SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(d({EXPRESSION_HOLDER_IDENTIFIER:D}),{[r]:!0})],V=_?[]:[...U,Object.assign(c({MSP_IDENTIFIER:M,SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(p({ISP_IDENTIFIER:F,SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(b({DE_IDENTIFIER:j}),{[r]:!0})],$=[...U,Object.assign(u({ANSP_IDENTIFIER:L,SP_IDENTIFIER:R,CUSTOM_ERROR_BUILDER:null!==(A=this.opts.customErrorBuilder)&&void 0!==A?A:e.identifier("Error")}),{[r]:!0})];if(n.parentPath.node.async)return void n.replaceWith(e.blockStatement([I,...V,g({ORIGINAL_CODE:n.node.body})]));if(n.parentPath.node.generator||n.parentPath.isClassMethod()&&"Identifier"===n.parentPath.node.key.type&&"constructor"===n.parentPath.node.key.name)return Object.assign(n.parentPath.node,{[i]:!0}),void n.replaceWith(e.blockStatement([I,...$,g({ORIGINAL_CODE:n.node.body})]));const K=Object.assign(h({FUNCTION_STATE_IDENTIFIER:k,SYNC_RETURN_VALUE_IDENTIFIER:N,ORIGINAL_CODE:Object.assign(n.node,{[s]:!0})}),{[t]:!0}),H=f({FUNCTION_STATE_IDENTIFIER:k,SYNC_RETURN_VALUE_IDENTIFIER:N,ASYNC_RETURN_VALUE_IDENTIFIER:O,MSP_IDENTIFIER:M,ASYNC_TRY_CATCH_WRAPPER:K});n.replaceWith(e.blockStatement([I,...V,...H]))},UnaryExpression:{enter(t){"typeof"!==t.node.operator||"Identifier"!==t.node.argument.type||t.node[n]||t.replaceWith(e.conditionalExpression(e.binaryExpression("===",{...t.node,[r]:!0,[n]:!0},e.stringLiteral("undefined")),e.stringLiteral("undefined"),{...t.node,[n]:!0}))}},Expression:{enter(t){var s,i;if(t.parentPath.isArrowFunctionExpression()&&"body"===t.key&&t.replaceWith(e.blockStatement([e.returnStatement(t.node)])),null===(i=null===(s=t.find((e=>e.isFunction()||!!e.node[r])))||void 0===s?void 0:s.node)||void 0===i?void 0:i[r])return t.skip()},exit(n){var a,l,c,p,u,h;const d=n.getFunctionParent();if(!d)return;if(!d.node.async&&!d.node[i])return;let f;if(d.node[t]){if(!(null===(l=null===(a=n.findParent((e=>e.isFunction()||!!e.node[s])))||void 0===a?void 0:a.node)||void 0===l?void 0:l[s]))return;if(f=null===(p=null===(c=d.getFunctionParent())||void 0===c?void 0:c.getData)||void 0===p?void 0:p.call(c,o),!f)throw new Error("Parent of generated inner function does not have existing identifiers available");if(n.parentPath.isReturnStatement()&&!n.node[r])return void n.replaceWith(Object.assign(x({SYNC_RETURN_VALUE_IDENTIFIER:f.synchronousReturnValue,FUNCTION_STATE_IDENTIFIER:f.functionState,NODE:n.node}),{[r]:!0}))}else f=d.getData(o);if(n.parentPath.isCallExpression()&&"callee"===n.key&&(n.isMemberExpression()||n.isImport()||n.isIdentifier()&&"eval"===n.node.name))return;if(n.parentPath.isAssignmentExpression()&&"left"===n.key)return;if(n.parentPath.isForXStatement()&&"left"===n.key)return;if(n.parentPath.isUpdateExpression())return;if(n.parentPath.isUnaryExpression()&&"delete"===n.parentPath.node.operator)return;if(n.isLiteral()||n.isArrayExpression()||n.isObjectExpression()||n.isFunctionExpression()||n.isArrowFunctionExpression()||n.isClassExpression()||n.isAssignmentExpression()||n.isBinaryExpression()||n.isConditionalExpression()||n.isLogicalExpression()||n.isSequenceExpression()||n.isParenthesizedExpression()||n.isUnaryExpression()||n.isSuper()||n.isThisExpression()||n.isAwaitExpression()||n.parentPath.isAwaitExpression())return;if(n.isIdentifier()&&n.scope.hasBinding(n.node.name))return;const{expressionHolder:g,isSyntheticPromise:b,assertNotSyntheticPromise:v}=f,E=(24,(P=void 0!==n.node.start?this.file.code.slice(null!==(u=n.node.start)&&void 0!==u?u:void 0,null!==(h=n.node.end)&&void 0!==h?h:void 0):"<unknown>").length<=24?P:P.slice(0,.7*19)+" ... "+P.slice(P.length-5.7));var P;if(!d.node.async)return void n.replaceWith(Object.assign(y({ORIGINAL_SOURCE:e.stringLiteral(E),NODE:n.node,ANSP_IDENTIFIER:v}),{[r]:!0}));const T=e.stringLiteral("\ufeff"+E+"\ufeff");n.replaceWith(Object.assign(m({ORIGINAL_SOURCE:T,EXPRESSION_HOLDER:g,ISP_IDENTIFIER:b,NODE:n.node}),{[r]:!0})),n.skip()}},CatchClause:{exit(t){var s;if(t.node[r]||!t.node.param||"Identifier"!==t.node.param.type)return;const i=null===(s=t.findParent((e=>!!e.getData(o))))||void 0===s?void 0:s.getData(o);i&&t.replaceWith(Object.assign(e.catchClause(t.node.param,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",t.node.param,e.callExpression(i.demangleError,[t.node.param]))),t.node.body])),{[r]:!0}))}}}}}},23093:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const a=n(r(30302));t.default=({types:e})=>{const t=Symbol("isGeneratedTryCatch"),r=a.template.expression("\n (!ERR_IDENTIFIER || !ERR_IDENTIFIER[Symbol.for('@@mongosh.uncatchable')])\n ");return{visitor:{TryStatement(s){var i;if(s.node[t])return;const{block:n,finalizer:a}=s.node;let o,l;const c=s.scope.generateUidIdentifier("err");if(s.node.handler?"Identifier"===(null===(i=s.node.handler.param)||void 0===i?void 0:i.type)?(o=s.node.handler.param,l=s.node.handler):s.node.handler.param?(o=c,l=e.catchClause(o,e.blockStatement([e.variableDeclaration("let",[e.variableDeclarator(s.node.handler.param,o)]),s.node.handler.body]))):(o=c,l=s.node.handler):(o=c,l=e.catchClause(o,e.blockStatement([e.throwStatement(o)]))),a){const i=s.scope.generateUidIdentifier("_isCatchable"),c=s.scope.generateUidIdentifier("_innerExc");s.replaceWithMultiple([e.variableDeclaration("let",[e.variableDeclarator(i,e.booleanLiteral(!0))]),Object.assign(e.tryStatement(n,e.catchClause(o,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",i,r({ERR_IDENTIFIER:o}))),e.ifStatement(i,Object.assign(e.tryStatement(l.body,e.catchClause(c,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",i,r({ERR_IDENTIFIER:c}))),e.throwStatement(c)]))),{[t]:!0}),e.throwStatement(o))])),e.blockStatement([e.ifStatement(i,a)])),{[t]:!0})])}else s.replaceWith(Object.assign(e.tryStatement(n,e.catchClause(o,e.blockStatement([e.ifStatement(r({ERR_IDENTIFIER:o}),l.body,e.throwStatement(o))]))),{[t]:!0}))}}}}},18937:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=({types:e})=>({pre(){this.movedStatements=[],this.functionDeclarations=[],this.hasFinishedMoving=!1,this.addedCompletionRecords=!1,this.variables=[]},visitor:{Statement(t){if(!this.hasFinishedMoving){if(t.isDeclaration()&&!t.getFunctionParent())if(t.isVariableDeclaration()){if(t.parentPath.isProgram()||"var"===t.node.kind){const r=[];for(const s of t.node.declarations){if(s.id.name===this.completionRecordId.name)return;if(this.variables.push(s.id.name),s.init){const i=e.assignmentExpression("=",s.id,s.init);r.push(e.variableDeclaration("const",[e.variableDeclarator(t.scope.generateUidIdentifier("v"),i)]))}}return void(t.parentPath.isProgram()?(this.movedStatements.push(...r),t.remove()):t.replaceWithMultiple(r))}}else{if(t.isFunctionDeclaration())return this.functionDeclarations.push(t.node),void(t.node.id?t.replaceWith(e.expressionStatement(t.node.id)):t.remove());if(t.isClassDeclaration()&&t.parentPath.isProgram())return this.variables.push(t.node.id.name),this.movedStatements.push(e.expressionStatement(e.assignmentExpression("=",t.node.id,e.classExpression(t.node.id,t.node.superClass,t.node.body)))),void t.replaceWith(e.expressionStatement(t.node.id))}!t.isExpressionWrapper()||t.getFunctionParent()||t.isExpressionStatement()&&"AssignmentExpression"===t.node.expression.type&&"Identifier"===t.node.expression.left.type&&t.node.expression.left.name===this.completionRecordId.name?t.parentPath.isProgram()&&this.movedStatements.push(t.node):t.replaceWith(e.expressionStatement(e.assignmentExpression("=",this.completionRecordId,t.node.expression)))}},Program:{enter(t){this.hasFinishedMoving||(this.completionRecordId=t.scope.generateUidIdentifier("cr"),1===t.node.directives.length&&"DirectiveLiteral"===t.node.directives[0].value.type&&0===t.node.body.length&&t.replaceWith(e.program([e.expressionStatement({...t.node.directives[0].value,type:"StringLiteral"})])))},exit(t){this.hasFinishedMoving||(this.hasFinishedMoving=!0,t.replaceWith(e.program([...this.variables.map((t=>e.variableDeclaration("var",[e.variableDeclarator(e.identifier(t))]))),...this.functionDeclarations,e.expressionStatement(e.callExpression(e.arrowFunctionExpression([],e.blockStatement([e.variableDeclaration("var",[e.variableDeclarator(this.completionRecordId)]),...this.movedStatements,e.returnStatement(this.completionRecordId)])),[]))],t.node.directives)))}}}})},77328:(e,t)=>{var r;t=e.exports=g,r="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var s=256,i=Number.MAX_SAFE_INTEGER||9007199254740991,n=s-6,a=t.re=[],o=t.safeRe=[],l=t.src=[],c=t.tokens={},p=0;function u(e){c[e]=p++}var h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",s],[h,n]];function f(e){for(var t=0;t<d.length;t++){var r=d[t][0],s=d[t][1];e=e.split(r+"*").join(r+"{0,"+s+"}").split(r+"+").join(r+"{1,"+s+"}")}return e}u("NUMERICIDENTIFIER"),l[c.NUMERICIDENTIFIER]="0|[1-9]\\d*",u("NUMERICIDENTIFIERLOOSE"),l[c.NUMERICIDENTIFIERLOOSE]="\\d+",u("NONNUMERICIDENTIFIER"),l[c.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-]"+h+"*",u("MAINVERSION"),l[c.MAINVERSION]="("+l[c.NUMERICIDENTIFIER]+")\\.("+l[c.NUMERICIDENTIFIER]+")\\.("+l[c.NUMERICIDENTIFIER]+")",u("MAINVERSIONLOOSE"),l[c.MAINVERSIONLOOSE]="("+l[c.NUMERICIDENTIFIERLOOSE]+")\\.("+l[c.NUMERICIDENTIFIERLOOSE]+")\\.("+l[c.NUMERICIDENTIFIERLOOSE]+")",u("PRERELEASEIDENTIFIER"),l[c.PRERELEASEIDENTIFIER]="(?:"+l[c.NUMERICIDENTIFIER]+"|"+l[c.NONNUMERICIDENTIFIER]+")",u("PRERELEASEIDENTIFIERLOOSE"),l[c.PRERELEASEIDENTIFIERLOOSE]="(?:"+l[c.NUMERICIDENTIFIERLOOSE]+"|"+l[c.NONNUMERICIDENTIFIER]+")",u("PRERELEASE"),l[c.PRERELEASE]="(?:-("+l[c.PRERELEASEIDENTIFIER]+"(?:\\."+l[c.PRERELEASEIDENTIFIER]+")*))",u("PRERELEASELOOSE"),l[c.PRERELEASELOOSE]="(?:-?("+l[c.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+l[c.PRERELEASEIDENTIFIERLOOSE]+")*))",u("BUILDIDENTIFIER"),l[c.BUILDIDENTIFIER]=h+"+",u("BUILD"),l[c.BUILD]="(?:\\+("+l[c.BUILDIDENTIFIER]+"(?:\\."+l[c.BUILDIDENTIFIER]+")*))",u("FULL"),u("FULLPLAIN"),l[c.FULLPLAIN]="v?"+l[c.MAINVERSION]+l[c.PRERELEASE]+"?"+l[c.BUILD]+"?",l[c.FULL]="^"+l[c.FULLPLAIN]+"$",u("LOOSEPLAIN"),l[c.LOOSEPLAIN]="[v=\\s]*"+l[c.MAINVERSIONLOOSE]+l[c.PRERELEASELOOSE]+"?"+l[c.BUILD]+"?",u("LOOSE"),l[c.LOOSE]="^"+l[c.LOOSEPLAIN]+"$",u("GTLT"),l[c.GTLT]="((?:<|>)?=?)",u("XRANGEIDENTIFIERLOOSE"),l[c.XRANGEIDENTIFIERLOOSE]=l[c.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*",u("XRANGEIDENTIFIER"),l[c.XRANGEIDENTIFIER]=l[c.NUMERICIDENTIFIER]+"|x|X|\\*",u("XRANGEPLAIN"),l[c.XRANGEPLAIN]="[v=\\s]*("+l[c.XRANGEIDENTIFIER]+")(?:\\.("+l[c.XRANGEIDENTIFIER]+")(?:\\.("+l[c.XRANGEIDENTIFIER]+")(?:"+l[c.PRERELEASE]+")?"+l[c.BUILD]+"?)?)?",u("XRANGEPLAINLOOSE"),l[c.XRANGEPLAINLOOSE]="[v=\\s]*("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:"+l[c.PRERELEASELOOSE]+")?"+l[c.BUILD]+"?)?)?",u("XRANGE"),l[c.XRANGE]="^"+l[c.GTLT]+"\\s*"+l[c.XRANGEPLAIN]+"$",u("XRANGELOOSE"),l[c.XRANGELOOSE]="^"+l[c.GTLT]+"\\s*"+l[c.XRANGEPLAINLOOSE]+"$",u("COERCE"),l[c.COERCE]="(^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])",u("COERCERTL"),a[c.COERCERTL]=new RegExp(l[c.COERCE],"g"),o[c.COERCERTL]=new RegExp(f(l[c.COERCE]),"g"),u("LONETILDE"),l[c.LONETILDE]="(?:~>?)",u("TILDETRIM"),l[c.TILDETRIM]="(\\s*)"+l[c.LONETILDE]+"\\s+",a[c.TILDETRIM]=new RegExp(l[c.TILDETRIM],"g"),o[c.TILDETRIM]=new RegExp(f(l[c.TILDETRIM]),"g"),u("TILDE"),l[c.TILDE]="^"+l[c.LONETILDE]+l[c.XRANGEPLAIN]+"$",u("TILDELOOSE"),l[c.TILDELOOSE]="^"+l[c.LONETILDE]+l[c.XRANGEPLAINLOOSE]+"$",u("LONECARET"),l[c.LONECARET]="(?:\\^)",u("CARETTRIM"),l[c.CARETTRIM]="(\\s*)"+l[c.LONECARET]+"\\s+",a[c.CARETTRIM]=new RegExp(l[c.CARETTRIM],"g"),o[c.CARETTRIM]=new RegExp(f(l[c.CARETTRIM]),"g"),u("CARET"),l[c.CARET]="^"+l[c.LONECARET]+l[c.XRANGEPLAIN]+"$",u("CARETLOOSE"),l[c.CARETLOOSE]="^"+l[c.LONECARET]+l[c.XRANGEPLAINLOOSE]+"$",u("COMPARATORLOOSE"),l[c.COMPARATORLOOSE]="^"+l[c.GTLT]+"\\s*("+l[c.LOOSEPLAIN]+")$|^$",u("COMPARATOR"),l[c.COMPARATOR]="^"+l[c.GTLT]+"\\s*("+l[c.FULLPLAIN]+")$|^$",u("COMPARATORTRIM"),l[c.COMPARATORTRIM]="(\\s*)"+l[c.GTLT]+"\\s*("+l[c.LOOSEPLAIN]+"|"+l[c.XRANGEPLAIN]+")",a[c.COMPARATORTRIM]=new RegExp(l[c.COMPARATORTRIM],"g"),o[c.COMPARATORTRIM]=new RegExp(f(l[c.COMPARATORTRIM]),"g"),u("HYPHENRANGE"),l[c.HYPHENRANGE]="^\\s*("+l[c.XRANGEPLAIN]+")\\s+-\\s+("+l[c.XRANGEPLAIN]+")\\s*$",u("HYPHENRANGELOOSE"),l[c.HYPHENRANGELOOSE]="^\\s*("+l[c.XRANGEPLAINLOOSE]+")\\s+-\\s+("+l[c.XRANGEPLAINLOOSE]+")\\s*$",u("STAR"),l[c.STAR]="(<|>)?=?\\s*\\*";for(var m=0;m<p;m++)r(m,l[m]),a[m]||(a[m]=new RegExp(l[m]),o[m]=new RegExp(f(l[m])));function y(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof g)return e;if("string"!=typeof e)return null;if(e.length>s)return null;if(!(t.loose?o[c.LOOSE]:o[c.FULL]).test(e))return null;try{return new g(e,t)}catch(e){return null}}function g(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof g){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>s)throw new TypeError("version is longer than "+s+" characters");if(!(this instanceof g))return new g(e,t);r("SemVer",e,t),this.options=t,this.loose=!!t.loose;var n=e.trim().match(t.loose?o[c.LOOSE]:o[c.FULL]);if(!n)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<i)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}t.parse=y,t.valid=function(e,t){var r=y(e,t);return r?r.version:null},t.clean=function(e,t){var r=y(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null},t.SemVer=g,g.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},g.prototype.toString=function(){return this.version},g.prototype.compare=function(e){return r("SemVer.compare",this.version,this.options,e),e instanceof g||(e=new g(e,this.options)),this.compareMain(e)||this.comparePre(e)},g.prototype.compareMain=function(e){return e instanceof g||(e=new g(e,this.options)),x(this.major,e.major)||x(this.minor,e.minor)||x(this.patch,e.patch)},g.prototype.comparePre=function(e){if(e instanceof g||(e=new g(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var s=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,s,i),void 0===s&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===s)return-1;if(s!==i)return x(s,i)}while(++t)},g.prototype.compareBuild=function(e){e instanceof g||(e=new g(e,this.options));var t=0;do{var s=this.build[t],i=e.build[t];if(r("prerelease compare",t,s,i),void 0===s&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===s)return-1;if(s!==i)return x(s,i)}while(++t)},g.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=function(e,t,r,s){"string"==typeof r&&(s=r,r=void 0);try{return new g(e,r).inc(t,s).version}catch(e){return null}},t.diff=function(e,t){if(T(e,t))return null;var r=y(e),s=y(t),i="";if(r.prerelease.length||s.prerelease.length){i="pre";var n="prerelease"}for(var a in r)if(("major"===a||"minor"===a||"patch"===a)&&r[a]!==s[a])return i+a;return n},t.compareIdentifiers=x;var b=/^[0-9]+$/;function x(e,t){var r=b.test(e),s=b.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1}function v(e,t,r){return new g(e,r).compare(new g(t,r))}function E(e,t,r){return v(e,t,r)>0}function P(e,t,r){return v(e,t,r)<0}function T(e,t,r){return 0===v(e,t,r)}function S(e,t,r){return 0!==v(e,t,r)}function A(e,t,r){return v(e,t,r)>=0}function w(e,t,r){return v(e,t,r)<=0}function C(e,t,r,s){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return T(e,r,s);case"!=":return S(e,r,s);case">":return E(e,r,s);case">=":return A(e,r,s);case"<":return P(e,r,s);case"<=":return w(e,r,s);default:throw new TypeError("Invalid operator: "+t)}}function I(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof I){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof I))return new I(e,t);e=e.trim().split(/\s+/).join(" "),r("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===_?this.value="":this.value=this.operator+this.semver.version,r("comp",this)}t.rcompareIdentifiers=function(e,t){return x(t,e)},t.major=function(e,t){return new g(e,t).major},t.minor=function(e,t){return new g(e,t).minor},t.patch=function(e,t){return new g(e,t).patch},t.compare=v,t.compareLoose=function(e,t){return v(e,t,!0)},t.compareBuild=function(e,t,r){var s=new g(e,r),i=new g(t,r);return s.compare(i)||s.compareBuild(i)},t.rcompare=function(e,t,r){return v(t,e,r)},t.sort=function(e,r){return e.sort((function(e,s){return t.compareBuild(e,s,r)}))},t.rsort=function(e,r){return e.sort((function(e,s){return t.compareBuild(s,e,r)}))},t.gt=E,t.lt=P,t.eq=T,t.neq=S,t.gte=A,t.lte=w,t.cmp=C,t.Comparator=I;var _={};function k(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof k)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new k(e.raw,t);if(e instanceof I)return new k(e.value,t);if(!(this instanceof k))return new k(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+this.raw);this.format()}function N(e,t){for(var r=!0,s=e.slice(),i=s.pop();r&&s.length;)r=s.every((function(e){return i.intersects(e,t)})),i=s.pop();return r}function O(e){return!e||"x"===e.toLowerCase()||"*"===e}function D(e,t,r,s,i,n,a,o,l,c,p,u,h){return((t=O(r)?"":O(s)?">="+r+".0.0":O(i)?">="+r+"."+s+".0":">="+t)+" "+(o=O(l)?"":O(c)?"<"+(+l+1)+".0.0":O(p)?"<"+l+"."+(+c+1)+".0":u?"<="+l+"."+c+"."+p+"-"+u:"<="+o)).trim()}function M(e,t,s){for(var i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!s.includePrerelease){for(i=0;i<e.length;i++)if(r(e[i].semver),e[i].semver!==_&&e[i].semver.prerelease.length>0){var n=e[i].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}function F(e,t,r){try{t=new k(t,r)}catch(e){return!1}return t.test(e)}function L(e,t,r,s){var i,n,a,o,l;switch(e=new g(e,s),t=new k(t,s),r){case">":i=E,n=w,a=P,o=">",l=">=";break;case"<":i=P,n=A,a=E,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(F(e,t,s))return!1;for(var c=0;c<t.set.length;++c){var p=t.set[c],u=null,h=null;if(p.forEach((function(e){e.semver===_&&(e=new I(">=0.0.0")),u=u||e,h=h||e,i(e.semver,u.semver,s)?u=e:a(e.semver,h.semver,s)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&n(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0}I.prototype.parse=function(e){var t=this.options.loose?o[c.COMPARATORLOOSE]:o[c.COMPARATOR],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new g(r[2],this.options.loose):this.semver=_},I.prototype.toString=function(){return this.value},I.prototype.test=function(e){if(r("Comparator.test",e,this.options.loose),this.semver===_||e===_)return!0;if("string"==typeof e)try{e=new g(e,this.options)}catch(e){return!1}return C(e,this.operator,this.semver,this.options)},I.prototype.intersects=function(e,t){if(!(e instanceof I))throw new TypeError("a Comparator is required");var r;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||(r=new k(e.value,t),F(this.value,r,t));if(""===e.operator)return""===e.value||(r=new k(this.value,t),F(e.semver,r,t));var s=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),n=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=C(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),l=C(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return s||i||n&&a||o||l},t.Range=k,k.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim(),this.range},k.prototype.toString=function(){return this.range},k.prototype.parseRange=function(e){var t=this.options.loose,s=t?o[c.HYPHENRANGELOOSE]:o[c.HYPHENRANGE];e=e.replace(s,D),r("hyphen replace",e),e=e.replace(o[c.COMPARATORTRIM],"$1$2$3"),r("comparator trim",e,o[c.COMPARATORTRIM]),e=(e=(e=e.replace(o[c.TILDETRIM],"$1~")).replace(o[c.CARETTRIM],"$1^")).split(/\s+/).join(" ");var i=t?o[c.COMPARATORLOOSE]:o[c.COMPARATOR],n=e.split(" ").map((function(e){return function(e,t){return r("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){r("caret",e,t);var s=t.loose?o[c.CARETLOOSE]:o[c.CARET];return e.replace(s,(function(t,s,i,n,a){var o;return r("caret",e,t,s,i,n,a),O(s)?o="":O(i)?o=">="+s+".0.0 <"+(+s+1)+".0.0":O(n)?o="0"===s?">="+s+"."+i+".0 <"+s+"."+(+i+1)+".0":">="+s+"."+i+".0 <"+(+s+1)+".0.0":a?(r("replaceCaret pr",a),o="0"===s?"0"===i?">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+i+"."+(+n+1):">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+(+i+1)+".0":">="+s+"."+i+"."+n+"-"+a+" <"+(+s+1)+".0.0"):(r("no pr"),o="0"===s?"0"===i?">="+s+"."+i+"."+n+" <"+s+"."+i+"."+(+n+1):">="+s+"."+i+"."+n+" <"+s+"."+(+i+1)+".0":">="+s+"."+i+"."+n+" <"+(+s+1)+".0.0"),r("caret return",o),o}))}(e,t)})).join(" ")}(e,t),r("caret",e),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){var s=t.loose?o[c.TILDELOOSE]:o[c.TILDE];return e.replace(s,(function(t,s,i,n,a){var o;return r("tilde",e,t,s,i,n,a),O(s)?o="":O(i)?o=">="+s+".0.0 <"+(+s+1)+".0.0":O(n)?o=">="+s+"."+i+".0 <"+s+"."+(+i+1)+".0":a?(r("replaceTilde pr",a),o=">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+(+i+1)+".0"):o=">="+s+"."+i+"."+n+" <"+s+"."+(+i+1)+".0",r("tilde return",o),o}))}(e,t)})).join(" ")}(e,t),r("tildes",e),e=function(e,t){return r("replaceXRanges",e,t),e.split(/\s+/).map((function(e){return function(e,t){e=e.trim();var s=t.loose?o[c.XRANGELOOSE]:o[c.XRANGE];return e.replace(s,(function(s,i,n,a,o,l){r("xRange",e,s,i,n,a,o,l);var c=O(n),p=c||O(a),u=p||O(o),h=u;return"="===i&&h&&(i=""),l=t.includePrerelease?"-0":"",c?s=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(p&&(a=0),o=0,">"===i?(i=">=",p?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",p?n=+n+1:a=+a+1),s=i+n+"."+a+"."+o+l):p?s=">="+n+".0.0"+l+" <"+(+n+1)+".0.0"+l:u&&(s=">="+n+"."+a+".0"+l+" <"+n+"."+(+a+1)+".0"+l),r("xRange return",s),s}))}(e,t)})).join(" ")}(e,t),r("xrange",e),e=function(e,t){return r("replaceStars",e,t),e.trim().replace(o[c.STAR],"")}(e,t),r("stars",e),e}(e,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(n=n.filter((function(e){return!!e.match(i)}))),n.map((function(e){return new I(e,this.options)}),this)},k.prototype.intersects=function(e,t){if(!(e instanceof k))throw new TypeError("a Range is required");return this.set.some((function(r){return N(r,t)&&e.set.some((function(e){return N(e,t)&&r.every((function(r){return e.every((function(e){return r.intersects(e,t)}))}))}))}))},t.toComparators=function(e,t){return new k(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))},k.prototype.test=function(e){if(!e)return!1;if("string"==typeof e)try{e=new g(e,this.options)}catch(e){return!1}for(var t=0;t<this.set.length;t++)if(M(this.set[t],e,this.options))return!0;return!1},t.satisfies=F,t.maxSatisfying=function(e,t,r){var s=null,i=null;try{var n=new k(t,r)}catch(e){return null}return e.forEach((function(e){n.test(e)&&(s&&-1!==i.compare(e)||(i=new g(s=e,r)))})),s},t.minSatisfying=function(e,t,r){var s=null,i=null;try{var n=new k(t,r)}catch(e){return null}return e.forEach((function(e){n.test(e)&&(s&&1!==i.compare(e)||(i=new g(s=e,r)))})),s},t.minVersion=function(e,t){e=new k(e,t);var r=new g("0.0.0");if(e.test(r))return r;if(r=new g("0.0.0-0"),e.test(r))return r;r=null;for(var s=0;s<e.set.length;++s)e.set[s].forEach((function(e){var t=new g(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":r&&!E(r,t)||(r=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}));return r&&e.test(r)?r:null},t.validRange=function(e,t){try{return new k(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,r){return L(e,t,"<",r)},t.gtr=function(e,t,r){return L(e,t,">",r)},t.outside=L,t.prerelease=function(e,t){var r=y(e,t);return r&&r.prerelease.length?r.prerelease:null},t.intersects=function(e,t,r){return e=new k(e,r),t=new k(t,r),e.intersects(t)},t.coerce=function(e,t){if(e instanceof g)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;var r=null;if((t=t||{}).rtl){for(var s;(s=o[c.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),o[c.COERCERTL].lastIndex=s.index+s[1].length+s[2].length;o[c.COERCERTL].lastIndex=-1}else r=e.match(o[c.COERCE]);return null===r?null:y(r[2]+"."+(r[3]||"0")+"."+(r[4]||"0"),t)}},678:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MATCH_COMPLETIONS=t.BASE_COMPLETIONS=void 0;const i=r(46993),n=s(r(97699)),a=r(15403);t.BASE_COMPLETIONS=[].concat(a.EXPRESSION_OPERATORS,a.CONVERSION_OPERATORS,a.BSON_TYPES,a.STAGE_OPERATORS),t.MATCH_COMPLETIONS=[].concat(a.QUERY_OPERATORS,a.BSON_TYPES);const o=a.STAGE_OPERATORS.filter((({namespaces:e})=>1===e.length&&e[0]===a.DATABASE));function l(e,t,r){const s=e.connectionInfo(),i=e.apiVersionInfo();let o;o=(null==i?void 0:i.strict)&&t.apiVersions?t.apiVersions.includes(+i.version):!t[r]||!(null==s?void 0:s.server_version)||n.default.gte(s.server_version,t[r]);const l=!t.env||!s||(s.is_data_federation?t.env.includes(a.ADL):s.is_atlas||s.is_local_atlas?t.env.includes(a.ATLAS):t.env.includes(a.ON_PREM));return o&&l}function c(e,t){return t.includes("$project")?a.ACCUMULATORS.filter((t=>l(e,t,"projectVersion"))):t.includes("$group")?a.ACCUMULATORS:[]}function p(e,t,r,s){return t.filter((t=>t.name&&t.name.startsWith(r)&&l(e,t,"version"))).map((e=>`${s}${e.name}`))}function u(e,t,r,s){const i=Object.keys(t).filter((s=>{var i;if(!s.toLowerCase().startsWith(r.toLowerCase()))return!1;if(t[s].deprecated)return!1;const a=e.apiVersionInfo();let o,l;if((null==a?void 0:a.strict)&&(l=t[s].apiVersions))o=+a.version>=l[0]&&+a.version<=l[1];else{const r=null===(i=e.connectionInfo())||void 0===i?void 0:i.server_version;if(!r)return!0;const a=t[s].serverVersions;o=!a||n.default.gte(r,a[0])&&n.default.lte(r,a[1])}const c=t[s].topologies,p=!c||c.includes(e.topology());return o&&p}));return s?i.map((e=>`${s.slice(0,-1).join(".")}.${e}`)):i}t.default=async function(e,r){var s,n,a;const l=i.signatures.ShellApi.attributes,h=i.signatures.Collection.attributes,d=i.signatures.Database.attributes,f=i.signatures.AggregationCursor.attributes,m=i.signatures.Cursor.attributes,y=i.signatures.ReplicaSet.attributes,g=i.signatures.ShellConfig.attributes,b=i.signatures.Shard.attributes,x=r.split(/(?<!\S)(?=\S)/),v=x[0].trim();if(null===(s=l[v])||void 0===s?void 0:s.isDirectShellCommand){const t=l[v].shellCommandCompleter;return t?(1===x.length&&(x[0].trimEnd()===x[0]&&(x[0]+=" "),x.push("")),[(await t(e,x.map((e=>e.trim())))||[]).map((e=>[...x.slice(0,-1),e].join(""))),r,"exclusive"]):[[r],r,"exclusive"]}const E=r.split("."),P=E[0],T=E[E.length-1];if(E.length<=1){const t=u(e,l,T);return[t.length?t:[],r]}if(/\bdb\b/.exec(P)&&2===E.length){if(/aggregate\s*\(\s*\[\s*\{\s*/.exec(T)){const s=r.split("{"),i=(null===(n=s.pop())||void 0===n?void 0:n.trim())||"",a=i?r.split(i).shift():r,l=p(e,s.length<=2?o:[...t.BASE_COMPLETIONS,...c(e,T)],i,a);return[l.length?l:[],r]}const s=u(e,d,T,E),i=await e.getCollectionCompletionsForCurrentDb(T.trim());return s.push(...i.map((e=>`${E[0]}.${e}`))),[s.length?s:[],r]}if(/\bdb\b/.exec(P)&&E.length>2){if(!/^\s*\w+\s*$/.exec(E[1])&&!/\bgetCollection\b/.exec(E[1]))return[[],r];if(E.length>3){if(/\baggregate\b/.exec(E[2])){const t=u(e,f,T,E);return[t.length?t:[],r]}if(/\bfind\b/.exec(E[2])){const t=u(e,m,T,E);return[t.length?t:[],r]}return[[],r]}if(E[2].includes("([")||E[2].includes("({")){let s;s=/\baggregate\b/.exec(E[2])?[...t.BASE_COMPLETIONS,...c(e,T)]:t.MATCH_COMPLETIONS;const i=null===(a=r.split("{").pop())||void 0===a?void 0:a.trim(),n=p(e,s,i||"",i?r.split(i).shift():r);return[n.length?n:[],r]}const s=u(e,h,T,E);return[s.length?s:[],r]}if(/\bsh\b/.exec(P)&&2===E.length){const t=u(e,b,T,E);return[t.length?t:[],r]}if(/\brs\b/.exec(P)&&2===E.length){const t=u(e,y,T,E);return[t.length?t:[],r]}if(/\bconfig\b/.exec(P)&&2===E.length){const t=u(e,g,T,E);return[t.length?t:[],r]}return[[],r]}},14314:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Editor=t.createCommands=t.editorStyles=void 0;const a=n(r(99497)),o=r(30709),l=r(22970),c=()=>{};function p({state:e,dispatch:t}){return t(e.update({selection:{anchor:e.doc.length},scrollIntoView:!0,userEvent:"select"})),!0}function u(e){return[{key:"Enter",run:()=>(e.onEnter(),!0),preventDefault:!0},{key:"ArrowUp",run:t=>{const r=t.state.selection.main;return!!r.empty&&(0===t.lineBlockAt(r.from).from&&(e.onArrowUpOnFirstLine().then((e=>{e&&p(t)})),!0))},preventDefault:!0},{key:"ArrowDown",run:t=>{const r=t.state.selection.main;return!!r.empty&&(t.lineBlockAt(r.from).to===t.state.doc.length&&(e.onArrowDownOnLastLine().then((e=>{e&&p(t)})),!0))},preventDefault:!0},{key:"Mod-l",run:()=>(e.onClearCommand(),!0),preventDefault:!0},{key:"Ctrl-c",run:()=>(e.onSigInt(),!0),preventDefault:!0}]}t.editorStyles=(0,o.css)({"& .cm-content":{paddingTop:0,paddingBottom:0},"& .cm-line":{paddingLeft:1,paddingRight:1}}),t.createCommands=u;class h extends a.Component{constructor(e){super(e),this.editorId=Date.now(),this.autocompleter=e=>{var t;if(!(null===(t=this.props.autocompleter)||void 0===t?void 0:t.getCompletions))return null;const r=e.state.doc.lineAt(e.pos);return this.props.autocompleter.getCompletions(r.text).then((e=>e&&e.length>0?{from:r.from,options:e.map((({completion:e})=>({label:e})))}:null),(()=>null))},this.commands=u(this.props)}render(){return a.default.createElement(l.CodemirrorInlineEditor,{id:`mongosh-ace-${this.editorId}`,language:"javascript",ref:this.props.editorRef,readOnly:this.props.operationInProgress,text:this.props.value,onChangeText:this.props.onChange,commands:this.commands,maxLines:1/0,className:t.editorStyles,completer:this.autocompleter,lineHeight:24})}}t.Editor=h,h.defaultProps={onEnter:c,onArrowUpOnFirstLine:()=>Promise.resolve(!1),onArrowDownOnLastLine:()=>Promise.resolve(!1),onChange:c,onClearCommand:c,onSigInt:c,operationInProgress:!1,value:""}},43240:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordPrompt=void 0;const a=n(r(99497)),o=r(30709),l=(0,o.css)({paddingLeft:23,"& input":{fontSize:"13px",lineHeight:"24px",fontFamily:o.fontFamilies.code,backgroundColor:o.palette.gray.dark4,color:o.palette.gray.light3,padding:"0 3px",border:`1px solid ${o.palette.gray.light3}`,borderRadius:3}});class c extends a.Component{constructor(e){super(e),this.onKeyDown=e=>{switch(e.key){case"Enter":this.props.onFinish(e.target.value);break;case"Esc":case"Escape":this.props.onCancel()}}}render(){return a.default.createElement("label",{className:l},this.props.prompt,": ",a.default.createElement("input",{type:"password",onKeyDown:this.onKeyDown,autoFocus:!0}))}}t.PasswordPrompt=c},31801:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellInput=void 0;const o=n(r(99497)),l=r(30709),c=r(14314),p=a(r(13013)),u=r(558),h=(0,l.css)({padding:"0 8px",minHeight:"24px"});class d extends o.Component{constructor(e){super(e),this.state={currentValue:"",readOnly:!1},this.historyNavigationEntries=[],this.historyNavigationIndex=0,this.onChange=e=>{this.setState({currentValue:e})},this.historyBack=()=>new Promise((e=>{if(this.historyNavigationIndex>=this.historyNavigationEntries.length-1)return e(!1);this.historyNavigationIndex++,this.syncCurrentValueWithHistoryNavigation(e)})),this.historyNext=()=>new Promise((e=>{if(this.historyNavigationIndex<=0)return e(!1);this.historyNavigationIndex--,this.syncCurrentValueWithHistoryNavigation(e)})),this.onEnter=async()=>{this.props.onInput&&await this.props.onInput(this.state.currentValue),this.setState({currentValue:""})},this.initializeHistoryNavigation()}componentDidUpdate(e){e.history!==this.props.history&&this.initializeHistoryNavigation(),0===this.historyNavigationIndex&&(this.historyNavigationEntries[0]=this.state.currentValue)}initializeHistoryNavigation(){this.historyNavigationEntries=[this.state.currentValue,...this.props.history||[]],this.historyNavigationIndex=0}syncCurrentValueWithHistoryNavigation(e){const t=this.historyNavigationEntries[this.historyNavigationIndex];if(void 0===t)return e(!1);this.setState({currentValue:t},(()=>{e(!0)}))}render(){let e;if(this.props.operationInProgress)e=o.default.createElement(p.default,null);else if(this.props.prompt){const t=this.props.prompt.trim();e=t.endsWith(">")?o.default.createElement(o.default.Fragment,null,o.default.createElement("span",null,t.replace(/>$/g,"")),o.default.createElement(l.Icon,{size:12,glyph:"ChevronRight"})):o.default.createElement("span",null,t)}else e=o.default.createElement(l.Icon,{size:12,glyph:"ChevronRight"});const t=o.default.createElement(c.Editor,{autocompleter:this.props.autocompleter,onArrowUpOnFirstLine:this.historyBack,onArrowDownOnLastLine:this.historyNext,onChange:this.onChange,onEnter:this.onEnter,onClearCommand:this.props.onClearCommand,editorRef:this.props.editorRef,value:this.state.currentValue,operationInProgress:this.props.operationInProgress,onSigInt:this.props.onSigInt});return o.default.createElement(u.LineWithIcon,{className:h,icon:e,"data-testid":"shell-input"},t)}}t.ShellInput=d},13013:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const a=n(r(99497)),o=r(30709),l=(0,o.css)({"& div":{borderTopColor:o.palette.green.light2}});class c extends a.Component{render(){const{size:e}=this.props;return a.default.createElement("div",{className:l},a.default.createElement(o.SpinLoader,{size:e}))}}c.defaultProps={size:"12px"},t.default=c},44790:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellOutputLine=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(30709),p=r(558),u=r(79395),h=r(9274),d=r(68661),f=r(15484),m=r(17680),y=r(84050),g=r(65734),b=r(98222),x=r(99489),v=r(38616),E=r(25572),P=(0,c.css)({padding:"0 8px"}),T=(0,c.css)({backgroundColor:c.palette.red.light2,color:c.palette.red.dark3}),S=(0,c.css)({color:c.palette.gray.dark1}),A=(0,c.css)({color:"inherit"});class w extends o.Component{renderValue(){const{type:e,value:t,format:r}=this.props.entry;return"input"===r||this.isPreformattedResult(t,e)?o.default.createElement("pre",null,t):"string"==typeof t&&"InspectResult"===e?o.default.createElement(x.SimpleTypeOutput,{value:t,raw:!0}):this.isPrimitiveOrFunction(t)?o.default.createElement(x.SimpleTypeOutput,{value:t}):"Help"===e?o.default.createElement(u.HelpOutput,{value:t}):"ShowDatabasesResult"===e?o.default.createElement(d.ShowDbsOutput,{value:t}):"StatsResult"===e?o.default.createElement(b.StatsResultOutput,{value:t}):"ListCommandsResult"===e?o.default.createElement(x.SimpleTypeOutput,{value:t}):"ShowCollectionsResult"===e?o.default.createElement(f.ShowCollectionsOutput,{value:t}):"ShowBannerResult"===e?o.default.createElement(h.ShowBannerResultOutput,{value:t}):"Cursor"===e||"AggregationCursor"===e?o.default.createElement(m.CursorOutput,{value:t}):"CursorIterationResult"===e?o.default.createElement(y.CursorIterationResultOutput,{value:t}):"ShowProfileResult"===e?o.default.createElement(E.ShowProfileOutput,{value:t}):this.isError(t)?o.default.createElement(v.ErrorOutput,{value:t}):o.default.createElement(g.ObjectOutput,{value:t})}isError(e){return"string"==typeof e.message&&"string"==typeof e.stack}isPreformattedResult(e,t){return"string"==typeof e&&("Database"===t||"Collection"===t||!t)}isPrimitiveOrFunction(e){return e!==Object(e)||"function"==typeof e}getIconGlyph(){const{format:e}=this.props.entry;return"input"===e?"ChevronRight":"error"===e?"XWithCircle":"ChevronLeft"}render(){const{format:e}=this.props.entry,t=o.default.createElement(c.Icon,{size:12,glyph:this.getIconGlyph(),className:(0,c.cx)("error"===e?A:S)});return o.default.createElement(p.LineWithIcon,{className:(0,c.cx)(P,"error"===e&&T),icon:t,"data-testid":"shell-output"},this.renderValue())}}t.ShellOutputLine=w,w.propTypes={entry:l.default.object.isRequired}},91295:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(44790);class p extends o.Component{constructor(){super(...arguments),this.renderLine=(e,t)=>o.default.createElement(c.ShellOutputLine,{key:`shell-output-entry-${t}`,entry:e})}render(){return this.props.output.filter((e=>void 0!==e.value)).map(this.renderLine)}}t.ShellOutput=p,p.propTypes={output:l.default.arrayOf(l.default.any).isRequired}},29103:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Shell=void 0;const a=n(r(99497)),o=r(30709),l=r(46177),c=r(43240),p=r(31801),u=r(91295),h=(0,o.css)({fontSize:"13px",lineHeight:"24px",fontFamily:o.fontFamilies.code,backgroundColor:o.palette.gray.dark4,color:o.palette.gray.light3,padding:"4px 0",width:"100%",height:"100%",overflowY:"scroll",overflowX:"hidden","& a, & a:link, & a:visited, & a:hover, & a:active":{fontWeight:"bold",color:"inherit",backgroundColor:"transparent",textDecoration:"underline",cursor:"pointer"},"& pre, & code":{background:"transparent",border:"0px transparent",padding:0,margin:0,fontSize:"inherit",borderRadius:0,color:"inherit",tabSize:2}}),d=()=>{};class f extends a.Component{constructor(){super(...arguments),this.shellInputElement=null,this.editor=null,this.onFinishPasswordPrompt=d,this.onCancelPasswordPrompt=d,this.state={operationInProgress:!1,output:this.props.initialOutput.slice(-this.props.maxOutputLength),history:this.props.initialHistory.slice(0,this.props.maxHistoryLength),passwordPrompt:"",shellPrompt:">"},this.evaluate=async e=>{let t;try{this.props.onOperationStarted(),this.props.runtime.setEvaluationListener(this);const r=await this.props.runtime.evaluate(e);t={format:"output",type:r.type,value:r.printable}}catch(e){t={format:"error",value:e}}finally{await this.updateShellPrompt(),this.props.onOperationEnd()}return t},this.onClearCommand=()=>{const e=[];Object.freeze(e),this.setState({output:e}),this.props.onOutputChanged(e)},this.onPrint=e=>{const t=this.addEntriesToOutput(e.map((e=>({format:"output",type:e.type,value:e.printable}))));this.setState({output:t}),this.props.onOutputChanged(t)},this.onPrompt=(e,t)=>{if("password"!==t)return Promise.reject(new Error("yes/no prompts not implemented yet"));const r=()=>{this.onFinishPasswordPrompt=d,this.onCancelPasswordPrompt=d,this.setState({passwordPrompt:""}),setTimeout(this.focusEditor,1)},s=new Promise(((e,t)=>{this.onFinishPasswordPrompt=t=>{r(),e(t)},this.onCancelPasswordPrompt=()=>{r(),t(new Error("Canceled by user"))}}));return this.setState({passwordPrompt:e}),s},this.onInput=async e=>{if(!e||""===e.trim())return void this.appendEmptyInput();const t={format:"input",value:e};let r=this.addEntriesToOutput([t]);this.setState({operationInProgress:!0,output:r}),this.props.onOutputChanged(r);const s=await this.evaluate(e);r=this.addEntriesToOutput([s]);const i=this.addEntryToHistory(e);this.setState({operationInProgress:!1,output:r,history:i}),this.props.onOutputChanged(r),this.props.onHistoryChanged(i)},this.onShellClicked=e=>{e.currentTarget===e.target&&this.focusEditor()},this.setEditor=e=>{this.editor=e},this.focusEditor=()=>{var e;null===(e=this.editor)||void 0===e||e.focus()},this.onSigInt=()=>this.state.operationInProgress&&this.props.runtime.interrupt?this.props.runtime.interrupt():Promise.resolve(!1)}componentDidMount(){this.scrollToBottom(),this.updateShellPrompt()}componentDidUpdate(){this.scrollToBottom()}async updateShellPrompt(){var e;let t=">",r=!1;try{this.props.runtime.setEvaluationListener(this);const e=await this.props.runtime.evaluate("\n (() => {\n switch (typeof prompt) {\n case 'function':\n return prompt();\n case 'string':\n return prompt;\n }\n })()");null===e.type&&"string"==typeof e.printable&&(t=e.printable,r=!0)}catch(e){}if(!r)try{t=null!==(e=await this.props.runtime.getShellPrompt())&&void 0!==e?e:">"}catch(e){}this.setState({shellPrompt:t})}addEntryToHistory(e){const t=[e,...this.state.history];return(0,l.changeHistory)(t,this.props.redactInfo?"redact-sensitive-data":"keep-sensitive-data"),t.splice(this.props.maxHistoryLength),Object.freeze(t),t}addEntriesToOutput(e){const t=[...this.state.output,...e];return t.splice(0,t.length-this.props.maxOutputLength),Object.freeze(t),t}appendEmptyInput(){const e=this.addEntriesToOutput([{format:"input",value:" "}]);this.setState({output:e})}scrollToBottom(){this.shellInputElement&&this.shellInputElement.scrollIntoView()}renderInput(){return this.state.passwordPrompt?a.default.createElement(c.PasswordPrompt,{onFinish:this.onFinishPasswordPrompt,onCancel:this.onCancelPasswordPrompt,prompt:this.state.passwordPrompt}):a.default.createElement(p.ShellInput,{prompt:this.state.shellPrompt,autocompleter:this.props.runtime,history:this.state.history,onClearCommand:this.onClearCommand,onInput:this.onInput,operationInProgress:this.state.operationInProgress,editorRef:this.setEditor,onSigInt:this.onSigInt})}render(){return a.default.createElement(o.ThemeProvider,{theme:{theme:o.Theme.Dark,enabled:!0}},a.default.createElement("div",{"data-testid":"shell",className:h,onClick:this.onShellClicked},a.default.createElement("div",null,a.default.createElement(u.ShellOutput,{output:this.state.output})),a.default.createElement("div",{ref:e=>{this.shellInputElement=e}},this.renderInput())))}}t.Shell=f,f.defaultProps={onHistoryChanged:d,onOperationStarted:d,onOperationEnd:d,onOutputChanged:d,maxOutputLength:1e3,maxHistoryLength:1e3,initialOutput:[],initialHistory:[]}},84050:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorIterationResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(65734),p=a(r(2416));class u extends o.Component{constructor(){super(...arguments),this.renderDocument=(e,t)=>o.default.createElement(c.ObjectOutput,{key:`document-${t}`,value:e})}render(){if(!this.props.value.documents.length)return o.default.createElement("div",null,p.default.__("shell-api.classes.Cursor.iteration.no-cursor"));const e=this.props.value.cursorHasMore?o.default.createElement("pre",null,p.default.__("shell-api.classes.Cursor.iteration.type-it-for-more")):"";return o.default.createElement("div",null,this.props.value.documents.map(this.renderDocument),e)}}t.CursorIterationResultOutput=u,u.propTypes={value:l.default.arrayOf(l.default.object).isRequired}},17680:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(84050);class p extends o.Component{render(){return this.props.value.documents.length?o.default.createElement(c.CursorIterationResultOutput,{value:this.props.value}):o.default.createElement("pre",null)}}t.CursorOutput=p,p.propTypes={value:l.default.arrayOf(l.default.object).isRequired}},38616:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(6534),p=r(99489),u=r(60868);class h extends o.Component{renderCollapsed(e){return o.default.createElement("div",null,o.default.createElement("pre",null,o.default.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),e()}},this.props.value.name||"Error",":")," ",this.props.value.message))}formatStack(){return this.props.value.stack.split("\n").slice(1).join("\n")}formatErrorBugReportInfo(){if((0,c.isShouldReportAsBugError)(this.props.value))return o.default.createElement("div",null,"This is an error inside mongosh. Please"," ",o.default.createElement("a",{href:"https://jira.mongodb.org/projects/MONGOSH/issues",target:"_blank",rel:"noreferrer"},"file a bug report for the MONGOSH project"),".")}formatErrorInfo(){if(this.props.value.errInfo)return o.default.createElement("div",null,"Additional information:",o.default.createElement(p.SimpleTypeOutput,{value:this.props.value.errInfo}))}formatErrorResult(){if(this.props.value.result)return o.default.createElement("div",null,"Result:",o.default.createElement(p.SimpleTypeOutput,{value:this.props.value.result}))}renderExpanded(e){return o.default.createElement("div",null,this.renderCollapsed(e),o.default.createElement("div",null,this.formatErrorBugReportInfo(),this.formatErrorInfo(),this.formatErrorResult(),o.default.createElement("pre",null,this.formatStack())))}render(){return o.default.createElement(u.Expandable,null,((e,t)=>e?this.renderExpanded(t):this.renderCollapsed(t)))}}t.ErrorOutput=h,h.propTypes={value:l.default.any}},79395:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HelpOutput=void 0;const o=n(r(99497)),l=r(30709),c=a(r(13980)),p=a(r(2416)),u=(0,l.css)({"& table, & caption, & tbody, & tfoot, & thead, & tr, & th, & td":{margin:0,padding:0,border:0,outline:0,fontSize:"100%",verticalAlign:"baseline",background:"transparent"},"& table":{width:"100%",tableLayout:"fixed",overflowWrap:"break-word",textAlign:"left",margin:"1em 0","& th":{width:"25%",fontWeight:"bold"},"& th, & td":{textAlign:"left"}}});class h extends o.Component{constructor(){super(...arguments),this.renderAttrTable=e=>{if(e&&e.length)return o.default.createElement("table",null,o.default.createElement("tbody",null,e.map(this.renderAttrTableRow)))},this.renderAttrTableRow=(e,t)=>o.default.createElement("tr",{key:`row-${t}`},o.default.createElement("th",null,e.name),o.default.createElement("td",null,e.description))}renderHelpDocsLink(e){if(e)return o.default.createElement("div",null,p.default.__("cli-repl.args.moreInformation")," ",o.default.createElement("a",{href:e,target:"_blank",rel:"noreferrer"},e))}renderHelpText(e){if(e)return o.default.createElement("div",null,e)}render(){const e=this.props.value;return o.default.createElement("div",{className:u},this.renderHelpText(e.help),this.renderAttrTable(e.attr),this.renderHelpDocsLink(e.docs))}}t.HelpOutput=h,h.propTypes={value:c.default.object.isRequired}},65734:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(29824),p=r(46403);class u extends o.Component{render(){return o.default.createElement(c.SyntaxHighlight,{code:(0,p.inspect)(this.props.value)})}}t.ObjectOutput=u,u.propTypes={value:l.default.any}},9274:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowBannerResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(30709);class p extends o.Component{render(){var e,t;return o.default.createElement(o.default.Fragment,null,(null===(e=this.props.value)||void 0===e?void 0:e.header)&&o.default.createElement(c.H3,null,this.props.value.header),(null===(t=this.props.value)||void 0===t?void 0:t.content)&&o.default.createElement("pre",null,this.props.value.content))}}t.ShowBannerResultOutput=p,p.propTypes={value:l.default.any}},15484:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowCollectionsOutput=void 0;const o=r(30709),l=a(r(13980)),c=n(r(99497)),p=(0,o.css)({fontWeight:"bold"}),u=(0,o.css)({color:o.palette.gray.base});function h(e){return e.name.startsWith("system.")||e.name.startsWith("enxcol_.")}class d extends c.Component{constructor(){super(...arguments),this.renderTable=e=>{const t=[],r=[];let s=0;e.forEach((e=>{s=Math.max(s,e.name.length),h(e)?t.push(e):r.push(e)}));const i=[];return[...r,...t].forEach(((e,t)=>{const r=s-e.name.length+1,n=(0,o.cx)(p,h(e)&&u);i.push(c.default.createElement("span",{key:`row-${t}`},c.default.createElement("span",{className:n},e.name),e.badge?e.badge.padStart(e.badge.length+r):"",c.default.createElement("br",null)))})),c.default.createElement(c.default.Fragment,null,i)}}render(){return c.default.createElement("pre",null,this.renderTable(this.props.value))}}t.ShowCollectionsOutput=d,d.propTypes={value:l.default.array}},68661:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowDbsOutput=void 0;const o=n(r(99497)),l=a(r(54699)),c=a(r(13980)),p=a(r(90082));function u(e){const t=e<=1e3?"0":"0.00";return(0,l.default)(e).format(t+" ib")}class h extends o.Component{constructor(){super(...arguments),this.renderTable=e=>{const t=e.map((e=>[e.name,u(e.sizeOnDisk)]));return(0,p.default)(t,{align:["l","r"]})}}render(){return o.default.createElement("pre",null,this.renderTable(this.props.value))}}t.ShowDbsOutput=h,h.propTypes={value:c.default.any}},25572:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowProfileOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(99489),p=r(46403);class u extends o.Component{render(){if(0===this.props.value.count)return o.default.createElement(c.SimpleTypeOutput,{value:'db.system.profile is empty.\\nUse db.setProfilingLevel(2) will enable profiling.\\nUse db.getCollection("system.profile").find() to show raw profile entries.'});const e=this.props.value.result.map((e=>{const t=`${e.op} ${e.ns} ${e.millis}ms ${String(e.ts).substring(0,24)}\n`;let r="";for(const t in e){if("op"===t||"ns"===t||"millis"===t||"ts"===t)continue;const s=e[t],i=typeof s;r+="object"===i?t+":"+(0,p.inspect)(s)+" ":"boolean"===i?t+" ":t+":"+s+" "}return`${t}${r}`}));return o.default.createElement(c.SimpleTypeOutput,{value:e})}}t.ShowProfileOutput=u,u.propTypes={value:l.default.object}},99489:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleTypeOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(29824),p=r(46403);class u extends o.Component{render(){const e=this.props.raw?this.props.value:(0,p.inspect)(this.props.value);return o.default.createElement(c.SyntaxHighlight,{code:e})}}t.SimpleTypeOutput=u,u.propTypes={value:l.default.any,raw:l.default.bool}},98222:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(65734);class p extends o.Component{render(){const e=[];for(const[t,r]of Object.entries(this.props.value))e.length>0&&e.push(o.default.createElement("hr",{key:`${t}-separator`})),e.push(o.default.createElement("div",{key:t},o.default.createElement("h4",null,t),o.default.createElement(c.ObjectOutput,{value:r})));return o.default.createElement("div",null,e)}}t.StatsResultOutput=p,p.propTypes={value:l.default.any}},60868:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Expandable=void 0;const a=n(r(99497)),o=r(30709),l=r(30709),c=r(558),p=(0,o.css)({cursor:"pointer"});class u extends a.Component{constructor(){super(...arguments),this.state={expanded:!1},this.toggle=()=>{this.setState({expanded:!this.state.expanded})}}render(){const e=a.default.createElement(l.Icon,{size:12,glyph:this.state.expanded?"CaretDown":"CaretRight",className:p,onClick:this.toggle});return a.default.createElement(c.LineWithIcon,{icon:e,"data-testid":"shell-output"},"function"==typeof this.props.children?this.props.children(this.state.expanded,this.toggle):this.props.children)}}t.Expandable=u,u.propTypes={}},46403:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inspect=void 0;const s=r(21764),i=r(67802),n=s.inspect.custom||"inspect",a=new WeakSet;function o(e,t){try{Object.defineProperty(e,n,{writable:!0,configurable:!0,enumerable:!1,value:function(...e){try{return t.call(this,...e)}catch(e){return console.warn("Could not inspect bson object",{obj:this,err:e}),(0,s.inspect)(this,{customInspect:!1})}}})}catch(t){console.warn("Could not add inspect key to object",{obj:e,err:t})}}function l(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return;if(a.has(e))return;a.add(e),l(Object.getPrototypeOf(e));const t=Object.getOwnPropertyDescriptors(e);for(const{value:e}of Object.values(t))l(e);const r=e._bsontype;r&&r in i.bsonStringifiers&&i.bsonStringifiers[r]&&!t[n]&&!Object.isSealed(e)?o(e,i.bsonStringifiers[r]):function(e){try{return Date.prototype.getTime.call(e),!0}catch(e){return!1}}(e)&&o(e,(function(){return this.toISOString()}))}t.inspect=function(e){return l(e),(0,s.inspect)(e,{customInspect:!0,depth:1e3,breakLength:0})}},558:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LineWithIcon=void 0;const o=n(r(99497)),l=r(30709),c=a(r(13980)),p=(0,l.css)({display:"flex",flexDirection:"row"}),u=(0,l.css)({display:"flex",alignItems:"center",marginRight:"3px",maxHeight:"24px"}),h=(0,l.css)({flex:1,overflowX:"auto"});class d extends o.Component{render(){return o.default.createElement("div",{className:(0,l.cx)(this.props.className,p),"data-testid":this.props["data-testid"]},o.default.createElement("span",{className:u},this.props.icon),o.default.createElement("div",{className:h},this.props.children))}}t.LineWithIcon=d,d.propTypes={icon:c.default.object.isRequired,className:c.default.string,"data-testid":c.default.string}},29824:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SyntaxHighlight=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(22970),p=r(14314);class u extends o.Component{render(){return o.default.createElement(c.CodemirrorInlineEditor,{readOnly:!0,initialText:this.props.code,maxLines:1/0,lineHeight:24,className:p.editorStyles})}}t.SyntaxHighlight=u,u.propTypes={code:l.default.string.isRequired}},77371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeInterpreterEnvironment=void 0,t.IframeInterpreterEnvironment=class{constructor(e){this.window=e,this.sloppyEval("delete window.prompt")}sloppyEval(e){return this.window.eval(e)}getContextObject(){return this.window}}},3055:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeRuntime=void 0;const s=r(77371),i=r(92081);t.IframeRuntime=class{constructor(e){this.openContextRuntime=null,this.readyPromise=null,this.iframe=null,this.container=null,this.evaluationListener=null,this.serviceProvider=e}setEvaluationListener(e){const t=this.evaluationListener;return this.evaluationListener=e,this.openContextRuntime&&this.openContextRuntime.setEvaluationListener(e),t}async evaluate(e){const t=await this.initialize();return await t.evaluate(e)}async getCompletions(e){const t=await this.initialize();return await t.getCompletions(e)}async getShellPrompt(){const e=await this.initialize();return await e.getShellPrompt()}async initialize(){if(null!==this.readyPromise)return await this.readyPromise,this.openContextRuntime;this.container=document.createElement("div"),this.container.style.display="none",this.container.insertAdjacentHTML("beforeend",'<iframe src="about:blank" style="display: none" sandbox="allow-same-origin" />');const e=this.container.firstElementChild;this.iframe=e,this.readyPromise=new Promise((t=>{e.onload=()=>{t()}})),document.body.appendChild(this.container);const t=new s.IframeInterpreterEnvironment(e.contentWindow);return this.openContextRuntime=new i.OpenContextRuntime(this.serviceProvider,t),this.evaluationListener&&this.openContextRuntime.setEvaluationListener(this.evaluationListener),this.initialize()}async destroy(){if(!this.iframe)return;const e=this.iframe.parentNode;e&&e.removeChild(this.iframe)}}},88617:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(3055),t)},72519:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeRuntime=t.Shell=void 0;var s=r(29103);Object.defineProperty(t,"Shell",{enumerable:!0,get:function(){return s.Shell}});var i=r(88617);Object.defineProperty(t,"IframeRuntime",{enumerable:!0,get:function(){return i.IframeRuntime}})},54699:function(e,t,r){var s,i;s=function(){var e,t,r,s,i,n={},a={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},l={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function c(e,t){this._input=e,this._value=t}return(e=function(r){var s,i,a,o;if(e.isNumeral(r))s=r.value();else if(0===r||void 0===r)s=0;else if(null===r||t.isNaN(r))s=null;else if("string"==typeof r)if(l.zeroFormat&&r===l.zeroFormat)s=0;else if(l.nullFormat&&r===l.nullFormat||!r.replace(/[^0-9]+/g,"").length)s=null;else{for(i in n)if((o="function"==typeof n[i].regexps.unformat?n[i].regexps.unformat():n[i].regexps.unformat)&&r.match(o)){a=n[i].unformat;break}s=(a=a||e._.stringToNumber)(r)}else s=Number(r)||null;return new c(r,s)}).version="2.0.6",e.isNumeral=function(e){return e instanceof c},e._=t={numberToFormat:function(t,r,s){var i,n,o,l,c,p,u,h,d=a[e.options.currentLocale],f=!1,m=!1,y="",g=1e12,b=1e9,x=1e6,v="",E=!1;if(t=t||0,n=Math.abs(t),e._.includes(r,"(")?(f=!0,r=r.replace(/[\(|\)]/g,"")):(e._.includes(r,"+")||e._.includes(r,"-"))&&(c=e._.includes(r,"+")?r.indexOf("+"):t<0?r.indexOf("-"):-1,r=r.replace(/[\+|\-]/g,"")),e._.includes(r,"a")&&(i=!!(i=r.match(/a(k|m|b|t)?/))&&i[1],e._.includes(r," a")&&(y=" "),r=r.replace(new RegExp(y+"a[kmbt]?"),""),n>=g&&!i||"t"===i?(y+=d.abbreviations.trillion,t/=g):n<g&&n>=b&&!i||"b"===i?(y+=d.abbreviations.billion,t/=b):n<b&&n>=x&&!i||"m"===i?(y+=d.abbreviations.million,t/=x):(n<x&&n>=1e3&&!i||"k"===i)&&(y+=d.abbreviations.thousand,t/=1e3)),e._.includes(r,"[.]")&&(m=!0,r=r.replace("[.]",".")),o=t.toString().split(".")[0],l=r.split(".")[1],p=r.indexOf(","),h=(r.split(".")[0].split(",")[0].match(/0/g)||[]).length,l?(e._.includes(l,"[")?(l=(l=l.replace("]","")).split("["),v=e._.toFixed(t,l[0].length+l[1].length,s,l[1].length)):v=e._.toFixed(t,l.length,s),o=v.split(".")[0],v=e._.includes(v,".")?d.delimiters.decimal+v.split(".")[1]:"",m&&0===Number(v.slice(1))&&(v="")):o=e._.toFixed(t,0,s),y&&!i&&Number(o)>=1e3&&y!==d.abbreviations.trillion)switch(o=String(Number(o)/1e3),y){case d.abbreviations.thousand:y=d.abbreviations.million;break;case d.abbreviations.million:y=d.abbreviations.billion;break;case d.abbreviations.billion:y=d.abbreviations.trillion}if(e._.includes(o,"-")&&(o=o.slice(1),E=!0),o.length<h)for(var P=h-o.length;P>0;P--)o="0"+o;return p>-1&&(o=o.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),0===r.indexOf(".")&&(o=""),u=o+v+(y||""),f?u=(f&&E?"(":"")+u+(f&&E?")":""):c>=0?u=0===c?(E?"-":"+")+u:u+(E?"-":"+"):E&&(u="-"+u),u},stringToNumber:function(e){var t,r,s,i=a[l.currentLocale],n=e,o={thousand:3,million:6,billion:9,trillion:12};if(l.zeroFormat&&e===l.zeroFormat)r=0;else if(l.nullFormat&&e===l.nullFormat||!e.replace(/[^0-9]+/g,"").length)r=null;else{for(t in r=1,"."!==i.delimiters.decimal&&(e=e.replace(/\./g,"").replace(i.delimiters.decimal,".")),o)if(s=new RegExp("[^a-zA-Z]"+i.abbreviations[t]+"(?:\\)|(\\"+i.currency.symbol+")?(?:\\))?)?$"),n.match(s)){r*=Math.pow(10,o[t]);break}r*=(e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1,e=e.replace(/[^0-9\.]+/g,""),r*=Number(e)}return r},isNaN:function(e){return"number"==typeof e&&isNaN(e)},includes:function(e,t){return-1!==e.indexOf(t)},insert:function(e,t,r){return e.slice(0,r)+t+e.slice(r)},reduce:function(e,t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var r,s=Object(e),i=s.length>>>0,n=0;if(3===arguments.length)r=arguments[2];else{for(;n<i&&!(n in s);)n++;if(n>=i)throw new TypeError("Reduce of empty array with no initial value");r=s[n++]}for(;n<i;n++)n in s&&(r=t(r,s[n],n,s));return r},multiplier:function(e){var t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)},correctionFactor:function(){return Array.prototype.slice.call(arguments).reduce((function(e,r){var s=t.multiplier(r);return e>s?e:s}),1)},toFixed:function(e,t,r,s){var i,n,a,o,l=e.toString().split("."),c=t-(s||0);return i=2===l.length?Math.min(Math.max(l[1].length,c),t):c,a=Math.pow(10,i),o=(r(e+"e+"+i)/a).toFixed(i),s>t-i&&(n=new RegExp("\\.?0{1,"+(s-(t-i))+"}$"),o=o.replace(n,"")),o}},e.options=l,e.formats=n,e.locales=a,e.locale=function(e){return e&&(l.currentLocale=e.toLowerCase()),l.currentLocale},e.localeData=function(e){if(!e)return a[l.currentLocale];if(e=e.toLowerCase(),!a[e])throw new Error("Unknown locale : "+e);return a[e]},e.reset=function(){for(var e in o)l[e]=o[e]},e.zeroFormat=function(e){l.zeroFormat="string"==typeof e?e:null},e.nullFormat=function(e){l.nullFormat="string"==typeof e?e:null},e.defaultFormat=function(e){l.defaultFormat="string"==typeof e?e:"0.0"},e.register=function(e,t,r){if(t=t.toLowerCase(),this[e+"s"][t])throw new TypeError(t+" "+e+" already registered.");return this[e+"s"][t]=r,r},e.validate=function(t,r){var s,i,n,a,o,l,c,p;if("string"!=typeof t&&(t+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",t)),(t=t.trim()).match(/^\d+$/))return!0;if(""===t)return!1;try{c=e.localeData(r)}catch(t){c=e.localeData(e.locale())}return n=c.currency.symbol,o=c.abbreviations,s=c.delimiters.decimal,i="."===c.delimiters.thousands?"\\.":c.delimiters.thousands,!(null!==(p=t.match(/^[^\d]+/))&&(t=t.substr(1),p[0]!==n)||null!==(p=t.match(/[^\d]+$/))&&(t=t.slice(0,-1),p[0]!==o.thousand&&p[0]!==o.million&&p[0]!==o.billion&&p[0]!==o.trillion)||(l=new RegExp(i+"{2}"),t.match(/[^\d.,]/g)||(a=t.split(s)).length>2||(a.length<2?!a[0].match(/^\d+.*\d$/)||a[0].match(l):1===a[0].length?!a[0].match(/^\d+$/)||a[0].match(l)||!a[1].match(/^\d+$/):!a[0].match(/^\d+.*\d$/)||a[0].match(l)||!a[1].match(/^\d+$/))))},e.fn=c.prototype={clone:function(){return e(this)},format:function(t,r){var s,i,a,o=this._value,c=t||l.defaultFormat;if(r=r||Math.round,0===o&&null!==l.zeroFormat)i=l.zeroFormat;else if(null===o&&null!==l.nullFormat)i=l.nullFormat;else{for(s in n)if(c.match(n[s].regexps.format)){a=n[s].format;break}i=(a=a||e._.numberToFormat)(o,c,r)}return i},value:function(){return this._value},input:function(){return this._input},set:function(e){return this._value=Number(e),this},add:function(e){var r=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([this._value,e],(function(e,t,s,i){return e+Math.round(r*t)}),0)/r,this},subtract:function(e){var r=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([e],(function(e,t,s,i){return e-Math.round(r*t)}),Math.round(this._value*r))/r,this},multiply:function(e){return this._value=t.reduce([this._value,e],(function(e,r,s,i){var n=t.correctionFactor(e,r);return Math.round(e*n)*Math.round(r*n)/Math.round(n*n)}),1),this},divide:function(e){return this._value=t.reduce([this._value,e],(function(e,r,s,i){var n=t.correctionFactor(e,r);return Math.round(e*n)/Math.round(r*n)})),this},difference:function(t){return Math.abs(e(this._value).subtract(t).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},currency:{symbol:"$"}}),e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(t,r,s){var i,n=e._.includes(r," BPS")?" ":"";return t*=1e4,r=r.replace(/\s?BPS/,""),i=e._.numberToFormat(t,r,s),e._.includes(i,")")?((i=i.split("")).splice(-1,0,n+"BPS"),i=i.join("")):i=i+n+"BPS",i},unformat:function(t){return+(1e-4*e._.stringToNumber(t)).toFixed(15)}}),s={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},i="("+(i=(r={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}).suffixes.concat(s.suffixes.filter((function(e){return r.suffixes.indexOf(e)<0}))).join("|")).replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(i)},format:function(t,i,n){var a,o,l,c=e._.includes(i,"ib")?s:r,p=e._.includes(i," b")||e._.includes(i," ib")?" ":"";for(i=i.replace(/\s?i?b/,""),a=0;a<=c.suffixes.length;a++)if(o=Math.pow(c.base,a),l=Math.pow(c.base,a+1),null===t||0===t||t>=o&&t<l){p+=c.suffixes[a],o>0&&(t/=o);break}return e._.numberToFormat(t,i,n)+p},unformat:function(t){var i,n,a=e._.stringToNumber(t);if(a){for(i=r.suffixes.length-1;i>=0;i--){if(e._.includes(t,r.suffixes[i])){n=Math.pow(r.base,i);break}if(e._.includes(t,s.suffixes[i])){n=Math.pow(s.base,i);break}}a*=n||1}return a}}),e.register("format","currency",{regexps:{format:/(\$)/},format:function(t,r,s){var i,n,a=e.locales[e.options.currentLocale],o={before:r.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:r.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(r=r.replace(/\s?\$\s?/,""),i=e._.numberToFormat(t,r,s),t>=0?(o.before=o.before.replace(/[\-\(]/,""),o.after=o.after.replace(/[\-\)]/,"")):t<0&&!e._.includes(o.before,"-")&&!e._.includes(o.before,"(")&&(o.before="-"+o.before),n=0;n<o.before.length;n++)switch(o.before[n]){case"$":i=e._.insert(i,a.currency.symbol,n);break;case" ":i=e._.insert(i," ",n+a.currency.symbol.length-1)}for(n=o.after.length-1;n>=0;n--)switch(o.after[n]){case"$":i=n===o.after.length-1?i+a.currency.symbol:e._.insert(i,a.currency.symbol,-(o.after.length-(1+n)));break;case" ":i=n===o.after.length-1?i+" ":e._.insert(i," ",-(o.after.length-(1+n)+a.currency.symbol.length-1))}return i}}),e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(t,r,s){var i=("number"!=typeof t||e._.isNaN(t)?"0e+0":t.toExponential()).split("e");return r=r.replace(/e[\+|\-]{1}0/,""),e._.numberToFormat(Number(i[0]),r,s)+"e"+i[1]},unformat:function(t){var r=e._.includes(t,"e+")?t.split("e+"):t.split("e-"),s=Number(r[0]),i=Number(r[1]);return i=e._.includes(t,"e-")?i*=-1:i,e._.reduce([s,Math.pow(10,i)],(function(t,r,s,i){var n=e._.correctionFactor(t,r);return t*n*(r*n)/(n*n)}),1)}}),e.register("format","ordinal",{regexps:{format:/(o)/},format:function(t,r,s){var i=e.locales[e.options.currentLocale],n=e._.includes(r," o")?" ":"";return r=r.replace(/\s?o/,""),n+=i.ordinal(t),e._.numberToFormat(t,r,s)+n}}),e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(t,r,s){var i,n=e._.includes(r," %")?" ":"";return e.options.scalePercentBy100&&(t*=100),r=r.replace(/\s?\%/,""),i=e._.numberToFormat(t,r,s),e._.includes(i,")")?((i=i.split("")).splice(-1,0,n+"%"),i=i.join("")):i=i+n+"%",i},unformat:function(t){var r=e._.stringToNumber(t);return e.options.scalePercentBy100?.01*r:r}}),e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(e,t,r){var s=Math.floor(e/60/60),i=Math.floor((e-60*s*60)/60),n=Math.round(e-60*s*60-60*i);return s+":"+(i<10?"0"+i:i)+":"+(n<10?"0"+n:n)},unformat:function(e){var t=e.split(":"),r=0;return 3===t.length?(r+=60*Number(t[0])*60,r+=60*Number(t[1]),r+=Number(t[2])):2===t.length&&(r+=60*Number(t[0]),r+=Number(t[1])),Number(r)}}),e},void 0===(i=s.call(t,r,t,e))||(e.exports=i)},43819:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellApiAutocompleter=void 0;const i=s(r(678));t.ShellApiAutocompleter=class{constructor(e){this.parameters=e}async getCompletions(e){if(!e)return[];const t=await(0,i.default)(this.parameters,e);return t&&t.length?t[0].map((e=>({completion:e}))):[]}}},92081:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenContextRuntime=void 0;var s=r(60484);Object.defineProperty(t,"OpenContextRuntime",{enumerable:!0,get:function(){return s.OpenContextRuntime}})},60484:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenContextRuntime=void 0;const s=r(43819),i=r(17702),n=r(46993),a=r(1136);t.OpenContextRuntime=class{constructor(e,t,r){this.autocompleter=null,this.evaluationListener=null,this.updatedConnectionInfoPromise=null,this.interpreterEnvironment=t,this.instanceState=new n.ShellInstanceState(e,r||new i.EventEmitter),this.instanceState.isInteractive=!0,this.shellEvaluator=new a.ShellEvaluator(this.instanceState),this.instanceState.setCtx(this.interpreterEnvironment.getContextObject())}async getCompletions(e){var t;return this.autocompleter||(this.autocompleter=new s.ShellApiAutocompleter(this.instanceState.getAutocompleteParameters()),null!==(t=this.updatedConnectionInfoPromise)&&void 0!==t||(this.updatedConnectionInfoPromise=this.instanceState.fetchConnectionInfo()),await this.updatedConnectionInfoPromise),this.autocompleter.getCompletions(e)}async evaluate(e){const t=this.interpreterEnvironment.sloppyEval.bind(this.interpreterEnvironment),{type:r,printable:s,source:i}=await this.shellEvaluator.customEval(t,e,this.interpreterEnvironment.getContextObject(),"");return{type:r,printable:s,source:i}}setEvaluationListener(e){const t=this.evaluationListener;return this.evaluationListener=e,this.instanceState.setEvaluationListener(e),t}async getShellPrompt(){var e;return null!==(e=this.updatedConnectionInfoPromise)&&void 0!==e||(this.updatedConnectionInfoPromise=this.instanceState.fetchConnectionInfo()),await this.updatedConnectionInfoPromise,await this.instanceState.getDefaultPrompt()}}},29830:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.CommonErrors=void 0,function(e){e.InvalidArgument="COMMON-10001",e.InvalidOperation="COMMON-10002",e.Deprecated="COMMON-10003",e.CommandFailed="COMMON-10004",e.UnexpectedInternalError="COMMON-90001",e.NotImplemented="COMMON-90002"}(r||(t.CommonErrors=r={}))},6534:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommonErrors=t.MongoshCommandFailed=t.MongoshDeprecatedError=t.MongoshUnimplementedError=t.MongoshInvalidInputError=t.MongoshInternalError=t.MongoshRuntimeError=t.MongoshWarning=t.MongoshBaseError=t.isShouldReportAsBugError=t.getScopeFromErrorCode=void 0;const s=r(29830);function i(e){if(!e)return;const t=/^([a-zA-Z0-9]+)-/.exec(e);return t?t[1]:void 0}Object.defineProperty(t,"CommonErrors",{enumerable:!0,get:function(){return s.CommonErrors}}),t.getScopeFromErrorCode=i,t.isShouldReportAsBugError=function(e){return(null==e?void 0:e.code)===s.CommonErrors.UnexpectedInternalError};class n extends Error{constructor(e,t,r,s){super(r?`[${r}] ${t}`:t),this.name=e,this.code=r,this.scope=i(r),this.metadata=s}}t.MongoshBaseError=n,t.MongoshRuntimeError=class extends n{constructor(e,t,r){super("MongoshRuntimeError",e,t,r)}},t.MongoshInternalError=class extends n{constructor(e,t){super("MongoshInternalError",e,s.CommonErrors.UnexpectedInternalError,t)}},t.MongoshUnimplementedError=class extends n{constructor(e,t,r){super("MongoshUnimplementedError",e,t,r)}},t.MongoshInvalidInputError=class extends n{constructor(e,t,r){super("MongoshInvalidInputError",e,t,r)}},t.MongoshWarning=class extends n{constructor(e,t,r){super("MongoshWarning",e,t,r)}},t.MongoshDeprecatedError=class extends n{constructor(e,t){super("MongoshDeprecatedError",e,s.CommonErrors.Deprecated,t)}},t.MongoshCommandFailed=class extends n{constructor(e,t){super("MongoshCommandFailed",`Command ${e} returned ok: 0. To see the raw results of the command, use 'runCommand' instead.`,s.CommonErrors.CommandFailed,t)}}},2416:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(64647));t.default=new i.default},8155:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i={...s(r(27098)).default};t.default=i},27098:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={"browser-repl":{},build:{},"cli-repl":{args:{usage:"$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]",options:"Options:",file:"Load the specified mongosh script",help:"Show this usage information",ipv6:"Enable IPv6 support (disabled by default)",host:"Server to connect to",port:"Port to connect to",version:"Show version information",quiet:"Silence output from the shell during the connection process",shell:"Run the shell after executing files",nodb:"Don't connect to mongod on startup - no 'db address' [arg] expected",norc:"Will not run the '.mongoshrc.js' file on start up",eval:"Evaluate javascript",json:"Print result of --eval as Extended JSON, including errors",retryWrites:"Automatically retry write operations upon transient network errors (Default: true)",authenticationOptions:"Authentication Options:",username:"Username for authentication",password:"Password for authentication",authenticationDatabase:"User source (defaults to dbname)",authenticationMechanism:"Authentication mechanism",awsIamSessionToken:"AWS IAM Temporary Session Token ID",gssapiServiceName:"Service name to use when authenticating using GSSAPI/Kerberos",gssapiHostName:"Remote host name to use for purpose of GSSAPI/Kerberos authentication",sspiHostnameCanonicalization:"Specify the SSPI hostname canonicalization (none or forward, available on Windows)",sspiRealmOverride:"Specify the SSPI server realm (available on Windows)",tlsOptions:"TLS Options:",tls:"Use TLS for all connections",tlsCertificateKeyFile:"PEM certificate/key file for TLS",tlsCertificateKeyFilePassword:"Password for key in PEM file for TLS",tlsCAFile:"Certificate Authority file for TLS",tlsCRFile:"Certificate Revocation List file for TLS",tlsAllowInvalidHostnames:"Allow connections to servers with non-matching hostnames",tlsAllowInvalidCertificates:"Allow connections to servers with invalid certificates",tlsCertificateSelector:"TLS Certificate in system store (Windows and macOS only)",tlsCRLFile:"Specifies the .pem file that contains the Certificate Revocation List",tlsDisabledProtocols:"Comma separated list of TLS protocols to disable [TLS1_0,TLS1_1,TLS1_2]",tlsUseSystemCA:"Load the operating system trusted certificate list",tlsFIPSMode:"Enable the system TLS library's FIPS mode",apiVersionOptions:"API version options:",apiVersion:"Specifies the API version to connect with",apiStrict:"Use strict API version mode",apiDeprecationErrors:"Fail deprecated commands for the specified API version",fleOptions:"FLE Options:",awsAccessKeyId:"AWS Access Key for FLE Amazon KMS",awsSecretAccessKey:"AWS Secret Key for FLE Amazon KMS",awsSessionToken:"Optional AWS Session Token ID",keyVaultNamespace:"database.collection to store encrypted FLE parameters",kmsURL:"Test parameter to override the URL of the KMS endpoint",dbAddressOptions:"DB Address Examples:","dbAddress/foo":"Foo database on local machine","dbAddress/192/foo":"Foo database on 192.168.0.5 machine","dbAddress/192/host/foo":"Foo database on 192.168.0.5 machine on port 9999","dbAddress/connectionURI":"Connection string URI can also be used",fileNames:"File Names:",filenameDescription:"A list of files to run. Files must end in .js and will exit after unless --shell is specified.",examples:"Examples:",connectionExampleWithDatabase:"Start mongosh using 'ships' database on specified connection string:",moreInformation:"For more information on usage:"},"arg-parser":{"unknown-option":"Error parsing command line: unrecognized option:"},"cli-repl":{connecting:"Connecting to:",telemetry:"To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).",disableTelemetry:"You can opt-out by running the ",command:"command.",enabledTelemetry:"Telemetry is now enabled.",disabledTelemetry:"Telemetry is now disabled.",wiki:{info:"For mongosh info see:",link:"https://docs.mongodb.com/mongodb-shell/"},additionalErrorInfo:"Additional information",additionalErrorResult:"Result",additionalErrorViolations:"Violations",additionalErrorWriteErrors:"Write Errors",errorCausedBy:"Caused by"},"uri-generator":{"no-host-port":"If a full URI is provided, you cannot also specify --host or --port","invalid-host":"The --host argument contains an invalid character","host-list-port-mismatch":"The host list contains different ports than provided by --port","diverging-service-name":"Either the --gssapiServiceName parameter or the SERVICE_NAME authentication mechanism property in the connection string can be used but not both.","gssapi-service-name-unsupported":"The gssapiServiceName query parameter is not supported anymore. Please use the --gssapiServiceName argument or the SERVICE_NAME authentication mechanism property (e.g. ?authMechanismProperties=SERVICE_NAME:<value>)."}},"service-provider-browser":{},"service-provider-core":{},"service-provider-server":{},"shell-api":{classes:{ShellApi:{help:{description:"Shell Help",link:"https://docs.mongodb.com/manual/reference/method",attributes:{use:{description:"Set current database"},it:{description:"result of the last line evaluated; use to further iterate"},exit:{description:"Quit the MongoDB shell with exit/exit()/.exit"},quit:{description:"Quit the MongoDB shell with quit/quit()"},show:{description:"'show databases'/'show dbs': Print a list of all available databases.\n'show collections'/'show tables': Print a list of all collections for current database.\n'show profile': Prints system.profile information.\n'show users': Print a list of all users for current database.\n'show roles': Print a list of all roles for current database.\n'show log <type>': log for current connection, if type is not set uses 'global'\n'show logs': Print all logs.\n"},connect:{description:"Create a new connection and return the Database object. Usage: connect(URI, username [optional], password [optional])",link:"https://docs.mongodb.com/manual/reference/method/connect"},Mongo:{description:"Create a new connection and return the Mongo object. Usage: new Mongo(URI, options [optional])",link:"https://docs.mongodb.com/manual/reference/method/Mongo/#Mongo"},version:{description:"Shell version",link:"https://docs.mongodb.com/manual/reference/method/version/"},load:{description:"Loads and runs a JavaScript file into the current shell environment",example:'load("path/to/file.js")'},enableTelemetry:{description:"Enables collection of anonymous usage data to improve the mongosh CLI"},disableTelemetry:{description:"Disables collection of anonymous usage data to improve the mongosh CLI"},passwordPrompt:{description:"Prompts the user for a password",link:"https://docs.mongodb.com/manual/reference/method/passwordPrompt/"},sleep:{description:"Sleep for the specified number of milliseconds",link:"https://docs.mongodb.com/manual/reference/method/sleep/",example:"sleep(5000)"},cls:{description:"Clears the screen like console.clear()"},print:{description:"Prints the contents of an object to the output",example:'print({ some: "value" })'},printjson:{description:"Alias for print()"},isInteractive:{description:"Returns whether the shell will enter or has entered interactive mode"},convertShardKeyToHashed:{description:"Returns the hashed value for the input using the same hashing function as a hashed index.",link:"https://www.mongodb.com/docs/manual/reference/method/convertShardKeyToHashed/"}}}},ShellConfig:{help:{description:"Shell configuration methods",attributes:{get:{description:"Get a configuration value with config.get(key)"},set:{description:"Change a configuration value with config.set(key, value)"},reset:{description:"Reset a configuration value to its default value with config.reset(key)"}}}},AggregationCursor:{help:{description:"Aggregation Class",attributes:{close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option.",example:"db.collection.aggregate(pipeline, options).close()"},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor.",example:"db.collection.aggregate(pipeline, options).forEach(function)"},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.aggregate() can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.aggregate(pipeline, options).hasNext()"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed.",example:"db.collection.aggregate(pipeline, options).isClosed()"},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch.",example:"db.collection.aggregate(pipeline, options).isExhausted()"},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process.",example:"db.collection.aggregate(pipeline, options).itcount()"},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array.",example:"db.collection.aggregate(pipeline, options).map(function)"},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor.",example:"db.collection.aggregate(pipeline, options).maxTimeMS(timeLimit)"},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.aggregate() method. NOTE: if the cursor is tailable with awaitData then next will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.aggregate(pipeline, options).next()"},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"},explain:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Provides information on the query plan for db.collection.aggregate() method.",example:"db.collection.aggregate(pipeline, options).explain([verbosity])"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch.",example:"db.collection.aggregate(pipeline, options).objsLeftInBatch()"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.",example:"db.collection.aggregate(pipeline, options).toArray()"},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},batchSize:{description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance.",example:"db.collection.aggregate(pipeline, options).batchSize(10)"},projection:{link:"",description:"Sets a field projection for the query.",example:"db.collection.aggregate(pipeline, options).projection(field)"},sort:{link:"https://docs.mongodb.com/manual/reference/method/cursor.sort",description:"Specifies the order in which the query returns matching documents. You must apply sort() to the cursor before retrieving any documents from the database.",example:"db.collection.aggregate(pipeline, options).sort(sortDocument)"},skip:{link:"https://docs.mongodb.com/manual/reference/method/cursor.skip",description:"Call the cursor.skip() method on a cursor to control where MongoDB begins returning results. This approach may be useful in implementing paginated results.",example:"db.collection.aggregate(pipeline, options).skip(offsetNumber)"}}}},BulkWriteResult:{help:{description:"BulkWriteResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedCount:{description:"Number of documents inserted"},insertedIds:{description:"Array of ObjectIds inserted"},matchedCount:{description:"Number of documents matched"},modifiedCount:{description:"Number of documents modified"},deletedCount:{description:"Number of documents deleted"},upsertedCount:{description:"Number of documents upserted"},upsertedIds:{description:"Array of ObjectIds upserted"}}}},CommandResult:{help:{description:"CommandResult Class"}},InsertManyResult:{help:{description:"InsertManyResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedIds:{description:"Array of ObjectIds inserted"}}}},InsertOneResult:{help:{description:"InsertOneResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedId:{description:"ObjectId of document inserted"}}}},UpdateResult:{help:{description:"CommandResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedId:{description:"ObjectId inserted"},matchedCount:{description:"Number of documents matched"},modifiedCount:{description:"Number of documents modified"},upsertedCount:{description:"Number of documents upserted"}}}},DeleteResult:{help:{description:"CommandResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},deletedCount:{description:"Number of documents deleted"}}}},ShowDbsResult:{help:{description:"ShowDatabasesResult Class"}},Collection:{help:{description:"Collection Class",attributes:{watch:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.watch",description:"Opens a change stream cursor on the collection",example:"const cursor = db.collection.watch(pipeline, options)"},aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.aggregate",description:"Calculates aggregate values for the data in a collection or a view.",example:"db.collection.aggregate(pipeline, options)"},bulkWrite:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite",description:"Performs multiple write operations with controls for order of execution.",example:"db.collection.bulkWrite(operations, options)"},countDocuments:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.countDocuments",description:"Returns the count of documents that match the query for a collection or view.",example:"db.collection.countDocuments(query, options)"},count:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.count",description:"Returns the count of documents that would match a find() query for the collection or view.",example:"db.collection.count(query, options)"},dataSize:{link:"hhttps://docs.mongodb.com/manual/reference/method/db.collection.dataSize",description:"This method provides a wrapper around the size output of the collStats (i.e. db.collection.stats()) command.",example:"db.collection.dataSize()"},deleteMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany",description:"Removes all documents that match the filter from a collection.",example:"db.collection.deleteMany()"},deleteOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.deleteOne",description:"Removes a single document from a collection.",example:"db.collection.deleteOne(filter, options)"},distinct:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.distinct",description:"Finds the distinct values for a specified field across a single collection or view and returns the results in an array.",example:"db.collection.distinct(field, query, options)"},estimatedDocumentCount:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount",description:"Returns the count of all documents in a collection or view.",example:"db.collection.estimatedDocumentCount(options)"},find:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.find",description:"Selects documents in a collection or view.",example:"db.collection.find(query, projection)"},findAndModify:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findAndModify",description:"Modifies and returns a single document.",example:"db.collection.findAndModify(spec)"},findOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOne",description:"Selects documents in a collection or view.",example:"db.collection.findOne(query, projection)"},findOneAndDelete:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndDelete",description:"Deletes a single document based on the filter and sort criteria, returning the deleted document.",example:"db.collection.findOneAndDelete(filter, options)"},findOneAndReplace:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndReplace",description:"Modifies and replaces a single document based on the filter and sort criteria.",example:"db.collection.findOneAndReplace(filter, replacement, options)"},findOneAndUpdate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndUpdate",description:"Updates a single document based on the filter and sort criteria.",example:"db.collection.findOneAndUpdate(filter, update, options)"},getIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndexes()"},getIndices:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Alias for getIndexes. Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndices()"},insert:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insert",description:"Inserts a document or documents into a collection.",example:"db.collection.insert(document, options)"},insertMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insertMany",description:"Inserts multiple documents into a collection.",example:"db.collection.insertMany(documents, options)"},insertOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insertOne",description:"Inserts a document into a collection.",example:"db.collection.insertOne(document, options)"},isCapped:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.isCapped",description:"Checks if a collection is capped",example:"db.collection.isCapped()"},remove:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.remove",description:"Removes documents from a collection.",example:"db.collection.remove(query, options)"},stats:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.stats",description:"Returns statistics about the collection.",example:"db.collection.stats(options)"},storageSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.storageSize",description:"The total amount of storage allocated to this collection for document storage.",example:"db.collection.storageSize()"},replaceOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne",description:"Replaces a single document within the collection based on the filter.",example:"db.collection.replaceOne(filter, replacement, options)"},totalSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.totalSize",description:"The total size in bytes of the data in the collection plus the size of every index on the collection.",example:"db.collection.totalSize()"},update:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.update",description:"Modifies an existing document or documents in a collection.",example:"db.collection.update(query, update, options)"},updateMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateMany",description:"Updates all documents that match the specified filter for a collection.",example:"db.collection.updateMany(filter, update, options)"},compactStructuredEncryptionData:{link:"",description:"Compacts structured encryption data",example:"db.collection.compactStructuredEncryptionData()"},convertToCapped:{link:"",description:"calls {convertToCapped:'coll', size:maxBytes}} command",example:"db.coll.convertToCapped(10000)"},createIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createIndexes",description:"Creates one or more indexes on a collection",example:"db.coll.createIndexes([{ category: 1 }], { name: 'index-1' })"},createIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createIndex",description:"Creates one index on a collection",example:"db.coll.createIndex({ category: 1 }, { name: 'index-1' })"},ensureIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.ensureIndex",description:"Creates one index on a collection",example:"db.coll.ensureIndex({ category: 1 }, { name: 'index-1' })"},getDB:{link:"",description:"Get current database.",example:"db.collection.getDB()"},getIndexKeys:{link:"",description:"Return an array of key patterns for indexes defined on collection",example:"db.collection.getIndexKeys()"},getIndexSpecs:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Alias for getIndexes. Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndexSpecs()"},totalIndexSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.totalIndexSize",description:"Reports the total size used by the indexes on a collection.",example:"db.collection.totalIndexSize()"},dropIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropIndexes",description:"Drops the specified index or indexes (except the index on the _id field) from a collection.",example:"db.collection.dropIndexes()"},dropIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropIndex",description:"Drops or removes the specified index from a collection.",example:"db.collection.dropIndex()"},reIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.reIndex",description:"Rebuilds all existing indexes on a collection.",example:""},hideIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.hideIndex",description:"Hides an existing index from the query planner.",example:'db.collection.hideIndex("index_1")'},unhideIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.unhideIndex",description:"Unhides an existing index from the query planner.",example:'db.collection.unhideIndex("index_1")'},drop:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.drop",description:"Removes a collection or view from the database.",example:"db.students.drop()"},exists:{link:"",description:"Returns collection infos if the collection exists or null otherwise.",example:"db.coll.exists()"},getFullName:{link:"",description:"Returns the name of the collection prefixed with the database name.",example:"db.coll.getFullName()"},getName:{link:"",description:"Returns the name of the collection.",example:"db.coll.getName()"},renameCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.renameCollection/",description:"Renames a collection.",example:'db.coll.renameCollection("newName")'},runCommand:{link:"",description:"Runs a db command with the given name where the first param is the collection name.",example:'db.collection.runCommand("text", { search: "searchKeywords" })'},explain:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan.",example:"db.collection.explain().<method(...)>"},updateOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateOne",description:"Updates a single document within the collection based on the filter.",example:"db.collection.updateOne(filter, update, options)"},getMongo:{description:"Returns the Mongo object.",example:"db.collection.getMongo()"},latencyStats:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.latencyStats",description:"returns the $latencyStats aggregation for the collection. Takes an options document with an optional boolean 'histograms' field.",example:"db.latencyStats({ histograms: true })"},initializeUnorderedBulkOp:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.initializeUnorderedBulkOp",description:"Initializes an unordered bulk command. Returns an instance of Bulk",example:"db.coll.initializeUnorderedBulkOp()"},initializeOrderedBulkOp:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.initializeOrderedBulkOp",description:"Initializes an ordered bulk command. Returns an instance of Bulk",example:"db.coll.initializeOrderedBulkOp()"},getPlanCache:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getPlanCache/",description:"Returns an interface to access the query plan cache for a collection. The interface provides methods to view and clear the query plan cache.",example:"db.coll.getPlanCache()"},validate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.validate",description:"Calls the validate command. Default full value is false",example:"db.coll.validate(<full>)"},mapReduce:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.mapReduce",description:"Calls the mapReduce command",example:"db.coll.mapReduce(mapFn, reduceFn, options)"},getShardVersion:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getShardVersion",description:"Calls the getShardVersion command",example:"db.coll.getShardVersion()"},getShardDistribution:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getShardDistribution",description:"Prints the data distribution statistics for a sharded collection.",example:"db.coll.getShardDistribution()"},analyzeShardKey:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.analyzeShardKey",description:"Returns metrics for evaluating a shard key. That is, ‘key’ can be a candidate shard key for an unsharded or sharded collection, or the current shard key for a sharded collection.",example:"db.coll.analyzeShardKey(key)"},configureQueryAnalyzer:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.configureQueryAnalyzer",description:"Starts or stops collecting metrics about reads and writes against an unsharded or sharded collection.",example:"db.coll.configureQueryAnalyzer(options)"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"db.coll.checkMetadataConsistency(<options>)"},getSearchIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getSearchIndexes",description:"Returns an array that holds a list of documents that identify and describe the existing search indexes on the collection.",example:"db.coll.getSearchIndexes(<name>)"},createSearchIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createSearchIndexes",description:"Creates one or more search indexes on a collection",example:"db.coll.createSearchIndexes(specs)"},createSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createSearchIndex",description:"Creates one search indexes on a collection",example:"db.coll.createSearchIndex(<name>, definition)"},dropSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropSearchIndex",description:"Drops or removes the specified search index from a collection.",example:"db.coll.dropSearchIndex(name)"},updateSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateSearchIndex",description:"Updates the sepecified search index.",example:"db.coll.updateSearchIndex(name, definition)"}}}},ChangeStreamCursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Change Stream Cursor",attributes:{close:{description:"Instructs the server to close a cursor and free associated server resources."},isClosed:{description:"Returns true if the cursor is closed"},itcount:{description:"Returns the number of documents in the current batch. NOTE: this method exhausts the cursor batch"},getResumeToken:{description:"Returns the ResumeToken of the change stream"},hasNext:{description:"WARNING: on change streams this method will block unless the cursor is closed. Use tryNext to check if there are any documents in the batch. This is a breaking change"},next:{description:"WARNING: on change streams this method will block unless the cursor is closed. Use tryNext to get the next document in the batch. This is a breaking change"},tryNext:{description:"If there is a document in the change stream, it will be returned. Otherwise returns null."},isExhausted:{description:"This method is deprecated because because after closing a cursor, the remaining documents in the batch are no longer accessible. If you want to see if the cursor is closed use cursor.isClosed. If you want to see if there are documents left in the batch, use cursor.tryNext. This is a breaking change"}}}},Cursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Collection Cursor",attributes:{addOption:{link:"https://docs.mongodb.com/manual/reference/method/cursor.addOption",description:"Adds OP_QUERY wire protocol flags, such as the tailable flag, to change the behavior of queries. Accepts: DBQuery.Option fields tailable, slaveOk, noTimeout, awaitData, exhaust, partial.",example:"db.collection.find(query, projection).addOption(flag)"},allowPartialResults:{link:"https://docs.mongodb.com/manual/reference/method/cursor.allowPartialResults",description:"Sets the 'partial' option to true.",example:"db.collection.find(query, projection).allowPartialResults()"},allowDiskUse:{link:"https://docs.mongodb.com/manual/reference/method/cursor.allowDiskUse",description:"Sets the 'allowDiskUse' option. If no argument is passed, the default is true.",example:"db.collection.find(query, projection).sort(sort).allowDiskUse(false)"},batchSize:{link:"https://docs.mongodb.com/manual/reference/method/cursor.batchSize",description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance. In most cases, modifying the batch size will not affect the user or the application, as the mongo shell and most drivers return results as if MongoDB returned a single batch.",example:"db.collection.find(query, projection).batchSize(10)"},close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option.",example:"db.collection.find(query, projection).close()"},collation:{link:"https://docs.mongodb.com/manual/reference/method/cursor.collation",description:"Specifies the collation for the cursor returned by the db.collection.find(). To use, append to the db.collection.find().",example:"db.collection.find(query, projection).collation(collationDocument)"},comment:{link:"https://docs.mongodb.com/manual/reference/method/cursor.comment",description:"Adds a comment field to the query.",example:"db.collection.find(query, projection).comment('Comment')"},count:{link:"https://docs.mongodb.com/manual/reference/method/cursor.count",description:"Counts the number of documents referenced by a cursor.",example:"db.collection.find(query, projection).count()"},explain:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Provides information on the query plan for the db.collection.find() method.",example:"db.collection.find(query, projection).explain()"},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor.",example:"db.collection.find(query, projection).forEach(function)"},getQueryPlan:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Runs cursor.explain()",example:"db.collection.find(query, projection).getQueryPlan()"},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.find() query can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.find(query, projection).hasNext()"},hint:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hint",description:"Call this method on a query to override MongoDB’s default index selection and query optimization process. Use db.collection.getIndexes() to return the list of current indexes on a collection.",example:"db.collection.find(query, projection).hint(index)"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed.",example:"db.collection.find(query, projection).isClosed()"},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch.",example:"db.collection.find(query, projection).isExhausted()"},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process.",example:"db.collection.find(query, projection).itcount()"},length:{link:"https://docs.mongodb.com/manual/reference/method/cursor.count",description:"Runs cursor.count()",example:"db.collection.find(query, projection).length()"},limit:{link:"https://docs.mongodb.com/manual/reference/method/cursor.limit",description:"Use the limit() method on a cursor to specify the maximum number of documents the cursor will return.",example:"db.collection.find(query, projection).limit(2)"},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array.",example:"db.collection.find(query, projection).map(function)"},max:{link:"https://docs.mongodb.com/manual/reference/method/cursor.max",description:"Specifies the exclusive upper bound for a specific index in order to constrain the results of find(). max() provides a way to specify an upper bound on compound key indexes.",example:"db.collection.find(query, projection).max(indexBoundsDocument)"},maxScan:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxScan",description:"deprecated, non-functional"},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor.",example:"db.collection.find(query, projection).maxTimeMS(timeLimit)"},maxAwaitTimeMS:{description:"Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)",example:"db.collection.find(query, projection).maxAwaitTimeMS(timeLimit)"},min:{link:"https://docs.mongodb.com/manual/reference/method/cursor.min",description:"Specifies the inclusive lower bound for a specific index in order to constrain the results of find(). min() provides a way to specify lower bounds on compound key indexes.",example:"db.collection.find(query, projection).min(indexBoundsDocument)"},modifiers:{link:"",description:"Get query modifiers.",example:"db.collection.find(query, projection).modifiers()"},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.find() method. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.find(query, projection).next()"},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"},noCursorTimeout:{link:"https://docs.mongodb.com/manual/reference/method/cursor.noCursorTimeout",description:"Instructs the server to avoid closing a cursor automatically after a period of inactivity.",example:"db.collection.find(query, projection).noCursorTimeout()"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch.",example:"db.collection.find(query, projection).objsLeftInBatch()"},oplogReplay:{link:"",description:"Sets oplogReplay cursor flag to true.",example:"db.collection.find(query, projection).oplogReplay()"},projection:{link:"",description:"Sets a field projection for the query.",example:"db.collection.find(query, projection).projection(field)"},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},readConcern:{link:"https://docs.mongodb.com/manual/reference/method/cursor.readConcern",description:"Specify a read concern for the db.collection.find() method.",example:"db.collection.find(query, projection).readConcern(level)"},readonly:{link:"",description:"",example:""},readPref:{link:"https://docs.mongodb.com/manual/reference/method/cursor.readPref",description:"Append readPref() to a cursor to control how the client routes the query to members of the replica set.",example:"db.collection.find(query, projection).readPref(mode, tagSet)"},returnKey:{link:"https://docs.mongodb.com/manual/reference/method/cursor.returnKey",description:"Modifies the cursor to return index keys rather than the documents.",example:"db.collection.find(query, projection).returnKey()"},showDiskLoc:{link:"",description:"The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY style find.",example:"db.collection.find(query, projection).showDiskLoc()"},showRecordId:{link:"https://docs.mongodb.com/manual/reference/method/cursor.showRecordId",description:"Modifies the output of a query by adding a field $recordId to matching documents. $recordId is the internal key which uniquely identifies a document in a collection.",example:"db.collection.find(query, projection).showRecordId"},size:{link:"https://docs.mongodb.com/manual/reference/method/cursor.size",description:"A count of the number of documents that match the db.collection.find() query after applying any cursor.skip() and cursor.limit() methods.",example:"db.collection.find(query, projection).size()"},skip:{link:"https://docs.mongodb.com/manual/reference/method/cursor.skip",description:"Call the cursor.skip() method on a cursor to control where MongoDB begins returning results. This approach may be useful in implementing paginated results.",example:"db.collection.find(query, projection).skip(offsetNumber)"},snapshot:{link:"",description:"The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document",example:"db.collection.find(query, projection).snapshot()"},sort:{link:"https://docs.mongodb.com/manual/reference/method/cursor.sort",description:"Specifies the order in which the query returns matching documents. You must apply sort() to the cursor before retrieving any documents from the database.",example:"db.collection.find(query, projection).sort(sortDocument)"},tailable:{link:"https://docs.mongodb.com/manual/reference/method/cursor.tailable",description:"Marks the cursor as tailable.",example:"db.collection.find(query, projection).tailable({ awaitData: true })"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.",example:"db.collection.find(query, projection).toArray()"}}}},Database:{help:{description:"Database Class",attributes:{sql:{link:"https://docs.mongodb.com/manual/reference/method/db.sql",description:"(Experimental) Runs a SQL query against Atlas Data Lake. Note: this is an experimental feature that may be subject to change in future releases.",example:'const cursor = db.sql("SELECT * FROM myCollection", options)'},watch:{link:"https://docs.mongodb.com/manual/reference/method/db.watch",description:"Opens a change stream cursor on the database",example:"const cursor = db.watch(pipeline, options)"},aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.aggregate",description:"Runs a specified admin/diagnostic pipeline which does not require an underlying collection.",example:"db.aggregate(pipeline, options)"},runCommand:{link:"https://docs.mongodb.com/manual/reference/method/db.runCommand",description:"Runs an arbitrary command on the database.",example:'db.runCommand({ text: "myCollection", search: "searchKeywords" })'},dropDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.dropDatabase",description:"Removes the current database, deleting the associated data files.",example:"db.dropDatabase([writeConcern])"},adminCommand:{link:"https://docs.mongodb.com/manual/reference/method/db.adminCommand",description:"Runs an arbitrary command against the admin database.",example:"db.adminCommand({ serverStatus: 1 })"},getCollectionInfos:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollectionInfos",description:"Returns an array of documents with collection information, i.e. collection name and options, for the current database.",example:"db.getCollectionInfos()"},getCollectionNames:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollectionNames",description:"Returns an array containing the names of all collections in the current database.",example:"db.getCollectionNames"},getSiblingDB:{link:"https://docs.mongodb.com/manual/reference/method/db.getSiblingDB",description:"Returns another database without modifying the db variable in the shell environment.",example:"db.getSiblingDB(name)"},getCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollection",description:"Returns a collection or a view object that is functionally equivalent to using the db.<collectionName>.",example:"db.getCollection(name)"},getMongo:{link:"https://docs.mongodb.com/manual/reference/method/db.getMongo/",description:"Returns the current database connection",example:"connection = db.getMongo()"},getName:{link:"https://docs.mongodb.com/manual/reference/method/db.getName",description:"Returns the name of the DB",example:"db.getName()"},createCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.createCollection/",description:"Create new collection",example:"db.createCollection('collName')"},createEncryptedCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.createEncryptedCollection/",description:"Creates a new collection with a list of encrypted fields each with unique and auto-created data encryption keys (DEKs). This is a utility function that internally utilises ClientEnryption.createEncryptedCollection.",example:'db.createEncryptedCollection( "collName", { "provider": "<kmsProvider>", "createCollectionOptions": { "encryptedFields": { ... }, ...<otherOptions> } })'},createView:{link:"https://docs.mongodb.com/manual/reference/method/db.createView/",description:"Create new view",example:"db.createCollection('viewName', 'source', [])"},createUser:{link:"https://docs.mongodb.com/manual/reference/method/db.createUser",description:"Creates a new user for the database on which the method is run. db.createUser() returns a duplicate user error if the user already exists on the database.",example:"db.createUser(user, writeConcern)"},updateUser:{link:"https://docs.mongodb.com/manual/reference/method/db.updateUser",description:"Updates the user’s profile on the database on which you run the method. An update to a field completely replaces the previous field’s values. This includes updates to the user’s roles array.",example:"db.updateUser(username, update, writeConcern)"},changeUserPassword:{link:"https://docs.mongodb.com/manual/reference/method/db.changeUserPassword",description:"Updates a user’s password. Run the method in the database where the user is defined, i.e. the database you created the user.",example:"db.changeUserPassword(username, password)"},logout:{link:"https://docs.mongodb.com/manual/reference/method/db.logout",description:"Ends the current authentication session. This function has no effect if the current session is not authenticated.",example:"db.logout()"},dropUser:{link:"https://docs.mongodb.com/manual/reference/method/db.dropUser",description:"Removes the user from the current database.",example:"db.dropUser(username, writeConcern)"},dropAllUsers:{link:"https://docs.mongodb.com/manual/reference/method/db.dropAllUsers",description:"Removes all users from the current database.",example:"db.dropAllUsers(writeConcern)"},auth:{link:"https://docs.mongodb.com/manual/reference/method/db.auth",description:"Allows a user to authenticate to the database from within the shell.",example:"db.auth(username, password)"},grantRolesToUser:{link:"https://docs.mongodb.com/manual/reference/method/db.grantRolesToUser",description:"Grants additional roles to a user.",example:'db.grantRolesToUser( "<username>", [ <roles> ], { <writeConcern> } )'},revokeRolesFromUser:{link:"https://docs.mongodb.com/manual/reference/method/db.revokeRolesFromUser",description:"Removes a one or more roles from a user on the current database.",example:'db.revokeRolesFromUser( "<username>", [ <roles> ], { <writeConcern> } )'},getUser:{link:"https://docs.mongodb.com/manual/reference/method/db.getUser",description:"Returns user information for a specified user. Run this method on the user’s database. The user must exist on the database on which the method runs.",example:"db.getUser(username, args)"},getUsers:{link:"https://docs.mongodb.com/manual/reference/method/db.getUsers",description:"Returns information for all the users in the database.",example:"db.getUsers(<options>)"},createRole:{link:"https://docs.mongodb.com/manual/reference/method/db.createRole",description:"Creates a new role.",example:"db.createRole(role, writeConcern)"},updateRole:{link:"https://docs.mongodb.com/manual/reference/method/db.updateRole",description:"Updates the role’s profile on the database on which you run the method. An update to a field completely replaces the previous field’s values.",example:"db.updateRole(rolename, update, writeConcern)"},dropRole:{link:"https://docs.mongodb.com/manual/reference/method/db.dropRole",description:"Removes the role from the current database.",example:"db.dropRole(rolename, writeConcern)"},dropAllRoles:{link:"https://docs.mongodb.com/manual/reference/method/db.dropAllRoles",description:"Removes all roles from the current database.",example:"db.dropAllRoles(writeConcern)"},grantRolesToRole:{link:"https://docs.mongodb.com/manual/reference/method/db.grantRolesToRole",description:"Grants additional roles to a role.",example:'db.grantRolesToRole( "<rolename>", [ <roles> ], { <writeConcern> } )'},revokeRolesFromRole:{link:"https://docs.mongodb.com/manual/reference/method/db.revokeRolesFromRole",description:"Removes a one or more roles from a role on the current database.",example:'db.revokeRolesFromRole( "<rolename>", [ <roles> ], { <writeConcern> } )'},grantPrivilegesToRole:{link:"https://docs.mongodb.com/manual/reference/method/db.grantPrivilegesToRole",description:"Grants additional privileges to a role.",example:'db.grantPrivilegesToRole( "<rolename>", [ <privileges> ], { <writeConcern> } )'},revokePrivilegesFromRole:{link:"https://docs.mongodb.com/manual/reference/method/db.revokePrivilegesFromRole",description:"Removes a one or more privileges from a role on the current database.",example:'db.revokeRolesFromRole( "<rolename>", [ <privileges> ], { <writeConcern> } )'},getRole:{link:"https://docs.mongodb.com/manual/reference/method/db.getRole",description:"Returns role information for a specified role. Run this method on the role’s database. The role must exist on the database on which the method runs.",example:"db.getRole(rolename, args)"},getRoles:{link:"https://docs.mongodb.com/manual/reference/method/db.getRoles",description:"Returns information for all the roles in the database.",example:"db.getRoles(<options>)"},currentOp:{link:"https://docs.mongodb.com/manual/reference/method/db.currentOp",description:"Runs an aggregation using $currentOp operator. Returns a document that contains information on in-progress operations for the database instance. For further information, see $currentOp.",example:"db.currentOp()"},killOp:{link:"https://docs.mongodb.com/manual/reference/method/db.killOp",description:"Calls the killOp command. Terminates an operation as specified by the operation ID. To find operations and their corresponding IDs, see $currentOp or db.currentOp().",example:"db.killOp(<options>)"},shutdownServer:{link:"https://docs.mongodb.com/manual/reference/method/db.shutdownServer",description:"Calls the shutdown command. Shuts down the current mongod or mongos process cleanly and safely. You must issue the db.shutdownServer() operation against the admin database.",example:"db.shutdownServer(<options>)"},fsyncLock:{link:"https://docs.mongodb.com/manual/reference/method/db.fsyncLock",description:"Calls the fsync command. Forces the mongod to flush all pending write operations to disk and locks the entire mongod instance to prevent additional writes until the user releases the lock with a corresponding db.fsyncUnlock() command.",example:"db.fsyncLock(<options>)"},fsyncUnlock:{link:"https://docs.mongodb.com/manual/reference/method/db.fsyncUnlock",description:"Calls the fsyncUnlock command. Reduces the lock taken by db.fsyncLock() on a mongod instance by 1.",example:"db.fsyncUnlock(<options>)"},version:{link:"https://docs.mongodb.com/manual/reference/method/db.version",description:"returns the db version. uses the buildinfo command",example:"db.version()"},serverBits:{link:"https://docs.mongodb.com/manual/reference/method/db.serverBits",description:"returns the db serverBits. uses the buildInfo command",example:"db.serverBits()"},isMaster:{link:"https://docs.mongodb.com/manual/reference/method/db.isMaster",description:"Calls the isMaster command",example:"db.isMaster()"},hello:{link:"https://docs.mongodb.com/manual/reference/method/db.hello",description:"Calls the hello command",example:"db.hello()"},rotateCertificates:{link:"https://docs.mongodb.com/manual/reference/method/db.rotateCertificates",description:"Calls the rotateCertificates command",example:"db.rotateCertificates()"},serverBuildInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.serverBuildInfo",description:"returns the db serverBuildInfo. uses the buildInfo command",example:"db.serverBuildInfo()"},serverStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.serverStatus",description:"returns the server stats. uses the serverStatus command",example:"db.serverStatus(<opts>)"},stats:{link:"https://docs.mongodb.com/manual/reference/method/db.stats",description:"returns the db stats. uses the dbStats command",example:"db.stats(<scale>) or db.stats({ scale: <scale> })"},hostInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.hostInfo",description:"Calls the hostInfo command",example:"db.hostInfo()"},serverCmdLineOpts:{link:"https://docs.mongodb.com/manual/reference/method/db.serverCmdLineOpts",description:"returns the db serverCmdLineOpts. uses the getCmdLineOpts command",example:"db.serverCmdLineOpts()"},printCollectionStats:{link:"https://docs.mongodb.com/manual/reference/method/db.printCollectionStats",description:"Prints the collection.stats for each collection in the db.",example:"db.printCollectionStats(scale)"},getProfilingStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.getProfilingStatus",description:"returns the db getProfilingStatus. uses the profile command",example:"db.getProfilingStatus()"},setProfilingLevel:{link:"https://docs.mongodb.com/manual/reference/method/db.setProfilingLevel",description:"returns the db setProfilingLevel. uses the profile command",example:"db.setProfilingLevel(level, <options>)"},setLogLevel:{link:"https://docs.mongodb.com/manual/reference/method/db.setLogLevel",description:"returns the db setLogLevel. uses the setParameter command",example:"db.setLogLevel(logLevel, <component>)"},getLogComponents:{link:"https://docs.mongodb.com/manual/reference/method/db.getLogComponents",description:"returns the db getLogComponents. uses the getParameter command",example:"db.getLogComponents()"},cloneDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.cloneDatabase",description:"deprecated, non-functional"},copyDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.copyDatabase",description:"deprecated, non-functional"},cloneCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.cloneCollection",description:"deprecated, non-functional"},listCommands:{link:"https://docs.mongodb.com/manual/reference/method/db.listCommands",description:"Calls the listCommands command",example:"db.listCommands()"},commandHelp:{link:"https://docs.mongodb.com/manual/reference/method/db.commandHelp",description:"returns the db commandHelp. uses the passed in command with help: true",example:"db.commandHelp(<command>)"},getLastError:{link:"https://docs.mongodb.com/manual/reference/method/db.getLastError",description:"Calls the getLastError command",example:"db.getLastError(<w>, <wTimeout>)"},getLastErrorObj:{link:"https://docs.mongodb.com/manual/reference/method/db.getLastErrorObj",description:"Calls the getLastError command",example:"db.getLastErrorObj(<w>, <wTimeout>, <j>)"},printShardingStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.printShardingStatus",description:"Calls sh.status(verbose)",example:"db.printShardingStatus(verbose?)"},printSecondaryReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printSecondaryReplicationInfo",description:"Prints secondary replicaset information",example:"db.printSecondaryReplicationInfo()"},printSlaveReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printSlaveReplicationInfo",description:"DEPRECATED. Use db.printSecondaryReplicationInfo",example:"db.printSlaveReplicationInfo()"},getReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.getReplicationInfo",description:"Returns replication information",example:"db.getReplicationInfo()"},printReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printReplicationInfo",description:"Formats sh.getReplicationInfo",example:"db.printReplicationInfo()"},setSecondaryOk:{description:"This method is deprecated. Use db.getMongo().setReadPref() instead"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/db.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"db.checkMetadataConsistency(<options>)"}}}},DBQuery:{help:{description:'Deprecated -- use config.set("displayBatchSize", value) instead of DBQuery.shellBatchSize = value'}},Explainable:{help:{description:"Explainable Class",attributes:{aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Provides information on the query plan for db.collection.aggregate() method.",example:"db.coll.explain().aggregate()"},find:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan.",example:"db.coll.explain().find()"},count:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.count().",example:"db.coll.explain().count()"},remove:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.remove().",example:"db.coll.explain().remove({})"},update:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.update().",example:"db.coll.explain().update({}, { $inc: ${ a: 1 } })"},distinct:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.distinct().",example:'db.coll.explain().distinct("_id")'},mapReduce:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.mapReduce().",example:"db.coll.explain().mapReduce(map, reduce, options)"},findAndModify:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findAndModify().",example:"db.coll.explain().findAndModify({ query: { ... }, update: { ... } })"},findOneAndDelete:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndDelete().",example:"db.coll.explain().findOneAndDelete({ ... query ... })"},findOneAndReplace:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndReplace().",example:"db.coll.explain().findOneAndReplace({ ... query ... }, { ... replacement ... })"},findOneAndUpdate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndUpdate().",example:"db.coll.explain().findOneAndUpdate({ ... query ... }, { ... update operators ... })"},getCollection:{link:"",description:"Returns the explainable collection.",example:"db.coll.explain().getCollection()"},getVerbosity:{link:"",description:"Returns the explainable verbosity.",example:"db.coll.explain().getVerbosity()"},setVerbosity:{link:"",description:"Sets the explainable verbosity.",example:'db.coll.explain().setVerbosity("queryPlanner")'}}}},ExplainableCursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Explainable Cursor. See the Cursor class help methods for more information"}},RunCommandCursor:{help:{description:"RunCommandCursor Class",attributes:{batchSize:{description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance."},close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option."},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor."},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.aggregate() can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed."},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch."},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process."},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array."},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor."},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.aggregate() method. NOTE: if the cursor is tailable with awaitData then next will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch."},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor."},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"}}}},ReplicaSet:{help:{description:"Replica Set Class",link:"https://docs.mongodb.com/manual/reference/method/js-replication/",attributes:{initiate:{link:"https://docs.mongodb.com/manual/reference/method/rs.initiate",description:"Initiates the replica set.",example:"rs.initiate()"},config:{link:"https://docs.mongodb.com/manual/reference/method/rs.conf",description:"Returns a document that contains the current replica set configuration.",example:"rs.config()"},reconfig:{link:"https://docs.mongodb.com/manual/reference/method/rs.reconfig",description:"Reconfigures an existing replica set, overwriting the existing replica set configuration.",example:"rs.reconfig()"},reconfigForPSASet:{link:"https://docs.mongodb.com/manual/reference/method/rs.reconfigForPSASet",description:"Reconfigures an existing replica set, overwriting the existing replica set configuration, if the reconfiguration is a transition from a Primary-Arbiter to a Primary-Secondary-Arbiter set.",example:"rs.reconfigForPSASet(indexOfNewMemberInMembersArray, config)"},conf:{link:"https://docs.mongodb.com/manual/reference/method/rs.conf",description:"Calls replSetConfig",example:"rs.conf()"},status:{link:"https://docs.mongodb.com/manual/reference/method/rs.status",description:"Calls replSetGetStatus",example:"rs.status()"},isMaster:{link:"https://docs.mongodb.com/manual/reference/method/rs.isMaster",description:"Calls isMaster",example:"rs.isMaster()"},hello:{link:"https://docs.mongodb.com/manual/reference/method/rs.hello",description:"Calls hello",example:"rs.hello()"},printSecondaryReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printSecondaryReplicationInfo",description:"Calls db.printSecondaryReplicationInfo",example:"rs.printSecondaryReplicationInfo()"},printSlaveReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printSlaveReplicationInfo",description:"DEPRECATED. Use rs.printSecondaryReplicationInfo",example:"rs.printSlaveReplicationInfo()"},printReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printReplicationInfo",description:"Calls db.printReplicationInfo",example:"rs.printReplicationInfo()"},add:{link:"https://docs.mongodb.com/manual/reference/method/rs.add",description:"Adds replica set member to replica set.",example:"rs.add(hostport, arbiterOnly?)"},addArb:{link:"https://docs.mongodb.com/manual/reference/method/rs.addArb",description:"Calls rs.add with arbiterOnly=true",example:"rs.addArb(hostname)"},remove:{link:"https://docs.mongodb.com/manual/reference/method/rs.remove",description:"Removes a replica set member.",example:"rs.remove(hostname)"},freeze:{link:"https://docs.mongodb.com/manual/reference/method/rs.freeze",description:"Prevents the current member from seeking election as primary for a period of time. Uses the replSetFreeze command",example:"rs.freeze(secs)"},stepDown:{link:"https://docs.mongodb.com/manual/reference/method/rs.stepDown",description:"Causes the current primary to become a secondary which forces an election. If no stepDownSecs is provided, uses 60 seconds. Uses the replSetStepDown command",example:"rs.stepDown(stepDownSecs?, catchUpSecs?)"},syncFrom:{link:"https://docs.mongodb.com/manual/reference/method/rs.syncFrom",description:"Sets the member that this replica set member will sync from, overriding the default sync target selection logic.",example:"rs.syncFrom(host)"},secondaryOk:{description:"This method is deprecated. Use db.getMongo().setReadPref() instead"}}}},Shard:{help:{description:"The Shard Class",attributes:{enableSharding:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableSharding",description:"Enables sharding on a specific database. Uses the enableSharding command",example:"sh.enableSharding(database, primaryShard?)"},shardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.shardCollection",description:"Enables sharding for a collection. Uses the shardCollection command",example:"sh.shardCollection(namespace, key, unique?, options?)"},reshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.reshardCollection",description:"Enables sharding for a collection. Uses the reshardCollection command",example:"sh.reshardCollection(namespace, key, unique?, options?)"},commitReshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.commitReshardCollection",description:"Commits the current reshardCollection on a given collection",example:"sh.commitReshardCollection(namespace)"},abortReshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.abortReshardCollection",description:"Abort the current reshardCollection on a given collection",example:"sh.abortReshardCollection(namespace)"},status:{link:"https://docs.mongodb.com/manual/reference/method/sh.status",description:"Prints a formatted report of the sharding configuration and the information regarding existing chunks in a sharded cluster. The default behavior suppresses the detailed chunk information if the total number of chunks is greater than or equal to 20.",example:"sh.status(verbose?)"},addShard:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShard",description:"Adds a shard to a sharded cluster. Uses the addShard command",example:"sh.addShard(url)"},addShardToZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShardToZone",description:"Associates a shard to a zone. Uses the addShardToZone command",example:"sh.addShardToZone(shard, zone)"},addShardTag:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShardTag",description:"3.4+ only. Calls addShardTag for a sharded DB. Aliases to sh.addShardToZone().",example:"sh.addShardTag(shard, tag)"},updateZoneKeyRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.updateZoneKeyRange",description:"Associates a range of shard keys to a zone. Uses the updateZoneKeyRange command",example:"sh.updateZoneKeyRange(ns, min, max, zone)"},addTagRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.addTagRange",description:"3.4+ only. Adds a tag range for a sharded DB. This method aliases to sh.updateZoneKeyRange()",example:"sh.addTagRange(ns, min, max, zone)"},removeRangeFromZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeRangeFromZone",description:"3.4+ only. Removes an association between a range of shard keys and a zone.",example:"sh.removeRangeFromZone(ns, min, max)"},removeTagRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeTagRange",description:"3.4+ only. Removes tag range for a sharded DB. Aliases to sh.removeRangeFromZone",example:"sh.removeTagRange(ns, min, max)"},removeShardFromZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeShardFromZone",description:"3.4+ only. Removes the association between a shard and a zone. Uses the removeShardFromZone command",example:"sh.removeShardFromZone(shard, zone)"},removeShardTag:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeShardTag",description:"3.4+ only. Removes a shard tag for a sharded DB. Aliases to sh.removeShardFromZone",example:"sh.removeShardTag(shard, zone)"},enableAutoSplit:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableAutoSplit",description:"Enables auto-splitting for the sharded cluster. Calls update on the config.settings collection",example:"sh.enableAutoSplit()"},disableAutoSplit:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableAutoSplit",description:"Disables auto-splitting for the sharded cluster. Calls update on the config.settings collection",example:"sh.disableAutoSplit()"},splitAt:{link:"https://docs.mongodb.com/manual/reference/method/sh.splitAt",description:"Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point. Uses the split command",example:"sh.splitAt(ns, query)"},splitFind:{link:"https://docs.mongodb.com/manual/reference/method/sh.splitFind",description:"Splits a chunk at the shard key value specified by the query at the median. Uses the split command",example:"sh.splitFind(ns, query)"},moveChunk:{link:"https://docs.mongodb.com/manual/reference/method/sh.moveChunk",description:"Moves the chunk that contains the document specified by the query to the destination shard. Uses the moveChunk command",example:"sh.moveChunk(ns, query, destination)"},balancerCollectionStatus:{link:"https://docs.mongodb.com/manual/reference/method/sh.balancerCollectionStatus",description:"Returns information on whether the chunks of a sharded collection are balanced. Uses the balancerCollectionStatus command",example:"sh.balancerCollectionStatus(ns)"},enableBalancing:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableBalancing",description:"Activates the sharded collection balancer process.",example:"sh.enableBalancing(ns)"},disableBalancing:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableBalancing",description:"Disable balancing on a single collection in a sharded database. Does not affect balancing of other collections in a sharded cluster.",example:"sh.disableBalancing(ns)"},getBalancerState:{link:"https://docs.mongodb.com/manual/reference/method/sh.getBalancerState",description:"Returns true when the balancer is enabled and false if the balancer is disabled. This does not reflect the current state of balancing operations: use sh.isBalancerRunning() to check the balancer’s current state.",example:"sh.getBalancerState()"},isBalancerRunning:{link:"https://docs.mongodb.com/manual/reference/method/sh.isBalancerRunning",description:"Returns true if the balancer process is currently running and migrating chunks and false if the balancer process is not running. Uses the balancerStatus command",example:"sh.isBalancerRunning()"},startBalancer:{link:"https://docs.mongodb.com/manual/reference/method/sh.startBalancer",description:"Enables the balancer. Uses the balancerStart command",example:"sh.startBalancer(timeout)"},stopBalancer:{link:"https://docs.mongodb.com/manual/reference/method/sh.stopBalancer",description:"Disables the balancer. uses the balancerStop command",example:"sh.stopBalancer(timeout)"},setBalancerState:{link:"https://docs.mongodb.com/manual/reference/method/sh.setBalancerState",description:"Calls sh.startBalancer if state is true, otherwise calls sh.stopBalancer",example:"sh.setBalancerState(state)"},getShardedDataDistribution:{description:"Returns data-size distribution information for all existing sharded collections",example:"sh.getShardedDataDistribution()"},startAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.startAutoMerger",description:"Globally enable auto-merger (active only if balancer is up)",example:"sh.startAutoMerger()"},stopAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.stopAutoMerger",description:"Globally disable auto-merger",example:"sh.stopAutoMerger()"},isAutoMergerEnabled:{link:"https://docs.mongodb.com/manual/reference/method/sh.isAutoMergerEnabled",description:"Returns whether the auto-merger is enabled",example:"sh.isAutoMergerEnabled()"},disableAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableAutoMerger",description:"Disable auto-merging on one collection",example:"sh.disableAutoMerger(ns)"},enableAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableAutoMerger",description:"Re-enable auto-merge on one collection",example:"sh.enableAutoMerger(ns)"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/sh.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"sh.checkMetadataConsistency(<options>)"}}}},Session:{help:{description:"The Session Class. Represents a server session",link:"https://docs.mongodb.com/manual/reference/method/Session/",attributes:{getDatabase:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getDatabase",description:"Returns a database class that will pass the session to the server with every command"},advanceOperationTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.advanceOperationTime",description:"Updates the operation time"},endSession:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.endSession",description:"Ends the session"},hasEnded:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.hasEnded",description:"Returns a boolean that specifies whether the session has ended."},getClusterTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getClusterTime",description:"Returns the most recent cluster time as seen by the session. Applicable for replica sets and sharded clusters only."},getOperationTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getOperationTime",description:"Returns the timestamp of the last acknowledged operation for the session."},getOptions:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getOptions",description:"Returns the options object passed to startSession"},startTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.startTransaction/#Session.startTransaction",description:"Starts a multi-document transaction for the session."},commitTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.commitTransaction/#Session.commitTransaction",description:"Commits the session’s transaction."},abortTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.abortTransaction/#Session.abortTransaction",description:"Aborts the session’s transaction."},withTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.abortTransaction/#Session.withTransaction",description:"Run a function within a transaction context.",example:'session.withTransaction(() => { session.getDatabase("test").test.insertOne({ doc: 1 }); })'},advanceClusterTime:{description:"Advances the clusterTime for a Session to the provided clusterTime."}}}},Mongo:{help:{description:"The Mongo Class. Represents a connection to a server",link:"https://docs.mongodb.com/manual/reference/method/Mongo/#Mongo",attributes:{watch:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.watch",description:"Opens a change stream cursor on the connection",example:"const cursor = db.getMongo().watch(pipeline, options)"},startSession:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.startSession/",description:"Starts a session for the connection."},getCollection:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getCollection",description:"Returns the specified Collection of the Mongo object.",example:'const collection = db.getMongo().getCollection("databaseName.collectionName")'},getDB:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDB",description:"Returns the specified Database of the Mongo object."},getDBs:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDBs",description:"Returns information about all databases. Uses the listDatabases command."},getDBNames:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDBs",description:"Returns an array of all database names. Uses the listDatabases command.",example:"db.getMongo().getDBNames().map(name => db.getSiblingDB(name).getCollectionNames())"},getURI:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getURI",description:"Returns the connection string for current session"},connect:{link:"https://docs.mongodb.com/manual/reference/method/connect",description:"Creates a connection to a MongoDB instance and returns the reference to the database."},close:{description:"Closes a Mongo object, disposing of related resources and closing the underlying connection."},getReadConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadConcern",description:"Returns the ReadConcern set for the connection.",example:"db.getMongo().getReadConcern()"},getWriteConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getWriteConcern",description:"Returns the WriteConcern set for the connection.",example:"db.getMongo().getWriteConcern()"},getReadPref:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPref",description:"Returns the ReadPreference set for the connection.",example:"db.getMongo().getReadPref()"},getReadPrefMode:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPrefMode",description:"Returns the ReadPreference Mode set for the connection.",example:"db.getMongo().getReadPrefMode()"},getReadPrefTagSet:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPrefTagSet",description:"Returns the ReadPreference TagSet set for the connection.",example:"db.getMongo().getReadPrefTagSet()"},setReadPref:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setReadPref",description:"Sets the ReadPreference for the connection",example:"db.getMongo().setReadPref(mode, tagSets, hedgeOptions)"},setReadConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setReadConcern",description:"Sets the ReadConcern for the connection",example:"db.getMongo().setReadConcern(level)"},setWriteConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setWriteConcern",description:"Sets the WriteConcern for the connection",example:"db.getMongo().setWriteConcern('majority')"},setCausalConsistency:{description:"This method is deprecated. It is not possible to set causal consistency for an entire connection due to driver limitations, use startSession({causalConsistency: <>}) instead."},setSlaveOk:{description:"This method is deprecated"},setSecondaryOk:{description:"This method is deprecated. Use .setReadPref() instead"},isCausalConsistency:{description:"This method is deprecated. Causal consistency for drivers is set via Mongo.startSession and can be checked via session.getOptions. The default value is true"},getKeyVault:{description:"Returns the KeyVault object for the current database connection. The KeyVault object supports data encryption key management for Client-side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/getKeyVault/#getKeyVault"},getClientEncryption:{description:"Returns the ClientEncryption object for the current database collection. The ClientEncryption object supports explicit (manual) encryption and decryption of field values for Client-Side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/getClientEncryption/#getClientEncryption"},convertShardKeyToHashed:{description:"Returns the hashed value for the input using the same hashing function as a hashed index.",link:"https://www.mongodb.com/docs/manual/reference/method/convertShardKeyToHashed/"}}}},DBRef:{help:{description:"The DBRef BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/DBRef.html",example:"new DBRef(namespace: string, oid: ObjectId, db: string [optional])"},attributes:{}},MaxKey:{help:{description:"The MaxKey BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/MaxKey.html",example:"new MaxKey()"},attributes:{}},MinKey:{help:{description:"The MinKey BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/MinKey.html",example:"new MinKey()"},attributes:{}},ObjectId:{help:{description:"The ObjectId BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/ObjectID.html",example:"new ObjectId(id: string|number [optional])"},attributes:{}},BSONSymbol:{help:{description:"The Symbol BSON Class. Deprecated since server version 1.6",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Symbol.html",example:'new BSONSymbol("abc")'},attributes:{}},Timestamp:{help:{description:"The Timestamp BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Timestamp.html",example:"new Timestamp(low: signed 32 bit number, high: signed 32 bit number)"},attributes:{}},Code:{help:{description:"The Code BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Code.html",example:'new Code("x", { x: 1 } [optional])'},attributes:{}},NumberDecimal:{help:{description:"A helper method that constructs a Decimal128 BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Decimal128.html",example:'NumberDecimal("1.23423423")'}},Decimal128:{help:{description:"The Decimal128 BSON Class. Takes a Buffer as an argument.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Decimal128.html"},attributes:{}},NumberInt:{help:{description:"A helper method that constructs an Int32 BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Int32.html",example:'NumberInt("123")'}},Int32:{help:{description:"The 32-bit Integer BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Int32.html",example:"new Int32(123)"},attributes:{}},Long:{help:{description:"The Long BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:"new Long(low: signed 32 bit number, high: signed 32 bit number)"},attributes:{}},Double:{help:{description:"The Double BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:"new Double(123)"},attributes:{}},NumberLong:{help:{description:"A helper method that constructs a Long BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:'NumberLong("123")'}},Date:{help:{description:"The Date Class"}},ISODate:{help:{description:"Helper method for creating dates using ISO"}},BinData:{help:{description:"A helper method that constructs a Binary BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Binary.html",example:"BinData(subtype: number, base64string)"}},Binary:{help:{description:"The Binary BSON Class that takes in (Buffer, subtype: number) as arguments.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Binary.html"},attributes:{SUBTYPE_BYTE_ARRAY:{description:"The byte array BSON type"},SUBTYPE_DEFAULT:{description:"The default BSON type"},SUBTYPE_FUNCTION:{description:"The function BSON type"},SUBTYPE_MD5:{description:"The MD5 BSON type"},SUBTYPE_USER_DEFINED:{description:"The user BSON type"},SUBTYPE_UUID:{description:"The UUID BSON type"},SUBTYPE_UUID_OLD:{description:"The Old UUID BSON type"}}},HexData:{help:{description:"Helper method to create BinData. Accepts subtype hex string",example:'HexData(0, "0123456789abcdef")'}},UUID:{help:{description:"Helper method to create BinData with subtype UUID. Accepts hex string (with optional dashes)",example:'UUID("01234567-89ab-cdef-0123-456789abcdef")'}},MD5:{help:{description:"Helper method to create BinData with subtype MD5. Accepts hex string",example:'MD5("0123456789abcdef0123456789abcdef")'}},bsonsize:{help:{description:"Helper method to calculate BSON object size",example:'bsonsize({ foo: "bar" })'}},Map:{help:{description:"BSON Map"}},Bulk:{help:{link:"https://docs.mongodb.com/manual/reference/method/Bulk",description:"Bulk operations builder used to construct a list of write operations to perform in bulk for a single collection. To instantiate the builder, use either the db.collection.initializeOrderedBulkOp() or the db.collection.initializeUnorderedBulkOp() method.",attributes:{insert:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.insert/",description:"Adds an insert to the bulk operation.",example:"db.insert(<document>)"},execute:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.execute/",description:"Executes the bulk operation.",example:"bulkOp.execute()"},find:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find/",description:"Adds a find to the bulk operation.",example:"bulkOp.find(<filter>)"},getOperations:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.getOperations/",description:"Returns the batches executed by the bulk write.",example:"bulkOp.getOperations()"},tojson:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.tojson/",description:"Returns a JSON document that contains the number of operations and batches in the Bulk() object.",example:"bulkOp.tojson()"},toString:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.toString/",description:"Returns as a string a JSON document that contains the number of operations and batches in the Bulk() object.",example:"bulkOp.toString()"}}}},BulkFindOp:{help:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find",description:"Bulk operations builder returned after Bulk.find()",attributes:{arrayFilters:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.arrayFilters/",description:"Adds an arrayFilter to the bulk operation.",example:"bulkOp.find(...).arrayFilters(<array of filters)"},hint:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.hint/",description:"Adds an hint to the bulk operation.",example:"bulkOp.find(...).hint(<hintd document>)"},collation:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.collation/",description:"Adds collation options to the bulk operation.",example:"bulkOp.find(...).collation(<collation doc>)"},remove:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.remove/",description:"Adds an remove to the bulk operation.",example:"bulkOp.find(...).remove()"},removeOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.removeOne/",description:"Adds an removeOne to the bulk operation.",example:"bulkOp.find(...).removeOne()"},delete:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.delete/",description:"Adds an delete to the bulk operation.",example:"bulkOp.find(...).delete()"},deleteOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.deleteOne/",description:"Adds an deleteOne to the bulk operation.",example:"bulkOp.find(...).deleteOne()"},replaceOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.replaceOne/",description:"Adds an replaceOne to the bulk operation.",example:"bulkOp.find(...).replaceOne(<document>)"},updateOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.updateOne/",description:"Adds an updateOne to the bulk operation.",example:"bulkOp.find(...).updateOne(<document>)"},update:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.update/",description:"Adds an update to the bulk operation.",example:"bulkOp.find(...).update(<document>)"},upsert:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.upsert/",description:"Adds an upsert to the bulk operation updates for this find(...).",example:"bulkOp.find(...).upsert()"}}}},PlanCache:{help:{link:"https://docs.mongodb.com/manual/reference/method/js-plan-cache/",description:"An interface to access the query plan cache object and associated PlanCache methods for a collection.",attributes:{clear:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.clear",description:"Removes cached query plan(s) for a collection.",example:"db.coll.getPlanCache().clear()"},clearPlansByQuery:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.clearPlansByQuery",description:"Removes cached query plan(s) for a collection of the specified query shape.",example:"db.coll.getPlanCache().clearPlansByQuery(<query>, <projection?>, <sort?>)"},list:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.list",description:"Lists cached query plan(s) for a collection.",example:"db.coll.getPlanCache().list(<pipeline>)"},getPlansByQuery:{description:"Deprecated. Please use PlanCache.list instead"},listQueryShapes:{description:"Deprecated. Please use PlanCache.list instead"}}}},Document:{help:{link:"https://docs.mongodb.com/manual/core/document/",description:"A generic MongoDB document, without any methods.",attributes:{}}},KeyVault:{help:{link:"https://docs.mongodb.com/manual/core/security-client-side-encryption/",description:"The key vault object for the current MongoDB connection",attributes:{createKey:{description:"Creates a data encryption key for use with client-side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.createKey/#KeyVault.createKey"},deleteKey:{description:"Deletes the specified data encryption key from the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.deleteKey/#KeyVault.deleteKey"},getKey:{description:"Retreives the specified data encryption key from the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKey/#KeyVault.getKey"},getKeys:{description:"Retrieves all keys in the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKeys/#KeyVault.getKeys"},addKeyAlternateName:{description:"Associates a key alternative name to the specified data encryption key.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.addKeyAlternateName/#KeyVault.addKeyAlternateName"},removeKeyAlternateName:{description:"Removes a key alternative name from the specified data encryption key.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.removeKeyAlternateName/#KeyVault.removeKeyAlternateName"},getKeyByAltName:{description:"Retrieves keys with the specified key alternative name.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKeyByAltName/#KeyVault.getKeyByAltName"},rewrapManyDataKey:{description:"Re-wrap one, more, or all data keys with another KMS provider, or re-wrap using the same one.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.rewrapManyDataKey/#KeyVault.rewrapManyDataKey"},createDataKey:{description:"Alias of KeyVault.createKey()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.createKey/#KeyVault.createKey"},removeKeyAltName:{description:"Alias of KeyVault.removeKeyAlternateName()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.removeKeyAlternateName/#KeyVault.removeKeyAlternateName"},addKeyAltName:{description:"Alias of KeyVault.addKeyAlternateName()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.addKeyAlternateName/#KeyVault.addKeyAlternateName"}}}},ClientEncryption:{help:{link:"https://docs.mongodb.com/manual/core/security-client-side-encryption/",description:"The ClientEncryption object for the current database collection.",attributes:{encrypt:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encrypt",description:"Encrypts the value using the specified encryptionKeyId and encryptionAlgorithm. encrypt supports explicit (manual) encryption of field values."},encryptExpression:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encryptExpression",description:"Encrypts an MQL expression using the specified encryptionKeyId and encryptionAlgorithm."},decrypt:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.decrypt/#ClientEncryption.decrypt",description:"decrypts the encryptionValue if the current database connection was configured with access to the Key Management Service (KMS) and key vault used to encrypt encryptionValue."},createEncryptedCollection:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.createEncryptedCollection/#ClientEncryption.createEncryptedCollection",description:"Creates a new collection with a list of encrypted fields each with unique and auto-created data encryption keys (DEKs). This method should be invoked on a connection instantiated with queryable encryption options.",example:'db.getMongo().getClientEncryption().createEncryptedCollection( "dbName", "collName", { "provider": "<kmsProvider>", "createCollectionOptions": { "encryptedFields": { ... }, ...<otherOptions> } })'}}}},Streams:{help:{description:"Streams",attributes:{process:{description:"Allows a user to process streams of data in the shell interactively and quickly iterate building a stream processor as they go."},createStreamProcessor:{description:"Create a named stream processor."},getProcessor:{description:"Get a stream processor with specified name."},listStreamProcessors:{description:"Show a list of all the named stream processors."},listConnections:{description:"Show a list of all the named connections for this instance from the Connection Registry."}}}},StreamProcessor:{help:{description:"Stream processor",attributes:{start:{description:"Start a named stream processor."},stop:{description:"Stop a named stream processor."},drop:{description:"Drop a named stream processor."},sample:{description:"Return a sample of the results from a named stream processor."},stats:{description:"Return stats captured from a named stream processor."}}}}}},"transport-browser":{"stitch-browser-transport":{"auth-error":"Error authenticating with Stitch."}},"transport-core":{"stitch-transport":{"not-implemented":"is not implemented in the Stitch SDK","agg-on-db":"Aggregations run on the database is not allowed via Stitch"}},"transport-server":{}}},64647:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=s(r(16599)),a=s(r(8155)),o=s(r(27098)),l="en_US",c={en_US:o.default,de_DE:a.default};t.default=class{__(e){const t=this.translate(e);if(void 0===t)throw new i.MongoshInternalError(`Could not translate key ${JSON.stringify(e)}`);return t}constructor(e){this.locale=l,this.catalog=e||c[this.locale]}setLocale(e){Object.prototype.hasOwnProperty.call(c,e)?(this.locale=e,this.catalog=c[e]):(this.locale=l,this.catalog=c[l])}translate(e){return this.find(e)}translateApiHelp(e){const t=this.find(e);if(t)return"string"==typeof t?t:n.default.render("{{description}}\n\n{{link}}\n\n{{example}}\n\n{{returns}}",t)}find(e){return e.split(".").reduce(((e,t)=>e?e[t]:void 0),this.catalog)}}},11866:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},47735:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},62393:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bson=void 0;const s=r(30345);t.bson={ObjectId:s.ObjectId,DBRef:s.DBRef,MaxKey:s.MaxKey,MinKey:s.MinKey,Timestamp:s.Timestamp,BSONSymbol:s.BSONSymbol,Code:s.Code,Decimal128:s.Decimal128,Int32:s.Int32,Long:s.Long,Binary:s.Binary,calculateObjectSize:s.calculateObjectSize,Double:s.Double,EJSON:s.EJSON,BSONRegExp:s.BSONRegExp}},41282:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(59176));t.default=function(e,t,r,s,n,a){var o;null!=r||(r={});const{isGenuine:l,serverName:c}=i.default.getGenuineMongoDB(e),{isDataLake:p,dlVersion:u}=i.default.getDataLake(r),h=n.s.credentials?n.s.credentials.mechanism:null,{serverOs:d,serverArch:f}=i.default.getBuildEnv(r);return{is_atlas:!!(null==s?void 0:s.atlasVersion)||i.default.isAtlas(e),is_localhost:i.default.isLocalhost(e),is_do:i.default.isDigitalOcean(e),server_version:r.version,node_version:process.version,mongosh_version:t,server_os:d,uri:e,server_arch:f,is_enterprise:i.default.isEnterprise(r),auth_type:h,is_data_federation:p,is_stream:i.default.isAtlasStream(e),dl_version:u,atlas_version:null!==(o=null==s?void 0:s.atlasVersion)&&void 0!==o?o:null,is_genuine:l,non_genuine_server_name:c,is_local_atlas:a}}},67802:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.bsonStringifiers=t.ServiceProviderCore=t.DEFAULT_DB=t.getConnectInfo=t.bson=void 0,r(97922);const a=r(3506);Object.defineProperty(t,"ServiceProviderCore",{enumerable:!0,get:function(){return a.ServiceProviderCore}});const o=n(r(41282));t.getConnectInfo=o.default,t.DEFAULT_DB="test";const l=r(15499);Object.defineProperty(t,"bsonStringifiers",{enumerable:!0,get:function(){return l.bsonStringifiers}}),i(r(47735),t),i(r(11866),t);var c=r(62393);Object.defineProperty(t,"bson",{enumerable:!0,get:function(){return c.bson}})},15499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makePrintableBson=t.bsonStringifiers=void 0;const s=r(62393),i=r(21764),n=Symbol.for("nodejs.util.inspect.custom");function a(e){const t=s.bson[e].prototype.inspect;return function(...e){return r=t.apply(this,e),String(r).replace(/^(\s*)(new )/,"$1");var r}}t.bsonStringifiers={ObjectId:a("ObjectId"),ObjectID:a("ObjectId"),DBRef:function(e,t){return`DBRef("${this.collection}", `+(0,i.inspect)(this.oid,t)+(this.db?`, ${(0,i.inspect)(this.db,t)}`:"")+")"},MaxKey:a("MaxKey"),MinKey:a("MinKey"),Timestamp:a("Timestamp"),BSONSymbol:a("BSONSymbol"),Code:a("Code"),Decimal128:a("Decimal128"),Int32:a("Int32"),Long:a("Long"),Double:a("Double"),BSONRegExp:a("BSONRegExp"),Binary:function(){const e=this.toString("hex");switch(this.sub_type){case s.bson.Binary.SUBTYPE_MD5:return`MD5("${e}")`;case s.bson.Binary.SUBTYPE_UUID:if(32===e.length)return`UUID("${/^(.{8})(.{4})(.{4})(.{4})(.{12})$/.exec(e).slice(1,6).join("-")}")`;default:return`Binary.createFromBase64("${this.toString("base64")}", ${this.sub_type})`}}},t.makePrintableBson=function(e){e||(e=s.bson);for(const[r,s]of Object.entries(t.bsonStringifiers)){if(!(r in e))continue;const t=e[r];for(const e of[n,"inspect"])t.prototype[e]=s}}},3506:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceProviderCore=void 0;const s=r(6534),i=r(15499);t.ServiceProviderCore=class{constructor(e){if(void 0===e)throw new s.MongoshInternalError("BSON Library is undefined.");(0,i.makePrintableBson)(e),this.bsonLibrary=e}}},97922:(e,t)=>{"use strict";function r(){return{TextDecoder:class{decode(e){const t=Buffer.from(e).toString("utf8");return t.slice(+t.startsWith("\ufeff"))}},TextEncoder:class{encode(e){return Buffer.from(e,"utf8")}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.textEncodingPolyfill=void 0,"function"==typeof TextDecoder&&"function"==typeof TextEncoder||Object.assign(Function("return this")(),r()),t.textEncodingPolyfill=r},35551:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractCursor=void 0;const i=r(40191),n=r(86930),a=r(58744),o=r(86901);let l=t.AbstractCursor=class extends i.ShellApiWithMongoClass{constructor(e,t){super(),this._currentIterationResult=null,this._mongo=e,this._cursor=t,this._transform=null}async[n.asPrintable](){var e;return(await(0,i.toShellResult)(null!==(e=this._currentIterationResult)&&void 0!==e?e:await this._it())).printable}async _it(){const e=this._currentIterationResult=new a.CursorIterationResult;return await(0,o.iterate)(e,this,await this._mongo._displayBatchSize()),e.cursorHasMore=!this.isExhausted(),e}batchSize(e){return this._cursor.batchSize(e),this}async close(){await this._cursor.close()}async forEach(e){for await(const t of this)if(!1===await e(t))break}async hasNext(){return this._cursor.hasNext()}async tryNext(){let e=await this._cursor.tryNext();return null!==e&&null!==this._transform&&(e=await this._transform(e)),e}async*[Symbol.asyncIterator](){let e;for(;null!=(e=await this.tryNext());)yield e}isClosed(){return this._cursor.closed}isExhausted(){return this.isClosed()&&0===this.objsLeftInBatch()}async itcount(){let e=0;for(;await this.tryNext();)e++;return e}async toArray(){const e=[];for await(const t of this)e.push(t);return e}pretty(){return this}map(e){if(null===this._transform)this._transform=e;else{const t=this._transform;this._transform=r=>e(t(r))}return this}maxTimeMS(e){return this._cursor.maxTimeMS(e),this}async next(){let e=await this._cursor.next();return null!==e&&null!==this._transform&&(e=await this._transform(e)),e}objsLeftInBatch(){return this._cursor.bufferedCount()}};s([(0,i.returnType)("this")],l.prototype,"batchSize",null),s([i.returnsPromise],l.prototype,"close",null),s([i.returnsPromise],l.prototype,"forEach",null),s([i.returnsPromise],l.prototype,"hasNext",null),s([i.returnsPromise],l.prototype,"tryNext",null),s([i.returnsPromise],l.prototype,"itcount",null),s([i.returnsPromise],l.prototype,"toArray",null),s([(0,i.returnType)("this")],l.prototype,"pretty",null),s([(0,i.returnType)("this")],l.prototype,"map",null),s([(0,i.returnType)("this")],l.prototype,"maxTimeMS",null),s([i.returnsPromise],l.prototype,"next",null),t.AbstractCursor=l=s([i.shellApiClassNoHelp],l)},73251:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateOrFindCursor=void 0;const i=r(40191),n=r(86901),a=r(35551);let o=t.AggregateOrFindCursor=class extends a.AbstractCursor{projection(e){return this._cursor.project(e),this}skip(e){return this._cursor.skip(e),this}sort(e){return this._cursor.sort(e),this}async explain(e){e=(0,n.validateExplainableVerbosity)(e);const t={...await this._cursor.explain(e)};return"executionStats"!==e&&"allPlansExecution"!==e&&t.executionStats&&delete t.executionStats,"executionStats"===e&&t.executionStats&&t.executionStats.allPlansExecution&&delete t.executionStats.allPlansExecution,(0,n.markAsExplainOutput)(t)}};s([(0,i.returnType)("this")],o.prototype,"projection",null),s([(0,i.returnType)("this")],o.prototype,"skip",null),s([(0,i.returnType)("this")],o.prototype,"sort",null),s([i.returnsPromise,(0,i.apiVersions)([1])],o.prototype,"explain",null),t.AggregateOrFindCursor=o=s([i.shellApiClassNoHelp],o)},20371:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(73251);let a=class extends n.AggregateOrFindCursor{constructor(e,t){super(e,t)}};a=s([i.shellApiClassDefault],a),t.default=a},22234:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.BulkFindOp=void 0;const i=r(40191),n=r(6534),a=r(86930),o=r(86901),l=r(58744);let c=t.BulkFindOp=class extends i.ShellApiWithMongoClass{constructor(e,t){super(),this._serviceProviderBulkFindOp=e,this._parentBulk=t}get _mongo(){return this._parentBulk._mongo}[a.asPrintable](){return"BulkFindOp"}collation(e){return this._serviceProviderBulkFindOp.collation(e),this}arrayFilters(e){return this._serviceProviderBulkFindOp.arrayFilters(e),this}hint(e){return(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.hint"),this._serviceProviderBulkFindOp.hint(e),this}delete(){return this._parentBulk._batchCounts.nRemoveOps++,this._serviceProviderBulkFindOp.delete(),this._parentBulk}deleteOne(){return this._parentBulk._batchCounts.nRemoveOps++,this._serviceProviderBulkFindOp.deleteOne(),this._parentBulk}remove(){return this.delete()}removeOne(){return this.deleteOne()}replaceOne(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.replacement");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.replaceOne(t),this._parentBulk}updateOne(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.update");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.updateOne(t),this._parentBulk}update(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.update");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.update(t),this._parentBulk}upsert(){return this._serviceProviderBulkFindOp.upsert(),this}};s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"collation",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"arrayFilters",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"hint",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"delete",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"deleteOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1]),i.deprecated],c.prototype,"remove",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1]),i.deprecated],c.prototype,"removeOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"replaceOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"updateOne",null),s([(0,i.returnType)("Bulk")],c.prototype,"update",null),s([(0,i.returnType)("Bulk")],c.prototype,"upsert",null),t.BulkFindOp=c=s([i.shellApiClassDefault],c);let p=class extends i.ShellApiWithMongoClass{constructor(e,t,r=!1){super(),this._collection=e,this._mongo=e._mongo,this._serviceProviderBulkOp=t,this._batchCounts={nInsertOps:0,nUpdateOps:0,nRemoveOps:0},this._executed=!1,this._ordered=r}[a.asPrintable](){return this.toJSON()}_emitBulkApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Bulk",db:this._collection._database._name,coll:this._collection._name,arguments:t})}async execute(e){const t=await this._serviceProviderBulkOp.execute();return this._executed=!0,this._emitBulkApiCall("execute",{writeConcern:e}),new l.BulkWriteResult(!!t.ok,t.insertedCount,t.insertedIds,t.matchedCount,t.modifiedCount,t.deletedCount,t.upsertedCount,t.upsertedIds)}find(e){return(0,o.assertArgsDefinedType)([e],[!0],"Bulk.find"),new c(this._serviceProviderBulkOp.find(e),this)}insert(e){return this._batchCounts.nInsertOps++,(0,o.assertArgsDefinedType)([e],[!0],"Bulk.insert"),this._serviceProviderBulkOp.insert(e),this}toJSON(){const e=this._serviceProviderBulkOp.batches.length;return{...this._batchCounts,nBatches:e}}toString(){return JSON.stringify(this.toJSON())}getOperations(){if(!this._executed)throw new n.MongoshInvalidInputError("Cannot call getOperations on an unexecuted Bulk operation",n.CommonErrors.InvalidOperation);return this._serviceProviderBulkOp.batches.map((e=>({originalZeroIndex:e.originalZeroIndex,batchType:e.batchType,operations:e.operations})))}};s([i.returnsPromise,(0,i.apiVersions)([1])],p.prototype,"execute",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],p.prototype,"find",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],p.prototype,"insert",null),p=s([i.shellApiClassDefault],p),t.default=p},88494:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(58744),a=r(86930),o=r(6534),l=r(86901);let c=class extends i.ShellApiWithMongoClass{constructor(e,t,r){super(),this._currentIterationResult=null,this._cursor=e,this._on=t,this._mongo=r}async _it(){if(this._cursor.closed)throw new o.MongoshRuntimeError("ChangeStreamCursor is closed");const e=this._currentIterationResult=new n.CursorIterationResult;return(0,l.iterate)(e,this,await this._mongo._displayBatchSize())}[a.asPrintable](){return`ChangeStreamCursor on ${this._on}`}async close(){await this._cursor.close()}async hasNext(){return await this._instanceState.printWarning("If there are no documents in the batch, hasNext will block. Use tryNext if you want to check if there are any documents without waiting."),this._cursor.hasNext()}async tryNext(){if(this._cursor.closed)throw new o.MongoshRuntimeError("Cannot call tryNext on closed cursor");return this._cursor.tryNext()}async*[Symbol.asyncIterator](){let e;for(;null!==(e=await this.tryNext());)yield e}isClosed(){return this._cursor.closed}isExhausted(){throw new o.MongoshInvalidInputError("isExhausted is not implemented for ChangeStreams because after closing a cursor, the remaining documents in the batch are no longer accessible. If you want to see if the cursor is closed use isClosed. If you want to see if there are documents left in the batch, use tryNext.")}async itcount(){let e=0;for(;await this.tryNext();)e++;return e}async next(){return await this._instanceState.printWarning("If there are no documents in the batch, next will block. Use tryNext if you want to check if there are any documents without waiting."),this._cursor.next()}getResumeToken(){return this._cursor.resumeToken}map(){throw new o.MongoshUnimplementedError("Cannot call map on a change stream cursor")}forEach(){throw new o.MongoshUnimplementedError("Cannot call forEach on a change stream cursor")}toArray(){throw new o.MongoshUnimplementedError("Cannot call toArray on a change stream cursor")}objsLeftInBatch(){throw new o.MongoshUnimplementedError("Cannot call objsLeftInBatch on a change stream cursor")}pretty(){return this}};s([i.returnsPromise],c.prototype,"close",null),s([i.returnsPromise,i.deprecated],c.prototype,"hasNext",null),s([i.returnsPromise],c.prototype,"tryNext",null),s([i.returnsPromise],c.prototype,"itcount",null),s([i.returnsPromise],c.prototype,"next",null),s([(0,i.returnType)("ChangeStreamCursor")],c.prototype,"pretty",null),c=s([i.shellApiClassDefault],c),t.default=c},6988:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=r(86901),l=r(46993),c=r(6534),p=i(r(22234)),u=r(46177),h=i(r(20541)),d=i(r(88494)),f=r(73041);let m=class extends n.ShellApiWithMongoClass{constructor(e,t,r){return super(),this._mongo=e,this._database=t,this._name=r,new Proxy(this,{get:(e,s)=>s in e?e[s]:"string"==typeof s&&!s.startsWith("_")&&(0,o.isValidCollectionName)(s)?t.getCollection(`${r}.${s}`):void 0})}[a.namespaceInfo](){return{db:this._database.getName(),collection:this._name}}[a.asPrintable](){return`${this._database.getName()}.${this._name}`}_emitCollectionApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Collection",db:this._database._name,coll:this._name,arguments:t})}async aggregate(...e){let t,r;0===e.length||Array.isArray(e[0])?(t=e[1]||{},r=e[0]||[]):(t={},r=e||[]),this._emitCollectionApiCall("aggregate",{options:t,pipeline:r});const{aggOptions:s,dbOptions:i,explain:n}=(0,o.adaptAggregateOptions)(t),a=this._mongo._serviceProvider.aggregate(this._database._name,this._name,r,{...await this._database._baseOptions(),...s},i),c=new l.AggregationCursor(this._mongo,a);return n?await c.explain(n):((0,o.shouldRunAggregationImmediately)(r)&&await c.hasNext(),this._mongo._instanceState.currentCursor=c,c)}async bulkWrite(e,t={}){this._emitCollectionApiCall("bulkWrite",{options:t});const r=await this._mongo._serviceProvider.bulkWrite(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return new l.BulkWriteResult(!!r.ok,r.insertedCount,r.insertedIds,r.matchedCount,r.modifiedCount,r.deletedCount,r.upsertedCount,r.upsertedIds)}async count(e={},t={}){return await this._instanceState.printDeprecationWarning("Collection.count() is deprecated. Use countDocuments or estimatedDocumentCount."),this._emitCollectionApiCall("count",{query:e,options:t}),this._mongo._serviceProvider.count(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async countDocuments(e,t={}){return this._emitCollectionApiCall("countDocuments",{query:e,options:t}),this._mongo._serviceProvider.countDocuments(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async deleteMany(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.deleteMany"),this._emitCollectionApiCall("deleteMany",{filter:e,options:t});const r=await this._mongo._serviceProvider.deleteMany(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain?(0,o.markAsExplainOutput)(r):new l.DeleteResult(!!r.acknowledged,r.deletedCount)}async deleteOne(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.deleteOne"),this._emitCollectionApiCall("deleteOne",{filter:e,options:t});const r=await this._mongo._serviceProvider.deleteOne(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain?(0,o.markAsExplainOutput)(r):new l.DeleteResult(!!r.acknowledged,r.deletedCount)}async distinct(e,t,r={}){return this._emitCollectionApiCall("distinct",{field:e,query:t,options:r}),(0,o.maybeMarkAsExplainOutput)(await this._mongo._serviceProvider.distinct(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}),r)}async estimatedDocumentCount(e={}){return this._emitCollectionApiCall("estimatedDocumentCount",{options:e}),this._mongo._serviceProvider.estimatedDocumentCount(this._database._name,this._name,{...await this._database._baseOptions(),...e})}async find(e,t,r={}){t&&(r.projection=t),this._emitCollectionApiCall("find",{query:e,options:r});const s=new l.Cursor(this._mongo,this._mongo._serviceProvider.find(this._database._name,this._name,e,{...await this._database._baseOptions(),...r}));return this._mongo._instanceState.currentCursor=s,s}async findAndModify(e){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findAndModify"),(0,o.assertKeysDefined)(e,["query"]),this._emitCollectionApiCall("findAndModify",{options:{...e,update:!!e.update}});const t={...e};if(delete t.query,delete t.update,e.remove)return this.findOneAndDelete(e.query,t);const{update:r}=e;if(!r)throw new c.MongoshInvalidInputError("Must specify options.update or options.remove",c.CommonErrors.InvalidArgument);return Array.isArray(r)||Object.keys(r).some((e=>e.startsWith("$")))?this.findOneAndUpdate(e.query,r,t):this.findOneAndReplace(e.query,r,t)}async findOne(e={},t,r={}){return t&&(r.projection=t),this._emitCollectionApiCall("findOne",{query:e,options:r}),new l.Cursor(this._mongo,this._mongo._serviceProvider.find(this._database._name,this._name,e,{...await this._database._baseOptions(),...r})).limit(1).tryNext()}async renameCollection(e,t){(0,o.assertArgsDefinedType)([e],["string"],"Collection.renameCollection"),this._emitCollectionApiCall("renameCollection",{newName:e,dropTarget:t});try{return await this._mongo._serviceProvider.renameCollection(this._database._name,this._name,e,{...await this._database._baseOptions(),dropTarget:!!t}),{ok:1}}catch(e){if("MongoError"===(null==e?void 0:e.name))return{ok:0,errmsg:e.errmsg,code:e.code,codeName:e.codeName};throw e}}async findOneAndDelete(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndDelete"),this._emitCollectionApiCall("findOneAndDelete",{filter:e,options:t});const r=await this._mongo._serviceProvider.findOneAndDelete(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain&&r?(0,o.markAsExplainOutput)(r):null==r?void 0:r.value}async findOneAndReplace(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndReplace");const s=(0,o.processFindAndModifyOptions)({...await this._database._baseOptions(),...r});this._emitCollectionApiCall("findOneAndReplace",{filter:e,findOneAndReplaceOptions:s});const i=await this._mongo._serviceProvider.findOneAndReplace(this._database._name,this._name,e,t,s);return r.explain?(0,o.markAsExplainOutput)(i):i.value}async findOneAndUpdate(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndUpdate");const s=(0,o.processFindAndModifyOptions)({...await this._database._baseOptions(),...r});this._emitCollectionApiCall("findOneAndUpdate",{filter:e,findOneAndUpdateOptions:s});const i=await this._mongo._serviceProvider.findOneAndUpdate(this._database._name,this._name,e,t,s);return r.explain?(0,o.markAsExplainOutput)(i):i.value}async insert(e,t={}){await this._instanceState.printDeprecationWarning("Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite."),(0,o.assertArgsDefinedType)([e],[!0],"Collection.insert");const r=Array.isArray(e)?e.map((e=>({...e}))):[{...e}];this._emitCollectionApiCall("insert",{options:t});const s=await this._mongo._serviceProvider.insertMany(this._database._name,this._name,r,{...await this._database._baseOptions(),...t});return new l.InsertManyResult(!!s.acknowledged,s.insertedIds)}async insertMany(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.insertMany");const r=Array.isArray(e)?e.map((e=>({...e}))):e;this._emitCollectionApiCall("insertMany",{options:t});const s=await this._mongo._serviceProvider.insertMany(this._database._name,this._name,r,{...await this._database._baseOptions(),...t});return new l.InsertManyResult(!!s.acknowledged,s.insertedIds)}async insertOne(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.insertOne"),this._emitCollectionApiCall("insertOne",{options:t});const r=await this._mongo._serviceProvider.insertOne(this._database._name,this._name,{...e},{...await this._database._baseOptions(),...t});return new l.InsertOneResult(!!r.acknowledged,r.insertedId)}async isCapped(){var e,t;this._emitCollectionApiCall("isCapped");const r=await this._database._listCollections({name:this._name},{nameOnly:!1});if(0===r.length)throw new c.MongoshRuntimeError(`collection ${this.getFullName()} not found`);return!!(null===(t=null===(e=r[0])||void 0===e?void 0:e.options)||void 0===t?void 0:t.capped)}async remove(e,t={}){await this._instanceState.printDeprecationWarning("Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite."),(0,o.assertArgsDefinedType)([e],[!0],"Collection.remove");const r=(0,o.processRemoveOptions)(t),s=r.justOne?"deleteOne":"deleteMany";delete r.justOne,this._emitCollectionApiCall("remove",{query:e,removeOptions:r});const i=await this._mongo._serviceProvider[s](this._database._name,this._name,e,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(i):new l.DeleteResult(!!i.acknowledged,i.deletedCount)}async replaceOne(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.replaceOne"),this._emitCollectionApiCall("replaceOne",{filter:e,options:r});const s=await this._mongo._serviceProvider.replaceOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async update(e,t,r={}){let s;return await this._instanceState.printDeprecationWarning("Collection.update() is deprecated. Use updateOne, updateMany, or bulkWrite."),(0,o.assertArgsDefinedType)([e,t],[!0,!0],"Collection.update"),this._emitCollectionApiCall("update",{filter:e,options:r}),s=r.multi?await this._mongo._serviceProvider.updateMany(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}):await this._mongo._serviceProvider.updateOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}),r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async updateMany(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.updateMany"),this._emitCollectionApiCall("updateMany",{filter:e,options:r});const s=await this._mongo._serviceProvider.updateMany(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async updateOne(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.updateOne"),this._emitCollectionApiCall("updateOne",{filter:e,options:r});const s=await this._mongo._serviceProvider.updateOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async compactStructuredEncryptionData(){if(!this._mongo._fleOptions)throw new c.MongoshInvalidInputError('The "compactStructuredEncryptionData" command requires Mongo instance configured with auto encryption.',c.CommonErrors.InvalidArgument);return this._emitCollectionApiCall("compactStructuredEncryptionData"),await this._database._runCommand({compactStructuredEncryptionData:this._name})}async convertToCapped(e){return this._emitCollectionApiCall("convertToCapped",{size:e}),await this._database._runCommand({convertToCapped:this._name,size:e})}async _createIndexes(e,t={},r){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.createIndexes"),"object"!=typeof t||Array.isArray(t))throw new c.MongoshInvalidInputError('The "options" argument must be an object.',c.CommonErrors.InvalidArgument);const s=e.map((e=>({...t,key:e}))),i={...await this._database._baseOptions(),...t};return void 0!==r&&(i.commitQuorum=r),await this._mongo._serviceProvider.createIndexes(this._database._name,this._name,s,i)}async createIndexes(e,t={},r){const s=e.map((e=>({...t,key:e})));return this._emitCollectionApiCall("createIndexes",{specs:s}),this._createIndexes(e,t,r)}async createIndex(e,t={},r){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.createIndex"),"object"!=typeof t||Array.isArray(t))throw new c.MongoshInvalidInputError('The "options" argument must be an object.',c.CommonErrors.InvalidArgument);this._emitCollectionApiCall("createIndex",{keys:e,options:t});const s=await this._createIndexes([e],t,r);if(!Array.isArray(s)||1!==s.length)throw new c.MongoshInternalError(`Expected createIndexes() to return array of length 1, saw ${s.toString()}`);return s[0]}async ensureIndex(e,t={},r){return this._emitCollectionApiCall("ensureIndex",{keys:e,options:t}),await this._createIndexes([e],t,r)}async getIndexes(){return this._emitCollectionApiCall("getIndexes"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndexSpecs(){return this._emitCollectionApiCall("getIndexSpecs"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndices(){return this._emitCollectionApiCall("getIndices"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndexKeys(){return this._emitCollectionApiCall("getIndexKeys"),(await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())).map((e=>e.key))}async dropIndexes(e="*"){this._emitCollectionApiCall("dropIndexes",{indexes:e});try{return await this._database._runCommand({dropIndexes:this._name,index:e})}catch(t){if(("IndexNotFound"===(null==t?void 0:t.codeName)||void 0===(null==t?void 0:t.codeName))&&("invalid index name spec"===(null==t?void 0:t.errmsg)||void 0===(null==t?void 0:t.errmsg))&&Array.isArray(e)&&e.length>0&&/^4\.0\./.exec(await this._database.version())){const t=await Promise.all(e.map((async e=>await this.dropIndexes(e))));return t.find((e=>!e.ok))||t.sort(((e,t)=>t.nIndexesWas-e.nIndexesWas))[0]}if("IndexNotFound"===(null==t?void 0:t.codeName))return{ok:t.ok,errmsg:t.errmsg,code:t.code,codeName:t.codeName};throw t}}async dropIndex(e){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.dropIndex"),this._emitCollectionApiCall("dropIndex",{index:e}),"*"===e)throw new c.MongoshInvalidInputError("To drop indexes in the collection using '*', use db.collection.dropIndexes().",c.CommonErrors.InvalidArgument);if(Array.isArray(e))throw new c.MongoshInvalidInputError("The index to drop must be either the index name or the index specification document.",c.CommonErrors.InvalidArgument);return this.dropIndexes(e)}async _getSingleStorageStatValue(e){const t=await this.aggregate([{$collStats:{storageStats:{}}},{$group:{_id:null,value:{$sum:`$storageStats.${e}`}}}]),[{value:r}]=await t.toArray();return r}async totalIndexSize(...e){if(this._emitCollectionApiCall("totalIndexSize"),e.length)throw new c.MongoshInvalidInputError('"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.',c.CommonErrors.InvalidArgument);return this._getSingleStorageStatValue("totalIndexSize")}async reIndex(){return this._emitCollectionApiCall("reIndex"),await this._database._runCommand({reIndex:this._name})}getDB(){return this._emitCollectionApiCall("getDB"),this._database}getMongo(){return this._emitCollectionApiCall("getMongo"),this._mongo}async dataSize(){return this._emitCollectionApiCall("dataSize"),this._getSingleStorageStatValue("size")}async storageSize(){return this._emitCollectionApiCall("storageSize"),this._getSingleStorageStatValue("storageSize")}async totalSize(){return this._emitCollectionApiCall("totalSize"),this._getSingleStorageStatValue("totalSize")}async drop(e={}){var t,r,s;this._emitCollectionApiCall("drop");let i={};const n=null===(t=this._mongo._fleOptions)||void 0===t?void 0:t.encryptedFieldsMap;if(!(null==n?void 0:n[`${this._database._name}.${this._name}`])&&!e.encryptedFields)try{const e=await this._mongo._serviceProvider.listCollections(this._database._name,{name:this._name},await this._database._baseOptions()),t=null===(s=null===(r=null==e?void 0:e[0])||void 0===r?void 0:r.options)||void 0===s?void 0:s.encryptedFields;t&&(i={encryptedFields:t})}catch(e){}try{return await this._mongo._serviceProvider.dropCollection(this._database._name,this._name,{...await this._database._baseOptions(),...e,...i})}catch(e){if("NamespaceNotFound"===(null==e?void 0:e.codeName))return this._mongo._instanceState.messageBus.emit("mongosh:warn",{method:"drop",class:"Collection",message:`Namespace not found: ${this._name}`}),!1;throw e}}async exists(){return this._emitCollectionApiCall("exists"),(await this._mongo._serviceProvider.listCollections(this._database._name,{name:this._name},await this._database._baseOptions()))[0]||null}getFullName(){return this._emitCollectionApiCall("getFullName"),`${this._database._name}.${this._name}`}getName(){return this._emitCollectionApiCall("getName"),`${this._name}`}async runCommand(e,t){if((0,o.assertArgsDefinedType)([e],[["string","object"]],"Collection.runCommand"),t){if("string"!=typeof e)throw new c.MongoshInvalidInputError("Collection.runCommand takes a command string as its first arugment",c.CommonErrors.InvalidArgument);if(e in t)throw new c.MongoshInvalidInputError('The "commandName" argument cannot be passed as an option to "runCommand".',c.CommonErrors.InvalidArgument)}const r=new RegExp(u.HIDDEN_COMMANDS);"string"!=typeof e||r.test(e)||this._emitCollectionApiCall("runCommand",{commandName:e});const s="string"==typeof e?{[e]:this._name,...t}:e;return await this._database._runCommand(s)}explain(e="queryPlanner"){return e=(0,o.validateExplainableVerbosity)(e),this._emitCollectionApiCall("explain",{verbosity:e}),new l.Explainable(this._mongo,this,e)}async _getLegacyCollStats(e){const t=await this._database._runReadCommand({collStats:this._name,scale:e||1});if(!t)throw new c.MongoshRuntimeError(`Error running collStats command on ${this.getFullName()}`,c.CommonErrors.CommandFailed);return t}async _aggregateAndScaleCollStats(e,t){var r;const s={ok:1},i={},n={},a={},l={};let c,p=0,u=0,h=0,d=0;for(const f of e){const e=f.storageStats,m=e.count,y=void 0!==m?m:0;for(const t of Object.keys(e))if(!["ns","ok","lastExtentSize","paddingFactor"].includes(t))if(["userFlags","capped","max","paddingFactorNote","indexDetails","wiredTiger"].includes(t))null!==(r=s[t])&&void 0!==r||(s[t]=e[t]);else if("timeseries"===t){const r=e[t];for(const[e,t]of Object.entries(r))"string"==typeof t?c||(c=t):"avgBucketSize"===e?d+=(0,o.coerceToJSNumber)(r.bucketCount)*(0,o.coerceToJSNumber)(t):(void 0===l[e]&&(l[e]=0),l[e]+=(0,o.coerceToJSNumber)(t))}else if(["count","size","storageSize","totalIndexSize","totalSize","numOrphanDocs"].includes(t))void 0===n[t]&&(n[t]=0),n[t]+=(0,o.coerceToJSNumber)(e[t]);else if("avgObjSize"===t)u+=(0,o.coerceToJSNumber)(e[t])*y;else if("maxSize"===t){const r=(0,o.coerceToJSNumber)(e[t]);p=Math.max(p,r)}else if("indexSizes"===t)for(const r of Object.keys(e[t]))void 0===a[r]&&(a[r]=0),a[r]+=(0,o.coerceToJSNumber)(e[t][r]);else if("nindexes"===t){const r=e[t];(0===h||r>h)&&(h=r)}f.shard&&(i[f.shard]=(0,o.scaleIndividualShardStatistics)(e,t))}const f=`${this._database._name}.${this._name}`,m=this._mongo.getDB("config");e[0].shard&&(s.shards=i);try{s.sharded=!!await m.getCollection("collections").findOne({_id:null!=c?c:f,dropped:{$ne:!0}})}catch(t){s.sharded=e.length>1}for(const[e,r]of Object.entries(n))["size","storageSize","totalIndexSize","totalSize"].includes(e)?s[e]=r/t:s[e]=r;c&&Object.keys(l).length>0&&(s.timeseries={...l,avgBucketSize:l.bucketCount?d/l.bucketCount:0,bucketsNs:c}),s.indexSizes={};for(const[e,r]of Object.entries(a))s.indexSizes[e]=r/t;return n.count>0?s.avgObjSize=u/n.count:s.avgObjSize=0,s.capped&&(s.maxSize=p/t),s.ns=f,s.nindexes=h,void 0!==e[0].storageStats.scaleFactor&&(s.scaleFactor=t),s.ok=1,s}async _getAggregatedCollStats(e){try{const t=await(await this.aggregate([{$collStats:{storageStats:{scale:1}}}])).toArray();if(!t||void 0===t[0])throw new c.MongoshRuntimeError(`Error running $collStats aggregation stage on ${this.getFullName()}`,c.CommonErrors.CommandFailed);return await this._aggregateAndScaleCollStats(t,e)}catch(t){if("StaleConfig"===(null==t?void 0:t.codeName)||13388===(null==t?void 0:t.code))try{return await this._getLegacyCollStats(e)}catch(e){throw t}throw t}}async stats(e={}){var t;const r="number"==typeof e?{scale:e}:e;if(r.indexDetailsKey&&r.indexDetailsName)throw new c.MongoshInvalidInputError("Cannot filter indexDetails on both indexDetailsKey and indexDetailsName",c.CommonErrors.InvalidArgument);if(r.indexDetailsKey&&"object"!=typeof r.indexDetailsKey)throw new c.MongoshInvalidInputError("Expected options.indexDetailsKey to be a document, got "+typeof r.indexDetailsKey,c.CommonErrors.InvalidArgument);if(r.indexDetailsName&&"string"!=typeof r.indexDetailsName)throw new c.MongoshInvalidInputError("Expected options.indexDetailsName to be a string, got "+typeof r.indexDetailsName,c.CommonErrors.InvalidArgument);r.scale=r.scale||1,r.indexDetails=r.indexDetails||!1,this._emitCollectionApiCall("stats",{options:r});const s=await this._getAggregatedCollStats(r.scale);let i=r.indexDetailsName;!i&&r.indexDetailsKey&&(await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())).forEach((e=>{JSON.stringify(e.key)===JSON.stringify(r.indexDetailsKey)&&(i=e.name)}));const n=e=>{if(e.indexDetails)if(r.indexDetails){if(i)for(const t of Object.keys(e.indexDetails))t!==i&&delete e.indexDetails[t]}else delete e.indexDetails};n(s);for(const e of Object.keys(null!==(t=s.shards)&&void 0!==t?t:{}))n(s.shards[e]);return s}async latencyStats(e={}){return this._emitCollectionApiCall("latencyStats",{options:e}),await(await this.aggregate([{$collStats:{latencyStats:e}}])).toArray()}async initializeOrderedBulkOp(){this._emitCollectionApiCall("initializeOrderedBulkOp");const e=await this._mongo._serviceProvider.initializeBulkOp(this._database._name,this._name,!0,await this._database._baseOptions());return new p.default(this,e,!0)}async initializeUnorderedBulkOp(){this._emitCollectionApiCall("initializeUnorderedBulkOp");const e=await this._mongo._serviceProvider.initializeBulkOp(this._database._name,this._name,!1,await this._database._baseOptions());return new p.default(this,e)}getPlanCache(){return this._emitCollectionApiCall("getPlanCache"),new h.default(this)}async mapReduce(e,t,r){await this._instanceState.printDeprecationWarning("Collection.mapReduce() is deprecated. Use an aggregation instead.\nSee https://docs.mongodb.com/manual/core/map-reduce for details."),(0,o.assertArgsDefinedType)([e,t,r],[!0,!0,!0],"Collection.mapReduce"),this._emitCollectionApiCall("mapReduce",{map:e,reduce:t,out:r});let s={mapReduce:this._name,map:e,reduce:t,...(0,o.processMapReduceOptions)(r)};if(s.explain){const e=s.explain;delete s.explain,s={explain:s,verbosity:e}}return await this._database._runCommand(s)}async validate(e=!1){return this._emitCollectionApiCall("validate",{options:e}),"boolean"==typeof e&&(e={full:e}),await this._database._runReadCommand({validate:this._name,...e})}async getShardVersion(){return this._emitCollectionApiCall("getShardVersion",{}),await this._database._runAdminCommand({getShardVersion:`${this._database._name}.${this._name}`})}async getShardDistribution(){this._emitCollectionApiCall("getShardDistribution",{});const e={},t=this._mongo.getDB("config"),r=`${this._database._name}.${this._name}`,s=await t.getCollection("collections").findOne({_id:r,dropped:{$ne:!0}});if(!s)throw new c.MongoshInvalidInputError(`Collection ${this._name} is not sharded`,f.ShellApiErrors.NotConnectedToShardedCluster);const i=await(await this.aggregate({$collStats:{storageStats:{}}})).toArray(),n={numChunks:0,size:0,count:0},a=[];await Promise.all(i.map((r=>(async()=>{const{shard:i}=r,l={...(0,o.buildConfigChunksCollectionMatch)(s),shard:i},[c,p]=await Promise.all([t.getCollection("shards").findOne({_id:r.shard}),t.getCollection("chunks").countDocuments(l)]),u={shardId:i,host:null!==c?c.host:null,size:r.storageStats.size,count:r.storageStats.count,numChunks:p,avgObjSize:r.storageStats.avgObjSize},h=`Shard ${u.shardId} at ${u.host}`,d=0===u.numChunks?0:u.size/u.numChunks,f=0===u.numChunks?0:Math.floor(u.count/u.numChunks);e[h]={data:(0,o.dataFormat)((0,o.coerceToJSNumber)(u.size)),docs:u.count,chunks:u.numChunks,"estimated data per chunk":(0,o.dataFormat)(d),"estimated docs per chunk":f},n.size+=(0,o.coerceToJSNumber)(u.size),n.count+=(0,o.coerceToJSNumber)(u.count),n.numChunks+=(0,o.coerceToJSNumber)(u.numChunks),a.push(u)})())));const p={data:(0,o.dataFormat)(n.size),docs:n.count,chunks:n.numChunks};for(const e of a){const t=0===n.size?0:Math.floor(e.size/n.size*1e4)/100,r=0===n.count?0:Math.floor(e.count/n.count*1e4)/100;p[`Shard ${e.shardId}`]=[`${t} % data`,`${r} % docs in cluster`,`${(0,o.dataFormat)(e.avgObjSize)} avg obj size on shard`]}return e.Totals=p,new l.CommandResult("StatsResult",e)}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitCollectionApiCall("watch",{pipeline:e,options:t});const r=new d.default(this._mongo._serviceProvider.watch(e,{...await this._database._baseOptions(),...t},{},this._database._name,this._name),this._name,this._mongo);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._mongo._instanceState.currentCursor=r,r}async hideIndex(e){return this._emitCollectionApiCall("hideIndex"),(0,o.setHideIndex)(this,e,!0)}async unhideIndex(e){return this._emitCollectionApiCall("unhideIndex"),(0,o.setHideIndex)(this,e,!1)}async analyzeShardKey(e,t={}){return(0,o.assertArgsDefinedType)([e],[!0],"Collection.analyzeShardKey"),this._emitCollectionApiCall("analyzeShardKey",{key:e}),await this._database._runAdminCommand({analyzeShardKey:this.getFullName(),key:e,...t})}async configureQueryAnalyzer(e){return this._emitCollectionApiCall("configureQueryAnalyzer",e),await this._database._runAdminCommand({configureQueryAnalyzer:this.getFullName(),...e})}async checkMetadataConsistency(e={}){return this._emitCollectionApiCall("checkMetadataConsistency",{options:e}),this._database._runCursorCommand({checkMetadataConsistency:this._name})}async getSearchIndexes(e,t){return"object"==typeof e&&null!==e&&(t=e,e=void 0),this._emitCollectionApiCall("getSearchIndexes",{options:t}),await this._mongo._serviceProvider.getSearchIndexes(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async createSearchIndex(e,t){var r;return"object"==typeof e&&null!==e&&(t=e,e=void 0),this._emitCollectionApiCall("createSearchIndex",{indexName:e,definition:t}),(await this._mongo._serviceProvider.createSearchIndexes(this._database._name,this._name,[{name:null!==(r=e)&&void 0!==r?r:"default",definition:{...t}}]))[0]}async createSearchIndexes(e){return this._emitCollectionApiCall("createSearchIndexes",{specs:e}),await this._mongo._serviceProvider.createSearchIndexes(this._database._name,this._name,e)}async dropSearchIndex(e){return this._emitCollectionApiCall("dropSearchIndex",{indexName:e}),await this._mongo._serviceProvider.dropSearchIndex(this._database._name,this._name,e)}async updateSearchIndex(e,t){return this._emitCollectionApiCall("updateSearchIndex",{indexName:e,definition:t}),await this._mongo._serviceProvider.updateSearchIndex(this._database._name,this._name,e,t)}};s([n.returnsPromise,(0,n.returnType)("AggregationCursor"),(0,n.apiVersions)([1])],m.prototype,"aggregate",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"bulkWrite",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"]),(0,n.apiVersions)([])],m.prototype,"count",null),s([n.returnsPromise,(0,n.serverVersions)(["4.0.3",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"countDocuments",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"deleteMany",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"deleteOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"distinct",null),s([n.returnsPromise,(0,n.serverVersions)(["4.0.3",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"estimatedDocumentCount",null),s([(0,n.returnType)("Cursor"),(0,n.apiVersions)([1]),n.returnsPromise],m.prototype,"find",null),s([n.returnsPromise,n.deprecated,(0,n.apiVersions)([1])],m.prototype,"findAndModify",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.apiVersions)([1])],m.prototype,"findOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"renameCollection",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndDelete",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndReplace",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndUpdate",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.6.0"]),(0,n.apiVersions)([1])],m.prototype,"insert",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"insertMany",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"insertOne",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"isCapped",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"]),(0,n.apiVersions)([1])],m.prototype,"remove",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"replaceOne",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"]),(0,n.apiVersions)([1])],m.prototype,"update",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"updateMany",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"updateOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"compactStructuredEncryptionData",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"convertToCapped",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"createIndexes",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"createIndex",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"ensureIndex",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexes",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexSpecs",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"getIndices",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexKeys",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"dropIndexes",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"dropIndex",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"totalIndexSize",null),s([n.returnsPromise,n.deprecated,(0,n.topologies)([a.Topologies.Standalone]),(0,n.apiVersions)([])],m.prototype,"reIndex",null),s([(0,n.returnType)("Database")],m.prototype,"getDB",null),s([(0,n.returnType)("Mongo")],m.prototype,"getMongo",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"dataSize",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"storageSize",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"totalSize",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"drop",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"exists",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"runCommand",null),s([(0,n.returnType)("Explainable"),(0,n.apiVersions)([1])],m.prototype,"explain",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"stats",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"latencyStats",null),s([n.returnsPromise,(0,n.returnType)("Bulk"),(0,n.apiVersions)([1])],m.prototype,"initializeOrderedBulkOp",null),s([n.returnsPromise,(0,n.returnType)("Bulk"),(0,n.apiVersions)([1])],m.prototype,"initializeUnorderedBulkOp",null),s([(0,n.returnType)("PlanCache"),(0,n.apiVersions)([])],m.prototype,"getPlanCache",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.9.0"]),(0,n.apiVersions)([])],m.prototype,"mapReduce",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"validate",null),s([n.returnsPromise,(0,n.topologies)([a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"getShardVersion",null),s([n.returnsPromise,(0,n.topologies)([a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"getShardDistribution",null),s([(0,n.serverVersions)(["3.1.0",a.ServerVersions.latest]),(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([1]),n.returnsPromise],m.prototype,"watch",null),s([(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"hideIndex",null),s([(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"unhideIndex",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"analyzeShardKey",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"configureQueryAnalyzer",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),(0,n.topologies)([a.Topologies.Sharded]),n.returnsPromise],m.prototype,"checkMetadataConsistency",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"getSearchIndexes",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"createSearchIndex",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"createSearchIndexes",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"dropSearchIndex",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"updateSearchIndex",null),m=s([n.shellApiClassDefault,n.addSourceToResults],m),t.default=m},4564:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(40191),a=r(86930),o=r(73251);let l=class extends o.AggregateOrFindCursor{constructor(e,t){super(e,t),this._tailable=!1}_addFlag(e){this._cursor.addCursorFlag(e,!0)}addOption(e){if(4===e)throw new i.MongoshUnimplementedError("the slaveOk option is not supported.",i.CommonErrors.NotImplemented);const t=a.CURSOR_FLAGS[e];if(!t)throw new i.MongoshInvalidInputError(`Unknown option flag number: ${e}.`,i.CommonErrors.InvalidArgument);return this._cursor.addCursorFlag(t,!0),this}allowDiskUse(e){return this._cursor.allowDiskUse(e),this}allowPartialResults(){return this._addFlag("partial"),this}collation(e){return this._cursor.collation(e),this}comment(e){return this._cursor.comment(e),this}async count(){return this._cursor.count()}async hasNext(){return this._tailable&&await this._instanceState.printWarning("If this is a tailable cursor with awaitData, and there are no documents in the batch, this method will will block. Use tryNext if you want to check if there are any documents without waiting."),super.hasNext()}hint(e){return this._cursor.hint(e),this}limit(e){return this._cursor.limit(e),this}max(e){return this._cursor.max(e),this}maxAwaitTimeMS(e){return this._cursor.maxAwaitTimeMS(e),this}min(e){return this._cursor.min(e),this}async next(){return this._tailable&&await this._instanceState.printWarning("If this is a tailable cursor with awaitData, and there are no documents in the batch, this method will will block. Use tryNext if you want to check if there are any documents without waiting."),super.next()}noCursorTimeout(){return this._addFlag("noCursorTimeout"),this}oplogReplay(){return this._addFlag("oplogReplay"),this}readPref(e,t,r){let s;return s=t||r?this._mongo._serviceProvider.readPreferenceFromOptions({readPreference:e,readPreferenceTags:t,hedge:r}):e,this._cursor=this._cursor.withReadPreference(s),this}returnKey(e){return this._cursor.returnKey(e),this}async size(){return this._cursor.count()}tailable(e={awaitData:!1}){return this._tailable=!0,this._addFlag("tailable"),e.awaitData&&this._addFlag("awaitData"),this}maxScan(){throw new i.MongoshDeprecatedError("`maxScan()` was removed because it was deprecated in MongoDB 4.0")}showRecordId(){return this._cursor.showRecordId(!0),this}readConcern(e){return this._cursor=this._cursor.withReadConcern({level:e}),this}};s([(0,n.returnType)("Cursor"),(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"])],l.prototype,"addOption",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest])],l.prototype,"allowDiskUse",null),s([(0,n.returnType)("Cursor")],l.prototype,"allowPartialResults",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.4.0",a.ServerVersions.latest])],l.prototype,"collation",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"comment",null),s([(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"]),n.returnsPromise,n.deprecated],l.prototype,"count",null),s([n.returnsPromise],l.prototype,"hasNext",null),s([(0,n.returnType)("Cursor")],l.prototype,"hint",null),s([(0,n.returnType)("Cursor")],l.prototype,"limit",null),s([(0,n.returnType)("Cursor")],l.prototype,"max",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"maxAwaitTimeMS",null),s([(0,n.returnType)("Cursor")],l.prototype,"min",null),s([n.returnsPromise],l.prototype,"next",null),s([(0,n.returnType)("Cursor")],l.prototype,"noCursorTimeout",null),s([(0,n.returnType)("Cursor")],l.prototype,"oplogReplay",null),s([(0,n.returnType)("Cursor")],l.prototype,"readPref",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"returnKey",null),s([n.returnsPromise],l.prototype,"size",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([])],l.prototype,"tailable",null),s([n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"])],l.prototype,"maxScan",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"showRecordId",null),s([(0,n.returnType)("Cursor")],l.prototype,"readConcern",null),l=s([n.shellApiClassDefault],l),t.default=l},78041:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(r(6988)),a=r(40191),o=r(86930),l=r(86901),c=r(46993),p=r(6534),u=r(46177),h=i(r(88494)),d=r(73041);let f=class extends a.ShellApiWithMongoClass{constructor(e,t,r){super(),this._cachedCollectionNames=[],this._cachedHello=null,this._mongo=e,this._name=t;const s=Object.create(null);this._collections=s,this._session=r;const i=new Proxy(this,{get:(t,r)=>r in t?t[r]:"string"==typeof r&&!r.startsWith("_")&&(0,l.isValidCollectionName)(r)?(s[r]||(s[r]=new n.default(e,i,r)),s[r]):void 0});return i}async _baseOptions(){const e={};this._session&&(e.session=this._session._session);const t=await this._instanceState.shellApi.config.get("maxTimeMS");return"number"==typeof t&&(e.maxTimeMS=t),e}async _maybeCachedHello(){var e;return null!==(e=this._cachedHello)&&void 0!==e?e:await this.hello()}[o.asPrintable](){return this._name}_emitDatabaseApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Database",db:this._name,arguments:t})}async _runCommand(e,t={}){return this._mongo._serviceProvider.runCommandWithCheck(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...await this._baseOptions(),...t})}async _runReadCommand(e,t={}){return this._mongo._serviceProvider.runCommandWithCheck(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t})}async _runAdminCommand(e,t={}){return this.getSiblingDB("admin")._runCommand(e,{...await this._baseOptions(),...t})}async _runCursorCommand(e,t={}){const r=this._mongo._serviceProvider.runCursorCommand(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t}),s=new c.RunCommandCursor(this._mongo,r);return this._mongo._instanceState.currentCursor=s,s}async _runAdminCursorCommand(e,t={}){return this.getSiblingDB("admin")._runCursorCommand(e,t)}async _listCollections(e,t){return await this._mongo._serviceProvider.listCollections(this._name,e,{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t})||[]}async _getCollectionNames(e){const t=await this._listCollections({},{...e,nameOnly:!0});return this._cachedCollectionNames=t.map((e=>e.name)),this._cachedCollectionNames}async _getCollectionNamesWithTypes(e){let t=await this._listCollections({},{...e,nameOnly:!0});return t=t.sort(((e,t)=>e.name.localeCompare(t.name))),this._cachedCollectionNames=t.map((e=>e.name)),t.map(((e,r)=>({name:e.name,badge:(0,l.getBadge)(t,r)})))}async _getCollectionNamesForCompletion(){return await Promise.race([(async()=>await this._getCollectionNames({readPreference:"primaryPreferred"}))(),(async()=>(await new Promise((e=>setTimeout(e,200).unref())),this._cachedCollectionNames))()])}async _getLastErrorObj(e,t,r){const s={getlasterror:1};e&&(s.w=e),t&&(s.wtimeout=t),void 0!==r&&(s.j=r);try{return await this._mongo._serviceProvider.runCommand(this._name,s,await this._baseOptions())}catch(e){return e}}getMongo(){return this._mongo}getName(){return this._name}async getCollectionNames(){return this._emitDatabaseApiCall("getCollectionNames"),this._getCollectionNames()}async getCollectionInfos(e={},t={}){return this._emitDatabaseApiCall("getCollectionInfos",{filter:e,options:t}),await this._listCollections(e,t)}async runCommand(e,t){(0,l.assertArgsDefinedType)([e],[["string","object"]],"Database.runCommand"),"string"==typeof e&&(e={[e]:1});const r=new RegExp(u.HIDDEN_COMMANDS);return Object.keys(e).some((e=>r.test(e)))||this._emitDatabaseApiCall("runCommand",{cmd:e,options:t}),this._runCommand(e,t)}async adminCommand(e){(0,l.assertArgsDefinedType)([e],[["string","object"]],"Database.adminCommand"),"string"==typeof e&&(e={[e]:1});const t=new RegExp(u.HIDDEN_COMMANDS);return Object.keys(e).some((e=>t.test(e)))||this._emitDatabaseApiCall("adminCommand",{cmd:e}),await this._runAdminCommand(e,{})}async aggregate(e,t){(0,l.assertArgsDefinedType)([e],[!0],"Database.aggregate"),this._emitDatabaseApiCall("aggregate",{options:t,pipeline:e});const{aggOptions:r,dbOptions:s,explain:i}=(0,l.adaptAggregateOptions)(t),n=this._mongo._serviceProvider.aggregateDb(this._name,e,{...await this._baseOptions(),...r},s),a=new c.AggregationCursor(this._mongo,n);return i?await a.explain(i):((0,l.shouldRunAggregationImmediately)(e)&&await a.hasNext(),this._mongo._instanceState.currentCursor=a,a)}getSiblingDB(e){return(0,l.assertArgsDefinedType)([e],["string"],"Database.getSiblingDB"),this._emitDatabaseApiCall("getSiblingDB",{db:e}),this._session?this._session.getDatabase(e):this._mongo._getDb(e)}getCollection(e){if((0,l.assertArgsDefinedType)([e],["string"],"Database.getColl"),this._emitDatabaseApiCall("getCollection",{coll:e}),!(0,l.isValidCollectionName)(e))throw new p.MongoshInvalidInputError(`Invalid collection name: ${e}`,p.CommonErrors.InvalidArgument);const t=this._collections;return t[e]||(t[e]=new n.default(this._mongo,this,e)),t[e]}async dropDatabase(e){return await this._mongo._serviceProvider.dropDatabase(this._name,{...await this._baseOptions(),writeConcern:e})}async createUser(e,t){if((0,l.assertArgsDefinedType)([e],["object"],"Database.createUser"),(0,l.assertKeysDefined)(e,["user","roles"]),"$external"===this._name){if("pwd"in e)throw new p.MongoshInvalidInputError("Cannot set password for users on the $external database",p.CommonErrors.InvalidArgument)}else(0,l.assertKeysDefined)(e,["pwd"]);if(this._emitDatabaseApiCall("createUser",{}),e.createUser)throw new p.MongoshInvalidInputError("Cannot set createUser field in helper method",p.CommonErrors.InvalidArgument);const r=(0,l.adaptOptions)({user:"createUser",passwordDigestor:null},{},e);t&&(r.writeConcern=t);const s=(0,l.processDigestPassword)(e.user,e.passwordDigestor,r),i={createUser:r.createUser,...r,...s};return await this._runCommand(i)}async updateUser(e,t,r){if((0,l.assertArgsDefinedType)([e,t],["string","object"],"Database.updateUser"),this._emitDatabaseApiCall("updateUser",{}),t.passwordDigestor&&"server"!==t.passwordDigestor&&"client"!==t.passwordDigestor)throw new p.MongoshInvalidInputError(`Invalid field: passwordDigestor must be 'client' or 'server', got ${t.passwordDigestor}`,p.CommonErrors.InvalidArgument);const s=(0,l.adaptOptions)({passwordDigestor:null},{updateUser:e},t);r&&(s.writeConcern=r);const i=(0,l.processDigestPassword)(e,t.passwordDigestor,s),n={updateUser:s.updateUser,...s,...i};return await this._runCommand(n)}async changeUserPassword(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string","string"],"Database.changeUserPassword"),this._emitDatabaseApiCall("changeUserPassword",{});const s=(0,l.adaptOptions)({},{updateUser:e,pwd:t},{});r&&(s.writeConcern=r);const i={updateUser:s.updateUser,...s};return await this._runCommand(i)}async logout(){return this._emitDatabaseApiCall("logout",{}),this._mongo._instanceState.currentCursor=null,await this._runCommand({logout:1})}async dropUser(e,t){(0,l.assertArgsDefinedType)([e],["string"],"Database.dropUser"),this._emitDatabaseApiCall("dropUser",{});const r={dropUser:e};return t&&(r.writeConcern=t),await this._runCommand(r)}async dropAllUsers(e){this._emitDatabaseApiCall("dropAllUsers",{});const t={dropAllUsersFromDatabase:1};return e&&(t.writeConcern=e),await this._runCommand(t)}async auth(...e){let t;if(this._emitDatabaseApiCall("auth",{}),1===e.length){const{evaluationListener:r}=this._mongo._instanceState;t="string"==typeof e[0]&&r.onPrompt?{user:e[0],pwd:await r.onPrompt("Enter password","password")}:e[0]}else{if(2!==e.length)throw new p.MongoshInvalidInputError("auth expects (username), (username, password), or ({ user: username, pwd: password })",p.CommonErrors.InvalidArgument);t={user:e[0],pwd:e[1]}}if(!(t.user&&t.pwd||t.mechanism))throw new p.MongoshInvalidInputError("auth expects user document with at least 'user' and 'pwd' or 'mechanism' fields",p.CommonErrors.InvalidArgument);if("digestPassword"in t)throw new p.MongoshUnimplementedError("digestPassword is not supported for authentication.",p.CommonErrors.NotImplemented);return t.authDb=this._name,this._mongo._instanceState.currentCursor=null,await this._mongo._serviceProvider.authenticate(t)}async grantRolesToUser(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantRolesToUser"),this._emitDatabaseApiCall("grantRolesToUser",{});const s={grantRolesToUser:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokeRolesFromUser(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokeRolesFromUser"),this._emitDatabaseApiCall("revokeRolesFromUser",{});const s={revokeRolesFromUser:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async getUser(e,t={}){(0,l.assertArgsDefinedType)([e],["string"],"Database.getUser"),this._emitDatabaseApiCall("getUser",{username:e});const r=(0,l.adaptOptions)({},{usersInfo:{user:e,db:this._name}},t),s=await this._runReadCommand(r);if(void 0===s.users)throw new p.MongoshInternalError("No users were returned from the userInfo command");for(let t=0;t<s.users.length;t++)if(s.users[t].user===e)return s.users[t];return null}async getUsers(e={}){this._emitDatabaseApiCall("getUsers",{options:e});const t=(0,l.adaptOptions)({},{usersInfo:1},e);return await this._runReadCommand(t)}async createCollection(e,t={}){return(0,l.assertArgsDefinedType)([e],["string"],"Database.createCollection"),this._emitDatabaseApiCall("createCollection",{name:e,options:t}),await this._mongo._serviceProvider.createCollection(this._name,e,{...await this._baseOptions(),...t})}async createEncryptedCollection(e,t){return this._emitDatabaseApiCall("createEncryptedCollection",{name:e,options:t}),this._mongo.getClientEncryption().createEncryptedCollection(this._name,e,t)}async createView(e,t,r,s={}){(0,l.assertArgsDefinedType)([e,t,r],["string","string",!0],"Database.createView"),this._emitDatabaseApiCall("createView",{name:e,source:t,pipeline:r,options:s});const i={...await this._baseOptions(),viewOn:t,pipeline:r};return s.collation&&(i.collation=s.collation),await this._mongo._serviceProvider.createCollection(this._name,e,i)}async createRole(e,t){if((0,l.assertArgsDefinedType)([e],["object"],"Database.createRole"),(0,l.assertKeysDefined)(e,["role","privileges","roles"]),this._emitDatabaseApiCall("createRole",{}),e.createRole)throw new p.MongoshInvalidInputError("Cannot set createRole field in helper method",p.CommonErrors.InvalidArgument);const r=(0,l.adaptOptions)({role:"createRole"},{},e);t&&(r.writeConcern=t);const s={createRole:r.createRole,...r};return await this._runCommand(s)}async updateRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string","object"],"Database.updateRole"),this._emitDatabaseApiCall("updateRole",{});const s=(0,l.adaptOptions)({},{updateRole:e},t);r&&(s.writeConcern=r);const i={updateRole:s.updateRole,...s};return await this._runCommand(i)}async dropRole(e,t){(0,l.assertArgsDefinedType)([e],["string"],"Database.dropRole"),this._emitDatabaseApiCall("dropRole",{});const r={dropRole:e};return t&&(r.writeConcern=t),await this._runCommand(r)}async dropAllRoles(e){this._emitDatabaseApiCall("dropAllRoles",{});const t={dropAllRolesFromDatabase:1};return e&&(t.writeConcern=e),await this._runCommand(t)}async grantRolesToRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantRolesToRole"),this._emitDatabaseApiCall("grantRolesToRole",{});const s={grantRolesToRole:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokeRolesFromRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokeRolesFromRole"),this._emitDatabaseApiCall("revokeRolesFromRole",{});const s={revokeRolesFromRole:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async grantPrivilegesToRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantPrivilegesToRole"),this._emitDatabaseApiCall("grantPrivilegesToRole",{});const s={grantPrivilegesToRole:e,privileges:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokePrivilegesFromRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokePrivilegesFromRole"),this._emitDatabaseApiCall("revokePrivilegesFromRole",{});const s={revokePrivilegesFromRole:e,privileges:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async getRole(e,t={}){(0,l.assertArgsDefinedType)([e],["string"],"Database.getRole"),this._emitDatabaseApiCall("getRole",{rolename:e});const r=(0,l.adaptOptions)({},{rolesInfo:{role:e,db:this._name}},t),s=await this._runReadCommand(r);if(void 0===s.roles)throw new p.MongoshInternalError("No roles returned from rolesInfo command");for(let t=0;t<s.roles.length;t++)if(s.roles[t].role===e)return s.roles[t];return null}async getRoles(e={}){this._emitDatabaseApiCall("getRoles",{options:e});const t=(0,l.adaptOptions)({},{rolesInfo:1},e);return await this._runReadCommand(t)}async _getCurrentOperations(e){const t="boolean"==typeof e?{$all:e,$ownOps:!1}:{$all:!!e.$all,$ownOps:!!e.$ownOps},r=[{$currentOp:{allUsers:!t.$ownOps,idleConnections:t.$all,truncateOps:!1}}];if("object"==typeof e){const t={};for(const r of Object.keys(e))"$ownOps"!==r&&"$all"!==r&&"$truncateOps"!==r&&(t[r]=e[r]);r.push({$match:t})}const s=this.getSiblingDB("admin"),i={$readPreference:{mode:"primaryPreferred"}};try{const e=await s.aggregate(r,i);return await e.toArray()}catch(e){if("FailedToParse"===(null==e?void 0:e.codeName)){delete r[0].$currentOp.truncateOps;const e=await s.aggregate(r,i);return await e.toArray()}throw e}}async currentOp(e={}){return this._emitDatabaseApiCall("currentOp",{opts:e}),{inprog:await this._getCurrentOperations(e),ok:1}}async killOp(e){return this._emitDatabaseApiCall("killOp",{opId:e}),await this._runAdminCommand({killOp:1,op:e})}async shutdownServer(e={}){return this._emitDatabaseApiCall("shutdownServer",{opts:e}),await this._runAdminCommand({shutdown:1,...e})}async fsyncLock(){return this._emitDatabaseApiCall("fsyncLock",{}),await this._runAdminCommand({fsync:1,lock:!0})}async fsyncUnlock(){return this._emitDatabaseApiCall("fsyncUnlock",{}),await this._runAdminCommand({fsyncUnlock:1})}async version(){this._emitDatabaseApiCall("version",{});const e=await this._runAdminCommand({buildInfo:1});if(!e||void 0===e.version)throw new p.MongoshRuntimeError(`Error running command serverBuildInfo ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.version}async serverBits(){this._emitDatabaseApiCall("serverBits",{});const e=await this._runAdminCommand({buildInfo:1});if(!e||void 0===e.bits)throw new p.MongoshRuntimeError(`Error running command serverBuildInfo ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.bits}async isMaster(){this._emitDatabaseApiCall("isMaster",{});const e=await this._runReadCommand({isMaster:1});return e.isWritablePrimary=e.ismaster,e}async hello(){this._emitDatabaseApiCall("hello",{});try{return this._cachedHello=await this._runReadCommand({hello:1}),this._cachedHello}catch(e){if("CommandNotFound"===(null==e?void 0:e.codeName)){const e=await this.isMaster();return delete e.ismaster,this._cachedHello=e,this._cachedHello}throw e}}async serverBuildInfo(){return this._emitDatabaseApiCall("serverBuildInfo",{}),await this._runAdminCommand({buildInfo:1})}async serverStatus(e={}){return this._emitDatabaseApiCall("serverStatus",{options:e}),await this._runAdminCommand({serverStatus:1,...e})}async stats(e=1){return(0,l.assertArgsDefinedType)([e],[["number","object"]],"Database.stats"),"number"==typeof e&&(e={scale:e}),this._emitDatabaseApiCall("stats",{scale:e.scale}),await this._runReadCommand({dbStats:1,scale:1,...e})}async hostInfo(){return this._emitDatabaseApiCall("hostInfo",{}),await this._runAdminCommand({hostInfo:1})}async serverCmdLineOpts(){return this._emitDatabaseApiCall("serverCmdLineOpts",{}),await this._runAdminCommand({getCmdLineOpts:1})}async rotateCertificates(e){return this._emitDatabaseApiCall("rotateCertificates",{message:e}),await this._runAdminCommand({rotateCertificates:1,message:e})}async printCollectionStats(e=1){if("number"!=typeof e||e<1)throw new p.MongoshInvalidInputError(`scale has to be a number >=1, got ${e}`,p.CommonErrors.InvalidArgument);this._emitDatabaseApiCall("printCollectionStats",{scale:e});const t=await this.getCollectionNames(),r={};for(const s of t)try{r[s]=await this.getCollection(s).stats({scale:e})}catch(e){r[s]={ok:0,errmsg:null==e?void 0:e.message}}return new c.CommandResult("StatsResult",r)}async getProfilingStatus(){return this._emitDatabaseApiCall("getProfilingStatus",{}),await this._runReadCommand({profile:-1})}async setProfilingLevel(e,t={}){if((0,l.assertArgsDefinedType)([e],["number"],"Database.setProfilingLevel"),e<0||e>2)throw new p.MongoshInvalidInputError(`Input level ${e} is out of range [0..2]`,p.CommonErrors.InvalidArgument);return"number"==typeof t&&(t={slowms:t}),this._emitDatabaseApiCall("setProfilingLevel",{opts:t}),await this._runCommand({profile:e,...t})}async setLogLevel(e,t){(0,l.assertArgsDefinedType)([e],["number"],"Database.setLogLevel"),this._emitDatabaseApiCall("setLogLevel",{logLevel:e,component:t});let r=[];if("string"==typeof t)r=t.split(".");else if(void 0!==t)throw new p.MongoshInvalidInputError("setLogLevel component must be a string: got "+typeof t,p.CommonErrors.InvalidArgument);let s={verbosity:e};for(;r.length>0;)s={[r.pop()]:s};const i={setParameter:1,logComponentVerbosity:s};return await this._runAdminCommand(i)}async getLogComponents(){this._emitDatabaseApiCall("getLogComponents",{});const e=await this._runAdminCommand({getParameter:1,logComponentVerbosity:1});if(!e||void 0===e.logComponentVerbosity)throw new p.MongoshRuntimeError(`Error running command ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.logComponentVerbosity}cloneDatabase(){throw new p.MongoshDeprecatedError("`cloneDatabase()` was removed because it was deprecated in MongoDB 4.0")}cloneCollection(){throw new p.MongoshDeprecatedError("`cloneCollection()` was removed because it was deprecated in MongoDB 4.0")}copyDatabase(){throw new p.MongoshDeprecatedError("`copyDatabase()` was removed because it was deprecated in MongoDB 4.0")}async commandHelp(e){(0,l.assertArgsDefinedType)([e],["string"],"Database.commandHelp"),this._emitDatabaseApiCall("commandHelp",{name:e});const t={};t[e]=1,t.help=!0;const r=await this._runCommand(t);if(!r||void 0===r.help)throw new p.MongoshRuntimeError(`Error running command commandHelp ${r&&r.errmsg||""}`,p.CommonErrors.CommandFailed);return r.help}async listCommands(){this._emitDatabaseApiCall("listCommands",{});const e=await this._runReadCommand({listCommands:1});if(!e||void 0===e.commands)throw new p.MongoshRuntimeError(`Error running command listCommands ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);for(const t of Object.values(e.commands))"slaveOk"in t&&(t.secondaryOk=t.slaveOk,delete t.slaveOk),"slaveOverrideOk"in t&&(t.secondaryOverrideOk=t.slaveOverrideOk,delete t.slaveOverrideOk);return new c.CommandResult("ListCommandsResult",e.commands)}async getLastErrorObj(e,t,r){return await this._instanceState.printDeprecationWarning("Database.getLastErrorObj() is deprecated and will be removed in the future."),this._emitDatabaseApiCall("getLastErrorObj",{w:e,wTimeout:t,j:r}),await this._getLastErrorObj(e,t,r)}async getLastError(e,t){return await this._instanceState.printDeprecationWarning("Database.getLastError() is deprecated and will be removed in the future."),this._emitDatabaseApiCall("getLastError",{w:e,wTimeout:t}),(await this._getLastErrorObj(e,t)).err||null}async printShardingStatus(e=!1){this._emitDatabaseApiCall("printShardingStatus",{verbose:e});const t=await(0,l.getPrintableShardStatus)(await(0,l.getConfigDB)(this),e);return new c.CommandResult("StatsResult",t)}async printSecondaryReplicationInfo(){let e=null;const t=this.getSiblingDB("local");if(0!==await t.getCollection("system.replset").countDocuments({})){const t=await this._runAdminCommand({replSetGetStatus:1});let r=null;for(const e of t.members)if(1===e.state){r=e;break}if(r)e=r.optimeDate;else{e=new Date(0,0);for(const r of t.members)r.optimeDate>e&&(e=r.optimeDate)}const s={};for(const i of t.members){const t={};if(null==i)throw new p.MongoshRuntimeError("Member returned from command replSetGetStatus is null",p.CommonErrors.CommandFailed);if(1!==i.state&&7!==i.state){if(i.optime&&0!==i.health){if(null==e)throw new p.MongoshRuntimeError("getReplLag startOptimeDate is null",p.CommonErrors.CommandFailed);e&&(t.syncedTo=i.optimeDate.toString());const s=(i.optimeDate-e)/1e3,n=Math.round(s/36)/100;let a="";a=r?"primary ":"freshest member (no primary available at the moment)",t.replLag=`${Math.round(s)} secs (${n} hrs) behind the ${a}`}else t["no replication info, yet. State"]=i.stateStr;s[`source: ${i.name}`]=t}}return new c.CommandResult("StatsResult",s)}throw new p.MongoshInvalidInputError("local.system.replset is empty. Are you connected to a replica set?",d.ShellApiErrors.NotConnectedToReplicaSet)}async getReplicationInfo(){const e=this.getSiblingDB("local"),t={},r="oplog.rs";if(!(await e.getCollectionNames()).includes(r))throw new p.MongoshInvalidInputError("Replication not detected. Are you connected to a replset?",d.ShellApiErrors.NotConnectedToReplicaSet);const s=e.getCollection(r),[i,n,a]=await Promise.all([s.stats(),(async()=>(await s.find()).sort({$natural:1}).limit(1).tryNext())(),(async()=>(await s.find()).sort({$natural:-1}).limit(1).tryNext())()]);if(!(null==i?void 0:i.maxSize))throw new p.MongoshRuntimeError(`Could not get stats for local.${r} collection. collstats returned ${JSON.stringify(i)}`,p.CommonErrors.CommandFailed);if(t.configuredLogSizeMB=i.maxSize/1048576,t.logSizeMB=Math.max(i.maxSize,i.size)/1048576,t.usedMB=i.size/1048576,t.usedMB=Math.ceil(100*t.usedMB)/100,null===n||null===a)throw new p.MongoshRuntimeError("objects not found in local.oplog.$main -- is this a new and empty db instance?",p.CommonErrors.CommandFailed);let o=n.ts,c=a.ts;return o&&c?(o=(0,l.tsToSeconds)(o),c=(0,l.tsToSeconds)(c),t.timeDiff=c-o,t.timeDiffHours=Math.round(t.timeDiff/36)/100,t.tFirst=new Date(1e3*o).toString(),t.tLast=new Date(1e3*c).toString(),t.now=Date()):t.errmsg="ts element not found in oplog objects",t}async printReplicationInfo(){const e={};let t;try{t=await this.getReplicationInfo()}catch(e){const t=await this.hello();if(t.arbiterOnly)return new c.CommandResult("StatsResult",{message:"cannot provide replication status from an arbiter"});if(!t.isWritablePrimary){const e=await this.printSecondaryReplicationInfo();return new c.CommandResult("StatsResult",{message:"this is a secondary, printing secondary replication info.",...e.value})}throw e}return e["actual oplog size"]=`${t.logSizeMB} MB`,e["configured oplog size"]=`${t.configuredLogSizeMB} MB`,e["log length start to end"]=`${t.timeDiff} secs (${t.timeDiffHours} hrs)`,e["oplog first event time"]=t.tFirst,e["oplog last event time"]=t.tLast,e.now=t.now,new c.CommandResult("StatsResult",e)}printSlaveReplicationInfo(){throw new p.MongoshDeprecatedError("Method deprecated, use db.printSecondaryReplicationInfo instead")}async setSecondaryOk(){await this._mongo.setSecondaryOk()}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitDatabaseApiCall("watch",{pipeline:e,options:t});const r=new h.default(this._mongo._serviceProvider.watch(e,{...await this._baseOptions(),...t},{},this._name),this._name,this._mongo);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._mongo._instanceState.currentCursor=r,r}async sql(e,t){var r;this._emitDatabaseApiCall("sql",{sqlString:e,options:t}),await this._instanceState.shellApi.print("Note: this is an experimental feature that may be subject to change in future releases.");const s=await this.aggregate([{$sql:{statement:e,format:"jdbc",dialect:"mongosql",formatVersion:1}}],t);try{await s.hasNext()}catch(e){if(40324===(null===(r=e.code)||void 0===r?void 0:r.valueOf()))throw new p.MongoshRuntimeError("db.sql currently only works when connected to a Data Lake",p.CommonErrors.CommandFailed);throw e}return s}async checkMetadataConsistency(e={}){return this._emitDatabaseApiCall("checkMetadataConsistency",{options:e}),this._runCursorCommand({checkMetadataConsistency:1})}};s([(0,a.returnType)("Mongo")],f.prototype,"getMongo",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"getCollectionNames",null),s([a.returnsPromise,(0,a.serverVersions)(["3.0.0",o.ServerVersions.latest]),(0,a.apiVersions)([1])],f.prototype,"getCollectionInfos",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"runCommand",null),s([a.returnsPromise,(0,a.serverVersions)(["3.4.0",o.ServerVersions.latest]),(0,a.apiVersions)([1])],f.prototype,"adminCommand",null),s([a.returnsPromise,(0,a.returnType)("AggregationCursor"),(0,a.apiVersions)([1])],f.prototype,"aggregate",null),s([(0,a.returnType)("Database")],f.prototype,"getSiblingDB",null),s([(0,a.returnType)("Collection")],f.prototype,"getCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"dropDatabase",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"createUser",null),s([a.returnsPromise],f.prototype,"updateUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"changeUserPassword",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"logout",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropAllUsers",null),s([a.returnsPromise],f.prototype,"auth",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"grantRolesToUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokeRolesFromUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getUsers",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createEncryptedCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createView",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"createRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"updateRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropRole",null),s([a.returnsPromise],f.prototype,"dropAllRoles",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"grantRolesToRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokeRolesFromRole",null),s([a.returnsPromise],f.prototype,"grantPrivilegesToRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokePrivilegesFromRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getRoles",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"currentOp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"killOp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"shutdownServer",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"fsyncLock",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"fsyncUnlock",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"version",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverBits",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"isMaster",null),s([a.returnsPromise,(0,a.apiVersions)([1]),(0,a.serverVersions)(["5.0.0",o.ServerVersions.latest])],f.prototype,"hello",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverBuildInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverStatus",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"stats",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"hostInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverCmdLineOpts",null),s([a.returnsPromise,(0,a.serverVersions)(["5.0.0",o.ServerVersions.latest]),(0,a.apiVersions)([])],f.prototype,"rotateCertificates",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"printCollectionStats",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getProfilingStatus",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"setProfilingLevel",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"setLogLevel",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLogComponents",null),s([a.deprecated],f.prototype,"cloneDatabase",null),s([a.deprecated],f.prototype,"cloneCollection",null),s([a.deprecated],f.prototype,"copyDatabase",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"commandHelp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"listCommands",null),s([(0,a.serverVersions)([o.ServerVersions.earliest,"5.1.0"]),a.deprecated,a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLastErrorObj",null),s([a.deprecated,a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLastError",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.Sharded]),(0,a.apiVersions)([1])],f.prototype,"printShardingStatus",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.ReplSet]),(0,a.apiVersions)([])],f.prototype,"printSecondaryReplicationInfo",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.ReplSet]),(0,a.apiVersions)([])],f.prototype,"getReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([]),(0,a.topologies)([o.Topologies.ReplSet])],f.prototype,"printReplicationInfo",null),s([a.deprecated],f.prototype,"printSlaveReplicationInfo",null),s([a.deprecated,a.returnsPromise],f.prototype,"setSecondaryOk",null),s([(0,a.serverVersions)(["3.1.0",o.ServerVersions.latest]),(0,a.topologies)([o.Topologies.ReplSet,o.Topologies.Sharded]),(0,a.apiVersions)([1]),a.returnsPromise],f.prototype,"watch",null),s([(0,a.serverVersions)(["4.4.0",o.ServerVersions.latest]),a.returnsPromise,(0,a.returnType)("AggregationCursor")],f.prototype,"sql",null),s([(0,a.serverVersions)(["7.0.0",o.ServerVersions.latest]),(0,a.topologies)([o.Topologies.Sharded]),a.returnsPromise],f.prototype,"checkMetadataConsistency",null),f=s([a.shellApiClassDefault],f),t.default=f},9461:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.DBQuery=void 0;const i=r(40191);let n=t.DBQuery=class extends i.ShellApiClass{constructor(e){super(),this._instanceState=e}get shellBatchSize(){return this._instanceState.displayBatchSizeFromDBQuery}set shellBatchSize(e){this._instanceState.printDeprecationWarning('DBQuery.shellBatchSize is deprecated, please use config.set("displayBatchSize") instead'),this._instanceState.displayBatchSizeFromDBQuery=e}};t.DBQuery=n=s([i.shellApiClassDefault,i.classDeprecated],n)},40191:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.addSourceToResults=t.classPlatforms=t.platforms=t.classDeprecated=t.returnType=t.shellCommandCompleter=t.directShellCommand=t.returnsPromise=t.nonAsyncFunctionsReturningPromises=t.topologies=t.deprecated=t.apiVersions=t.serverVersions=t.shellApiClassNoHelp=t.shellApiClassDefault=t.toIgnore=t.signatures=t.toShellResult=t.getShellApiType=t.ShellApiValueClass=t.ShellApiWithMongoClass=t.ShellApiClass=void 0;const i=r(6534),n=r(86930),a=s(r(55179)),o=r(86901),l=Symbol.for("@@mongosh.addSourceToResults"),c=Symbol.for("@@mongosh.resultSource");class p{get[n.shellApiType](){throw new i.MongoshInternalError("Shell API Type did not use decorators")}set[n.shellApiType](e){(0,o.addHiddenDataProperty)(this,n.shellApiType,e)}[n.asPrintable](){return Array.isArray(this)?[...this]:{...this}}}function u(e){var t;return null!==(t=null==e?void 0:e[n.shellApiType])&&void 0!==t?t:null}function h(e){function t(t,r){if("object"==typeof t&&null!==t){const s={namespace:r[n.namespaceInfo]()};(0,o.addHiddenDataProperty)(t,c,s),void 0===t[n.shellApiType]&&e.returnType&&(0,o.addHiddenDataProperty)(t,n.shellApiType,e.returnType)}return t}const r=e.returnsPromise?x((async function(...r){return t(await e.call(this,...r),this)})):function(...r){return t(e.call(this,...r),this)};return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)),r}function d(e,t){const r=e.returnsPromise?x((async function(...r){var s,i;const n=m(this);f(n,t,e,!0);const a=null==n?void 0:n.interrupted;null==a||a.checkpoint();const o=null==a?void 0:a.asPromise();let l;try{n&&n.apiCallDepth++,l=await Promise.race([null!==(s=null==o?void 0:o.promise)&&void 0!==s?s:new Promise((()=>{})),e.call(this,...r)])}catch(e){throw null!==(i=null==n?void 0:n.transformError(e))&&void 0!==i?i:e}finally{n&&n.apiCallDepth--,o&&o.destroy()}return null==a||a.checkpoint(),l})):function(...r){var s;const i=m(this);f(i,t,e,!1);const n=null==i?void 0:i.interrupted;let a;null==n||n.checkpoint();try{i&&i.apiCallDepth++,a=e.call(this,...r)}catch(e){throw null!==(s=null==i?void 0:i.transformError(e))&&void 0!==s?s:e}finally{i&&i.apiCallDepth--}return null==n||n.checkpoint(),a};return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)),r}function f(e,t,r,s){var i;null===(i=null==e?void 0:e.emitApiCall)||void 0===i||i.call(e,{method:r.name,class:t,deprecated:!!r.deprecated,isAsync:s})}function m(e){if(!e[n.shellApiType])throw new i.MongoshInternalError("getShellInstanceState can only be called for functions from shell API classes");return e._instanceState}t.ShellApiClass=p,t.ShellApiWithMongoClass=class extends p{get _instanceState(){var e;return null===(e=this._mongo)||void 0===e?void 0:e._instanceState}},t.ShellApiValueClass=class extends p{get _mongo(){throw new i.MongoshInternalError("Not supported on this value class")}get _instanceState(){throw new i.MongoshInternalError("Not supported on this value class")}},t.getShellApiType=u,t.toShellResult=async function e(t){var r;if("object"!=typeof t&&"function"!=typeof t||null===t)return{type:null,rawValue:t,printable:t};if("then"in t&&"function"==typeof t.then)return e(await t);const s="function"==typeof t[n.asPrintable]?await t[n.asPrintable]():t,i=null!==(r=t[c])&&void 0!==r?r:void 0;return{type:u(t),rawValue:t,printable:s,source:i}};const y="@@@mdb.signatures@@@";r.g[y]||(r.g[y]={});const g=r.g[y];function b(e,r){const s=e.name,i=`shell-api.classes.${s}.help`,c={help:`${i}.description`,docs:`${i}.link`,attr:[]},u={type:s,returnsPromise:e.prototype.returnsPromise||!1,deprecated:e.prototype.deprecated||!1,attributes:{}},f=Object.getOwnPropertyNames(e.prototype);for(const r of f){const o=Object.getOwnPropertyDescriptor(e.prototype,r);if(!(null==o?void 0:o.value)||"function"!=typeof o.value||t.toIgnore.includes(r)||r.startsWith("_"))continue;let p=o.value;e[l]&&(p=h(p)),p=d(p,s),p.serverVersions=p.serverVersions||n.ALL_SERVER_VERSIONS,p.apiVersions=p.apiVersions||n.ALL_API_VERSIONS,p.topologies=p.topologies||n.ALL_TOPOLOGIES,p.returnType=p.returnType||{type:"unknown",attributes:{}},p.returnsPromise=p.returnsPromise||!1,p.deprecated=p.deprecated||!1,p.platforms=p.platforms||n.ALL_PLATFORMS,p.isDirectShellCommand=p.isDirectShellCommand||!1,p.acceptsRawInput=p.acceptsRawInput||!1,p.shellCommandCompleter=p.shellCommandCompleter||void 0,u.attributes[r]={type:"function",serverVersions:p.serverVersions,apiVersions:p.apiVersions,topologies:p.topologies,returnType:"this"===p.returnType?s:p.returnType,returnsPromise:p.returnsPromise,deprecated:p.deprecated,platforms:p.platforms,isDirectShellCommand:p.isDirectShellCommand,acceptsRawInput:p.acceptsRawInput,shellCommandCompleter:p.shellCommandCompleter};const f=`${i}.attributes.${r}`,m={help:`${f}.example`,docs:`${f}.link`,attr:[{description:`${f}.description`}]},y=new a.default(m);p.help=()=>y,Object.setPrototypeOf(p.help,y),c.attr.push({name:r,description:`${f}.description`}),Object.defineProperty(e.prototype,r,{...o,value:p})}let m=e.prototype;for(;null!==(m=Object.getPrototypeOf(m))&&"ShellApiClass"!==m.constructor.name&&m.constructor!==Array;){const e=`shell-api.classes.${m.constructor.name}.help`;for(const r of Object.getOwnPropertyNames(m)){const i=Object.getOwnPropertyDescriptor(m,r),n=(null==i?void 0:i.value)&&"function"==typeof i.value;if(f.includes(r)||!n||t.toIgnore.includes(r)||r.startsWith("_"))continue;const a=i.value;u.attributes[r]={type:"function",serverVersions:a.serverVersions,apiVersions:a.apiVersions,topologies:a.topologies,returnType:"this"===a.returnType?s:a.returnType,returnsPromise:a.returnsPromise,deprecated:a.deprecated,platforms:a.platforms,isDirectShellCommand:a.isDirectShellCommand,acceptsRawInput:a.acceptsRawInput,shellCommandCompleter:a.shellCommandCompleter};const o=`${e}.attributes.${r}`;c.attr.push({name:r,description:`${o}.description`})}}const y=new a.default(c);e.prototype.help=()=>y,Object.setPrototypeOf(e.prototype.help,y),e.prototype[n.asPrintable]=e.prototype[n.asPrintable]||p.prototype[n.asPrintable],(0,o.addHiddenDataProperty)(e.prototype,n.shellApiType,s),r&&(g[s]=u)}function x(e){function t(...t){const r=e.call(this,...t);return(0,o.addHiddenDataProperty)(r,Symbol.for("@@mongosh.syntheticPromise"),!0)}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),t}t.signatures=g,g.Document={type:"Document",attributes:{}},t.toIgnore=["constructor","help","toJSON"],t.shellApiClassDefault=function(e){b(e,!0)},t.shellApiClassNoHelp=function(e){b(e,!1)},t.serverVersions=function(e){return function(t,r,s){s.value.serverVersions=e}},t.apiVersions=function(e){return function(t,r,s){0===e.length?e=[0,0]:1===e.length&&(e=[e[0],1/0]),s.value.apiVersions=e}},t.deprecated=function(e,t,r){r.value.deprecated=!0},t.topologies=function(e){return function(t,r,s){s.value.topologies=e}},t.nonAsyncFunctionsReturningPromises=[],t.returnsPromise=function(e,r,s){const i=s.value;async function n(...e){try{return await i.call(this,...e)}finally{"function"==typeof setTimeout&&"function"==typeof setImmediate&&await new Promise(setImmediate)}}i.returnsPromise=!0,Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)),s.value=x(n),"AsyncFunction"!==i.constructor.name&&t.nonAsyncFunctionsReturningPromises.push(i.name)},t.directShellCommand=function(e,t,r){r.value.isDirectShellCommand=!0},t.shellCommandCompleter=function(e){return function(t,r,s){s.value.shellCommandCompleter=e}},t.returnType=function(e){return function(t,r,s){s.value.returnType=e}},t.classDeprecated=function(e){e.prototype.deprecated=!0},t.platforms=function(e){return function(t,r,s){s.value.platforms=e}},t.classPlatforms=function(e){return function(t){t.prototype.platforms=e}},t.addSourceToResults=function(e){e[l]=!0}},86930:(e,t)=>{"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.ADMIN_DB=t.namespaceInfo=t.asPrintable=t.shellApiType=t.CURSOR_FLAGS=t.ALL_API_VERSIONS=t.ALL_PLATFORMS=t.ALL_TOPOLOGIES=t.ALL_SERVER_VERSIONS=t.Topologies=t.ServerVersions=void 0,function(e){e.latest="999.999.999",e.earliest="0.0.0"}(r||(t.ServerVersions=r={})),function(e){e.ReplSet="ReplSet",e.Standalone="Standalone",e.Sharded="Sharded",e.LoadBalanced="LoadBalanced"}(s||(t.Topologies=s={})),t.ALL_SERVER_VERSIONS=[r.earliest,r.latest],t.ALL_TOPOLOGIES=[s.ReplSet,s.Sharded,s.LoadBalanced,s.Standalone],t.ALL_PLATFORMS=["Compass","Browser","CLI"],t.ALL_API_VERSIONS=[0,1/0],t.CURSOR_FLAGS={2:"tailable",4:"SlaveOk",8:"oplogReplay",16:"noTimeout",32:"awaitData",64:"exhaust",128:"partial"},t.shellApiType=Symbol.for("@@mongosh.shellApiType"),t.asPrintable=Symbol.for("@@mongosh.asPrintable"),t.namespaceInfo=Symbol.for("@@mongosh.namespaceInfo"),t.ADMIN_DB="admin"},73041:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ShellApiErrors=t.blockedByDriverMetadata=void 0,t.blockedByDriverMetadata=function(e){return{driverCaused:!0,api:e}},function(e){e.NotConnectedToShardedCluster="SHAPI-10001",e.NotConnectedToReplicaSet="SHAPI-10002",e.NotConnectedToMongos="SHAPI-10003",e.NotConnected="SHAPI-10004",e.NotUsingFLE="SHAPI-10005"}(r||(t.ShellApiErrors=r={}))},93379:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=i(r(4564)),o=r(86930);let l=class extends a.default{constructor(e,t,r){super(e,t._cursor),this._baseCursor=t,this._verbosity=r,this._explained=null}async[o.asPrintable](){var e;return null!==(e=this._explained)&&void 0!==e||(this._explained=await this._baseCursor.explain(this._verbosity)),this._explained}};l=s([n.shellApiClassDefault],l),t.default=l},37149:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(r(93379)),a=r(40191),o=r(86930),l=r(86901);let c=class extends a.ShellApiWithMongoClass{constructor(e,t,r){super(),this._mongo=e,this._collection=t,this._verbosity=r}[o.asPrintable](){return`Explainable(${this._collection.getFullName()})`}_emitExplainableApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Explainable",db:this._collection._database._name,coll:this._collection._name,arguments:t})}getCollection(){return this._emitExplainableApiCall("getCollection"),this._collection}getVerbosity(){return this._emitExplainableApiCall("getVerbosity"),this._verbosity}setVerbosity(e){e=(0,l.validateExplainableVerbosity)(e),this._emitExplainableApiCall("setVerbosity",{verbosity:e}),this._verbosity=e}async find(e,t){this._emitExplainableApiCall("find",{query:e,projection:t});const r=await this._collection.find(e,t);return new n.default(this._mongo,r,this._verbosity)}async aggregate(...e){var t;let r,s;return this._emitExplainableApiCall("aggregate",{args:e}),Array.isArray(e[0])?(s=e[0],r=null!==(t=e[1])&&void 0!==t?t:{}):(s=e,r={}),await this._collection.aggregate(s,{...r,explain:this._verbosity})}async count(e={},t={}){return this._emitExplainableApiCall("count",{query:e,options:t}),(0,l.markAsExplainOutput)(await this._collection._database._runReadCommand({explain:{count:`${this._collection._name}`,query:e,...t},verbosity:this._verbosity}))}async distinct(e,t,r={}){return this._emitExplainableApiCall("distinct",{field:e,query:t,options:r}),this._collection.distinct(e,null!=t?t:{},{...r,explain:this._verbosity})}async findAndModify(e){return this._emitExplainableApiCall("findAndModify",{options:e}),this._collection.findAndModify({...e,explain:this._verbosity})}async findOneAndDelete(e,t={}){return this._emitExplainableApiCall("findOneAndDelete",{filter:e,options:t}),this._collection.findOneAndDelete(e,{...t,explain:this._verbosity})}async findOneAndReplace(e,t,r={}){return this._emitExplainableApiCall("findOneAndReplace",{filter:e,options:r}),this._collection.findOneAndReplace(e,t,{...r,explain:this._verbosity})}async findOneAndUpdate(e,t,r={}){return this._emitExplainableApiCall("findOneAndUpdate",{filter:e,options:r}),this._collection.findOneAndUpdate(e,t,{...r,explain:this._verbosity})}async remove(e,t={}){return this._emitExplainableApiCall("remove",{query:e,options:t}),t={...(0,l.processRemoveOptions)(t),explain:this._verbosity},this._collection.remove(e,t)}async update(e,t,r={}){return this._emitExplainableApiCall("update",{filter:e,update:t,options:r}),this._collection.update(e,t,{...r,explain:this._verbosity})}async mapReduce(e,t,r){this._emitExplainableApiCall("mapReduce",{map:e,reduce:t,optionsOrOutString:r});const s={...(0,l.processMapReduceOptions)(r),explain:this._verbosity};return this._collection.mapReduce(e,t,s)}};s([(0,a.returnType)("ExplainableCursor"),(0,a.apiVersions)([1]),a.returnsPromise],c.prototype,"find",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"aggregate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"count",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"distinct",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findAndModify",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndDelete",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndReplace",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndUpdate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"remove",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"update",null),s([a.returnsPromise,(0,a.serverVersions)(["4.4.0",o.ServerVersions.latest]),(0,a.apiVersions)([])],c.prototype,"mapReduce",null),c=s([a.shellApiClassDefault],c),t.default=c},99232:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KeyVault=t.ClientEncryption=void 0;const n=r(40191),a=i(r(4564)),o=r(86901),l=r(86930),c=r(46177),p=r(6534),u=e=>!Array.isArray(e)&&"object"==typeof e&&("masterKey"in e||"keyAltNames"in e||"keyMaterial"in e);let h=t.ClientEncryption=class extends n.ShellApiWithMongoClass{constructor(e){super(),this._mongo=e;const t={...this._mongo._fleOptions};if(delete t.schemaMap,delete t.encryptedFieldsMap,!e._serviceProvider.createClientEncryption)throw new p.MongoshRuntimeError("FLE API is not available");this._libmongocrypt=e._serviceProvider.createClientEncryption(t)}[l.asPrintable](){return`ClientEncryption class for ${(0,c.redactURICredentials)(this._mongo._uri)}`}async encrypt(e,t,r){let s;return s="object"==typeof r?{keyId:e,...r}:{keyId:e,algorithm:r},(0,o.assertArgsDefinedType)([e,t,s],[!0,!0,!0],"ClientEncryption.encrypt"),await this._libmongocrypt.encrypt(t,s)}async decrypt(e){return(0,o.assertArgsDefinedType)([e],[!0],"ClientEncryption.decrypt"),await this._libmongocrypt.decrypt(e)}async encryptExpression(e,t,r){return(0,o.assertArgsDefinedType)([e,t,r],[!0,!0,!0],"ClientEncryption.encryptExpression"),await this._libmongocrypt.encryptExpression(t,{keyId:e,...r})}async createEncryptedCollection(e,t,r){if((0,o.assertArgsDefinedType)([e],["string"],"ClientEncryption.createEncryptedCollection"),(0,o.assertArgsDefinedType)([t],["string"],"ClientEncryption.createEncryptedCollection"),(0,o.assertArgsDefinedType)([r],["object"],"ClientEncryption.createEncryptedCollection"),(0,o.assertKeysDefined)(r,["provider","createCollectionOptions"]),!this._mongo._serviceProvider.createEncryptedCollection)throw new p.MongoshRuntimeError("Runtime does not support createEncryptedCollection yet");const{encryptedFields:s}=await this._mongo._serviceProvider.createEncryptedCollection(e,t,r,this._libmongocrypt);return{collection:this._mongo.getDB(e).getCollection(t),encryptedFields:s}}};s([n.returnsPromise],h.prototype,"encrypt",null),s([n.returnsPromise],h.prototype,"decrypt",null),s([n.returnsPromise],h.prototype,"encryptExpression",null),s([n.returnsPromise,(0,n.apiVersions)([1])],h.prototype,"createEncryptedCollection",null),t.ClientEncryption=h=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],h);let d=t.KeyVault=class extends n.ShellApiWithMongoClass{constructor(e){var t,r,s;super(),this._mongo=e._mongo,this._clientEncryption=e;const i=null===(r=null===(t=this._mongo)||void 0===t?void 0:t._fleOptions)||void 0===r?void 0:r.keyVaultNamespace;if(!i)throw new p.MongoshInvalidInputError("FLE options must be passed to the Mongo object");const n=null===(s=i.match(/^(?<db>[^.]+)\.(?<coll>.+)$/))||void 0===s?void 0:s.groups;if(!n)throw new p.MongoshInvalidInputError(`Invalid keyVaultNamespace '${i}'`);const{db:a,coll:o}=n;this._keyColl=this._mongo.getDB(a).getCollection(o)}async _init(){try{if((await this._keyColl.getIndexKeys()).some((e=>e.keyAltNames)))return}catch(e){}try{await this._keyColl.updateMany({keyAltNames:{$size:0}},{$unset:{keyAltNames:""},$currentDate:{updateDate:!0}}),await this._keyColl.createIndex({keyAltNames:1},{unique:!0,partialFilterExpression:{keyAltNames:{$exists:!0}}})}catch(e){await this._instanceState.printWarning(`Creating 'keyAltNames' index on '${this._keyColl.getFullName()}' failed: ${e.message}`)}}[l.asPrintable](){return`KeyVault class for ${(0,c.redactURICredentials)(this._mongo._uri)}`}async createKey(e,t,r){let s,i,n,a;if(u(t)?(s=null==t?void 0:t.masterKey,i=null==t?void 0:t.keyAltNames,n=null==t?void 0:t.keyMaterial):(e=>!Array.isArray(e)&&"object"==typeof e&&!u(e))(t)&&(s=t),r&&(i=r),(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.createKey"),"string"==typeof t){if("local"!==e||""!==t)throw new p.MongoshInvalidInputError('KeyVault.createKey does not support providing masterKey as string anymore. For AWS please use createKey("aws", { region: ..., key: ... })',p.CommonErrors.Deprecated);s=void 0}else if(Array.isArray(t)){if("local"!==e)throw new p.MongoshInvalidInputError("KeyVault.createKey requires masterKey to be given as second argument if KMS is not local",p.CommonErrors.InvalidArgument);if(i)throw new p.MongoshInvalidInputError("KeyVault.createKey was supplied with an array for the masterKey and keyAltNames - either specify keyAltNames as second argument or set undefined for masterKey",p.CommonErrors.InvalidArgument);i=t,s=void 0}return s&&(a={...null!=a?a:{},masterKey:s}),i&&(a={...null!=a?a:{},keyAltNames:i}),n&&(a={...null!=a?a:{},keyMaterial:n}),await this._clientEncryption._libmongocrypt.createDataKey(e,a)}async getKey(e){(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.getKey");const t=await this._keyColl.find({_id:e});return await t.limit(1).next()}async getKeyByAltName(e){(0,o.assertArgsDefinedType)([e],["string"],"KeyVault.getKeyByAltName");const t=await this._keyColl.find({keyAltNames:e});return await t.limit(1).next()}async getKeys(){return new a.default(this._mongo,this._clientEncryption._libmongocrypt.getKeys())}async deleteKey(e){return(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.deleteKey"),await this._clientEncryption._libmongocrypt.deleteKey(e)}async addKeyAlternateName(e,t){return(0,o.assertArgsDefinedType)([e,t],[!0,"string"],"KeyVault.addKeyAlternateName"),await this._clientEncryption._libmongocrypt.addKeyAltName(e,t)}async removeKeyAlternateName(e,t){return(0,o.assertArgsDefinedType)([e,t],[!0,"string"],"KeyVault.removeKeyAlternateName"),await this._clientEncryption._libmongocrypt.removeKeyAltName(e,t)}async rewrapManyDataKey(e,t){return await this._clientEncryption._libmongocrypt.rewrapManyDataKey(e,t)}async createDataKey(...e){return await this.createKey(...e)}async removeKeyAltName(...e){return await this.removeKeyAlternateName(...e)}async addKeyAltName(...e){return await this.addKeyAlternateName(...e)}};s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"createKey",null),s([(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKey",null),s([(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKeyByAltName",null),s([(0,n.returnType)("Cursor"),(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKeys",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"deleteKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"addKeyAlternateName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"removeKeyAlternateName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"rewrapManyDataKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"createDataKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"removeKeyAltName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"addKeyAltName",null),t.KeyVault=d=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],d)},55179:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(2416)),n=r(86930),a=i.default.translateApiHelp.bind(i.default);class o{constructor(e,t={translate:a}){this.attr=[],this.help=t.translate(e.help),this.docs=t.translate(e.docs),this.attr=(e.attr||[]).map((e=>({name:e.name,description:t.translate(e.description)}))).filter((e=>e.description))}[n.asPrintable](){const{help:e,docs:t,attr:r}=this;return{help:e,docs:t,attr:r}}get[n.shellApiType](){return"Help"}}t.default=o},86901:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildConfigChunksCollectionMatch=t.pickWithExactKeyMatch=t.assignAll=t.functionCtorWithoutProps=t.shallowClone=t.getBadge=t.adjustRunCommand=t.shouldRunAggregationImmediately=t.isValidCollectionName=t.isValidDatabaseName=t.markAsExplainOutput=t.maybeMarkAsExplainOutput=t.processFLEOptions=t.assertCLI=t.setHideIndex=t.processMapReduceOptions=t.processRemoveOptions=t.processFindAndModifyOptions=t.iterate=t.addHiddenDataProperty=t.tsToSeconds=t.scaleIndividualShardStatistics=t.dataFormat=t.coerceToJSNumber=t.getConfigDB=t.getPrintableShardStatus=t.processDigestPassword=t.adaptOptions=t.assertKeysDefined=t.assertArgsDefinedType=t.validateExplainableVerbosity=t.adaptAggregateOptions=void 0;const i=r(6534),n=s(r(84770)),a=r(73041),o=r(86930),l=r(21764);function c(e){if(!0===e?e="allPlansExecution":!1!==e&&void 0!==e||(e="queryPlanner"),"string"!=typeof e)throw new i.MongoshInvalidInputError("verbosity must be a string",i.CommonErrors.InvalidArgument);return e}function p(e){return e?` (${e})`:""}function u(e,t){for(const r of t)if(void 0===e[r])throw new i.MongoshInvalidInputError(`Missing required property: ${JSON.stringify(r)}`,i.CommonErrors.InvalidArgument)}function h(e){return"number"==typeof e?e:"toNumber"in e?e.toNumber():e.valueOf()}function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0}),e}function f(e){return null!==e&&"object"==typeof e&&d(e,o.shellApiType,"ExplainOutput"),e}function m(e){return"number"==typeof e&&Number.isInteger(e)||"Int32"===(null==e?void 0:e._bsontype)}function y(e){return Object.prototype.hasOwnProperty.call(e,"timestamp")?{uuid:e.uuid}:{ns:e._id}}t.adaptAggregateOptions=function(e={}){const t={...e},r={};let s;return"readConcern"in t&&(r.readConcern=e.readConcern,delete t.readConcern),"writeConcern"in t&&(Object.assign(r,e.writeConcern),delete t.writeConcern),"explain"in t&&(s=c(t.explain),delete t.explain),{aggOptions:t,dbOptions:r,explain:s}},t.validateExplainableVerbosity=c,t.assertArgsDefinedType=function(e,t,r){e.forEach(((e,s)=>{const n=t[s];if(void 0===e){if(!0!==n&&Array.isArray(n)&&n.includes(void 0))return;throw new i.MongoshInvalidInputError(`Missing required argument at position ${s}${p(r)}`,i.CommonErrors.InvalidArgument)}if(!0===n)return;const a="string"==typeof n?[n]:n,o=a.includes(typeof e),l=a.includes(`bson:${null==e?void 0:e._bsontype}`);if(!o&&!l){const t=a.filter((e=>void 0!==e)).map((e=>null==e?void 0:e.replace(/^bson:/,""))).join(" or ");throw new i.MongoshInvalidInputError(`Argument at position ${s} must be of type ${t}, got ${typeof e} instead${p(r)}`,i.CommonErrors.InvalidArgument)}}))},t.assertKeysDefined=u,t.adaptOptions=function(e,t,r){return Object.keys(r).reduce(((t,s)=>(null===e[s]||(t[e[s]||s]=r[s]),t)),t)},t.processDigestPassword=function(e,t,r){if(void 0===t)return{};if("server"!==t&&"client"!==t)throw new i.MongoshInvalidInputError(`Invalid field: passwordDigestor must be 'client' or 'server', got ${t}`,i.CommonErrors.InvalidArgument);if("client"===t){if("string"!=typeof r.pwd)throw new i.MongoshInvalidInputError("User passwords must be of type string. Was given password with type "+typeof r.pwd,i.CommonErrors.InvalidArgument);const t=n.default.createHash("md5");return t.update(`${e}:mongo:${r.pwd}`),{digestPassword:!1,pwd:t.digest("hex")}}return{digestPassword:!0}},t.getPrintableShardStatus=async function(e,t){const r={},s=e.getCollection("mongos"),n=e.getCollection("version"),o=e.getCollection("shards"),c=e.getCollection("chunks"),p=e.getCollection("settings"),u=e.getCollection("changelog"),[h,d,f]=await Promise.all([n.findOne({},{minCompatibleVersion:0,excluding:0,upgradeId:0,upgradeState:0}),o.find().then((e=>e.sort({_id:1}).toArray())),s.find().then((e=>e.sort({ping:-1}).limit(1).tryNext()))]);if(null===h)throw new i.MongoshInvalidInputError("This db does not have sharding enabled. Be sure you are connecting to a mongos from the shell and not to a mongod.",a.ShellApiErrors.NotConnectedToMongos);r.shardingVersion=h,r.shards=d;let m=null,g="most recently active";if(null!==f&&(m=f.ping,m.getTime()>=Date.now()-6e4&&(g="active")),g=`${g} mongoses`,null===m)r[g]="none";else{const e={ping:{$gt:(()=>{const e=m;return e.setTime(e.getTime()-6e4),e})()}};r[g]=t?await(await s.find(e)).sort({ping:-1}).toArray():(await(await s.aggregate([{$match:e},{$group:{_id:"$mongoVersion",num:{$sum:1}}},{$sort:{num:-1}}])).toArray()).map((e=>({[e._id]:e.num})))}const b={};await Promise.all([(async()=>{const e=await p.findOne({_id:"autosplit"});r.autosplit={"Currently enabled":null===e||e.enabled?"yes":"no"}})(),(async()=>{const e=await p.findOne({_id:"balancer"});b["Currently enabled"]=null!==e&&e.stopped?"no":"yes"})(),(async()=>{let t="unknown";try{t=(await e.adminCommand({balancerStatus:1})).inBalancerRound?"yes":"no"}catch(e){}b["Currently running"]=t})(),(async()=>{const e=await p.findOne({_id:"balancer"});if(null!==e&&Object.prototype.hasOwnProperty.call(e,"activeWindow")){const t=e.activeWindow;b["Balancer active window is set between"]=`${t.start} and ${t.stop} server local time`}})(),(async()=>{const t=await(await e.getCollection("locks").find({state:{$eq:2}})).toArray();(null==t?void 0:t.length)>0&&(b["Collections with active migrations"]=t.map((e=>`${e._id} started at ${e.when}`)))})(),(async()=>{let t=!h.currentVersion;const r=h.currentVersion;if(r>5&&(t=!0),5===r){const r=(await e.serverBuildInfo()).versionArray;2===r[0]&&r[1]>6&&(t=!0)}if(t){const t=await(await e.getCollection("actionlog").find({what:"balancer.round"})).sort({time:-1}).limit(5).toArray(),r={count:0,lastErr:"",lastTime:" "};null!==t&&t.forEach((e=>{e.details.errorOccured&&(r.count+=1,1===r.count&&(r.lastErr=e.details.errmsg,r.lastTime=e.time))})),b["Failed balancer rounds in last 5 attempts"]=r.count,r.count>0&&(b["Last reported error"]=r.lastErr,b["Time of Reported error"]=r.lastTime);const s=new Date;s.setDate(s.getDate()-1);let i=await(await u.aggregate([{$match:{time:{$gt:s},what:"moveChunk.from","details.errmsg":{$exists:!1},"details.note":"success"}},{$group:{_id:{msg:"$details.errmsg"},count:{$sum:1}}},{$project:{_id:{$ifNull:["$_id.msg","Success"]},count:"$count"}}])).toArray();i=i.concat(await(await u.aggregate([{$match:{time:{$gt:s},what:"moveChunk.from",$or:[{"details.errmsg":{$exists:!0}},{"details.note":{$ne:"success"}}]}},{$group:{_id:{msg:"$details.errmsg",from:"$details.from",to:"$details.to"},count:{$sum:1}}},{$project:{_id:{$ifNull:["$_id.msg","aborted"]},from:"$_id.from",to:"$_id.to",count:"$count"}}])).toArray());const n={};i.forEach((e=>{"Success"===e._id?n[e.count]=e._id:n[e.count]=`Failed with error '${e._id}', from ${e.from} to ${e.to}`})),0===i.length?b["Migration Results for the last 24 hours"]="No recent migrations":b["Migration Results for the last 24 hours"]=n}})()]),r.balancer=b;const x=await(await e.getCollection("databases").find()).sort({name:1}).toArray();return x.push({_id:"config",primary:"config",partitioned:!0}),x.sort(((e,t)=>e._id.localeCompare(t._id))),r.databases=await Promise.all(x.map((async r=>{const s=await(await e.getCollection("collections").find({_id:new RegExp("^"+(i=r._id,i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")+"\\."))})).sort({_id:1}).toArray();var i;const n=await Promise.all(s.filter((e=>!e.dropped)).map((async r=>{const s={};s.shardKey=r.key,s.unique=!!r.unique,"boolean"!=typeof r.unique&&void 0!==r.unique&&(s.unique=[!!r.unique,{unique:r.unique}]),s.balancing=!r.noBalance,"boolean"!=typeof r.noBalance&&void 0!==r.noBalance&&(s.balancing=[!r.noBalance,{noBalance:r.noBalance}]);const i=[],n=y(r),a=await(await c.aggregate([{$match:n},{$group:{_id:"$shard",cnt:{$sum:1}}},{$project:{_id:0,shard:"$_id",nChunks:"$cnt"}},{$sort:{shard:1}}])).toArray();let o=0;if(s.chunkMetadata=[],a.forEach((e=>{o+=e.nChunks,s.chunkMetadata.push({shard:e.shard,nChunks:e.nChunks})})),o<20||t)for await(const e of(await c.find(n)).sort({min:1})){const t={min:e.min,max:e.max,"on shard":e.shard,"last modified":e.lastmod};Object.defineProperty(t,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t){return(0,l.inspect)({...this},{...t,breakLength:1/0})},writable:!0,configurable:!0}),e.jumbo&&(t.jumbo="yes"),i.push(t)}else i.push("too many chunks to print, use verbose if you want to force print");const p=[];for await(const t of(await e.getCollection("tags").find({ns:r._id})).sort({min:1}))p.push({tag:t.tag,min:t.min,max:t.max});return s.chunks=i,s.tags=p,[r._id,s]})));return{database:r,collections:Object.fromEntries(n)}}))),delete r.shardingVersion.currentVersion,r},t.getConfigDB=async function(e){return"isdbgrid"!==(await e._maybeCachedHello()).msg&&await e._instanceState.printWarning("MongoshWarning: [SHAPI-10003] You are not connected to a mongos. This command may not work as expected."),e.getSiblingDB("config")},t.coerceToJSNumber=h,t.dataFormat=function(e){return null==e?"0B":e<1024?Math.floor(e)+"B":e<1048576?Math.floor(e/1024)+"KiB":e<1073741824?Math.floor(Math.floor(e/1024)/1024*100)/100+"MiB":Math.floor(Math.floor(e/1048576)/1024*100)/100+"GiB"},t.scaleIndividualShardStatistics=function(e,t){const r={};for(const s of Object.keys(e))if(["size","maxSize","storageSize","totalIndexSize","totalSize"].includes(s))r[s]=h(e[s])/t;else if("scaleFactor"===s)r[s]=t;else if("indexSizes"===s){const i={};for(const r of Object.keys(e[s]))i[r]=h(e[s][r])/t;r[s]=i}else r[s]=e[s];return r},t.tsToSeconds=function(e){return"object"==typeof e&&e&&"getHighBits"in e&&"getLowBits"in e?e.getHighBits():Number(e)/4294967296},t.addHiddenDataProperty=d,t.iterate=async function(e,t,r){if(t.isClosed())return e;for(let s=0;s<r;s++){const r=await t.tryNext();if(null===r){e.cursorHasMore=!1;break}e.documents.push(r)}return e},t.processFindAndModifyOptions=function(e){if("returnDocument"in(e={...e})){if("before"!==e.returnDocument&&"after"!==e.returnDocument)throw new i.MongoshInvalidInputError("returnDocument needs to be either 'before' or 'after'",i.CommonErrors.InvalidArgument);return delete e.returnNewDocument,delete e.returnOriginal,e}return"returnOriginal"in e?(e.returnDocument=e.returnOriginal?"before":"after",delete e.returnOriginal,delete e.returnNewDocument,e):"returnNewDocument"in e?(e.returnDocument=e.returnNewDocument?"after":"before",delete e.returnOriginal,delete e.returnNewDocument,delete e.new,e):"new"in e?(e.returnDocument=e.new?"after":"before",delete e.returnOriginal,delete e.returnNewDocument,delete e.new,e):(e.returnDocument="before",e)},t.processRemoveOptions=function(e){return"boolean"==typeof e?{justOne:e}:{justOne:!1,...e}},t.processMapReduceOptions=function(e){if("string"==typeof e)return{out:e};if(void 0===e.out)throw new i.MongoshInvalidInputError("Missing 'out' option",i.CommonErrors.InvalidArgument);return e},t.setHideIndex=async function(e,t,r){const s="string"==typeof t?{name:t,hidden:r}:{keyPattern:t,hidden:r};return await e._database._runCommand({collMod:e._name,index:s})},t.assertCLI=function(e,t){if("CLI"!==e)throw new i.MongoshUnimplementedError(`${t} are not supported for current platform: ${e}`,i.CommonErrors.NotImplemented)},t.processFLEOptions=function(e){var t,r;u(e,["keyVaultNamespace","kmsProviders"]),Object.keys(e).forEach((e=>{if(-1===["keyVaultClient","keyVaultNamespace","kmsProviders","schemaMap","bypassAutoEncryption","tlsOptions","bypassQueryAnalysis","encryptedFieldsMap"].indexOf(e))throw new i.MongoshInvalidInputError(`Unrecognized FLE Client Option ${e}`)}));const s={keyVaultClient:null===(t=e.keyVaultClient)||void 0===t?void 0:t._serviceProvider.getRawClient(),keyVaultNamespace:e.keyVaultNamespace},n=null===(r=e.kmsProviders.local)||void 0===r?void 0:r.key;if(n&&"Binary"===n._bsontype){const t=n.value();if(!Buffer.isBuffer(t))throw new i.MongoshInvalidInputError("When specifying the key of a local KMS as BSON binary it must be constructed from a base64 encoded string");s.kmsProviders={...e.kmsProviders,local:{key:t}}}else s.kmsProviders={...e.kmsProviders};return e.schemaMap&&(s.schemaMap=e.schemaMap),void 0!==e.bypassAutoEncryption&&(s.bypassAutoEncryption=e.bypassAutoEncryption),e.encryptedFieldsMap&&(s.encryptedFieldsMap=e.encryptedFieldsMap),void 0!==e.bypassQueryAnalysis&&(s.bypassQueryAnalysis=e.bypassQueryAnalysis),void 0!==e.tlsOptions&&(s.tlsOptions=e.tlsOptions),s},t.maybeMarkAsExplainOutput=function(e,t){return"explain"in t?f(e):e},t.markAsExplainOutput=f,t.isValidDatabaseName=function(e){return!!e&&!/[/\\. "\0]/.test(e)},t.isValidCollectionName=function(e){return!!e&&!/[$\0]/.test(e)},t.shouldRunAggregationImmediately=function(e){return e.some((e=>Object.keys(e).some((e=>"$merge"===e||"$out"===e))))},t.adjustRunCommand=function e(t,r){if(void 0!==t.replSetResizeOplog){if("size"in t&&m(t.size))return e({...t,size:new r.Double(+t.size)},r);if("minRetentionHours"in t&&m(t.minRetentionHours))return e({...t,minRetentionHours:new r.Double(+t.minRetentionHours)},r)}return void 0!==t.profile&&"sampleRate"in t&&m(t.sampleRate)?e({...t,sampleRate:new r.Double(+t.sampleRate)},r):void 0!==t.setParameter&&void 0!==t.mirrorReads&&"samplingRate"in t.mirrorReads&&m(t.mirrorReads.samplingRate)?e({...t,mirrorReads:{...t.mirrorReads,samplingRate:new r.Double(+t.mirrorReads.samplingRate)}},r):"configureQueryAnalyzer"in t&&m(t.sampleRate)?e({...t,sampleRate:new r.Double(+t.sampleRate)},r):t},t.getBadge=function(e,t){return"timeseries"===e[t].type?"[time-series]":"view"===e[t].type?"[view]":((e,t)=>!e[t].name.startsWith("enxcol_.")&&e.some((r=>r.name===`enxcol_.${e[t].name}.esc`))&&e.some((r=>r.name===`enxcol_.${e[t].name}.ecc`))&&e.some((r=>r.name===`enxcol_.${e[t].name}.ecoc`)))(e,t)?"[queryable-encryption]":""},t.shallowClone=function(e){return e&&"object"==typeof e?Array.isArray(e)?[...e]:{...e}:e},t.functionCtorWithoutProps=function(e){function t(...t){return new.target?Reflect.construct(e,t,new.target):new e(...t)}Object.setPrototypeOf(t,Object.getPrototypeOf(e));const r=Object.getOwnPropertyDescriptor(e,"name");return r&&Object.defineProperty(t,"name",r),t},t.assignAll=function(e,...t){var r;const s=[];for(const e of t)s.push(...Object.entries(Object.getOwnPropertyDescriptors(e)));const i=Object.fromEntries(s);for(const t of Object.getOwnPropertyNames(i))!1===(null===(r=Object.getOwnPropertyDescriptor(e,t))||void 0===r?void 0:r.configurable)&&(e[t]=i[t].value,delete i[t]);return Object.defineProperties(e,i),e},t.pickWithExactKeyMatch=function(e,t){return Object.create(Object.getPrototypeOf(e),Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(e)).filter((([e])=>t.includes(e)))))},t.buildConfigChunksCollectionMatch=y},46993:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.InterruptFlag=t.getShellApiType=t.toShellResult=t.Topologies=t.ServerVersions=t.ShellApi=t.signatures=t.UpdateResult=t.ReplicaSet=t.Shard=t.Mongo=t.InsertOneResult=t.InsertManyResult=t.DeleteResult=t.CommandResult=t.BulkWriteResult=t.ShellInstanceState=t.Help=t.ExplainableCursor=t.Explainable=t.Collection=t.Database=t.CursorIterationResult=t.Cursor=t.RunCommandCursor=t.AggregationCursor=void 0;const i=s(r(20371));t.AggregationCursor=i.default;const n=s(r(7191));t.RunCommandCursor=n.default;const a=s(r(6988));t.Collection=a.default;const o=s(r(4564));t.Cursor=o.default;const l=s(r(78041));t.Database=l.default;const c=s(r(37149));t.Explainable=c.default;const p=s(r(93379));t.ExplainableCursor=p.default;const u=s(r(55179));t.Help=u.default;const h=s(r(75794));t.ShellInstanceState=h.default;const d=s(r(91923));t.Shard=d.default;const f=s(r(35215));t.ReplicaSet=f.default;const m=s(r(15826));t.ShellApi=m.default;const y=r(58744);Object.defineProperty(t,"BulkWriteResult",{enumerable:!0,get:function(){return y.BulkWriteResult}}),Object.defineProperty(t,"CommandResult",{enumerable:!0,get:function(){return y.CommandResult}}),Object.defineProperty(t,"CursorIterationResult",{enumerable:!0,get:function(){return y.CursorIterationResult}}),Object.defineProperty(t,"DeleteResult",{enumerable:!0,get:function(){return y.DeleteResult}}),Object.defineProperty(t,"InsertManyResult",{enumerable:!0,get:function(){return y.InsertManyResult}}),Object.defineProperty(t,"InsertOneResult",{enumerable:!0,get:function(){return y.InsertOneResult}}),Object.defineProperty(t,"UpdateResult",{enumerable:!0,get:function(){return y.UpdateResult}});const g=s(r(69483));t.Mongo=g.default;const b=r(40191);Object.defineProperty(t,"signatures",{enumerable:!0,get:function(){return b.signatures}}),Object.defineProperty(t,"toShellResult",{enumerable:!0,get:function(){return b.toShellResult}}),Object.defineProperty(t,"getShellApiType",{enumerable:!0,get:function(){return b.getShellApiType}});const x=r(86930);Object.defineProperty(t,"Topologies",{enumerable:!0,get:function(){return x.Topologies}}),Object.defineProperty(t,"ServerVersions",{enumerable:!0,get:function(){return x.ServerVersions}});const v=r(38961);Object.defineProperty(t,"InterruptFlag",{enumerable:!0,get:function(){return v.InterruptFlag}})},38961:(e,t,r)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.InterruptFlag=t.MongoshInterruptedError=void 0;const i=r(6534),n=Symbol.for("@@mongosh.uncatchable");class a extends i.MongoshBaseError{constructor(){super("MongoshInterruptedError","execution was interrupted"),this[s]=!0}}t.MongoshInterruptedError=a,s=n,t.InterruptFlag=class{constructor(){this.interrupted=!1,this.onInterruptListeners=new Set}isSet(){return this.interrupted}checkpoint(){if(this.interrupted)throw new a}asPromise(){if(this.interrupted){const e=Promise.reject(new a);return e.catch((()=>{})),{destroy:()=>{},promise:e}}let e;const t=new Promise(((t,r)=>{e=()=>{this.onInterruptListeners.delete(r),r(null)},this.onInterruptListeners.add(r)}));return t.catch((()=>{})),{destroy:e,promise:t}}async set(){this.interrupted=!0;const e=new a;for(const t of[...this.onInterruptListeners])try{await t(e)}catch(e){}}reset(){this.interrupted=!1}async withOverrideInterruptBehavior(e,t){const r=this.asPromise();let s;const i=new Promise((e=>{s=async()=>{const r=t();return e(r),r}}));this.onInterruptListeners.add(s);try{this.checkpoint();const t=e(r);return t.catch((()=>{})),await Promise.race([t,r.promise])}catch(e){throw this.interrupted&&await i,e}finally{r.destroy(),this.onInterruptListeners.delete(s)}}}},91616:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseAnyLogEntry=void 0,t.parseAnyLogEntry=function(e){var t;try{const r=JSON.parse(e);return{id:r.id,timestamp:null===(t=r.t)||void 0===t?void 0:t.$date,severity:r.s,component:r.c,context:r.ctx,message:r.msg,attr:r.attr}}catch(t){return function(e){const t=/^(?<timestamp>\S*) *(?<severity>\S*) *(?<component>\S*) *\[(?<context>[^\]]+)\]\s*(?<message>.*)$/.exec(e.trim());if(!t)throw new Error(`Could not parse line ${JSON.stringify(e)}`);return t.groups}(e)}}},72292:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransformMongoErrorPlugin=t.rephraseMongoError=void 0;const r=[{code:13435,replacement:"not primary and secondaryOk=false - consider using db.getMongo().setReadPref() or readPreference in the connection string"}];function s(e){if(!function(e){var t,r,s;return/^Mongo([A-Z].*)?Error$/.test(null!==(s=null===(r=null===(t=Object.getPrototypeOf(e))||void 0===t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==s?s:"")}(e))return e;const t=e,s=t.message,i=r.find((e=>e.matchMessage?"string"==typeof e.matchMessage?s.includes(e.matchMessage):e.matchMessage.test(s):void 0!==e.code&&t.code===e.code));return i&&(t.message="function"==typeof i.replacement?i.replacement(s):i.replacement),t}t.rephraseMongoError=s,t.TransformMongoErrorPlugin=class{transformError(e){return s(e)}}},69483:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(6534),a=r(40191),o=r(35935),l=i(r(78041)),c=r(58744),p=r(46177),u=r(86930),h=i(r(82428)),d=r(86901),f=i(r(88494)),m=r(73041),y=r(99232),g=r(73041),b=r(91616);let x=class extends a.ShellApiClass{constructor(e,t,r,s,i){var a,l,c;if(super(),this.__serviceProvider=null,this._explicitEncryptionOnly=!1,this._readPreferenceWasExplicitlyRequested=!1,this._cachedDatabaseNames=[],this._instanceState=e,this._databases={},i&&(this.__serviceProvider=i),"object"==typeof t&&null!==t&&"string"==typeof t._uri?t=t._uri:"string"!=typeof t&&(t=null!==(l=null===(a=null==i?void 0:i.getURI)||void 0===a?void 0:a.call(i))&&void 0!==l?l:"mongodb://localhost/"),this._connectionInfo=(0,o.generateConnectionInfoFromCliArgs)({connectionSpecifier:t}),this._readPreferenceWasExplicitlyRequested=/\breadPreference=/i.test(this._uri),r){if(void 0!==r.explicitEncryptionOnly){if(void 0!==r.schemaMap)throw new n.MongoshInvalidInputError("explicitEncryptionOnly and schemaMap are mutually exclusive",n.CommonErrors.InvalidArgument);r={...r},this._explicitEncryptionOnly=!!r.explicitEncryptionOnly,delete r.explicitEncryptionOnly}this._connectionInfo.driverOptions.autoEncryption=(0,d.processFLEOptions)(r)}else{const e=null===(c=null==i?void 0:i.getFleOptions)||void 0===c?void 0:c.call(i);e&&(this._connectionInfo.driverOptions.autoEncryption=e)}(null==s?void 0:s.api)&&("string"==typeof s.api?this._connectionInfo.driverOptions.serverApi={version:s.api}:this._connectionInfo.driverOptions.serverApi=s.api)}get _uri(){return this._connectionInfo.connectionString}get _fleOptions(){return this._connectionInfo.driverOptions.autoEncryption}get _serviceProvider(){if(null===this.__serviceProvider)throw new n.MongoshInternalError("No ServiceProvider available for this mongo",g.ShellApiErrors.NotConnected);return this.__serviceProvider}set _serviceProvider(e){this.__serviceProvider=e}async _displayBatchSize(){var e;return null!==(e=this._instanceState.displayBatchSizeFromDBQuery)&&void 0!==e?e:await this._instanceState.shellApi.config.get("displayBatchSize")}[u.asPrintable](){return(0,p.redactURICredentials)(this._uri)}_emitMongoApiCall(e,t={}){this._instanceState.emitApiCallWithArgs({method:e,class:"Mongo",uri:this._uri,arguments:t})}async connect(e,t){var r,s,i,n;(e||t)&&(this._connectionInfo=(0,o.mapCliToDriver)({username:e,password:t},this._connectionInfo));const a={...this._connectionInfo.driverOptions};this._explicitEncryptionOnly?delete a.autoEncryption:a.autoEncryption&&(a.autoEncryption.extraOptions={...a.autoEncryption.extraOptions,...await(null===(s=null===(r=this._instanceState.evaluationListener)||void 0===r?void 0:r.getCryptLibraryOptions)||void 0===s?void 0:s.call(r))});const l=this._instanceState.initialServiceProvider;try{this.__serviceProvider=await l.getNewConnection(this._uri,a)}catch(e){throw"MongoServerSelectionError"===(null==e?void 0:e.name)&&(null===(n=null===(i=l.getRawClient())||void 0===i?void 0:i.options)||void 0===n?void 0:n.tls)&&!/\b(ssl|tls)=/.exec(this._uri)&&(e.message+=" (is ?tls=true missing from the connection string?)"),e}}_getDb(e){if((0,d.assertArgsDefinedType)([e],["string"]),!(0,d.isValidDatabaseName)(e))throw new n.MongoshInvalidInputError(`Invalid database name: ${e}`,n.CommonErrors.InvalidArgument);return e in this._databases||(this._databases[e]=new l.default(this,e)),this._databases[e]}getDB(e){return(0,d.assertArgsDefinedType)([e],["string"],"Mongo.getDB"),this._instanceState.messageBus.emit("mongosh:getDB",{db:e}),this._getDb(e)}getCollection(e){var t,r;(0,d.assertArgsDefinedType)([e],["string"]);const{db:s,coll:i}=null!==(r=null===(t=/^(?<db>[^.]+)\.(?<coll>.+)$/.exec(e))||void 0===t?void 0:t.groups)&&void 0!==r?r:{};if(!s||!i)throw new n.MongoshInvalidInputError("Collection must be of the format <db>.<collection>",n.CommonErrors.InvalidArgument);return this._getDb(s).getCollection(i)}getURI(){return this._uri}use(e){var t;let r,s;(0,d.assertArgsDefinedType)([e],["string"],"Mongo.use"),this._instanceState.messageBus.emit("mongosh:use",{db:e});try{const e=this._instanceState.context.db;r=null===(t=null==e?void 0:e.getName)||void 0===t?void 0:t.call(e),s=null==e?void 0:e._mongo}catch(e){if((null==e?void 0:e.code)!==g.ShellApiErrors.NotConnected)throw e}return this._instanceState.context.db=this._getDb(e),e===r&&s===this?`already on db ${e}`:`switched to db ${e}`}async _listDatabases(e={}){const t=await this._serviceProvider.listDatabases("admin",{...this._getExplicitlyRequestedReadPref(),...e});if(!("databases"in t)){const e=new n.MongoshRuntimeError('Got invalid result from "listDatabases"',n.CommonErrors.CommandFailed);throw this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),e}return this._cachedDatabaseNames=t.databases.map((e=>e.name)),t}async _getDatabaseNamesForCompletion(){return await Promise.race([(async()=>(await this._listDatabases({readPreference:"primaryPreferred"})).databases.map((e=>e.name)))(),(async()=>(await new Promise((e=>setTimeout(e,200).unref())),this._cachedDatabaseNames))()])}async getDBs(e={}){return this._emitMongoApiCall("getDBs",{options:e}),await this._listDatabases(e)}async getDBNames(e={}){return this._emitMongoApiCall("getDBNames",{options:e}),(await this._listDatabases(e)).databases.map((e=>e.name))}async show(e,t){var r,s,i;const a=this._instanceState.currentDb;switch(this._instanceState.messageBus.emit("mongosh:show",{method:`show ${e}`}),e){case"databases":case"dbs":const o=(await this._listDatabases({readPreference:"primaryPreferred",promoteLongs:!0})).databases;return new c.CommandResult("ShowDatabasesResult",o);case"collections":case"tables":const l=await a._getCollectionNamesWithTypes({readPreference:"primaryPreferred",promoteLongs:!0});return new c.CommandResult("ShowCollectionsResult",l);case"profile":const p=a.getCollection("system.profile"),u={count:await p.countDocuments({})};return 0!==u.count&&(u.result=await(await p.find({millis:{$gt:0}})).sort({$natural:-1}).limit(5).toArray()),new c.CommandResult("ShowProfileResult",u);case"users":const h=await a.getUsers();return new c.CommandResult("ShowResult",h.users);case"roles":const d=await a.getRoles({showBuiltinRoles:!0});return new c.CommandResult("ShowResult",d.roles);case"log":const f=await a.adminCommand({getLog:t||"global"});return new c.CommandResult("ShowResult",f.log);case"logs":const m=await a.adminCommand({getLog:"*"});return new c.CommandResult("ShowResult",m.names);case"startupWarnings":{let e;try{if(e=await a.adminCommand({getLog:"startupWarnings"}),!e)throw new n.MongoshCommandFailed("adminCommand getLog unexpectedly returned no result")}catch(e){return this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),new c.CommandResult("ShowBannerResult",null)}if(!e.log||!e.log.length)return new c.CommandResult("ShowBannerResult",null);const t=e.log.map((e=>{try{const t=(0,b.parseAnyLogEntry)(e);return`${t.timestamp}: ${t.message}`}catch(t){return`Unexpected log line format: ${e}`}}));return new c.CommandResult("ShowBannerResult",{header:"The server generated these startup warnings when booting",content:t.join("\n")})}case"automationNotices":{let e;try{e=await a.hello()}catch(e){return this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),new c.CommandResult("ShowBannerResult",null)}return e.automationServiceDescriptor?new c.CommandResult("ShowBannerResult",{content:`This server is managed by automation service '${e.automationServiceDescriptor}'.\nMany administrative actions are inappropriate, and may be automatically reverted.`}):new c.CommandResult("ShowBannerResult",null)}case"nonGenuineMongoDBCheck":return null===(i=null===(s=null===(r=this._instanceState.connectionInfo)||void 0===r?void 0:r.extraInfo)||void 0===s?void 0:s.is_genuine)||void 0===i||i?new c.CommandResult("ShowBannerResult",null):new c.CommandResult("ShowBannerResult",{header:"Warning: Non-Genuine MongoDB Detected",content:["This server or service appears to be an emulation of MongoDB rather than an official MongoDB product.","Some documented MongoDB features may work differently, be entirely missing or incomplete, or have unexpected performance characteristics.","To learn more please visit: https://dochub.mongodb.org/core/non-genuine-mongodb-server-warning."].join("\n")});default:const y=new n.MongoshInvalidInputError(`'${e}' is not a valid argument for "show".`,n.CommonErrors.InvalidArgument);throw this._instanceState.messageBus.emit("mongosh:error",y,"shell-api"),y}}async close(e){const t=this._instanceState.mongos.indexOf(this);-1===t?process.emitWarning(new n.MongoshInternalError(`Closing untracked Mongo instance ${this[u.asPrintable]()}`)):this._instanceState.mongos.splice(t,1),await this._serviceProvider.close(e)}async _suspend(){return await this._serviceProvider.suspend()}getReadPrefMode(){return this._serviceProvider.getReadPreference().mode}getReadPrefTagSet(){return this._serviceProvider.getReadPreference().tags}getReadPref(){return this._serviceProvider.getReadPreference()}_getExplicitlyRequestedReadPref(){return this._readPreferenceWasExplicitlyRequested?{readPreference:this.getReadPref()}:void 0}getReadConcern(){try{const e=this._serviceProvider.getReadConcern();return e?e.level:void 0}catch(e){throw new n.MongoshInternalError("Error retrieving ReadConcern.")}}getWriteConcern(){try{return this._serviceProvider.getWriteConcern()}catch(e){throw new n.MongoshInternalError("Error retrieving WriteConcern.")}}async setReadPref(e,t,r){await this._serviceProvider.resetConnectionOptions({readPreference:this._serviceProvider.readPreferenceFromOptions({readPreference:e,readPreferenceTags:t,hedge:r})}),this._readPreferenceWasExplicitlyRequested=!0}async setReadConcern(e){await this._serviceProvider.resetConnectionOptions({readConcern:{level:e}})}async setWriteConcern(e,t,r){const s={};let i;if("object"==typeof e){if(void 0!==t||void 0!==r)throw new n.MongoshInvalidInputError("If concern is given as an object no other arguments must be specified",n.CommonErrors.InvalidArgument);i=e}else{if(i={},"string"!=typeof e&&"number"!=typeof e)throw new n.MongoshInvalidInputError("w value must be a number or string, got: "+typeof e,n.CommonErrors.InvalidArgument);if("number"==typeof e&&e<0)throw new n.MongoshInvalidInputError(`w value must be equal to or greather than 0, got: ${e}`,n.CommonErrors.InvalidArgument);if(i.w=e,void 0!==t){if("number"!=typeof t)throw new n.MongoshInvalidInputError("wtimeoutMS value must be a number, got: "+typeof t,n.CommonErrors.InvalidArgument);if(t<0)throw new n.MongoshInvalidInputError(`wtimeoutMS must be equal to or greather than 0, got: ${t}`,n.CommonErrors.InvalidArgument);i.wtimeout=t}if(void 0!==r){if("boolean"!=typeof r)throw new n.MongoshInvalidInputError("j value must be a boolean, got: "+typeof r,n.CommonErrors.InvalidArgument);i.j=r}}void 0!==i.w&&(s.w=i.w),void 0!==i.wtimeout&&(s.wtimeoutMS=i.wtimeout),void 0!==i.j&&(s.journal=i.j),void 0!==i.fsync&&(s.journal=!!i.fsync),await this._serviceProvider.resetConnectionOptions(s)}startSession(e={}){const t=["readConcern","writeConcern","readPreference","maxCommitTimeMS"],r={};for(const s of t)void 0!==e[s]&&(r[s]=e[s]);const s=["causalConsistency","snapshot"],i={};Object.keys(r).length>0&&(i.defaultTransactionOptions=r);for(const t of s)void 0!==e[t]&&(i[t]=e[t]);return new h.default(this,i,this._serviceProvider.startSession(i))}setCausalConsistency(){throw new n.MongoshUnimplementedError("It is not possible to set causal consistency for an entire connection due to the driver, use startSession({causalConsistency: <>}) instead.",n.CommonErrors.NotImplemented,(0,m.blockedByDriverMetadata)("Mongo.setCausalConsistency"))}isCausalConsistency(){throw new n.MongoshUnimplementedError("Causal consistency for drivers is set via Mongo.startSession and can be checked via session.getOptions. The default value is true",n.CommonErrors.NotImplemented,(0,m.blockedByDriverMetadata)("Mongo.isCausalConsistency"))}setSlaveOk(){throw new n.MongoshDeprecatedError("Setting slaveOk is deprecated, use setReadPref instead.")}async setSecondaryOk(){await this._instanceState.printDeprecationWarning('.setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead');const e=this.getReadPrefMode();"primary"===e?(await this._instanceState.shellApi.print('Setting read preference from "primary" to "primaryPreferred"'),await this.setReadPref("primaryPreferred")):await this._instanceState.shellApi.print(`Leaving read preference unchanged (is already "${e}")`)}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitMongoApiCall("watch",{pipeline:e,options:t});const r=new f.default(this._serviceProvider.watch(e,t),(0,p.redactURICredentials)(this._uri),this);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._instanceState.currentCursor=r,r}getClientEncryption(){if(!this._fleOptions)throw new n.MongoshInvalidInputError("Cannot call getClientEncryption() without field-level encryption options",g.ShellApiErrors.NotUsingFLE);return this._clientEncryption||(this._clientEncryption=new y.ClientEncryption(this)),this._clientEncryption}async getKeyVault(){return this._keyVault||(this._keyVault=new y.KeyVault(this.getClientEncryption()),await this._keyVault._init()),this._keyVault}async convertShardKeyToHashed(e){const t=[{$limit:1},{$project:{_id:{$toHashedIndexKey:{$literal:e}}}}];let r;for(const e of[()=>this.getDB("_fakeDbForMongoshCSKTH").aggregate([{$documents:[{}]},...t]),()=>this.getDB("admin").aggregate([{$documents:[{}]},...t]),()=>this.getDB("admin").getCollection("system.version").aggregate(t),()=>this.getDB("local").getCollection("oplog.rs").aggregate([{$collStats:{}},...t])]){try{r=await(await e()).next()}catch(e){continue}if(r)break}if(!r)throw new n.MongoshRuntimeError("Could not find a suitable way to run convertShardKeyToHashed() -- tried $documents and aggregating on admin.system.version and local.oplog.rs",n.CommonErrors.CommandFailed);return r._id}};s([(0,a.returnType)("Database")],x.prototype,"getDB",null),s([(0,a.returnType)("Collection")],x.prototype,"getCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"getDBs",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"getDBNames",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"show",null),s([a.returnsPromise],x.prototype,"setReadPref",null),s([a.returnsPromise],x.prototype,"setReadConcern",null),s([a.returnsPromise],x.prototype,"setWriteConcern",null),s([(0,a.topologies)([u.Topologies.ReplSet])],x.prototype,"startSession",null),s([a.deprecated],x.prototype,"setSlaveOk",null),s([a.deprecated,a.returnsPromise],x.prototype,"setSecondaryOk",null),s([(0,a.serverVersions)(["3.1.0",u.ServerVersions.latest]),(0,a.topologies)([u.Topologies.ReplSet,u.Topologies.Sharded]),(0,a.apiVersions)([1]),a.returnsPromise],x.prototype,"watch",null),s([(0,a.platforms)(["CLI"]),(0,a.serverVersions)(["4.2.0",u.ServerVersions.latest]),(0,a.returnType)("ClientEncryption")],x.prototype,"getClientEncryption",null),s([(0,a.platforms)(["CLI"]),(0,a.serverVersions)(["4.2.0",u.ServerVersions.latest]),(0,a.returnType)("KeyVault"),a.returnsPromise],x.prototype,"getKeyVault",null),s([a.returnsPromise],x.prototype,"convertShardKeyToHashed",null),x=s([a.shellApiClassDefault,(0,a.classPlatforms)(["CLI"])],x),t.default=x},51238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=r(6534),i=r(73041);t.default=class{constructor(){return this._mongo=new n,new Proxy(this,{get:(e,t)=>{if("_mongo"===t)return this._mongo;throw new s.MongoshInvalidInputError("No connected database",i.ShellApiErrors.NotConnected)}})}};class n{constructor(){return new Proxy(this,{get:()=>{throw new s.MongoshInvalidInputError("No connected database",i.ShellApiErrors.NotConnected)}})}}},20541:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(86930),a=r(6534);let o=class extends i.ShellApiWithMongoClass{constructor(e){super(),this._collection=e}get _mongo(){return this._collection._mongo}[n.asPrintable](){return`PlanCache for collection ${this._collection._name}.`}async clear(){return await this._collection.runCommand("planCacheClear")}async clearPlansByQuery(e,t,r){const s={query:e};return t&&(s.projection=t),r&&(s.sort=r),await this._collection.runCommand("planCacheClear",s)}async list(e){const t=e||[],r=await this._collection.aggregate([{$planCacheStats:{}},...t]);return await r.toArray()}listQueryShapes(){throw new a.MongoshDeprecatedError("PlanCache.listQueryShapes was deprecated, please use PlanCache.list instead")}getPlansByQuery(){throw new a.MongoshDeprecatedError("PlanCache.getPlansByQuery was deprecated, please use PlanCache.list instead")}};s([i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"clear",null),s([i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"clearPlansByQuery",null),s([(0,i.serverVersions)(["4.4.0",n.ServerVersions.latest]),i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"list",null),s([i.deprecated],o.prototype,"listQueryShapes",null),s([i.deprecated],o.prototype,"getPlansByQuery",null),o=s([i.shellApiClassDefault],o),t.default=o},35215:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(46177),a=r(40191),o=r(86930),l=r(86901);let c=class extends a.ShellApiWithMongoClass{constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}async initiate(e={}){return this._emitReplicaSetApiCall("initiate",{config:e}),this._database._runAdminCommand({replSetInitiate:e})}async _getConfig(){try{const e=await this._database._runAdminCommand({replSetGetConfig:1});if(void 0===e.config)throw new i.MongoshRuntimeError("Documented returned from command replSetGetConfig does not contain 'config'",i.CommonErrors.CommandFailed);return e.config}catch(e){if("CommandNotFound"===(null==e?void 0:e.codeName)||"APIStrictError"===(null==e?void 0:e.codeName)){const e=await this._database.getSiblingDB("local").getCollection("system.replset").findOne();if(null===e)throw new i.MongoshRuntimeError("No documents in local.system.replset",i.CommonErrors.CommandFailed);return e}throw e}}async config(){return this._emitReplicaSetApiCall("config",{}),this._getConfig()}async conf(){return this._emitReplicaSetApiCall("conf",{}),this._getConfig()}async reconfig(e,t={}){var r;(0,l.assertArgsDefinedType)([e,t],["object",[void 0,"object"]],"ReplicaSet.reconfig"),this._emitReplicaSetApiCall("reconfig",{config:e,options:t});const s=await this._getConfig();e.version=s.version?s.version+1:1,null!==(r=e.protocolVersion)&&void 0!==r||(e.protocolVersion=s.protocolVersion);const i={replSetReconfig:e,...t};return await this._database._runAdminCommand(i)}async reconfigForPSASet(e,t,r={}){var s;(0,l.assertArgsDefinedType)([e,t,r],["number","object",[void 0,"object"]],"ReplicaSet.reconfigForPSASet"),this._emitReplicaSetApiCall("reconfigForPSASet",{newMemberIndex:e,config:t,options:r});const n=e=>this._instanceState.shellApi.print(e),a=null===(s=t.members)||void 0===s?void 0:s[e];if(!a)throw new i.MongoshInvalidInputError(`Node at index ${e} does not exist in the new config`,i.CommonErrors.InvalidArgument);if(1!==a.votes)throw new i.MongoshInvalidInputError(`Node at index ${e} must have { votes: 1 } in the new config (actual: { votes: ${a.votes} })`,i.CommonErrors.InvalidArgument);const o=await this._getConfig(),c=o.members.find((e=>e._id===a._id));if(c){if(c.votes)throw new i.MongoshInvalidInputError(`Node at index ${e} must have { votes: 0 } in the old config (actual: { votes: ${c.votes} })`,i.CommonErrors.InvalidArgument)}else o.members.find((e=>e.host===a.host))&&await n(`Warning: Node at index ${e} has { host: "${a.host}" }, which is also present in the old config, but with a different _id field.`);const p=a.priority;await n(`Running first reconfig to give member at index ${e} { votes: 1, priority: 0 }`),a.votes=1,a.priority=0;const u=await this.reconfig(t,r);if(0===p)return await n("No second reconfig necessary because .priority = 0"),u;await n(`Running second reconfig to give member at index ${e} { priority: ${p} }`),a.priority=p;try{return await this.reconfig(t,r)}catch(e){throw await n("Second reconfig did not succeed, giving up"),await n(`Attempted command: rs.reconfig(${JSON.stringify(t,null," ")}, ${JSON.stringify(r)})`),e}}async status(){return this._emitReplicaSetApiCall("status",{}),this._database._runAdminCommand({replSetGetStatus:1})}async isMaster(){return this._emitReplicaSetApiCall("isMaster",{}),this._database.getSiblingDB("admin").isMaster()}async hello(){return this._emitReplicaSetApiCall("hello",{}),this._database.getSiblingDB("admin").hello()}async printSecondaryReplicationInfo(){return this._emitReplicaSetApiCall("printSecondaryReplicationInfo",{}),this._database.printSecondaryReplicationInfo()}printSlaveReplicationInfo(){throw new i.MongoshDeprecatedError("printSlaveReplicationInfo has been deprecated. Use printSecondaryReplicationInfo instead")}async printReplicationInfo(){return this._emitReplicaSetApiCall("printReplicationInfo",{}),this._database.printReplicationInfo()}async add(e,t){(0,l.assertArgsDefinedType)([e,t],[["string","object"],[void 0,"boolean"]],"ReplicaSet.add"),this._emitReplicaSetApiCall("add",{hostport:e,arb:t});const r=await this._getConfig();r.version++;const s=Math.max(...r.members.map((e=>e._id)));let n;if("string"==typeof e)n={_id:s+1,host:e},t&&(n.arbiterOnly=!0);else{if(!0===t)throw new i.MongoshInvalidInputError(`Expected first parameter to be a host-and-port string of arbiter, but got ${JSON.stringify(e)}`,i.CommonErrors.InvalidArgument);n=e,null!==n._id&&void 0!==n._id||(n._id=s+1)}return r.members.push(n),this._database._runAdminCommand({replSetReconfig:r})}async addArb(e){return this._emitReplicaSetApiCall("addArb",{hostname:e}),this.add(e,!0)}async remove(e){(0,l.assertArgsDefinedType)([e],["string"],"ReplicaSet.remove"),this._emitReplicaSetApiCall("remove",{hostname:e});const t=await this._getConfig();t.version++;for(let r=0;r<t.members.length;r++)if(t.members[r].host===e)return t.members.splice(r,1),this._database._runAdminCommand({replSetReconfig:t});throw new i.MongoshInvalidInputError(`Couldn't find ${e} in ${JSON.stringify(t.members)}. Is ${e} a member of this replset?`,i.CommonErrors.InvalidArgument)}async freeze(e){return(0,l.assertArgsDefinedType)([e],["number"],"ReplicaSet.freeze"),this._emitReplicaSetApiCall("freeze",{secs:e}),this._database._runAdminCommand({replSetFreeze:e})}async stepDown(e,t){(0,l.assertArgsDefinedType)([e,t],[[void 0,"number"],[void 0,"number"]],"ReplicaSet.stepDown"),this._emitReplicaSetApiCall("stepDown",{stepdownSecs:e,catchUpSecs:t});const r={replSetStepDown:void 0===e?60:e};return void 0!==t&&(r.secondaryCatchUpPeriodSecs=t),this._database._runAdminCommand(r)}async syncFrom(e){return(0,l.assertArgsDefinedType)([e],["string"],"ReplicaSet.syncFrom"),this._emitReplicaSetApiCall("syncFrom",{host:e}),this._database._runAdminCommand({replSetSyncFrom:e})}async secondaryOk(){await this._mongo.setSecondaryOk()}[o.asPrintable](){return`ReplicaSet class connected to ${(0,n.redactURICredentials)(this._database._mongo._uri)} via db ${this._database._name}`}_emitReplicaSetApiCall(e,t={}){this._database._mongo._instanceState.emitApiCallWithArgs({method:e,class:"ReplicaSet",arguments:t})}};s([a.returnsPromise],c.prototype,"initiate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"config",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"conf",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"reconfig",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"reconfigForPSASet",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"status",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"isMaster",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"hello",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"printSecondaryReplicationInfo",null),s([a.deprecated,(0,a.apiVersions)([])],c.prototype,"printSlaveReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"printReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"add",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"addArb",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"remove",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"freeze",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"stepDown",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"syncFrom",null),s([a.deprecated,a.returnsPromise],c.prototype,"secondaryOk",null),c=s([a.shellApiClassDefault],c),t.default=c},58744:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorIterationResult=t.DeleteResult=t.UpdateResult=t.InsertOneResult=t.InsertManyResult=t.BulkWriteResult=t.CommandResult=void 0;const i=r(40191),n=r(86930);let a=t.CommandResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.type=e,this.value=t,this[n.shellApiType]=e}[n.asPrintable](){return this.value}toJSON(){return this.value}};t.CommandResult=a=s([i.shellApiClassDefault],a);let o=t.BulkWriteResult=class extends i.ShellApiValueClass{constructor(e,t,r,s,i,n,a,o){super(),this.acknowledged=e,this.insertedCount=t,this.insertedIds=r,this.matchedCount=s,this.modifiedCount=i,this.deletedCount=n,this.upsertedCount=a,this.upsertedIds=o}};t.BulkWriteResult=o=s([i.shellApiClassDefault],o);let l=t.InsertManyResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.insertedIds=t}};t.InsertManyResult=l=s([i.shellApiClassDefault],l);let c=t.InsertOneResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.insertedId=t}};t.InsertOneResult=c=s([i.shellApiClassDefault],c);let p=t.UpdateResult=class extends i.ShellApiValueClass{constructor(e,t,r,s,i){super(),this.acknowledged=e,this.insertedId=i,this.matchedCount=t,this.modifiedCount=r,this.upsertedCount=s}};t.UpdateResult=p=s([i.shellApiClassDefault],p);let u=t.DeleteResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.deletedCount=t}};t.DeleteResult=u=s([i.shellApiClassDefault],u);let h=t.CursorIterationResult=class extends i.ShellApiValueClass{constructor(){super(),this.cursorHasMore=!0,this.documents=[]}};t.CursorIterationResult=h=s([i.shellApiClassDefault],h)},7191:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(35551);let a=class extends n.AbstractCursor{constructor(e,t){super(e,t)}};a=s([i.shellApiClassDefault],a),t.default=a},82428:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=i(r(78041)),l=r(6534),c=r(86901);let p=class extends n.ShellApiWithMongoClass{constructor(e,t,r){super(),this._session=r,this._options=t,this._mongo=e,this._databases={},this.id=r.id}[a.asPrintable](){return this._session.id}getDatabase(e){if((0,c.assertArgsDefinedType)([e],["string"],"Session.getDatabase"),!(0,c.isValidDatabaseName)(e))throw new l.MongoshInvalidInputError(`Invalid database name: ${e}`,l.CommonErrors.InvalidArgument);return e in this._databases||(this._databases[e]=new o.default(this._mongo,e,this)),this._databases[e]}advanceOperationTime(e){this._session.advanceOperationTime(e)}advanceClusterTime(e){this._session.advanceClusterTime(e)}async endSession(){return await this._session.endSession()}hasEnded(){return this._session.hasEnded}getClusterTime(){return this._session.clusterTime}getOperationTime(){return this._session.operationTime}getOptions(){return this._options}startTransaction(e={}){return this._session.startTransaction(e)}async commitTransaction(){await this._session.commitTransaction()}async abortTransaction(){await this._session.abortTransaction()}async withTransaction(e,t={}){return(0,c.assertArgsDefinedType)([e,t],["function",[void 0,"object"]]),await this._session.withTransaction((async()=>await e()),t)}};s([n.returnsPromise],p.prototype,"endSession",null),s([n.returnsPromise],p.prototype,"commitTransaction",null),s([n.returnsPromise],p.prototype,"abortTransaction",null),s([n.returnsPromise],p.prototype,"withTransaction",null),p=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],p),t.default=p},91923:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86901),o=r(86930),l=r(58744),c=r(46177),p=i(r(97699));let u=class extends n.ShellApiWithMongoClass{constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}[o.asPrintable](){return`Shard class connected to ${(0,c.redactURICredentials)(this._database._mongo._uri)} via db ${this._database._name}`}_emitShardApiCall(e,t={}){this._database._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Shard",arguments:t})}async enableSharding(e,t){(0,a.assertArgsDefinedType)([e,t],["string",[void 0,"string"]],"Shard.enableSharding"),this._emitShardApiCall("enableSharding",{database:e,primaryShard:t});const r={enableSharding:e};void 0!==t&&(r.primaryShard=t);try{return await this._database._runAdminCommand(r)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. Are you connected to mongos?`),e}}async commitReshardCollection(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.commitReshardCollection"),this._emitShardApiCall("commitReshardCollection",{namespace:e}),await this._database._runAdminCommand({commitReshardCollection:e})}async abortReshardCollection(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.abortReshardCollection"),this._emitShardApiCall("abortReshardCollection",{namespace:e}),await this._database._runAdminCommand({abortReshardCollection:e})}async shardCollection(e,t,r,s){return await this._runShardCollection("shardCollection",e,t,r,s)}async reshardCollection(e,t,r,s){return await this._runShardCollection("reshardCollection",e,t,r,s)}async _runShardCollection(e,t,r,s,i){(0,a.assertArgsDefinedType)([t,r,s,i],["string","object",[void 0,"boolean","object"],[void 0,"object"]],`Shard.${e}`),this._emitShardApiCall(e,{namespace:t,key:r,unique:s,options:i}),"object"==typeof s&&null!==s&&(i=s,s=void 0);const n={[e]:t,key:r};void 0!==s&&(n.unique=s);try{return await this._database._runAdminCommand({...n,...i})}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. Are you connected to mongos?`),e}}async status(e=!1,t){const r=await(0,a.getPrintableShardStatus)(null!=t?t:await(0,a.getConfigDB)(this._database),e);return new l.CommandResult("StatsResult",r)}async addShard(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.addShard"),await(0,a.getConfigDB)(this._database),this._emitShardApiCall("addShard",{url:e}),this._database._runAdminCommand({addShard:e})}async addShardToZone(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.addShardToZone"),this._emitShardApiCall("addShardToZone",{shard:e,zone:t}),await(0,a.getConfigDB)(this._database),this._database._runAdminCommand({addShardToZone:e,zone:t})}async addShardTag(e,t){(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.addShardTag"),this._emitShardApiCall("addShardTag",{shard:e,tag:t});try{return await this.addShardToZone(e,t)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to addShardToZone which exists only for server versions > 3.4.`),e}}async updateZoneKeyRange(e,t,r,s){return(0,a.assertArgsDefinedType)([e,t,r,s],["string","object","object",!0],"Shard.updateZoneKeyRange"),this._emitShardApiCall("updateZoneKeyRange",{namespace:e,min:t,max:r,zone:s}),await(0,a.getConfigDB)(this._database),await this._database._runAdminCommand({updateZoneKeyRange:e,min:t,max:r,zone:s})}async addTagRange(e,t,r,s){(0,a.assertArgsDefinedType)([e,t,r,s],["string","object","object",!0],"Shard.addTagRange"),this._emitShardApiCall("addTagRange",{namespace:e,min:t,max:r,zone:s});try{return await this.updateZoneKeyRange(e,t,r,s)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to updateZoneKeyRange which exists only for server versions > 3.4.`),e}}async removeRangeFromZone(e,t,r){return(0,a.assertArgsDefinedType)([e,t,r],["string","object","object"],"Shard.removeRangeFromZone"),this._emitShardApiCall("removeRangeFromZone",{ns:e,min:t,max:r}),this.updateZoneKeyRange(e,t,r,null)}async removeTagRange(e,t,r){(0,a.assertArgsDefinedType)([e,t,r],["string","object","object"],"Shard.removeTagRange"),this._emitShardApiCall("removeTagRange",{ns:e,min:t,max:r});try{return await this.updateZoneKeyRange(e,t,r,null)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to updateZoneKeyRange which exists only for server versions > 3.4.`),e}}async removeShardFromZone(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.removeShardFromZone"),this._emitShardApiCall("removeShardFromZone",{shard:e,zone:t}),await(0,a.getConfigDB)(this._database),await this._database._runAdminCommand({removeShardFromZone:e,zone:t})}async removeShardTag(e,t){(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.removeShardTag"),this._emitShardApiCall("removeTagRange",{shard:e,tag:t});try{return await this.removeShardFromZone(e,t)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to removeShardFromZone which exists only for server versions > 3.4.`),e}}async enableAutoSplit(){this._instanceState.connectionInfo.buildInfo.version&&p.default.gte(this._instanceState.connectionInfo.buildInfo.version,"6.0.3")&&await this._instanceState.printDeprecationWarning("Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. For details, see Balancing Policy Changes: https://www.mongodb.com/docs/manual/release-notes/6.0/#balancing-policy-changes\n"),this._emitShardApiCall("enableAutoSplit",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"autosplit"},{$set:{enabled:!0}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async disableAutoSplit(){this._instanceState.connectionInfo.buildInfo.version&&p.default.gte(this._instanceState.connectionInfo.buildInfo.version,"6.0.3")&&await this._instanceState.printDeprecationWarning("Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. For details, see Balancing Policy Changes: https://www.mongodb.com/docs/manual/release-notes/6.0/#balancing-policy-changes\n"),this._emitShardApiCall("disableAutoSplit",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"autosplit"},{$set:{enabled:!1}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async splitAt(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","object"],"Shard.splitAt"),this._emitShardApiCall("splitAt",{ns:e,query:t}),this._database._runAdminCommand({split:e,middle:t})}async splitFind(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","object"],"Shard.splitFind"),this._emitShardApiCall("splitFind",{ns:e,query:t}),this._database._runAdminCommand({split:e,find:t})}async moveChunk(e,t,r){return(0,a.assertArgsDefinedType)([e,t,r],["string","object","string"],"Shard.moveChunk"),this._emitShardApiCall("moveChunk",{ns:e,query:t,destination:r}),this._database._runAdminCommand({moveChunk:e,find:t,to:r})}async balancerCollectionStatus(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.balancerCollectionStatus"),this._emitShardApiCall("balancerCollectionStatus",{ns:e}),this._database._runAdminCommand({balancerCollectionStatus:e})}async enableBalancing(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.enableBalancing"),this._emitShardApiCall("enableBalancing",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{noBalance:!1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async disableBalancing(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.disableBalancing"),this._emitShardApiCall("disableBalancing",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{noBalance:!0}},{writeConcern:{w:"majority",wtimeout:6e4}})}async getBalancerState(){this._emitShardApiCall("getBalancerState",{});const e=await(0,a.getConfigDB)(this._database),t=await e.getCollection("settings").findOne({_id:"balancer"});return null==t||!t.stopped}async isBalancerRunning(){return this._emitShardApiCall("isBalancerRunning",{}),await(0,a.getConfigDB)(this._database),this._database._runAdminCommand({balancerStatus:1})}async startBalancer(e=6e4){return(0,a.assertArgsDefinedType)([e],["number"],"Shard.startBalancer"),this._emitShardApiCall("startBalancer",{timeout:e}),this._database._runAdminCommand({balancerStart:1,maxTimeMS:e})}async stopBalancer(e=6e4){return(0,a.assertArgsDefinedType)([e],["number"],"Shard.stopBalancer"),this._emitShardApiCall("stopBalancer",{timeout:e}),this._database._runAdminCommand({balancerStop:1,maxTimeMS:e})}async setBalancerState(e){return(0,a.assertArgsDefinedType)([e],["boolean"],"Shard.setBalancerState"),this._emitShardApiCall("setBalancerState",{state:e}),e?this.startBalancer():this.stopBalancer()}async getShardedDataDistribution(e={}){var t;this._emitShardApiCall("getShardedDataDistribution",{});const r=await this._database.getSiblingDB("admin").aggregate([{$shardedDataDistribution:e}]);try{await r.hasNext()}catch(e){throw 40324===(null===(t=e.code)||void 0===t?void 0:t.valueOf())&&(e.message=`sh.getShardedDataDistribution only works on mongos and MongoDB server versions greater than 6.0.3 [Original Error: ${e.message}]`),e}return r}async startAutoMerger(){this._emitShardApiCall("startAutoMerger",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"automerge"},{$set:{enabled:!0}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async stopAutoMerger(){this._emitShardApiCall("stopAutoMerger",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"automerge"},{$set:{enabled:!1}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async isAutoMergerEnabled(){this._emitShardApiCall("isAutoMergerEnabled",{});const e=await(0,a.getConfigDB)(this._database),t=await e.getCollection("settings").findOne({_id:"automerge"});return null==t||t.enabled}async disableAutoMerger(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.disableAutoMerger"),this._emitShardApiCall("disableAutoMerger",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{enableAutoMerge:!1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async enableAutoMerger(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.enableAutoMerger"),this._emitShardApiCall("enableAutoMerger",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$unset:{enableAutoMerge:1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async checkMetadataConsistency(e={}){return this._emitShardApiCall("checkMetadataConsistency",{options:e}),this._database._runAdminCursorCommand({checkMetadataConsistency:1})}};s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"enableSharding",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"commitReshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"abortReshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"shardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"reshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([1])],u.prototype,"status",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"addShard",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addShardToZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addShardTag",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"updateZoneKeyRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addTagRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeRangeFromZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeTagRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeShardFromZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeShardTag",null),s([n.returnsPromise,(0,n.apiVersions)([1]),(0,n.serverVersions)(["3.4.0","6.0.2"])],u.prototype,"enableAutoSplit",null),s([n.returnsPromise,(0,n.apiVersions)([1]),(0,n.serverVersions)(["3.4.0","6.0.2"])],u.prototype,"disableAutoSplit",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"splitAt",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"splitFind",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"moveChunk",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["4.4.0",o.ServerVersions.latest])],u.prototype,"balancerCollectionStatus",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"enableBalancing",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"disableBalancing",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"getBalancerState",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"isBalancerRunning",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"startBalancer",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"stopBalancer",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"setBalancerState",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["6.0.3",o.ServerVersions.latest]),(0,n.returnType)("AggregationCursor")],u.prototype,"getShardedDataDistribution",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"startAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"stopAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"isAutoMergerEnabled",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"disableAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"enableAutoMerger",null),s([n.returnsPromise,(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"checkMetadataConsistency",null),u=s([n.shellApiClassDefault],u),t.default=u},15826:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=i(r(69483)),l=r(58744),c=r(86901),p=r(67802),u=r(6534),h=r(9461),d=r(21764),f=r(55315),m=r(63873),y=i(r(2416)),g=Symbol.for("@@mongosh.instanceState"),b=Symbol.for("@@mongosh.loadCallNestingLevel");let x=class extends n.ShellApiClass{constructor(e){super(),this._instanceState=e,this.defaults=Object.freeze(new m.ShellUserConfig)}async set(e,t){var r,s;(0,c.assertArgsDefinedType)([e],["string"],"config.set");const{evaluationListener:i}=this._instanceState,n=(await this._allKeys()).includes(e);if(n){const s=await(null===(r=i.validateConfig)||void 0===r?void 0:r.call(i,e,t));if(s)return`Cannot set option "${e}": ${s}`}return"success"!==(n&&await(null===(s=i.setConfig)||void 0===s?void 0:s.call(i,e,t)))?`Option "${e}" is not available in this environment`:`Setting "${e}" has been changed`}async get(e){var t,r;(0,c.assertArgsDefinedType)([e],["string"],"config.get");const{evaluationListener:s}=this._instanceState;return null!==(r=await(null===(t=s.getConfig)||void 0===t?void 0:t.call(s,e)))&&void 0!==r?r:this.defaults[e]}async reset(e){var t;(0,c.assertArgsDefinedType)([e],["string"],"config.reset");const{evaluationListener:r}=this._instanceState;return"success"!==await(null===(t=r.resetConfig)||void 0===t?void 0:t.call(r,e))?`Option "${e}" cannot be changed in this environment`:`Setting "${e}" has been reset to its default value`}async _allKeys(){var e,t;const{evaluationListener:r}=this._instanceState;return null!==(t=await(null===(e=r.listConfigOptions)||void 0===e?void 0:e.call(r)))&&void 0!==t?t:Object.keys(this.defaults)}async[a.asPrintable](){return new Map(await Promise.all((await this._allKeys()).map((async e=>[e,await this.get(e)]))))}};s([n.returnsPromise],x.prototype,"set",null),s([n.returnsPromise],x.prototype,"get",null),s([n.returnsPromise],x.prototype,"reset",null),x=s([n.shellApiClassDefault],x);let v=class extends n.ShellApiClass{constructor(e){super(),this[g]=e,this[b]=0,this.DBQuery=new h.DBQuery(e),this.config=new x(e)}get _instanceState(){return this[g]}get loadCallNestingLevel(){return this[b]}set loadCallNestingLevel(e){this[b]=e}use(e){return this._instanceState.currentDb._mongo.use(e)}async show(e,t){return await this._instanceState.currentDb._mongo.show(e,t)}async exit(e){var t,r;throw(0,c.assertArgsDefinedType)([e],[[void 0,"number"]],"exit"),(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"the exit/quit commands"),await this._instanceState.close(!0),await(null===(r=(t=this._instanceState.evaluationListener).onExit)||void 0===r?void 0:r.call(t,e)),new u.MongoshInternalError(".onExit listener returned")}async quit(e){return await this.exit(e)}async Mongo(e,t,r){(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"new Mongo connections");const s=new o.default(this._instanceState,e,t,r);return await s.connect(),this._instanceState.mongos.push(s),s}async connect(e,t,r){(0,c.assertArgsDefinedType)([e,t,r],["string",[void 0,"string"],[void 0,"string"]],"connect"),(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"new Mongo connections");const s=new o.default(this._instanceState,e);await s.connect(t,r),this._instanceState.mongos.push(s);const i=s._serviceProvider.initialDb||p.DEFAULT_DB;return s.getDB(i)}async it(){return this._instanceState.currentCursor?await this._instanceState.currentCursor._it():new l.CursorIterationResult}version(){return r(57518).i8}async load(e){if((0,c.assertArgsDefinedType)([e],["string"],"load"),!this._instanceState.evaluationListener.onLoad)throw new u.MongoshUnimplementedError("load is not currently implemented for this platform",u.CommonErrors.NotImplemented);this._instanceState.messageBus.emit("mongosh:api-load-file",{nested:this.loadCallNestingLevel>0,filename:e});const{resolvedFilename:t,evaluate:r}=await this._instanceState.evaluationListener.onLoad(e),s=this._instanceState.context,i=s.__filename;s.__filename=t,s.__dirname=(0,f.dirname)(t),this.loadCallNestingLevel++;try{await r()}finally{this.loadCallNestingLevel--,i?(s.__filename=i,s.__dirname=(0,f.dirname)(i)):(delete s.__filename,delete s.__dirname)}return!0}async enableTelemetry(){var e,t;if("success"===await(null===(t=(e=this._instanceState.evaluationListener).setConfig)||void 0===t?void 0:t.call(e,"enableTelemetry",!0)))return y.default.__("cli-repl.cli-repl.enabledTelemetry")}async disableTelemetry(){var e,t;if("success"===await(null===(t=(e=this._instanceState.evaluationListener).setConfig)||void 0===t?void 0:t.call(e,"enableTelemetry",!1)))return y.default.__("cli-repl.cli-repl.disabledTelemetry")}async passwordPrompt(){const{evaluationListener:e}=this._instanceState;if(!e.onPrompt)throw new u.MongoshUnimplementedError("passwordPrompt() is not available in this shell",u.CommonErrors.NotImplemented);return await e.onPrompt("Enter password","password")}async sleep(e){return await(0,d.promisify)(setTimeout)(e)}async _print(e,t){var r;const{evaluationListener:s}=this._instanceState,i=await Promise.all(e.map((e=>(0,n.toShellResult)(e))));await(null===(r=s.onPrint)||void 0===r?void 0:r.call(s,i,t))}async print(...e){await this._print(e,"print")}async printjson(...e){await this._print(e,"printjson")}async convertShardKeyToHashed(e){return this._instanceState.currentDb._mongo.convertShardKeyToHashed(e)}async cls(){var e;const{evaluationListener:t}=this._instanceState;await(null===(e=t.onClearCommand)||void 0===e?void 0:e.call(t))}isInteractive(){return this._instanceState.isInteractive}};s([n.directShellCommand,(0,n.shellCommandCompleter)((async function(e,t){var r;if(!(t.length>2))return await e.getDatabaseCompletions(null!==(r=t[1])&&void 0!==r?r:"")}))],v.prototype,"use",null),s([n.directShellCommand,n.returnsPromise,(0,n.shellCommandCompleter)((async function(e,t){if(!(t.length>2))return"d"===t[1]?["databases"]:["databases","dbs","collections","tables","profile","users","roles","log","logs","startupWarnings","automationNotices","nonGenuineMongoDBCheck"].filter((e=>{var r;return e.startsWith(null!==(r=t[1])&&void 0!==r?r:"")}))}))],v.prototype,"show",null),s([n.directShellCommand,n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"exit",null),s([n.directShellCommand,n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"quit",null),s([n.returnsPromise,(0,n.returnType)("Mongo"),(0,n.platforms)(["CLI"])],v.prototype,"Mongo",null),s([n.returnsPromise,(0,n.returnType)("Database"),(0,n.platforms)(["CLI"])],v.prototype,"connect",null),s([n.directShellCommand,n.returnsPromise],v.prototype,"it",null),s([n.returnsPromise],v.prototype,"load",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"enableTelemetry",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"disableTelemetry",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"passwordPrompt",null),s([n.returnsPromise],v.prototype,"sleep",null),s([n.returnsPromise],v.prototype,"print",null),s([n.returnsPromise],v.prototype,"printjson",null),s([n.returnsPromise],v.prototype,"convertShardKeyToHashed",null),s([n.directShellCommand,n.returnsPromise],v.prototype,"cls",null),v=s([n.shellApiClassDefault],v),t.default=v},11731:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(86930),n=s(r(55179)),a=r(67802),o=r(6534),l=r(86901),c=r(84770);function p(e){const t=`shell-api.classes.${e}.help`,r={help:`${t}.description`,example:`${t}.example`,docs:`${t}.link`,attr:[]};return new n.default(r)}t.default=function(e,t){void 0===e&&(e=a.bson);const r={};["Binary","Code","DBRef","Decimal128","Double","Int32","Long","MaxKey","MinKey","ObjectId","Timestamp","BSONSymbol","BSONRegExp"].forEach((t=>{if(!(t in e))throw new o.MongoshInternalError(`${t} does not exist in provided BSON package.`);const s=e[t].prototype;s.serverVersions=i.ALL_SERVER_VERSIONS,s.platforms=i.ALL_PLATFORMS,s.topologies=i.ALL_TOPOLOGIES;const n=p(t);r[t]=n,s.help=()=>n,Object.setPrototypeOf(s.help,n)})),e.BSONSymbol.prototype.serverVersions=[i.ServerVersions.earliest,"1.6.0"],e.BSONSymbol.prototype.deprecated=!0;const s={DBRef:(0,l.assignAll)((function(t,r,s,i){return(0,l.assertArgsDefinedType)([t,r,s],["string",!0,[void 0,"string"],[void 0,"object"]],"DBRef"),new e.DBRef(t,r,s,i)}),(0,l.pickWithExactKeyMatch)(e.DBRef,["prototype"])),bsonsize:function(t){return(0,l.assertArgsDefinedType)([t],["object"],"bsonsize"),e.calculateObjectSize(t)},MaxKey:(0,l.assignAll)((function(){return new e.MaxKey}),(0,l.pickWithExactKeyMatch)(e.MaxKey,["prototype"]),{toBSON:()=>new e.MaxKey}),MinKey:(0,l.assignAll)((function(){return new e.MinKey}),(0,l.pickWithExactKeyMatch)(e.MinKey,["prototype"]),{toBSON:()=>new e.MinKey}),ObjectId:(0,l.assignAll)((function(t){return(0,l.assertArgsDefinedType)([t],[[void 0,"string","number","object"]],"ObjectId"),new e.ObjectId(t)}),(0,l.pickWithExactKeyMatch)(e.ObjectId,["prototype","cacheHexString","generate","createFromTime","createFromHexString","createFromBase64","isValid"])),Timestamp:(0,l.assignAll)((function(t,r){return(0,l.assertArgsDefinedType)([t,r],[["number","object",void 0],[void 0,"number"]],"Timestamp"),"object"==typeof t&&null!==t&&"t"in t&&"i"in t?new e.Timestamp(t):void 0!==r||"number"==typeof t?new e.Timestamp({t,i:null!=r?r:0}):new e.Timestamp(t)}),(0,l.pickWithExactKeyMatch)(e.Timestamp,["prototype","fromInt","fromNumber","fromBits","fromString","MAX_VALUE"])),Code:(0,l.assignAll)((function(t="",r){return(0,l.assertArgsDefinedType)([t,r],[[void 0,"string","function"],[void 0,"object"]],"Code"),new e.Code(t,r)}),(0,l.pickWithExactKeyMatch)(e.Code,["prototype"])),NumberDecimal:(0,l.assignAll)((function(r="0"){return(0,l.assertArgsDefinedType)([r],[["string","number","bson:Long","bson:Int32","bson:Decimal128"]],"NumberDecimal"),"number"==typeof r&&t("NumberDecimal: specifying a number as argument is deprecated and may lead to loss of precision, pass a string instead"),e.Decimal128.fromString(`${r}`)}),{prototype:e.Decimal128.prototype}),NumberInt:(0,l.assignAll)((function(t="0"){return null!=t||(t="0"),(0,l.assertArgsDefinedType)([t],[["string","number","bson:Long","bson:Int32"]],"NumberInt"),new e.Int32(parseInt(`${t}`,10))}),{prototype:e.Int32.prototype}),NumberLong:(0,l.assignAll)((function(r="0"){return null!=r||(r="0"),(0,l.assertArgsDefinedType)([r],[["string","number","bson:Long","bson:Int32"]],"NumberLong"),"number"==typeof r?(t("NumberLong: specifying a number as argument is deprecated and may lead to loss of precision, pass a string instead"),e.Long.fromNumber(r)):e.Long.fromString(`${r}`)}),{prototype:e.Long.prototype}),ISODate:function(e){e||(e=(new Date).toISOString());const t=/^(?<Y>\d{4})-?(?<M>\d{2})-?(?<D>\d{2})([T ](?<h>\d{2})(:?(?<m>\d{2})(:?((?<s>\d{2})(\.(?<ms>\d+))?))?)?(?<tz>Z|([+-])(\d{2}):?(\d{2})?)?)?$/.exec(e);if(null!==t&&void 0!==t.groups){const{Y:e,M:r,D:s,h:i,m:n,s:a,ms:o,tz:l}=t.groups,c=new Date(`${e}-${r}-${s}T${i||"00"}:${n||"00"}:${a||"00"}.${o||"000"}${l||"Z"}`);if(c.getTime()>=-621672192e5&&c.getTime()<=0xe677d21fdbff)return c}throw new o.MongoshInvalidInputError(`${JSON.stringify(e)} is not a valid ISODate`,o.CommonErrors.InvalidArgument)},BinData:(0,l.assignAll)((function(t,r){(0,l.assertArgsDefinedType)([t,r],["number","string"],"BinData");const s=Buffer.from(r,"base64");return new e.Binary(s,t)}),{prototype:e.Binary.prototype}),HexData:(0,l.assignAll)((function(t,r){(0,l.assertArgsDefinedType)([t,r],["number","string"],"HexData");const s=Buffer.from(r,"hex");return new e.Binary(s,t)}),{prototype:e.Binary.prototype}),UUID:(0,l.assignAll)((function(t){if(void 0===t){const e=(0,c.randomBytes)(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128,t=e.toString("hex")}(0,l.assertArgsDefinedType)([t],["string"],"UUID");const r=Buffer.from(t.replace(/-/g,""),"hex");return new e.Binary(r,e.Binary.SUBTYPE_UUID)}),{prototype:e.Binary.prototype}),MD5:(0,l.assignAll)((function(t){(0,l.assertArgsDefinedType)([t],["string"],"MD5");const r=Buffer.from(t,"hex");return new e.Binary(r,e.Binary.SUBTYPE_MD5)}),{prototype:e.Binary.prototype}),Decimal128:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Decimal128),(0,l.pickWithExactKeyMatch)(e.Decimal128,["prototype","fromString"])),BSONSymbol:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.BSONSymbol),(0,l.pickWithExactKeyMatch)(e.BSONSymbol,["prototype"])),Int32:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Int32),(0,l.pickWithExactKeyMatch)(e.Int32,["prototype"])),Long:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Long),(0,l.pickWithExactKeyMatch)(e.Long,["prototype","fromValue","isLong","fromBytesBE","fromBytesLE","fromBytes","fromString","fromBigInt","fromNumber","fromInt","fromBits","MIN_VALUE","MAX_VALUE","NEG_ONE","UONE","ONE","UZERO","ZERO","MAX_UNSIGNED_VALUE","TWO_PWR_24"])),Binary:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Binary),(0,l.pickWithExactKeyMatch)(e.Binary,["prototype","createFromBase64","createFromHexString","BUFFER_SIZE","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_ENCRYPTED","SUBTYPE_COLUMN","SUBTYPE_USER_DEFINED"])),Double:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Double),(0,l.pickWithExactKeyMatch)(e.Double,["prototype"])),BSONRegExp:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.BSONRegExp),(0,l.pickWithExactKeyMatch)(e.BSONRegExp,["prototype","parseOptions"])),EJSON:(0,l.pickWithExactKeyMatch)(e.EJSON,["parse","serialize","stringify","deserialize"])};for(const e of Object.keys(s)){const t=r[e]||p(e);s[e].help=()=>t,Object.setPrototypeOf(s[e].help,t)}return s}},75794:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(67802),a=r(17702),o=s(r(5051)),l=r(40191),c=r(86930),p=r(73041),u=r(46993),h=r(38961),d=r(72292),f=s(r(51238)),m=s(r(11731)),y=r(32261);t.default=class{constructor(e,t=new a.EventEmitter,r={}){if(this.displayBatchSizeFromDBQuery=void 0,this.isInteractive=!1,this.apiCallDepth=0,this.warningsShown=new Set,this.interrupted=new h.InterruptFlag,this.plugins=[new d.TransformMongoErrorPlugin],this.alreadyTransformedErrors=new WeakMap,this.initialServiceProvider=e,this.messageBus=t,this.shellApi=new u.ShellApi(this),this.shellBson=(0,m.default)(e.bsonLibrary,(e=>{this.shellApi.print(`Warning: ${e}`)})),this.mongos=[],this.connectionInfo={buildInfo:{}},r.nodb)this.currentDb=new f.default;else{const t=new u.Mongo(this,void 0,void 0,void 0,e);this.mongos.push(t),this.currentDb=t.getDB(e.initialDb||n.DEFAULT_DB)}this.currentCursor=null,this.context={},this.cliOptions=r,this.evaluationListener={}}async fetchConnectionInfo(){if(!this.cliOptions.nodb){this.connectionInfo=await this.currentServiceProvider.getConnectionInfo();const e=this.apiVersionInfo();this.messageBus.emit("mongosh:connect",{...this.connectionInfo.extraInfo,api_version:null==e?void 0:e.version,api_strict:null==e?void 0:e.strict,api_deprecation_errors:null==e?void 0:e.deprecationErrors,uri:(0,o.default)(this.connectionInfo.extraInfo.uri)})}}async close(e){for(const t of[...this.mongos])await t.close(e)}setDbFunc(e){return this.currentDb=e,this.context.rs=new u.ReplicaSet(this.currentDb),this.context.sh=new u.Shard(this.currentDb),this.context.sp=y.Streams.newInstance(this.currentDb),this.fetchConnectionInfo().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentDb._getCollectionNamesForCompletion().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentDb._mongo._getDatabaseNamesForCompletion().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentCursor=null,e}setCtx(e){this.context=e,Object.assign(e,this.shellApi);for(const t of Object.getOwnPropertyNames(u.ShellApi.prototype)){const{shellApi:r}=this;l.toIgnore.concat(["help"]).includes(t)||"function"!=typeof r[t]||(e[t]=function(...e){return r[t](...e)},e[t].help=r[t].help)}e.help=this.shellApi.help,Object.assign(e,this.shellBson),void 0===e.console&&(e.console={});for(const t of["log","warn","info","error"])e.console[t]=(...t)=>e.print(...t);e.console.clear=e.cls,e.rs=new u.ReplicaSet(this.currentDb),e.sh=new u.Shard(this.currentDb),e.sp=y.Streams.newInstance(this.currentDb);"JavaShell"===this.initialServiceProvider.platform?e.db=this.setDbFunc(this.currentDb):Object.defineProperty(e,"db",{configurable:!0,set:e=>{if("Database"!==(0,u.getShellApiType)(e))throw new i.MongoshInvalidInputError("Cannot reassign 'db' to non-Database type",i.CommonErrors.InvalidOperation);return this.setDbFunc(e)},get:()=>this.currentDb}),this.messageBus.emit("mongosh:setCtx",{method:"setCtx",arguments:{}})}get currentServiceProvider(){try{return this.currentDb._mongo._serviceProvider}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected)return this.initialServiceProvider;throw e}}emitApiCallWithArgs(e){this.messageBus.emit("mongosh:api-call-with-arguments",e)}emitApiCall(e){this.messageBus.emit("mongosh:api-call",{...e,callDepth:this.apiCallDepth})}setEvaluationListener(e){this.evaluationListener=e}getAutocompleteParameters(){return{topology:()=>{var e;let t;const r=null===(e=this.currentServiceProvider.getTopology())||void 0===e?void 0:e.description;switch(null==r?void 0:r.type){case"ReplicaSetNoPrimary":case"ReplicaSetWithPrimary":t=c.Topologies.ReplSet;break;case"Sharded":t=c.Topologies.Sharded;break;case"LoadBalanced":t=c.Topologies.LoadBalanced;break;default:if(t=c.Topologies.Standalone,1===r.servers.size){const[e]=r.servers.values();switch(e.type){case"Mongos":t=c.Topologies.Sharded;break;case"PossiblePrimary":case"RSPrimary":case"RSSecondary":case"RSArbiter":case"RSOther":case"RSGhost":t=c.Topologies.ReplSet}}}return t},apiVersionInfo:()=>this.apiVersionInfo(),connectionInfo:()=>this.connectionInfo.extraInfo,getCollectionCompletionsForCurrentDb:async e=>{try{return(await this.currentDb._getCollectionNamesForCompletion()).filter((t=>t.toLowerCase().startsWith(e.toLowerCase())))}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected||"Unauthorized"===(null==e?void 0:e.codeName))return[];throw e}},getDatabaseCompletions:async e=>{try{return(await this.currentDb._mongo._getDatabaseNamesForCompletion()).filter((t=>t.toLowerCase().startsWith(e.toLowerCase())))}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected||"Unauthorized"===(null==e?void 0:e.codeName))return[];throw e}}}}apiVersionInfo(){var e,t;const{serverApi:r}=null!==(t=null===(e=this.currentServiceProvider.getRawClient())||void 0===e?void 0:e.options)&&void 0!==t?t:{};return(null==r?void 0:r.version)?{strict:!1,deprecationErrors:!1,...r}:void 0}async onInterruptExecution(){return await this.interrupted.set(),this.currentCursor=null,this.resumeMongosAfterInterrupt=await Promise.all(this.mongos.map((async e=>{try{return{mongo:e,resume:await e._suspend()}}catch(t){return{mongo:e,resume:null}}}))),!this.resumeMongosAfterInterrupt.find((e=>null===e.resume))}async onResumeExecution(){var e,t;const r=null!==(t=null===(e=this.resumeMongosAfterInterrupt)||void 0===e?void 0:e.map((async e=>{if(!this.mongos.find((t=>t===e.mongo)))return!0;if(null===e.resume)return!1;try{return await e.resume(),!0}catch(e){return!1}})))&&void 0!==t?t:[];this.resumeMongosAfterInterrupt=void 0;const s=await Promise.all(r);return this.interrupted.reset(),!s.find((e=>!1===e))}async getDefaultPrompt(){var e,t;if(null===(t=null===(e=this.connectionInfo)||void 0===e?void 0:e.extraInfo)||void 0===t?void 0:t.is_stream)return"AtlasStreamProcessing> ";const r=this.getDefaultPromptPrefix(),s=this.getTopologySpecificPrompt();let i="";try{i=this.currentDb.getName()}catch(e){}return`${[r,s,i].filter(Boolean).join(" ")}> `}getDefaultPromptPrefix(){var e,t,r,s;const i=null===(e=this.connectionInfo)||void 0===e?void 0:e.extraInfo;return(null==i?void 0:i.is_data_federation)?"AtlasDataFederation":(null==i?void 0:i.is_local_atlas)?"AtlasLocalDev":(null==i?void 0:i.is_atlas)?"Atlas":(null==i?void 0:i.is_enterprise)||(null===(s=null===(r=null===(t=this.connectionInfo)||void 0===t?void 0:t.buildInfo)||void 0===r?void 0:r.modules)||void 0===s?void 0:s.indexOf("enterprise"))>=0?"Enterprise":""}getTopologySpecificPrompt(){var e,t,r,s;const i=null===(e=this.currentServiceProvider.getTopology())||void 0===e?void 0:e.description;if(!i)return"";let n=i.setName,a="";switch(i.type){case"Single":const e=this.getTopologySinglePrompt(i);n=null!==(t=null==e?void 0:e.replicaSet)&&void 0!==t?t:n,a=(null==e?void 0:e.serverType)?`[direct: ${e.serverType}]`:"";break;case"ReplicaSetNoPrimary":a="[secondary]";break;case"ReplicaSetWithPrimary":a="[primary]";break;case"Sharded":a=(null===(s=null===(r=this.connectionInfo)||void 0===r?void 0:r.extraInfo)||void 0===s?void 0:s.atlas_version)?"":"[mongos]";break;default:return""}return`${n?`${n} `:""}${a}`}getTopologySinglePrompt(e){var t;if(1!==(null===(t=e.servers)||void 0===t?void 0:t.size))return;const[r]=e.servers.values();let s;switch(r.type){case"Mongos":s="mongos";break;case"RSPrimary":s="primary";break;case"RSSecondary":s="secondary";break;case"RSArbiter":s="arbiter";break;case"RSOther":s="other";break;default:s=""}return{replicaSet:r.setName,serverType:s}}registerPlugin(e){this.plugins.push(e)}transformError(e){if("[object Error]"===Object.prototype.toString.call(e)){if(this.alreadyTransformedErrors.has(e))return this.alreadyTransformedErrors.get(e);const t=e;for(const t of this.plugins)t.transformError&&(e=t.transformError(e));this.alreadyTransformedErrors.set(t,e)}return e}async printDeprecationWarning(e){this.warningsShown.has(e)||(this.warningsShown.add(e),this.context.print?await this.context.print.call(this.shellApi,`DeprecationWarning: ${e}`):await this.shellApi.print(`DeprecationWarning: ${e}`))}async printWarning(e){this.warningsShown.has(e)||(this.warningsShown.add(e),this.context.print?await this.context.print.call(this.shellApi,`Warning: ${e}`):await this.shellApi.print(`Warning: ${e}`))}}},53278:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(86930),n=r(40191);let a=class extends n.ShellApiWithMongoClass{constructor(e,t){super(),this._streams=e,this.name=t}get _mongo(){return this._streams._mongo}[i.asPrintable](){return`Atlas Stream Processor: ${this.name}`}async start(){return await this._streams._runStreamCommand({startStreamProcessor:this.name})}async stop(){return await this._streams._runStreamCommand({stopStreamProcessor:this.name})}async drop(){return this._drop()}async _drop(){return await this._streams._runStreamCommand({dropStreamProcessor:this.name})}async stats(e={}){return this._streams._runStreamCommand({getStreamProcessorStats:this.name,...e})}async sample(e={}){const t=await this._streams._runStreamCommand({startSampleStreamProcessor:this.name,...e});return 1!==t.ok?t:this._sampleFrom(t.cursorId)}async _sampleFrom(e){let t=e;for(;"0"!==String(t);){const e=await this._streams._runStreamCommand({getMoreSampleStreamProcessor:this.name,cursorId:t});if(1!==e.ok)return e;t=e.cursorId;for(const t of e.messages)await this._instanceState.shellApi.printjson(t);if(!e.messages.length){const e=this._instanceState.interrupted.asPromise();try{await Promise.race([this._instanceState.shellApi.sleep(1e3),e.promise])}finally{e.destroy()}}}}};s([n.returnsPromise],a.prototype,"start",null),s([n.returnsPromise],a.prototype,"stop",null),s([n.returnsPromise],a.prototype,"drop",null),s([n.returnsPromise],a.prototype,"stats",null),s([n.returnsPromise],a.prototype,"sample",null),a=s([n.shellApiClassDefault],a),t.default=a},32261:function(e,t,r){"use strict";var s,i=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Streams=void 0;const a=r(6534),o=r(40191),l=n(r(53278)),c=r(86930);let p=t.Streams=s=class extends o.ShellApiWithMongoClass{static newInstance(e){return new Proxy(new s(e),{get(e,t){const r=e[t];return void 0!==r?r:"string"!=typeof t||t.startsWith("_")?void 0:e.getProcessor(t)}})}constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}[c.asPrintable](){return"Atlas Stream Processing"}getProcessor(e){return new l.default(this,e)}async process(e,t){if(!Array.isArray(e)||!e.length)throw new a.MongoshInvalidInputError("Invalid pipeline",a.CommonErrors.InvalidArgument,e);const r=await this._runStreamCommand({processStreamProcessor:e,...t?{options:t}:{}});if(1!==r.ok)return r;const{name:s,cursorId:i}=r,n=this.getProcessor(s);async function o(){try{await n._drop()}catch(e){}}return await this._instanceState.interrupted.withOverrideInterruptBehavior((()=>n._sampleFrom(i)),o),o()}async createStreamProcessor(e,t,r){if("string"!=typeof e||""===e.trim())throw new a.MongoshInvalidInputError(`Invalid processor name: ${e}`,a.CommonErrors.InvalidArgument);if(!Array.isArray(t)||!t.length)throw new a.MongoshInvalidInputError("Invalid pipeline",a.CommonErrors.InvalidArgument,t);const s=await this._runStreamCommand({createStreamProcessor:e,pipeline:t,...r?{options:r}:{}});return 1!==s.ok?s:this.getProcessor(e)}async listStreamProcessors(e){const t=await this._runStreamCommand({listStreamProcessors:1,filter:e});if(1!==t.ok)return t;const r=t.streamProcessors,s=r.map((e=>this.getProcessor(e.name)));return Object.defineProperties(s,{[c.asPrintable]:{value:()=>r},[c.shellApiType]:{value:"StreamsListResult"}})}async listConnections(e){const t=await this._runStreamCommand({listStreamConnections:1,filter:e});return 1!==t.ok?t:Object.defineProperties(t.connections,{[c.shellApiType]:{value:"StreamsListResult"}})}async _runStreamCommand(e,t={}){return this._mongo._serviceProvider.runCommand(c.ADMIN_DB,e,t)}};i([o.returnsPromise],p.prototype,"process",null),i([o.returnsPromise],p.prototype,"createStreamProcessor",null),i([o.returnsPromise],p.prototype,"listStreamProcessors",null),i([o.returnsPromise],p.prototype,"listConnections",null),t.Streams=p=s=i([o.shellApiClassDefault],p)},1136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellEvaluator=void 0;const s=r(60890);Object.defineProperty(t,"ShellEvaluator",{enumerable:!0,get:function(){return s.ShellEvaluator}}),t.default=s.ShellEvaluator},60890:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShellEvaluator=void 0;const shell_api_1=__webpack_require__(46993),async_rewriter2_1=__importDefault(__webpack_require__(671)),history_1=__webpack_require__(46177);class ShellEvaluator{constructor(e,t=shell_api_1.toShellResult){this.hasAppliedAsyncWriterRuntimeSupport=!0,this.instanceState=e,this.resultHandler=t,this.asyncWriter=new async_rewriter2_1.default,this.hasAppliedAsyncWriterRuntimeSupport=!1}async innerEval(originalEval,input,context,filename){var _a,_b,_c,_d,_e;const{shellApi}=this.instanceState,trimmedInput=input.trim(),argv=trimmedInput.replace(/;$/,"").split(/\s+/g),cmd=argv.shift();if((null===(_a=shellApi[cmd])||void 0===_a?void 0:_a.isDirectShellCommand)&&(null===(_b=shellApi[cmd])||void 0===_b?void 0:_b.acceptsRawInput)&&!(null!==(_c=argv[0])&&void 0!==_c?_c:"").startsWith("(")){const e=trimmedInput.replace(/^\S+\s*/,"");return shellApi[cmd](e)}if((null===(_d=shellApi[cmd])||void 0===_d?void 0:_d.isDirectShellCommand)&&!(null!==(_e=argv[0])&&void 0!==_e?_e:"").startsWith("("))return shellApi[cmd](...argv);let rewrittenInput=this.asyncWriter.process(input);const hiddenCommands=RegExp(history_1.HIDDEN_COMMANDS,"g");if(hiddenCommands.test(input)||hiddenCommands.test(rewrittenInput)||this.instanceState.messageBus.emit("mongosh:evaluate-input",{input:(0,history_1.redactSensitiveData)(trimmedInput)}),!this.hasAppliedAsyncWriterRuntimeSupport){this.hasAppliedAsyncWriterRuntimeSupport=!0;const supportCode=this.asyncWriter.runtimeSupportCode();eval(supportCode),rewrittenInput=supportCode+";\n"+rewrittenInput}try{return await originalEval(rewrittenInput,context,filename)}catch(e){throw this.instanceState.transformError(e)}}async customEval(e,t,r,s){const i=await this.innerEval(e,t,r,s);return await this.resultHandler(i)}}exports.ShellEvaluator=ShellEvaluator},63873:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CliUserConfigValidator=t.CliUserConfig=t.SnippetShellUserConfigValidator=t.SnippetShellUserConfig=t.ShellUserConfigValidator=t.ShellUserConfig=void 0;class r{constructor(){this.displayBatchSize=20,this.maxTimeMS=null,this.enableTelemetry=!1,this.editor=null}}t.ShellUserConfig=r;class s{static async validate(e,t){switch(e){case"displayBatchSize":return"number"!=typeof t||t<=0?`${e} must be a positive integer`:null;case"maxTimeMS":return null!==t&&("number"!=typeof t||t<=0)?`${e} must be null or a positive integer`:null;case"enableTelemetry":return"boolean"!=typeof t?`${e} must be a boolean`:null;case"editor":return"string"!=typeof t&&null!==t?`${e} must be a string or null`:null;default:return`${e} is not a known config option`}}}t.ShellUserConfigValidator=s;class i extends r{constructor(){super(...arguments),this.snippetIndexSourceURLs="https://compass.mongodb.com/mongosh/snippets-index.bson.br",this.snippetRegistryURL="https://registry.npmjs.org",this.snippetAutoload=!0}}t.SnippetShellUserConfig=i;class n extends s{static async validate(e,t){switch(e){case"snippetIndexSourceURLs":return"string"!=typeof t||t.split(";").some((e=>e&&!a(e)))?`${e} must be a ;-separated list of valid URLs`:null;case"snippetRegistryURL":return"string"==typeof t&&a(t)?null:`${e} must be a valid URL`;case"snippetAutoload":return"boolean"!=typeof t?`${e} must be a boolean`:null;default:return super.validate(e,t)}}}function a(e){if("function"==typeof URL)try{return new URL(e),!0}catch(e){return!1}return!0}t.SnippetShellUserConfigValidator=n,t.CliUserConfig=class extends i{constructor(){super(...arguments),this.userId="",this.telemetryAnonymousId="",this.disableGreetingMessage=!1,this.forceDisableTelemetry=!1,this.inspectCompact=3,this.inspectDepth=6,this.historyLength=1e3,this.showStackTraces=!1,this.redactHistory="remove",this.oidcRedirectURI=void 0,this.oidcTrustedEndpoints=void 0,this.browser=void 0,this.updateURL="https://downloads.mongodb.com/compass/mongosh.json"}},t.CliUserConfigValidator=class extends n{static async validate(e,t){switch(e){case"userId":case"telemetryAnonymousId":case"disableGreetingMessage":return null;case"inspectCompact":return"boolean"!=typeof t&&("number"!=typeof t||t<0)?`${e} must be a boolean or a positive integer`:null;case"inspectDepth":case"historyLength":return"number"!=typeof t||t<0?`${e} must be a positive integer`:null;case"forceDisableTelemetry":case"showStackTraces":return"boolean"!=typeof t?`${e} must be a boolean`:null;case"redactHistory":return"keep"!==t&&"remove"!==t&&"remove-redact"!==t?`${e} must be one of 'keep', 'remove', or 'remove-redact'`:null;case"oidcRedirectURI":return void 0===t||"string"==typeof t&&a(t)?null:`${e} must be undefined or a valid URL`;case"oidcTrustedEndpoints":return void 0===t||Array.isArray(t)&&!t.some((e=>"string"!=typeof e))?null:`${e} must be undefined or an array of hostnames`;case"browser":return void 0!==t&&!1!==t&&"string"!=typeof t?`${e} must be undefined, false, or a command string`:null;case"updateURL":return"string"!=typeof t||t.trim()&&!a(t)?`${e} must be a valid URL or empty`:null;default:return super.validate(e,t)}}}},97143:(e,t,r)=>{"use strict";var s=r(92048),i=r(55315),n=r(48858);function a(e,r){var a;(r=r||{}).isFileComment&&(e=function(e,r){var n=t.mapFileCommentRegex.exec(e),a=n[1]||n[2],o=i.resolve(r,a);try{return s.readFileSync(o,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+o+"\n"+e)}}(e,r.commentFileDir)),r.hasComment&&(e=function(e){return e.split(",").pop()}(e)),r.isEncoded&&(a=e,e=(n.Buffer.from(a,"base64")||"").toString()),(r.isJSON||r.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}Object.defineProperty(t,"commentRegex",{get:function(){return/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/gm}}),Object.defineProperty(t,"mapFileCommentRegex",{get:function(){return/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm}}),a.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},a.prototype.toBase64=function(){var e=this.toJSON();return(n.Buffer.from(e,"utf8")||"").toString("base64")},a.prototype.toComment=function(e){var t="sourceMappingURL=data:application/json;charset=utf-8;base64,"+this.toBase64();return e&&e.multiline?"/*# "+t+" */":"//# "+t},a.prototype.toObject=function(){return JSON.parse(this.toJSON())},a.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error('property "'+e+'" already exists on the sourcemap, use set property instead');return this.setProperty(e,t)},a.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},a.prototype.getProperty=function(e){return this.sourcemap[e]},t.fromObject=function(e){return new a(e)},t.fromJSON=function(e){return new a(e,{isJSON:!0})},t.fromBase64=function(e){return new a(e,{isEncoded:!0})},t.fromComment=function(e){return new a(e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),{isEncoded:!0,hasComment:!0})},t.fromMapFileComment=function(e,t){return new a(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},t.fromSource=function(e){var r=e.match(t.commentRegex);return r?t.fromComment(r.pop()):null},t.fromMapFileSource=function(e,r){var s=e.match(t.mapFileCommentRegex);return s?t.fromMapFileComment(s.pop(),r):null},t.removeComments=function(e){return e.replace(t.commentRegex,"")},t.removeMapFileComments=function(e){return e.replace(t.mapFileCommentRegex,"")},t.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}},48858:(e,t,r)=>{var s=r(78893),i=s.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=s:(n(s,t),t.Buffer=a),n(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var s=i(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s.SlowBuffer(e)}},25130:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(s++,"%c"===e&&(i=s))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(87123)(t);const{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},87123:(e,t,r)=>{e.exports=function(e){function t(e){let r,i=null;function n(...e){if(!n.enabled)return;const s=n,i=Number(new Date),a=i-(r||i);s.diff=a,s.prev=r,s.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";o++;const n=t.formatters[i];if("function"==typeof n){const t=e[o];r=n.call(s,t),e.splice(o,1),o--}return r})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return n.namespace=e,n.useColors=t.useColors(),n.color=t.selectColor(e),n.extend=s,n.destroy=t.destroy,Object.defineProperty(n,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(n),n}function s(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),i=s.length;for(r=0;r<i;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,s;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(11378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},48102:e=>{"use strict";var t=/[|\\{}()[\]^$+*?.]/g;e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(t,"\\$&")}},43291:e=>{"use strict";const t=Symbol.for("gensync:v1:start"),r=Symbol.for("gensync:v1:suspend"),s="GENSYNC_EXPECTED_START",i="GENSYNC_EXPECTED_SUSPEND",n="GENSYNC_OPTIONS_ERROR",a="GENSYNC_RACE_NONEMPTY";function o(e,t,r,s){if(typeof r===e||s&&void 0===r)return;let i;throw i=s?`Expected opts.${t} to be either a ${e}, or undefined.`:`Expected opts.${t} to be a ${e}.`,l(i,n)}function l(e,t){return Object.assign(new Error(e),{code:t})}function c({name:e,arity:s,sync:i,async:n}){return m(e,s,(function*(...e){const s=yield t;if(!s)return i.call(this,e);let a;try{n.call(this,e,(e=>{a||(a={value:e},s())}),(e=>{a||(a={err:e},s())}))}catch(e){a={err:e},s()}if(yield r,a.hasOwnProperty("err"))throw a.err;return a.value}))}function p(e){let t;for(;!({value:t}=e.next()).done;)h(t,e);return t}function u(e,t,r){!function s(){try{let r;for(;!({value:r}=e.next()).done;){h(r,e);let t=!0,i=!1;const n=e.next((()=>{t?i=!0:s()}));if(t=!1,d(n,e),!i)return}return t(r)}catch(e){return r(e)}}()}function h(e,r){e!==t&&f(r,l(`Got unexpected yielded value in gensync generator: ${JSON.stringify(e)}. Did you perhaps mean to use 'yield*' instead of 'yield'?`,s))}function d({value:e,done:t},s){(t||e!==r)&&f(s,l(t?"Unexpected generator completion. If you get this, it is probably a gensync bug.":`Expected GENSYNC_SUSPEND, got ${JSON.stringify(e)}. If you get this, it is probably a gensync bug.`,i))}function f(e,t){throw e.throw&&e.throw(t),t}function m(e,t,r){if("string"==typeof e){const t=Object.getOwnPropertyDescriptor(r,"name");t&&!t.configurable||Object.defineProperty(r,"name",Object.assign(t||{},{configurable:!0,value:e}))}if("number"==typeof t){const e=Object.getOwnPropertyDescriptor(r,"length");e&&!e.configurable||Object.defineProperty(r,"length",Object.assign(e||{},{configurable:!0,value:t}))}return r}e.exports=Object.assign((function(e){let t=e;return t="function"!=typeof e?function({name:e,arity:t,sync:r,async:s,errback:i}){if(o("string","name",e,!0),o("number","arity",t,!0),o("function","sync",r),o("function","async",s,!0),o("function","errback",i,!0),s&&i)throw l("Expected one of either opts.async or opts.errback, but got _both_.",n);if("string"!=typeof e){let t;i&&i.name&&"errback"!==i.name&&(t=i.name),s&&s.name&&"async"!==s.name&&(t=s.name.replace(/Async$/,"")),r&&r.name&&"sync"!==r.name&&(t=r.name.replace(/Sync$/,"")),"string"==typeof t&&(e=t)}return"number"!=typeof t&&(t=r.length),c({name:e,arity:t,sync:function(e){return r.apply(this,e)},async:function(e,t,n){s?s.apply(this,e).then(t,n):i?i.call(this,...e,((e,r)=>{null==e?t(r):n(e)})):t(r.apply(this,e))}})}(e):function(e){return m(e.name,e.length,(function(...t){return e.apply(this,t)}))}(e),Object.assign(t,function(e){return{sync:function(...t){return p(e.apply(this,t))},async:function(...t){return new Promise(((r,s)=>{u(e.apply(this,t),r,s)}))},errback:function(...t){const r=t.pop();if("function"!=typeof r)throw l("Asynchronous function called without callback","GENSYNC_ERRBACK_NO_CALLBACK");let s;try{s=e.apply(this,t)}catch(e){return void r(e)}u(s,(e=>r(void 0,e)),(e=>r(e)))}}}(t))}),{all:c({name:"all",arity:1,sync:function(e){return Array.from(e[0]).map((e=>p(e)))},async:function(e,t,r){const s=Array.from(e[0]);if(0===s.length)return void Promise.resolve().then((()=>t([])));let i=0;const n=s.map((()=>{}));s.forEach(((e,s)=>{u(e,(e=>{n[s]=e,i+=1,i===n.length&&t(n)}),r)}))}}),race:c({name:"race",arity:1,sync:function(e){const t=Array.from(e[0]);if(0===t.length)throw l("Must race at least 1 item",a);return p(t[0])},async:function(e,t,r){const s=Array.from(e[0]);if(0===s.length)throw l("Must race at least 1 item",a);for(const e of s)u(e,t,r)}})})},84904:(e,t,r)=>{"use strict";e.exports=r(10964)},39520:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:void 0};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},94669:e=>{"use strict";const t={},r=t.hasOwnProperty,s=(e,t)=>{for(const s in e)r.call(e,s)&&t(s,e[s])},i=t.toString,n=Array.isArray,a=Buffer.isBuffer,o={'"':'\\"',"'":"\\'","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},l=/["'\\\b\f\n\r\t]/,c=/[0-9]/,p=/[ !#-&\(-\[\]-_a-~]/,u=(e,t)=>{const r=()=>{v=x,++t.indentLevel,x=t.indent.repeat(t.indentLevel)},h={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",indentLevel:0,__inline1__:!1,__inline2__:!1},d=t&&t.json;var f,m;d&&(h.quotes="double",h.wrap=!0),f=h,t=(m=t)?(s(m,((e,t)=>{f[e]=t})),f):f,"single"!=t.quotes&&"double"!=t.quotes&&"backtick"!=t.quotes&&(t.quotes="single");const y="double"==t.quotes?'"':"backtick"==t.quotes?"`":"'",g=t.compact,b=t.lowercaseHex;let x=t.indent.repeat(t.indentLevel),v="";const E=t.__inline1__,P=t.__inline2__,T=g?"":"\n";let S,A=!0;const w="binary"==t.numbers,C="octal"==t.numbers,I="decimal"==t.numbers,_="hexadecimal"==t.numbers;if(d&&e&&"function"==typeof e.toJSON&&(e=e.toJSON()),"string"!=typeof(k=e)&&"[object String]"!=i.call(k)){if((e=>"[object Map]"==i.call(e))(e))return 0==e.size?"new Map()":(g||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+u(Array.from(e),t)+")");if((e=>"[object Set]"==i.call(e))(e))return 0==e.size?"new Set()":"new Set("+u(Array.from(e),t)+")";if(a(e))return 0==e.length?"Buffer.from([])":"Buffer.from("+u(Array.from(e),t)+")";if(n(e))return S=[],t.wrap=!0,E&&(t.__inline1__=!1,t.__inline2__=!0),P||r(),((e,t)=>{const r=e.length;let s=-1;for(;++s<r;)t(e[s])})(e,(e=>{A=!1,P&&(t.__inline2__=!1),S.push((g||P?"":x)+u(e,t))})),A?"[]":P?"["+S.join(", ")+"]":"["+T+S.join(","+T)+T+(g?"":v)+"]";if(!(e=>"number"==typeof e||"[object Number]"==i.call(e))(e))return(e=>"[object Object]"==i.call(e))(e)?(S=[],t.wrap=!0,r(),s(e,((e,r)=>{A=!1,S.push((g?"":x)+u(e,t)+":"+(g?"":" ")+u(r,t))})),A?"{}":"{"+T+S.join(","+T)+T+(g?"":v)+"}"):d?JSON.stringify(e)||"null":String(e);if(d)return JSON.stringify(e);if(I)return String(e);if(_){let t=e.toString(16);return b||(t=t.toUpperCase()),"0x"+t}if(w)return"0b"+e.toString(2);if(C)return"0o"+e.toString(8)}var k;const N=e;let O=-1;const D=N.length;for(S="";++O<D;){const e=N.charAt(O);if(t.es6){const e=N.charCodeAt(O);if(e>=55296&&e<=56319&&D>O+1){const t=N.charCodeAt(O+1);if(t>=56320&&t<=57343){let r=(1024*(e-55296)+t-56320+65536).toString(16);b||(r=r.toUpperCase()),S+="\\u{"+r+"}",++O;continue}}}if(!t.escapeEverything){if(p.test(e)){S+=e;continue}if('"'==e){S+=y==e?'\\"':e;continue}if("`"==e){S+=y==e?"\\`":e;continue}if("'"==e){S+=y==e?"\\'":e;continue}}if("\0"==e&&!d&&!c.test(N.charAt(O+1))){S+="\\0";continue}if(l.test(e)){S+=o[e];continue}const r=e.charCodeAt(0);if(t.minimal&&8232!=r&&8233!=r){S+=e;continue}let s=r.toString(16);b||(s=s.toUpperCase());const i=s.length>2||d,n="\\"+(i?"u":"x")+("0000"+s).slice(i?-4:-2);S+=n}return t.wrap&&(S=y+S+y),"`"==y&&(S=S.replace(/\$\{/g,"\\${")),t.isScriptContext?S.replace(/<\/(script|style)/gi,"<\\/$1").replace(/<!--/g,d?"\\u003C!--":"\\x3C!--"):S};u.version="2.5.2",e.exports=u},59176:(e,t,r)=>{const{default:s}=r(4680),i=/\.mongodb(-dev|-qa|-stage)?\.net$/i,n=/^atlas-stream-.+/i,a=/^(localhost|127\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])|0\.0\.0\.0|(?:0*\:)*?:?0*1)$/i,o=/\.mongo\.ondigitalocean\.com$/i,l=/\.cosmos\.azure\.com$/i,c=/docdb(-elastic)?\.amazonaws\.com$/i;function p(e){return e.startsWith("[")?e.substring(1).split("]")[0]:e.split(":")[0]}function u(e){if("string"!=typeof e)return"";try{return p(new s(e).hosts[0])}catch(t){return p(e)}}e.exports={getDataLake:function(e){const t={isDataLake:!1,dlVersion:null};return e.dataLake&&(t.isDataLake=!0,t.dlVersion=e.dataLake.version),t},isEnterprise:function(e){return!(!e.gitVersion||!e.gitVersion.match(/enterprise/))||!(!e.modules||-1===e.modules.indexOf("enterprise"))},isAtlas:function(e){return!!u(e).match(i)},isAtlasStream:function(e){const t=u(e);return!(!t.match(i)||!t.match(n))},isLocalhost:function(e){return!!u(e).match(a)},isDigitalOcean:function(e){return!!u(e).match(o)},getGenuineMongoDB:function(e){const t=u(e);return t.match(l)?{isGenuine:!1,serverName:"cosmosdb"}:t.match(c)?{isGenuine:!1,serverName:"documentdb"}:{isGenuine:!0,serverName:"mongodb"}},getBuildEnv:function(e){return{serverOs:e.buildEnvironment?e.buildEnvironment.target_os:null,serverArch:e.buildEnvironment?e.buildEnvironment.target_arch:null}}}},11378:e=>{var t=1e3,r=60*t,s=60*r,i=24*s;function n(e,t,r,s){var i=t>=1.5*r;return Math.round(e/r)+" "+s+(i?"s":"")}e.exports=function(e,a){a=a||{};var o,l,c=typeof e;if("string"===c&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var n=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(n){var a=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*s;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===c&&isFinite(e))return a.long?(o=e,(l=Math.abs(o))>=i?n(o,l,i,"day"):l>=s?n(o,l,s,"hour"):l>=r?n(o,l,r,"minute"):l>=t?n(o,l,t,"second"):o+" ms"):function(e){var n=Math.abs(e);return n>=i?Math.round(e/i)+"d":n>=s?Math.round(e/s)+"h":n>=r?Math.round(e/r)+"m":n>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},16599:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function r(e){return"function"==typeof e}function s(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var n=RegExp.prototype.test;var a=/\S/;function o(e){return!function(e,t){return n.call(e,t)}(a,e)}var l={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};var c=/\s*/,p=/\s+/,u=/\s*=/,h=/\s*\}/,d=/#|\^|\/|>|\{|&|=|!/;function f(e){this.string=e,this.tail=e,this.pos=0}function m(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function y(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}f.prototype.eos=function(){return""===this.tail},f.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r},f.prototype.scanUntil=function(e){var t,r=this.tail.search(e);switch(r){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=t.length,t},m.prototype.push=function(e){return new m(e,this)},m.prototype.lookup=function(e){var t,s,n,a=this.cache;if(a.hasOwnProperty(e))t=a[e];else{for(var o,l,c,p=this,u=!1;p;){if(e.indexOf(".")>0)for(o=p.view,l=e.split("."),c=0;null!=o&&c<l.length;)c===l.length-1&&(u=i(o,l[c])||(s=o,n=l[c],null!=s&&"object"!=typeof s&&s.hasOwnProperty&&s.hasOwnProperty(n))),o=o[l[c++]];else o=p.view[e],u=i(p.view,e);if(u){t=o;break}p=p.parent}a[e]=t}return r(t)&&(t=t.call(this.view)),t},y.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},y.prototype.parse=function(e,r){var i=this.templateCache,n=e+":"+(r||g.tags).join(":"),a=void 0!==i,l=a?i.get(n):void 0;return null==l&&(l=function(e,r){if(!e)return[];var i,n,a,l=!1,m=[],y=[],b=[],x=!1,v=!1,E="",P=0;function T(){if(x&&!v)for(;b.length;)delete y[b.pop()];else b=[];x=!1,v=!1}function S(e){if("string"==typeof e&&(e=e.split(p,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);i=new RegExp(s(e[0])+"\\s*"),n=new RegExp("\\s*"+s(e[1])),a=new RegExp("\\s*"+s("}"+e[1]))}S(r||g.tags);for(var A,w,C,I,_,k,N=new f(e);!N.eos();){if(A=N.pos,C=N.scanUntil(i))for(var O=0,D=C.length;O<D;++O)o(I=C.charAt(O))?(b.push(y.length),E+=I):(v=!0,l=!0,E+=" "),y.push(["text",I,A,A+1]),A+=1,"\n"===I&&(T(),E="",P=0,l=!1);if(!N.scan(i))break;if(x=!0,w=N.scan(d)||"name",N.scan(c),"="===w?(C=N.scanUntil(u),N.scan(u),N.scanUntil(n)):"{"===w?(C=N.scanUntil(a),N.scan(h),N.scanUntil(n),w="&"):C=N.scanUntil(n),!N.scan(n))throw new Error("Unclosed tag at "+N.pos);if(_=">"==w?[w,C,A,N.pos,E,P,l]:[w,C,A,N.pos],P++,y.push(_),"#"===w||"^"===w)m.push(_);else if("/"===w){if(!(k=m.pop()))throw new Error('Unopened section "'+C+'" at '+A);if(k[1]!==C)throw new Error('Unclosed section "'+k[1]+'" at '+A)}else"name"===w||"{"===w||"&"===w?v=!0:"="===w&&S(C)}if(T(),k=m.pop())throw new Error('Unclosed section "'+k[1]+'" at '+N.pos);return function(e){for(var t,r=[],s=r,i=[],n=0,a=e.length;n<a;++n)switch((t=e[n])[0]){case"#":case"^":s.push(t),i.push(t),s=t[4]=[];break;case"/":i.pop()[5]=t[2],s=i.length>0?i[i.length-1][4]:r;break;default:s.push(t)}return r}(function(e){for(var t,r,s=[],i=0,n=e.length;i<n;++i)(t=e[i])&&("text"===t[0]&&r&&"text"===r[0]?(r[1]+=t[1],r[3]=t[3]):(s.push(t),r=t));return s}(y))}(e,r),a&&i.set(n,l)),l},y.prototype.render=function(e,t,r,s){var i=this.getConfigTags(s),n=this.parse(e,i),a=t instanceof m?t:new m(t,void 0);return this.renderTokens(n,a,r,e,s)},y.prototype.renderTokens=function(e,t,r,s,i){for(var n,a,o,l="",c=0,p=e.length;c<p;++c)o=void 0,"#"===(a=(n=e[c])[0])?o=this.renderSection(n,t,r,s,i):"^"===a?o=this.renderInverted(n,t,r,s,i):">"===a?o=this.renderPartial(n,t,r,i):"&"===a?o=this.unescapedValue(n,t):"name"===a?o=this.escapedValue(n,t,i):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(l+=o);return l},y.prototype.renderSection=function(e,s,i,n,a){var o=this,l="",c=s.lookup(e[1]);if(c){if(t(c))for(var p=0,u=c.length;p<u;++p)l+=this.renderTokens(e[4],s.push(c[p]),i,n,a);else if("object"==typeof c||"string"==typeof c||"number"==typeof c)l+=this.renderTokens(e[4],s.push(c),i,n,a);else if(r(c)){if("string"!=typeof n)throw new Error("Cannot use higher-order sections without the original template");null!=(c=c.call(s.view,n.slice(e[3],e[5]),(function(e){return o.render(e,s,i,a)})))&&(l+=c)}else l+=this.renderTokens(e[4],s,i,n,a);return l}},y.prototype.renderInverted=function(e,r,s,i,n){var a=r.lookup(e[1]);if(!a||t(a)&&0===a.length)return this.renderTokens(e[4],r,s,i,n)},y.prototype.indentPartial=function(e,t,r){for(var s=t.replace(/[^ \t]/g,""),i=e.split("\n"),n=0;n<i.length;n++)i[n].length&&(n>0||!r)&&(i[n]=s+i[n]);return i.join("\n")},y.prototype.renderPartial=function(e,t,s,i){if(s){var n=this.getConfigTags(i),a=r(s)?s(e[1]):s[e[1]];if(null!=a){var o=e[6],l=e[5],c=e[4],p=a;0==l&&c&&(p=this.indentPartial(a,c,o));var u=this.parse(p,n);return this.renderTokens(u,t,s,p,i)}}},y.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(null!=r)return r},y.prototype.escapedValue=function(e,t,r){var s=this.getConfigEscape(r)||g.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&s===g.escape?String(i):s(i)},y.prototype.rawValue=function(e){return e[1]},y.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},y.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var g={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){b.templateCache=e},get templateCache(){return b.templateCache}},b=new y;return g.clearCache=function(){return b.clearCache()},g.parse=function(e,t){return b.parse(e,t)},g.render=function(e,r,s,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(n=e)?"array":typeof n)+'" was given as the first argument for mustache#render(template, view, partials)'));var n;return b.render(e,r,s,i)},g.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return l[e]}))},g.Scanner=f,g.Context=m,g.Writer=y,g}()},68262:(e,t,r)=>{"use strict";var s=r(23586);function i(){}function n(){}n.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,n,a){if(a!==s){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:i};return r.PropTypes=r,r}},13980:(e,t,r)=>{e.exports=r(68262)()},23586:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},7847:(e,t,r)=>{const s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=n(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),c("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(e){const t=this.options.loose?a[o.COMPARATORLOOSE]:a[o.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new p(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(c("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new p(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new u(e.value,t).test(this.value):""===e.operator?""===e.value||new u(this.value,t).test(e.semver):!((t=n(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=i;const n=r(71388),{safeRe:a,t:o}=r(94808),l=r(28117),c=r(10952),p=r(52435),u=r(66843)},66843:(e,t,r)=>{class s{constructor(e,t){if(t=n(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!y(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&m))+":"+e,r=i.get(t);if(r)return r;const s=this.options.loose,n=s?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(n,_(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(c[p.TILDETRIM],h),o("tilde trim",e),e=e.replace(c[p.CARETTRIM],d),o("caret trim",e);let l=e.split(" ").map((e=>x(e,this.options))).join(" ").split(/\s+/).map((e=>I(e,this.options)));s&&(l=l.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),o("range list",l);const g=new Map,b=l.map((e=>new a(e,this.options)));for(const e of b){if(y(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const v=[...g.values()];return i.set(t,v),v}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some((r=>b(r,t)&&e.set.some((e=>b(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const i=new(r(77105))({max:1e3}),n=r(71388),a=r(7847),o=r(10952),l=r(52435),{safeRe:c,t:p,comparatorTrimReplace:u,tildeTrimReplace:h,caretTrimReplace:d}=r(94808),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:m}=r(55558),y=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,b=(e,t)=>{let r=!0;const s=e.slice();let i=s.pop();for(;r&&s.length;)r=s.every((e=>i.intersects(e,t))),i=s.pop();return r},x=(e,t)=>(o("comp",e,t),e=T(e,t),o("caret",e),e=E(e,t),o("tildes",e),e=A(e,t),o("xrange",e),e=C(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,E=(e,t)=>e.trim().split(/\s+/).map((e=>P(e,t))).join(" "),P=(e,t)=>{const r=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(r,((t,r,s,i,n)=>{let a;return o("tilde",e,t,r,s,i,n),v(r)?a="":v(s)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:v(i)?a=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:n?(o("replaceTilde pr",n),a=`>=${r}.${s}.${i}-${n} <${r}.${+s+1}.0-0`):a=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,o("tilde return",a),a}))},T=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{o("caret",e,t);const r=t.loose?c[p.CARETLOOSE]:c[p.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,n,a)=>{let l;return o("caret",e,t,r,i,n,a),v(r)?l="":v(i)?l=`>=${r}.0.0${s} <${+r+1}.0.0-0`:v(n)?l="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:a?(o("replaceCaret pr",a),l="0"===r?"0"===i?`>=${r}.${i}.${n}-${a} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n}-${a} <${+r+1}.0.0-0`):(o("no pr"),l="0"===r?"0"===i?`>=${r}.${i}.${n}${s} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n} <${+r+1}.0.0-0`),o("caret return",l),l}))},A=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>w(e,t))).join(" ")),w=(e,t)=>{e=e.trim();const r=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(r,((r,s,i,n,a,l)=>{o("xRange",e,r,s,i,n,a,l);const c=v(i),p=c||v(n),u=p||v(a),h=u;return"="===s&&h&&(s=""),l=t.includePrerelease?"-0":"",c?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&h?(p&&(n=0),a=0,">"===s?(s=">=",p?(i=+i+1,n=0,a=0):(n=+n+1,a=0)):"<="===s&&(s="<",p?i=+i+1:n=+n+1),"<"===s&&(l="-0"),r=`${s+i}.${n}.${a}${l}`):p?r=`>=${i}.0.0${l} <${+i+1}.0.0-0`:u&&(r=`>=${i}.${n}.0${l} <${i}.${+n+1}.0-0`),o("xRange return",r),r}))},C=(e,t)=>(o("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),I=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),_=e=>(t,r,s,i,n,a,o,l,c,p,u,h,d)=>`${r=v(s)?"":v(i)?`>=${s}.0.0${e?"-0":""}`:v(n)?`>=${s}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=v(c)?"":v(p)?`<${+c+1}.0.0-0`:v(u)?`<${c}.${+p+1}.0-0`:h?`<=${c}.${p}.${u}-${h}`:e?`<${c}.${p}.${+u+1}-0`:`<=${l}`}`.trim(),k=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(o(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){const s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},52435:(e,t,r)=>{const s=r(10952),{MAX_LENGTH:i,MAX_SAFE_INTEGER:n}=r(55558),{safeRe:a,t:o}=r(94808),l=r(71388),{compareIdentifiers:c}=r(14935);class p{constructor(e,t){if(t=l(t),e instanceof p){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?a[o.LOOSE]:a[o.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof p)){if("string"==typeof e&&e===this.version)return 0;e=new p(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof p||(e=new p(e,this.options)),c(this.major,e.major)||c(this.minor,e.minor)||c(this.patch,e.patch)}comparePre(e){if(e instanceof p||(e=new p(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],i=e.prerelease[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}compareBuild(e){e instanceof p||(e=new p(e,this.options));let t=0;do{const r=this.build[t],i=e.build[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===c(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=p},36694:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},28117:(e,t,r)=>{const s=r(33276),i=r(77893),n=r(16379),a=r(8463),o=r(21897),l=r(30506);e.exports=(e,t,r,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return i(e,r,c);case">":return n(e,r,c);case">=":return a(e,r,c);case"<":return o(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},98686:(e,t,r)=>{const s=r(52435),i=r(79943),{safeRe:n,t:a}=r(94808);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=n[a.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),n[a.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;n[a.COERCERTL].lastIndex=-1}else r=e.match(n[a.COERCE]);return null===r?null:i(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},65914:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r)=>{const i=new s(e,r),n=new s(t,r);return i.compare(n)||i.compareBuild(n)}},55404:(e,t,r)=>{const s=r(92271);e.exports=(e,t)=>s(e,t,!0)},92271:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},66007:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,null,!0),i=s(t,null,!0),n=r.compare(i);if(0===n)return null;const a=n>0,o=a?r:i,l=a?i:r,c=!!o.prerelease.length;if(l.prerelease.length&&!c)return l.patch||l.minor?o.patch?"patch":o.minor?"minor":"major":"major";const p=c?"pre":"";return r.major!==i.major?p+"major":r.minor!==i.minor?p+"minor":r.patch!==i.patch?p+"patch":"prerelease"}},33276:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>0===s(e,t,r)},16379:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)>0},8463:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)>=0},86360:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,n).version}catch(e){return null}}},21897:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)<0},30506:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)<=0},14551:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).major},469:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).minor},77893:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>0!==s(e,t,r)},79943:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},54250:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).patch},58204:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},70733:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(t,e,r)},72961:(e,t,r)=>{const s=r(65914);e.exports=(e,t)=>e.sort(((e,r)=>s(r,e,t)))},59844:(e,t,r)=>{const s=r(66843);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},51116:(e,t,r)=>{const s=r(65914);e.exports=(e,t)=>e.sort(((e,r)=>s(e,r,t)))},97230:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,t);return r?r.version:null}},97699:(e,t,r)=>{const s=r(94808),i=r(55558),n=r(52435),a=r(14935),o=r(79943),l=r(97230),c=r(36694),p=r(86360),u=r(66007),h=r(14551),d=r(469),f=r(54250),m=r(58204),y=r(92271),g=r(70733),b=r(55404),x=r(65914),v=r(51116),E=r(72961),P=r(16379),T=r(21897),S=r(33276),A=r(77893),w=r(8463),C=r(30506),I=r(28117),_=r(98686),k=r(7847),N=r(66843),O=r(59844),D=r(48865),M=r(53727),F=r(14338),L=r(21542),R=r(36240),j=r(89106),B=r(90995),U=r(47805),V=r(22013),$=r(81338),K=r(53122);e.exports={parse:o,valid:l,clean:c,inc:p,diff:u,major:h,minor:d,patch:f,prerelease:m,compare:y,rcompare:g,compareLoose:b,compareBuild:x,sort:v,rsort:E,gt:P,lt:T,eq:S,neq:A,gte:w,lte:C,cmp:I,coerce:_,Comparator:k,Range:N,satisfies:O,toComparators:D,maxSatisfying:M,minSatisfying:F,minVersion:L,validRange:R,outside:j,gtr:B,ltr:U,intersects:V,simplifyRange:$,subset:K,SemVer:n,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}},55558:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},10952:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},14935:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const s=t.test(e),i=t.test(r);return s&&i&&(e=+e,r=+r),e===r?0:s&&!i?-1:i&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},71388:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},94808:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=r(55558),a=r(10952),o=(t=e.exports={}).re=[],l=t.safeRe=[],c=t.src=[],p=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const s=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=u++;a(e,i,t),p[e]=i,c[i]=t,o[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(s,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),f("MAINVERSION",`(${c[p.NUMERICIDENTIFIER]})\\.(${c[p.NUMERICIDENTIFIER]})\\.(${c[p.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${c[p.NUMERICIDENTIFIERLOOSE]})\\.(${c[p.NUMERICIDENTIFIERLOOSE]})\\.(${c[p.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${c[p.NUMERICIDENTIFIER]}|${c[p.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${c[p.NUMERICIDENTIFIERLOOSE]}|${c[p.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${c[p.PRERELEASEIDENTIFIER]}(?:\\.${c[p.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${c[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[p.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${h}+`),f("BUILD",`(?:\\+(${c[p.BUILDIDENTIFIER]}(?:\\.${c[p.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${c[p.MAINVERSION]}${c[p.PRERELEASE]}?${c[p.BUILD]}?`),f("FULL",`^${c[p.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${c[p.MAINVERSIONLOOSE]}${c[p.PRERELEASELOOSE]}?${c[p.BUILD]}?`),f("LOOSE",`^${c[p.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${c[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${c[p.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${c[p.XRANGEIDENTIFIER]})(?:\\.(${c[p.XRANGEIDENTIFIER]})(?:\\.(${c[p.XRANGEIDENTIFIER]})(?:${c[p.PRERELEASE]})?${c[p.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${c[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[p.XRANGEIDENTIFIERLOOSE]})(?:${c[p.PRERELEASELOOSE]})?${c[p.BUILD]}?)?)?`),f("XRANGE",`^${c[p.GTLT]}\\s*${c[p.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${c[p.GTLT]}\\s*${c[p.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?(?:$|[^\\d])`),f("COERCERTL",c[p.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${c[p.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${c[p.LONETILDE]}${c[p.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${c[p.LONETILDE]}${c[p.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${c[p.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${c[p.LONECARET]}${c[p.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${c[p.LONECARET]}${c[p.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${c[p.GTLT]}\\s*(${c[p.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${c[p.GTLT]}\\s*(${c[p.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${c[p.GTLT]}\\s*(${c[p.LOOSEPLAIN]}|${c[p.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${c[p.XRANGEPLAIN]})\\s+-\\s+(${c[p.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${c[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[p.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},90995:(e,t,r)=>{const s=r(89106);e.exports=(e,t,r)=>s(e,t,">",r)},22013:(e,t,r)=>{const s=r(66843);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},47805:(e,t,r)=>{const s=r(89106);e.exports=(e,t,r)=>s(e,t,"<",r)},53727:(e,t,r)=>{const s=r(52435),i=r(66843);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&-1!==a.compare(e)||(n=e,a=new s(n,r)))})),n}},14338:(e,t,r)=>{const s=r(52435),i=r(66843);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&1!==a.compare(e)||(n=e,a=new s(n,r)))})),n}},21542:(e,t,r)=>{const s=r(52435),i=r(66843),n=r(16379);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r))return r;if(r=new s("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let a=null;i.forEach((e=>{const t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":a&&!n(t,a)||(a=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!a||r&&!n(r,a)||(r=a)}return r&&e.test(r)?r:null}},89106:(e,t,r)=>{const s=r(52435),i=r(7847),{ANY:n}=i,a=r(66843),o=r(59844),l=r(16379),c=r(21897),p=r(30506),u=r(8463);e.exports=(e,t,r,h)=>{let d,f,m,y,g;switch(e=new s(e,h),t=new a(t,h),r){case">":d=l,f=p,m=c,y=">",g=">=";break;case"<":d=c,f=u,m=l,y="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,h))return!1;for(let r=0;r<t.set.length;++r){const s=t.set[r];let a=null,o=null;if(s.forEach((e=>{e.semver===n&&(e=new i(">=0.0.0")),a=a||e,o=o||e,d(e.semver,a.semver,h)?a=e:m(e.semver,o.semver,h)&&(o=e)})),a.operator===y||a.operator===g)return!1;if((!o.operator||o.operator===y)&&f(e,o.semver))return!1;if(o.operator===g&&m(e,o.semver))return!1}return!0}},81338:(e,t,r)=>{const s=r(59844),i=r(92271);e.exports=(e,t,r)=>{const n=[];let a=null,o=null;const l=e.sort(((e,t)=>i(e,t,r)));for(const e of l)s(e,t,r)?(o=e,a||(a=e)):(o&&n.push([a,o]),o=null,a=null);a&&n.push([a,null]);const c=[];for(const[e,t]of n)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push(`<=${t}`):c.push(`${e} - ${t}`):c.push(`>=${e}`):c.push("*");const p=c.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return p.length<u.length?p:t}},53122:(e,t,r)=>{const s=r(66843),i=r(7847),{ANY:n}=i,a=r(59844),o=r(92271),l=[new i(">=0.0.0-0")],c=[new i(">=0.0.0")],p=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?l:c}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=c}const s=new Set;let i,p,d,f,m,y,g;for(const t of e)">"===t.operator||">="===t.operator?i=u(i,t,r):"<"===t.operator||"<="===t.operator?p=h(p,t,r):s.add(t.semver);if(s.size>1)return null;if(i&&p){if(d=o(i.semver,p.semver,r),d>0)return null;if(0===d&&(">="!==i.operator||"<="!==p.operator))return null}for(const e of s){if(i&&!a(e,String(i),r))return null;if(p&&!a(e,String(p),r))return null;for(const s of t)if(!a(e,String(s),r))return!1;return!0}let b=!(!p||r.includePrerelease||!p.semver.prerelease.length)&&p.semver,x=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;b&&1===b.prerelease.length&&"<"===p.operator&&0===b.prerelease[0]&&(b=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,y=y||"<"===e.operator||"<="===e.operator,i)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),">"===e.operator||">="===e.operator){if(f=u(i,e,r),f===e&&f!==i)return!1}else if(">="===i.operator&&!a(i.semver,String(e),r))return!1;if(p)if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),"<"===e.operator||"<="===e.operator){if(m=h(p,e,r),m===e&&m!==p)return!1}else if("<="===p.operator&&!a(p.semver,String(e),r))return!1;if(!e.operator&&(p||i)&&0!==d)return!1}return!(i&&y&&!p&&0!==d||p&&g&&!i&&0!==d||x||b)},u=(e,t,r)=>{if(!e)return t;const s=o(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},h=(e,t,r)=>{if(!e)return t;const s=o(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(const s of e.set){for(const e of t.set){const t=p(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},48865:(e,t,r)=>{const s=r(66843);e.exports=(e,t)=>new s(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},36240:(e,t,r)=>{const s=r(66843);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},90082:e=>{function t(e){var t=/\.[^.]*$/.exec(e);return t?t.index+1:e.length}function r(e,t,r){if(e.reduce)return e.reduce(t,r);for(var s=0,i=arguments.length>=3?r:e[s++];s<e.length;s++)t(i,e[s],s);return i}function s(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t.call(e,e[r],r)}function i(e,t){if(e.map)return e.map(t);for(var r=[],s=0;s<e.length;s++)r.push(t.call(e,e[s],s));return r}e.exports=function(e,n){n||(n={});var a=void 0===n.hsep?" ":n.hsep,o=n.align||[],l=n.stringLength||function(e){return String(e).length},c=r(e,(function(e,r){return s(r,(function(r,s){var i=t(r);(!e[s]||i>e[s])&&(e[s]=i)})),e}),[]),p=i(e,(function(e){return i(e,(function(e,r){var s=String(e);if("."===o[r]){var i=t(s),n=c[r]+(/\./.test(s)?1:2)-(l(s)-i);return s+Array(n).join(" ")}return s}))})),u=r(p,(function(e,t){return s(t,(function(t,r){var s=l(t);(!e[r]||s>e[r])&&(e[r]=s)})),e}),[]);return i(p,(function(e){return i(e,(function(e,t){var r=u[t]-l(e)||0,s=Array(Math.max(r+1,1)).join(" ");return"r"===o[t]||"."===o[t]?s+e:"c"===o[t]?Array(Math.ceil(r/2+1)).join(" ")+e+Array(Math.floor(r/2+1)).join(" "):e+s})).join(a).replace(/\s+$/,"")})).join("\n")}},49517:e=>{"use strict";let t=null;function r(e){if(null!==t&&(t.property,1)){const e=t;return t=r.prototype=null,e}return t=r.prototype=null==e?Object.create(null):e,new r}r(),e.exports=function(e){return r(e)}},96092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.codeFrameColumns=c,t.default=function(e,t,r,s={}){if(!o){o=!0;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";process.emitWarning?process.emitWarning(e,"DeprecationWarning"):(new Error(e).name="DeprecationWarning",console.warn(new Error(e)))}return c(e,{start:{column:r=Math.max(r,0),line:t}},s)};var s=r(13106),i=function(e,t){if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(true);if(r&&r.has(e))return r.get(e);var s={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(s,a,o):s[a]=e[a]}return s.default=e,r&&r.set(e,s),s}(r(43574));function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}let a,o=!1;const l=/\r\n|[\n\r\u2028\u2029]/;function c(e,t,r={}){const n=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r),o=r.forceColor?(null!=a||(a=new i.default.constructor({enabled:!0,level:1})),a):i.default,c=function(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}(o),p=(e,t)=>n?e(t):t,u=e.split(l),{start:h,end:d,markerLines:f}=function(e,t,r){const s=Object.assign({column:0,line:-1},e.start),i=Object.assign({},s,e.end),{linesAbove:n=2,linesBelow:a=3}=r||{},o=s.line,l=s.column,c=i.line,p=i.column;let u=Math.max(o-(n+1),0),h=Math.min(t.length,c+a);-1===o&&(u=0),-1===c&&(h=t.length);const d=c-o,f={};if(d)for(let e=0;e<=d;e++){const r=e+o;if(l)if(0===e){const e=t[r-1].length;f[r]=[l,e-l+1]}else if(e===d)f[r]=[0,p];else{const s=t[r-e].length;f[r]=[0,s]}else f[r]=!0}else f[o]=l===p?!l||[l,0]:[l,p-l];return{start:u,end:h,markerLines:f}}(t,u,r),m=t.start&&"number"==typeof t.start.column,y=String(d).length;let g=(n?(0,s.default)(e,r):e).split(l,d).slice(h,d).map(((e,t)=>{const s=h+1+t,i=` ${` ${s}`.slice(-y)} |`,n=f[s],a=!f[s+1];if(n){let t="";if(Array.isArray(n)){const s=e.slice(0,Math.max(n[0]-1,0)).replace(/[^\t]/g," "),o=n[1]||1;t=["\n ",p(c.gutter,i.replace(/\d/g," "))," ",s,p(c.marker,"^").repeat(o)].join(""),a&&r.message&&(t+=" "+p(c.message,r.message))}return[p(c.marker,">"),p(c.gutter,i),e.length>0?` ${e}`:"",t].join("")}return` ${p(c.gutter,i)}${e.length>0?` ${e}`:""}`})).join("\n");return r.message&&!m&&(g=`${" ".repeat(y+1)}${r.message}\n${g}`),n?o.reset(g):g}},45884:(e,t,r)=>{e.exports=r(95619)},18052:(e,t,r)=>{e.exports=r(7286)},69417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=class{constructor(e){this._map=null,this._buf="",this._str="",this._appendCount=0,this._last=0,this._queue=[],this._queueCursor=0,this._canMarkIdName=!0,this._position={line:1,column:0},this._sourcePosition={identifierName:void 0,identifierNamePos:void 0,line:void 0,column:void 0,filename:void 0},this._map=e,this._allocQueue()}_allocQueue(){const e=this._queue;for(let t=0;t<16;t++)e.push({char:0,repeat:1,line:void 0,column:void 0,identifierName:void 0,identifierNamePos:void 0,filename:""})}_pushQueue(e,t,r,s,i){const n=this._queueCursor;n===this._queue.length&&this._allocQueue();const a=this._queue[n];a.char=e,a.repeat=t,a.line=r,a.column=s,a.filename=i,this._queueCursor++}_popQueue(){if(0===this._queueCursor)throw new Error("Cannot pop from empty queue");return this._queue[--this._queueCursor]}get(){this._flush();const e=this._map,t={code:(this._buf+this._str).trimRight(),decodedMap:null==e?void 0:e.getDecoded(),get __mergedMap(){return this.map},get map(){const r=e?e.get():null;return t.map=r,r},set map(e){Object.defineProperty(t,"map",{value:e,writable:!0})},get rawMappings(){const r=null==e?void 0:e.getRawMappings();return t.rawMappings=r,r},set rawMappings(e){Object.defineProperty(t,"rawMappings",{value:e,writable:!0})}};return t}append(e,t){this._flush(),this._append(e,this._sourcePosition,t)}appendChar(e){this._flush(),this._appendChar(e,1,this._sourcePosition)}queue(e){if(10===e)for(;0!==this._queueCursor;){const e=this._queue[this._queueCursor-1].char;if(32!==e&&9!==e)break;this._queueCursor--}const t=this._sourcePosition;this._pushQueue(e,1,t.line,t.column,t.filename)}queueIndentation(e,t){this._pushQueue(e,t,void 0,void 0,void 0)}_flush(){const e=this._queueCursor,t=this._queue;for(let r=0;r<e;r++){const e=t[r];this._appendChar(e.char,e.repeat,e)}this._queueCursor=0}_appendChar(e,t,r){this._last=e,this._str+=t>1?String.fromCharCode(e).repeat(t):String.fromCharCode(e),10!==e?(this._mark(r.line,r.column,r.identifierName,r.identifierNamePos,r.filename),this._position.column+=t):(this._position.line++,this._position.column=0),this._canMarkIdName&&(r.identifierName=void 0,r.identifierNamePos=void 0)}_append(e,t,r){const s=e.length,i=this._position;if(this._last=e.charCodeAt(s-1),++this._appendCount>4096?(this._str,this._buf+=this._str,this._str=e,this._appendCount=0):this._str+=e,!r&&!this._map)return void(i.column+=s);const{column:n,identifierName:a,identifierNamePos:o,filename:l}=t;let c=t.line;null==a&&null==o||!this._canMarkIdName||(t.identifierName=void 0,t.identifierNamePos=void 0);let p=e.indexOf("\n"),u=0;for(0!==p&&this._mark(c,n,a,o,l);-1!==p;)i.line++,i.column=0,u=p+1,u<s&&void 0!==c&&this._mark(++c,0,null,null,l),p=e.indexOf("\n",u);i.column+=s-u}_mark(e,t,r,s,i){var n;null==(n=this._map)||n.mark(this._position,e,t,r,s,i)}removeTrailingNewline(){const e=this._queueCursor;0!==e&&10===this._queue[e-1].char&&this._queueCursor--}removeLastSemicolon(){const e=this._queueCursor;0!==e&&59===this._queue[e-1].char&&this._queueCursor--}getLastChar(){const e=this._queueCursor;return 0!==e?this._queue[e-1].char:this._last}getNewlineCount(){const e=this._queueCursor;let t=0;if(0===e)return 10===this._last?1:0;for(let r=e-1;r>=0&&10===this._queue[r].char;r--)t++;return t===e&&10===this._last?t+1:t}endsWithCharAndNewline(){const e=this._queue,t=this._queueCursor;if(0!==t){if(10!==e[t-1].char)return;return t>1?e[t-2].char:this._last}}hasContent(){return 0!==this._queueCursor||!!this._last}exactSource(e,t){if(!this._map)return void t();this.source("start",e);const r=e.identifierName,s=this._sourcePosition;r&&(this._canMarkIdName=!1,s.identifierName=r),t(),r&&(this._canMarkIdName=!0,s.identifierName=void 0,s.identifierNamePos=void 0),this.source("end",e)}source(e,t){this._map&&this._normalizePosition(e,t,0)}sourceWithOffset(e,t,r){this._map&&this._normalizePosition(e,t,r)}withSource(e,t,r){this._map&&this.source(e,t),r()}_normalizePosition(e,t,r){const s=t[e],i=this._sourcePosition;s&&(i.line=s.line,i.column=Math.max(s.column+r,0),i.filename=t.filename)}getCurrentColumn(){const e=this._queue,t=this._queueCursor;let r=-1,s=0;for(let i=0;i<t;i++){const t=e[i];10===t.char&&(r=s),s+=t.repeat}return-1===r?this._position.column+s:s-1-r}getCurrentLine(){let e=0;const t=this._queue;for(let r=0;r<this._queueCursor;r++)10===t[r].char&&e++;return this._position.line+e}}},45406:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockStatement=function(e){var t;this.tokenChar(123);const r=null==(t=e.directives)?void 0:t.length;if(r){var s;const t=e.body.length?2:1;this.printSequence(e.directives,e,{indent:!0,trailingCommentsLineOffset:t}),null!=(s=e.directives[r-1].trailingComments)&&s.length||this.newline(t)}this.printSequence(e.body,e,{indent:!0}),this.rightBrace(e)},t.Directive=function(e){this.print(e.value,e),this.semicolon()},t.DirectiveLiteral=function(e){const t=this.getPossibleRaw(e);if(!this.format.minified&&void 0!==t)return void this.token(t);const{value:i}=e;if(s.test(i)){if(r.test(i))throw new Error("Malformed AST: it is not possible to print a directive containing both unescaped single and double quotes.");this.token(`'${i}'`)}else this.token(`"${i}"`)},t.File=function(e){e.program&&this.print(e.program.interpreter,e),this.print(e.program,e)},t.InterpreterDirective=function(e){this.token(`#!${e.value}`),this.newline(1,!0)},t.Placeholder=function(e){this.token("%%"),this.print(e.name),this.token("%%"),"Statement"===e.expectedNode&&this.semicolon()},t.Program=function(e){var t;this.noIndentInnerCommentsHere(),this.printInnerComments();const r=null==(t=e.directives)?void 0:t.length;if(r){var s;const t=e.body.length?2:1;this.printSequence(e.directives,e,{trailingCommentsLineOffset:t}),null!=(s=e.directives[r-1].trailingComments)&&s.length||this.newline(t)}this.printSequence(e.body,e)};const r=/(?:^|[^\\])(?:\\\\)*'/,s=/(?:^|[^\\])(?:\\\\)*"/},60315:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClassAccessorProperty=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),this.word("accessor",!0),this.space(),e.computed?(this.tokenChar(91),this.print(e.key,e),this.tokenChar(93)):(this._variance(e),this.print(e.key,e)),e.optional&&this.tokenChar(63),e.definite&&this.tokenChar(33),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.ClassBody=function(e){this.tokenChar(123),0===e.body.length?this.tokenChar(125):(this.newline(),this.printSequence(e.body,e,{indent:!0}),this.endsWith(10)||this.newline(),this.rightBrace(e))},t.ClassExpression=t.ClassDeclaration=function(e,t){(i(t)||n(t))&&this._shouldPrintDecoratorsBeforeExport(t)||this.printJoin(e.decorators,e),e.declare&&(this.word("declare"),this.space()),e.abstract&&(this.word("abstract"),this.space()),this.word("class"),e.id&&(this.space(),this.print(e.id,e)),this.print(e.typeParameters,e),e.superClass&&(this.space(),this.word("extends"),this.space(),this.print(e.superClass,e),this.print(e.superTypeParameters,e)),e.implements&&(this.space(),this.word("implements"),this.space(),this.printList(e.implements,e)),this.space(),this.print(e.body,e)},t.ClassMethod=function(e){this._classMethodHead(e),this.space(),this.print(e.body,e)},t.ClassPrivateMethod=function(e){this._classMethodHead(e),this.space(),this.print(e.body,e)},t.ClassPrivateProperty=function(e){this.printJoin(e.decorators,e),e.static&&(this.word("static"),this.space()),this.print(e.key,e),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.ClassProperty=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),e.computed?(this.tokenChar(91),this.print(e.key,e),this.tokenChar(93)):(this._variance(e),this.print(e.key,e)),e.optional&&this.tokenChar(63),e.definite&&this.tokenChar(33),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.StaticBlock=function(e){this.word("static"),this.space(),this.tokenChar(123),0===e.body.length?this.tokenChar(125):(this.newline(),this.printSequence(e.body,e,{indent:!0}),this.rightBrace(e))},t._classMethodHead=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),this._methodHead(e)};var s=r(81483);const{isExportDefaultDeclaration:i,isExportNamedDeclaration:n}=s},59853:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogicalExpression=t.BinaryExpression=t.AssignmentExpression=function(e,t){const r=this.inForStatementInitCounter&&"in"===e.operator&&!i.needsParens(e,t);r&&this.tokenChar(40),this.print(e.left,e),this.space(),"in"===e.operator||"instanceof"===e.operator?this.word(e.operator):this.token(e.operator),this.space(),this.print(e.right,e),r&&this.tokenChar(41)},t.AssignmentPattern=function(e){this.print(e.left,e),e.left.optional&&this.tokenChar(63),this.print(e.left.typeAnnotation,e),this.space(),this.tokenChar(61),this.space(),this.print(e.right,e)},t.AwaitExpression=function(e){this.word("await"),e.argument&&(this.space(),this.printTerminatorless(e.argument,e,!1))},t.BindExpression=function(e){this.print(e.object,e),this.token("::"),this.print(e.callee,e)},t.CallExpression=function(e){this.print(e.callee,e),this.print(e.typeArguments,e),this.print(e.typeParameters,e),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e)},t.ConditionalExpression=function(e){this.print(e.test,e),this.space(),this.tokenChar(63),this.space(),this.print(e.consequent,e),this.space(),this.tokenChar(58),this.space(),this.print(e.alternate,e)},t.Decorator=function(e){this.tokenChar(64);const{expression:t}=e;!function(e){return"ParenthesizedExpression"!==e.type&&!c("CallExpression"===e.type?e.callee:e)}(t)?this.print(t,e):(this.tokenChar(40),this.print(t,e),this.tokenChar(41)),this.newline()},t.DoExpression=function(e){e.async&&(this.word("async",!0),this.space()),this.word("do"),this.space(),this.print(e.body,e)},t.EmptyStatement=function(){this.semicolon(!0)},t.ExpressionStatement=function(e){this.print(e.expression,e),this.semicolon()},t.Import=function(){this.word("import")},t.MemberExpression=function(e){if(this.print(e.object,e),!e.computed&&o(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");let t=e.computed;a(e.property)&&"number"==typeof e.property.value&&(t=!0),t?(this.tokenChar(91),this.print(e.property,e),this.tokenChar(93)):(this.tokenChar(46),this.print(e.property,e))},t.MetaProperty=function(e){this.print(e.meta,e),this.tokenChar(46),this.print(e.property,e)},t.ModuleExpression=function(e){this.word("module",!0),this.space(),this.tokenChar(123),this.indent();const{body:t}=e;(t.body.length||t.directives.length)&&this.newline(),this.print(t,e),this.dedent(),this.rightBrace(e)},t.NewExpression=function(e,t){this.word("new"),this.space(),this.print(e.callee,e),(!this.format.minified||0!==e.arguments.length||e.optional||n(t,{callee:e})||o(t)||l(t))&&(this.print(e.typeArguments,e),this.print(e.typeParameters,e),e.optional&&this.token("?."),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e))},t.OptionalCallExpression=function(e){this.print(e.callee,e),this.print(e.typeParameters,e),e.optional&&this.token("?."),this.print(e.typeArguments,e),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e)},t.OptionalMemberExpression=function(e){let{computed:t}=e;const{optional:r,property:s}=e;if(this.print(e.object,e),!t&&o(s))throw new TypeError("Got a MemberExpression for MemberExpression property");a(s)&&"number"==typeof s.value&&(t=!0),r&&this.token("?."),t?(this.tokenChar(91),this.print(s,e),this.tokenChar(93)):(r||this.tokenChar(46),this.print(s,e))},t.ParenthesizedExpression=function(e){this.tokenChar(40),this.print(e.expression,e),this.rightParens(e)},t.PrivateName=function(e){this.tokenChar(35),this.print(e.id,e)},t.SequenceExpression=function(e){this.printList(e.expressions,e)},t.Super=function(){this.word("super")},t.ThisExpression=function(){this.word("this")},t.UnaryExpression=function(e){const{operator:t}=e;"void"===t||"delete"===t||"typeof"===t||"throw"===t?(this.word(t),this.space()):this.token(t),this.print(e.argument,e)},t.UpdateExpression=function(e){e.prefix?(this.token(e.operator),this.print(e.argument,e)):(this.printTerminatorless(e.argument,e,!0),this.token(e.operator))},t.V8IntrinsicIdentifier=function(e){this.tokenChar(37),this.word(e.name)},t.YieldExpression=function(e){this.word("yield",!0),e.delegate?(this.tokenChar(42),e.argument&&(this.space(),this.print(e.argument,e))):e.argument&&(this.space(),this.printTerminatorless(e.argument,e,!1))},t._shouldPrintDecoratorsBeforeExport=function(e){return"boolean"==typeof this.format.decoratorsBeforeExport?this.format.decoratorsBeforeExport:"number"==typeof e.start&&e.start===e.declaration.start};var s=r(81483),i=r(92505);const{isCallExpression:n,isLiteral:a,isMemberExpression:o,isNewExpression:l}=s;function c(e){switch(e.type){case"Identifier":return!0;case"MemberExpression":return!e.computed&&"Identifier"===e.property.type&&c(e.object);default:return!1}}},97900:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnyTypeAnnotation=function(){this.word("any")},t.ArrayTypeAnnotation=function(e){this.print(e.elementType,e,!0),this.tokenChar(91),this.tokenChar(93)},t.BooleanLiteralTypeAnnotation=function(e){this.word(e.value?"true":"false")},t.BooleanTypeAnnotation=function(){this.word("boolean")},t.DeclareClass=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("class"),this.space(),this._interfaceish(e)},t.DeclareExportAllDeclaration=function(e){this.word("declare"),this.space(),i.ExportAllDeclaration.call(this,e)},t.DeclareExportDeclaration=function(e){this.word("declare"),this.space(),this.word("export"),this.space(),e.default&&(this.word("default"),this.space()),u.call(this,e)},t.DeclareFunction=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("function"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation.typeAnnotation,e),e.predicate&&(this.space(),this.print(e.predicate,e)),this.semicolon()},t.DeclareInterface=function(e){this.word("declare"),this.space(),this.InterfaceDeclaration(e)},t.DeclareModule=function(e){this.word("declare"),this.space(),this.word("module"),this.space(),this.print(e.id,e),this.space(),this.print(e.body,e)},t.DeclareModuleExports=function(e){this.word("declare"),this.space(),this.word("module"),this.tokenChar(46),this.word("exports"),this.print(e.typeAnnotation,e)},t.DeclareOpaqueType=function(e,t){a(t)||(this.word("declare"),this.space()),this.OpaqueType(e)},t.DeclareTypeAlias=function(e){this.word("declare"),this.space(),this.TypeAlias(e)},t.DeclareVariable=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("var"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation,e),this.semicolon()},t.DeclaredPredicate=function(e){this.tokenChar(37),this.word("checks"),this.tokenChar(40),this.print(e.value,e),this.tokenChar(41)},t.EmptyTypeAnnotation=function(){this.word("empty")},t.EnumBooleanBody=function(e){const{explicitType:t}=e;l(this,"boolean",t),c(this,e)},t.EnumBooleanMember=function(e){p(this,e)},t.EnumDeclaration=function(e){const{id:t,body:r}=e;this.word("enum"),this.space(),this.print(t,e),this.print(r,e)},t.EnumDefaultedMember=function(e){const{id:t}=e;this.print(t,e),this.tokenChar(44)},t.EnumNumberBody=function(e){const{explicitType:t}=e;l(this,"number",t),c(this,e)},t.EnumNumberMember=function(e){p(this,e)},t.EnumStringBody=function(e){const{explicitType:t}=e;l(this,"string",t),c(this,e)},t.EnumStringMember=function(e){p(this,e)},t.EnumSymbolBody=function(e){l(this,"symbol",!0),c(this,e)},t.ExistsTypeAnnotation=function(){this.tokenChar(42)},t.FunctionTypeAnnotation=function(e,t){this.print(e.typeParameters,e),this.tokenChar(40),e.this&&(this.word("this"),this.tokenChar(58),this.space(),this.print(e.this.typeAnnotation,e),(e.params.length||e.rest)&&(this.tokenChar(44),this.space())),this.printList(e.params,e),e.rest&&(e.params.length&&(this.tokenChar(44),this.space()),this.token("..."),this.print(e.rest,e)),this.tokenChar(41);const r=null==t?void 0:t.type;null!=r&&("ObjectTypeCallProperty"===r||"ObjectTypeInternalSlot"===r||"DeclareFunction"===r||"ObjectTypeProperty"===r&&t.method)?this.tokenChar(58):(this.space(),this.token("=>")),this.space(),this.print(e.returnType,e)},t.FunctionTypeParam=function(e){this.print(e.name,e),e.optional&&this.tokenChar(63),e.name&&(this.tokenChar(58),this.space()),this.print(e.typeAnnotation,e)},t.IndexedAccessType=function(e){this.print(e.objectType,e,!0),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.InferredPredicate=function(){this.tokenChar(37),this.word("checks")},t.InterfaceDeclaration=function(e){this.word("interface"),this.space(),this._interfaceish(e)},t.GenericTypeAnnotation=t.ClassImplements=t.InterfaceExtends=function(e){this.print(e.id,e),this.print(e.typeParameters,e,!0)},t.InterfaceTypeAnnotation=function(e){var t;this.word("interface"),null!=(t=e.extends)&&t.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),this.space(),this.print(e.body,e)},t.IntersectionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:h})},t.MixedTypeAnnotation=function(){this.word("mixed")},t.NullLiteralTypeAnnotation=function(){this.word("null")},t.NullableTypeAnnotation=function(e){this.tokenChar(63),this.print(e.typeAnnotation,e)},Object.defineProperty(t,"NumberLiteralTypeAnnotation",{enumerable:!0,get:function(){return n.NumericLiteral}}),t.NumberTypeAnnotation=function(){this.word("number")},t.ObjectTypeAnnotation=function(e){e.exact?this.token("{|"):this.tokenChar(123);const t=[...e.properties,...e.callProperties||[],...e.indexers||[],...e.internalSlots||[]];t.length&&(this.newline(),this.space(),this.printJoin(t,e,{addNewlines(e){if(e&&!t[0])return 1},indent:!0,statement:!0,iterator:()=>{(1!==t.length||e.inexact)&&(this.tokenChar(44),this.space())}}),this.space()),e.inexact&&(this.indent(),this.token("..."),t.length&&this.newline(),this.dedent()),e.exact?this.token("|}"):this.tokenChar(125)},t.ObjectTypeCallProperty=function(e){e.static&&(this.word("static"),this.space()),this.print(e.value,e)},t.ObjectTypeIndexer=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.tokenChar(91),e.id&&(this.print(e.id,e),this.tokenChar(58),this.space()),this.print(e.key,e),this.tokenChar(93),this.tokenChar(58),this.space(),this.print(e.value,e)},t.ObjectTypeInternalSlot=function(e){e.static&&(this.word("static"),this.space()),this.tokenChar(91),this.tokenChar(91),this.print(e.id,e),this.tokenChar(93),this.tokenChar(93),e.optional&&this.tokenChar(63),e.method||(this.tokenChar(58),this.space()),this.print(e.value,e)},t.ObjectTypeProperty=function(e){e.proto&&(this.word("proto"),this.space()),e.static&&(this.word("static"),this.space()),"get"!==e.kind&&"set"!==e.kind||(this.word(e.kind),this.space()),this._variance(e),this.print(e.key,e),e.optional&&this.tokenChar(63),e.method||(this.tokenChar(58),this.space()),this.print(e.value,e)},t.ObjectTypeSpreadProperty=function(e){this.token("..."),this.print(e.argument,e)},t.OpaqueType=function(e){this.word("opaque"),this.space(),this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),e.supertype&&(this.tokenChar(58),this.space(),this.print(e.supertype,e)),e.impltype&&(this.space(),this.tokenChar(61),this.space(),this.print(e.impltype,e)),this.semicolon()},t.OptionalIndexedAccessType=function(e){this.print(e.objectType,e),e.optional&&this.token("?."),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.QualifiedTypeIdentifier=function(e){this.print(e.qualification,e),this.tokenChar(46),this.print(e.id,e)},Object.defineProperty(t,"StringLiteralTypeAnnotation",{enumerable:!0,get:function(){return n.StringLiteral}}),t.StringTypeAnnotation=function(){this.word("string")},t.SymbolTypeAnnotation=function(){this.word("symbol")},t.ThisTypeAnnotation=function(){this.word("this")},t.TupleTypeAnnotation=function(e){this.tokenChar(91),this.printList(e.types,e),this.tokenChar(93)},t.TypeAlias=function(e){this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),this.space(),this.tokenChar(61),this.space(),this.print(e.right,e),this.semicolon()},t.TypeAnnotation=function(e){this.tokenChar(58),this.space(),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t.TypeCastExpression=function(e){this.tokenChar(40),this.print(e.expression,e),this.print(e.typeAnnotation,e),this.tokenChar(41)},t.TypeParameter=function(e){this._variance(e),this.word(e.name),e.bound&&this.print(e.bound,e),e.default&&(this.space(),this.tokenChar(61),this.space(),this.print(e.default,e))},t.TypeParameterDeclaration=t.TypeParameterInstantiation=function(e){this.tokenChar(60),this.printList(e.params,e,{}),this.tokenChar(62)},t.TypeofTypeAnnotation=function(e){this.word("typeof"),this.space(),this.print(e.argument,e)},t.UnionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:d})},t.Variance=function(e){"plus"===e.kind?this.tokenChar(43):this.tokenChar(45)},t.VoidTypeAnnotation=function(){this.word("void")},t._interfaceish=function(e){var t,r,s;(this.print(e.id,e),this.print(e.typeParameters,e),null!=(t=e.extends)&&t.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),"DeclareClass"===e.type)&&(null!=(r=e.mixins)&&r.length&&(this.space(),this.word("mixins"),this.space(),this.printList(e.mixins,e)),null!=(s=e.implements)&&s.length&&(this.space(),this.word("implements"),this.space(),this.printList(e.implements,e)));this.space(),this.print(e.body,e)},t._variance=function(e){var t;const r=null==(t=e.variance)?void 0:t.kind;null!=r&&("plus"===r?this.tokenChar(43):"minus"===r&&this.tokenChar(45))};var s=r(81483),i=r(86019),n=r(40062);const{isDeclareExportDeclaration:a,isStatement:o}=s;function l(e,t,r){r&&(e.space(),e.word("of"),e.space(),e.word(t)),e.space()}function c(e,t){const{members:r}=t;e.token("{"),e.indent(),e.newline();for(const s of r)e.print(s,t),e.newline();t.hasUnknownMembers&&(e.token("..."),e.newline()),e.dedent(),e.token("}")}function p(e,t){const{id:r,init:s}=t;e.print(r,t),e.space(),e.token("="),e.space(),e.print(s,t),e.token(",")}function u(e){if(e.declaration){const t=e.declaration;this.print(t,e),o(t)||this.semicolon()}else this.tokenChar(123),e.specifiers.length&&(this.space(),this.printList(e.specifiers,e),this.space()),this.tokenChar(125),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}function h(){this.space(),this.tokenChar(38),this.space()}function d(){this.space(),this.tokenChar(124),this.space()}},87817:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=r(36644);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var i=r(59853);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));var n=r(14679);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===n[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}}))}));var a=r(60315);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=r(58588);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var l=r(86019);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===l[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}}))}));var c=r(40062);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===c[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}}))}));var p=r(97900);Object.keys(p).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===p[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}}))}));var u=r(45406);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}));var h=r(68136);Object.keys(h).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===h[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return h[e]}}))}));var d=r(6704);Object.keys(d).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===d[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}}))}))},68136:(e,t)=>{"use strict";function r(){this.space()}Object.defineProperty(t,"__esModule",{value:!0}),t.JSXAttribute=function(e){this.print(e.name,e),e.value&&(this.tokenChar(61),this.print(e.value,e))},t.JSXClosingElement=function(e){this.token("</"),this.print(e.name,e),this.tokenChar(62)},t.JSXClosingFragment=function(){this.token("</"),this.tokenChar(62)},t.JSXElement=function(e){const t=e.openingElement;if(this.print(t,e),!t.selfClosing){this.indent();for(const t of e.children)this.print(t,e);this.dedent(),this.print(e.closingElement,e)}},t.JSXEmptyExpression=function(){this.printInnerComments()},t.JSXExpressionContainer=function(e){this.tokenChar(123),this.print(e.expression,e),this.tokenChar(125)},t.JSXFragment=function(e){this.print(e.openingFragment,e),this.indent();for(const t of e.children)this.print(t,e);this.dedent(),this.print(e.closingFragment,e)},t.JSXIdentifier=function(e){this.word(e.name)},t.JSXMemberExpression=function(e){this.print(e.object,e),this.tokenChar(46),this.print(e.property,e)},t.JSXNamespacedName=function(e){this.print(e.namespace,e),this.tokenChar(58),this.print(e.name,e)},t.JSXOpeningElement=function(e){this.tokenChar(60),this.print(e.name,e),this.print(e.typeParameters,e),e.attributes.length>0&&(this.space(),this.printJoin(e.attributes,e,{separator:r})),e.selfClosing?(this.space(),this.token("/>")):this.tokenChar(62)},t.JSXOpeningFragment=function(){this.tokenChar(60),this.tokenChar(62)},t.JSXSpreadAttribute=function(e){this.tokenChar(123),this.token("..."),this.print(e.argument,e),this.tokenChar(125)},t.JSXSpreadChild=function(e){this.tokenChar(123),this.token("..."),this.print(e.expression,e),this.tokenChar(125)},t.JSXText=function(e){const t=this.getPossibleRaw(e);void 0!==t?this.token(t,!0):this.token(e.value,!0)}},58588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowFunctionExpression=function(e,t){let r;e.async&&(this.word("async",!0),this.space()),this.format.retainLines||1!==e.params.length||!i(r=e.params[0])||function(e,t){var r,s;return!!(e.typeParameters||e.returnType||e.predicate||t.typeAnnotation||t.optional||null!=(r=t.leadingComments)&&r.length||null!=(s=t.trailingComments)&&s.length)}(e,r)?this._params(e,void 0,t):this.print(r,e,!0),this._predicate(e,!0),this.space(),this.printInnerComments(),this.token("=>"),this.space(),this.print(e.body,e)},t.FunctionDeclaration=t.FunctionExpression=function(e,t){this._functionHead(e,t),this.space(),this.print(e.body,e)},t._functionHead=function(e,t){e.async&&(this.word("async"),this._endsWithInnerRaw=!1,this.space()),this.word("function"),e.generator&&(this._endsWithInnerRaw=!1,this.tokenChar(42)),this.space(),e.id&&this.print(e.id,e),this._params(e,e.id,t),"TSDeclareFunction"!==e.type&&this._predicate(e)},t._methodHead=function(e){const t=e.kind,r=e.key;"get"!==t&&"set"!==t||(this.word(t),this.space()),e.async&&(this.word("async",!0),this.space()),"method"!==t&&"init"!==t||e.generator&&this.tokenChar(42),e.computed?(this.tokenChar(91),this.print(r,e),this.tokenChar(93)):this.print(r,e),e.optional&&this.tokenChar(63),this._params(e,e.computed&&"StringLiteral"!==e.key.type?void 0:e.key,void 0)},t._param=function(e,t){this.printJoin(e.decorators,e),this.print(e,t),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t._parameters=function(e,t){const r=e.length;for(let s=0;s<r;s++)this._param(e[s],t),s<e.length-1&&(this.tokenChar(44),this.space())},t._params=function(e,t,r){this.print(e.typeParameters,e);const s=n.call(this,t,r);s&&this.sourceIdentifierName(s.name,s.pos),this.tokenChar(40),this._parameters(e.params,e),this.tokenChar(41);const i="ArrowFunctionExpression"===e.type;this.print(e.returnType,e,i),this._noLineTerminator=i},t._predicate=function(e,t){e.predicate&&(e.returnType||this.tokenChar(58),this.space(),this.print(e.predicate,e,t))};var s=r(81483);const{isIdentifier:i}=s;function n(e,t){let r,s=e;if(!s&&t){const e=t.type;"VariableDeclarator"===e?s=t.id:"AssignmentExpression"===e||"AssignmentPattern"===e?s=t.left:"ObjectProperty"===e||"ClassProperty"===e?t.computed&&"StringLiteral"!==t.key.type||(s=t.key):"ClassPrivateProperty"!==e&&"ClassAccessorProperty"!==e||(s=t.key)}if(s){var i,n;if("Identifier"===s.type)r={pos:null==(i=s.loc)?void 0:i.start,name:(null==(n=s.loc)?void 0:n.identifierName)||s.name};else if("PrivateName"===s.type){var a;r={pos:null==(a=s.loc)?void 0:a.start,name:"#"+s.id.name}}else if("StringLiteral"===s.type){var o;r={pos:null==(o=s.loc)?void 0:o.start,name:s.value}}return r}}},86019:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExportAllDeclaration=function(e){var t,r;this.word("export"),this.space(),"type"===e.exportKind&&(this.word("type"),this.space()),this.tokenChar(42),this.space(),this.word("from"),this.space(),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e),this.semicolon()},t.ExportDefaultDeclaration=function(e){u(this,e),this.word("export"),this.noIndentInnerCommentsHere(),this.space(),this.word("default"),this.space();const t=e.declaration;this.print(t,e),c(t)||this.semicolon()},t.ExportDefaultSpecifier=function(e){this.print(e.exported,e)},t.ExportNamedDeclaration=function(e){if(u(this,e),this.word("export"),this.space(),e.declaration){const t=e.declaration;this.print(t,e),c(t)||this.semicolon()}else{"type"===e.exportKind&&(this.word("type"),this.space());const s=e.specifiers.slice(0);let i=!1;for(;;){const t=s[0];if(!n(t)&&!a(t))break;i=!0,this.print(s.shift(),e),s.length&&(this.tokenChar(44),this.space())}var t,r;(s.length||!s.length&&!i)&&(this.tokenChar(123),s.length&&(this.space(),this.printList(s,e),this.space()),this.tokenChar(125)),e.source&&(this.space(),this.word("from"),this.space(),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e)),this.semicolon()}},t.ExportNamespaceSpecifier=function(e){this.tokenChar(42),this.space(),this.word("as"),this.space(),this.print(e.exported,e)},t.ExportSpecifier=function(e){"type"===e.exportKind&&(this.word("type"),this.space()),this.print(e.local,e),e.exported&&e.local.name!==e.exported.name&&(this.space(),this.word("as"),this.space(),this.print(e.exported,e))},t.ImportAttribute=function(e){this.print(e.key),this.tokenChar(58),this.space(),this.print(e.value)},t.ImportDeclaration=function(e){var t,r;this.word("import"),this.space();const s="type"===e.importKind||"typeof"===e.importKind;s?(this.noIndentInnerCommentsHere(),this.word(e.importKind),this.space()):e.module&&(this.noIndentInnerCommentsHere(),this.word("module"),this.space());const i=e.specifiers.slice(0),n=!!i.length;for(;n;){const t=i[0];if(!o(t)&&!l(t))break;this.print(i.shift(),e),i.length&&(this.tokenChar(44),this.space())}i.length?(this.tokenChar(123),this.space(),this.printList(i,e),this.space(),this.tokenChar(125)):s&&!n&&(this.tokenChar(123),this.tokenChar(125)),(n||s)&&(this.space(),this.word("from"),this.space()),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e),this.semicolon()},t.ImportDefaultSpecifier=function(e){this.print(e.local,e)},t.ImportNamespaceSpecifier=function(e){this.tokenChar(42),this.space(),this.word("as"),this.space(),this.print(e.local,e)},t.ImportSpecifier=function(e){"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space()),this.print(e.imported,e),e.local&&e.local.name!==e.imported.name&&(this.space(),this.word("as"),this.space(),this.print(e.local,e))},t._printAttributes=function(e){const{importAttributesKeyword:t}=this.format,{attributes:r,assertions:s}=e;!r||t||p||(p=!0,console.warn('You are using import attributes, without specifying the desired output syntax.\nPlease specify the "importAttributesKeyword" generator option, whose value can be one of:\n - "with" : `import { a } from "b" with { type: "json" };`\n - "assert" : `import { a } from "b" assert { type: "json" };`\n - "with-legacy" : `import { a } from "b" with type: "json";`\n'));const i="assert"===t||!t&&s;this.word(i?"assert":"with"),this.space(),i||"with"===t?(this.tokenChar(123),this.space(),this.printList(r||s,e),this.space(),this.tokenChar(125)):this.printList(r||s,e)};var s=r(81483);const{isClassDeclaration:i,isExportDefaultSpecifier:n,isExportNamespaceSpecifier:a,isImportDefaultSpecifier:o,isImportNamespaceSpecifier:l,isStatement:c}=s;let p=!1;function u(e,t){i(t.declaration)&&e._shouldPrintDecoratorsBeforeExport(t)&&e.printJoin(t.declaration.decorators,t)}},14679:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BreakStatement=function(e){this.word("break"),h(this,e.label,e,!0)},t.CatchClause=function(e){this.word("catch"),this.space(),e.param&&(this.tokenChar(40),this.print(e.param,e),this.print(e.param.typeAnnotation,e),this.tokenChar(41),this.space()),this.print(e.body,e)},t.ContinueStatement=function(e){this.word("continue"),h(this,e.label,e,!0)},t.DebuggerStatement=function(){this.word("debugger"),this.semicolon()},t.DoWhileStatement=function(e){this.word("do"),this.space(),this.print(e.body,e),this.space(),this.word("while"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.semicolon()},t.ForOfStatement=t.ForInStatement=void 0,t.ForStatement=function(e){this.word("for"),this.space(),this.tokenChar(40),this.inForStatementInitCounter++,this.print(e.init,e),this.inForStatementInitCounter--,this.tokenChar(59),e.test&&(this.space(),this.print(e.test,e)),this.tokenChar(59),e.update&&(this.space(),this.print(e.update,e)),this.tokenChar(41),this.printBlock(e)},t.IfStatement=function(e){this.word("if"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.space();const t=e.alternate&&a(l(e.consequent));t&&(this.tokenChar(123),this.newline(),this.indent()),this.printAndIndentOnComments(e.consequent,e),t&&(this.dedent(),this.newline(),this.tokenChar(125)),e.alternate&&(this.endsWith(125)&&this.space(),this.word("else"),this.space(),this.printAndIndentOnComments(e.alternate,e))},t.LabeledStatement=function(e){this.print(e.label,e),this.tokenChar(58),this.space(),this.print(e.body,e)},t.ReturnStatement=function(e){this.word("return"),h(this,e.argument,e,!1)},t.SwitchCase=function(e){e.test?(this.word("case"),this.space(),this.print(e.test,e),this.tokenChar(58)):(this.word("default"),this.tokenChar(58)),e.consequent.length&&(this.newline(),this.printSequence(e.consequent,e,{indent:!0}))},t.SwitchStatement=function(e){this.word("switch"),this.space(),this.tokenChar(40),this.print(e.discriminant,e),this.tokenChar(41),this.space(),this.tokenChar(123),this.printSequence(e.cases,e,{indent:!0,addNewlines(t,r){if(!t&&e.cases[e.cases.length-1]===r)return-1}}),this.rightBrace(e)},t.ThrowStatement=function(e){this.word("throw"),h(this,e.argument,e,!1)},t.TryStatement=function(e){this.word("try"),this.space(),this.print(e.block,e),this.space(),e.handlers?this.print(e.handlers[0],e):this.print(e.handler,e),e.finalizer&&(this.space(),this.word("finally"),this.space(),this.print(e.finalizer,e))},t.VariableDeclaration=function(e,t){e.declare&&(this.word("declare"),this.space());const{kind:r}=e;this.word(r,"using"===r||"await using"===r),this.space();let s=!1;if(!i(t))for(const t of e.declarations)t.init&&(s=!0);if(this.printList(e.declarations,e,{separator:s?function(){this.tokenChar(44),this.newline()}:void 0,indent:e.declarations.length>1}),i(t))if(n(t)){if(t.init===e)return}else if(t.left===e)return;this.semicolon()},t.VariableDeclarator=function(e){this.print(e.id,e),e.definite&&this.tokenChar(33),this.print(e.id.typeAnnotation,e),e.init&&(this.space(),this.tokenChar(61),this.space(),this.print(e.init,e))},t.WhileStatement=function(e){this.word("while"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.printBlock(e)},t.WithStatement=function(e){this.word("with"),this.space(),this.tokenChar(40),this.print(e.object,e),this.tokenChar(41),this.printBlock(e)};var s=r(81483);const{isFor:i,isForStatement:n,isIfStatement:a,isStatement:o}=s;function l(e){const{body:t}=e;return!1===o(t)?e:l(t)}function c(e){this.word("for"),this.space();const t="ForOfStatement"===e.type;t&&e.await&&(this.word("await"),this.space()),this.noIndentInnerCommentsHere(),this.tokenChar(40),this.print(e.left,e),this.space(),this.word(t?"of":"in"),this.space(),this.print(e.right,e),this.tokenChar(41),this.printBlock(e)}const p=c;t.ForInStatement=p;const u=c;function h(e,t,r,s){t&&(e.space(),e.printTerminatorless(t,r,s)),e.semicolon()}t.ForOfStatement=u},36644:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaggedTemplateExpression=function(e){this.print(e.tag,e),this.print(e.typeParameters,e),this.print(e.quasi,e)},t.TemplateElement=function(e,t){const r=t.quasis[0]===e,s=t.quasis[t.quasis.length-1]===e,i=(r?"`":"}")+e.value.raw+(s?"`":"${");this.token(i,!0)},t.TemplateLiteral=function(e){const t=e.quasis;for(let r=0;r<t.length;r++)this.print(t[r],e),r+1<t.length&&this.print(e.expressions[r],e)}},40062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentPlaceholder=function(){this.tokenChar(63)},t.ArrayPattern=t.ArrayExpression=function(e){const t=e.elements,r=t.length;this.tokenChar(91);for(let s=0;s<t.length;s++){const i=t[s];i?(s>0&&this.space(),this.print(i,e),s<r-1&&this.tokenChar(44)):this.tokenChar(44)}this.tokenChar(93)},t.BigIntLiteral=function(e){const t=this.getPossibleRaw(e);this.format.minified||void 0===t?this.word(e.value+"n"):this.word(t)},t.BooleanLiteral=function(e){this.word(e.value?"true":"false")},t.DecimalLiteral=function(e){const t=this.getPossibleRaw(e);this.format.minified||void 0===t?this.word(e.value+"m"):this.word(t)},t.Identifier=function(e){var t;this.sourceIdentifierName((null==(t=e.loc)?void 0:t.identifierName)||e.name),this.word(e.name)},t.NullLiteral=function(){this.word("null")},t.NumericLiteral=function(e){const t=this.getPossibleRaw(e),r=this.format.jsescOption,s=e.value+"";r.numbers?this.number(i(e.value,r)):null==t?this.number(s):this.format.minified?this.number(t.length<s.length?t:s):this.number(t)},t.ObjectPattern=t.ObjectExpression=function(e){const t=e.properties;this.tokenChar(123),t.length&&(this.space(),this.printList(t,e,{indent:!0,statement:!0}),this.space()),this.sourceWithOffset("end",e.loc,-1),this.tokenChar(125)},t.ObjectMethod=function(e){this.printJoin(e.decorators,e),this._methodHead(e),this.space(),this.print(e.body,e)},t.ObjectProperty=function(e){if(this.printJoin(e.decorators,e),e.computed)this.tokenChar(91),this.print(e.key,e),this.tokenChar(93);else{if(n(e.value)&&a(e.key)&&e.key.name===e.value.left.name)return void this.print(e.value,e);if(this.print(e.key,e),e.shorthand&&a(e.key)&&a(e.value)&&e.key.name===e.value.name)return}this.tokenChar(58),this.space(),this.print(e.value,e)},t.PipelineBareFunction=function(e){this.print(e.callee,e)},t.PipelinePrimaryTopicReference=function(){this.tokenChar(35)},t.PipelineTopicExpression=function(e){this.print(e.expression,e)},t.RecordExpression=function(e){const t=e.properties;let r,s;if("bar"===this.format.recordAndTupleSyntaxType)r="{|",s="|}";else{if("hash"!==this.format.recordAndTupleSyntaxType&&null!=this.format.recordAndTupleSyntaxType)throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);r="#{",s="}"}this.token(r),t.length&&(this.space(),this.printList(t,e,{indent:!0,statement:!0}),this.space()),this.token(s)},t.RegExpLiteral=function(e){this.word(`/${e.pattern}/${e.flags}`)},t.SpreadElement=t.RestElement=function(e){this.token("..."),this.print(e.argument,e)},t.StringLiteral=function(e){const t=this.getPossibleRaw(e);if(!this.format.minified&&void 0!==t)return void this.token(t);const r=i(e.value,this.format.jsescOption);this.token(r)},t.TopicReference=function(){const{topicToken:e}=this.format;if(!o.has(e)){const t=JSON.stringify(e),r=Array.from(o,(e=>JSON.stringify(e)));throw new Error(`The "topicToken" generator option must be one of ${r.join(", ")} (${t} received instead).`)}this.token(e)},t.TupleExpression=function(e){const t=e.elements,r=t.length;let s,i;if("bar"===this.format.recordAndTupleSyntaxType)s="[|",i="|]";else{if("hash"!==this.format.recordAndTupleSyntaxType)throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);s="#[",i="]"}this.token(s);for(let s=0;s<t.length;s++){const i=t[s];i&&(s>0&&this.space(),this.print(i,e),s<r-1&&this.tokenChar(44))}this.token(i)};var s=r(81483),i=r(94669);const{isAssignmentPattern:n,isIdentifier:a}=s,o=new Set(["^^","@@","^","%","#"])},6704:(e,t)=>{"use strict";function r(e,t,r){if(e.token("{"),t.length){e.indent(),e.newline();for(const s of t)e.print(s,r),e.newline();e.dedent()}e.rightBrace(r)}function s(e,t,r){e.printJoin(t.types,t,{separator(){this.space(),this.token(r),this.space()}})}function i(e,t){!0!==t&&e.token(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TSAnyKeyword=function(){this.word("any")},t.TSArrayType=function(e){this.print(e.elementType,e,!0),this.token("[]")},t.TSSatisfiesExpression=t.TSAsExpression=function(e){var t;const{type:r,expression:s,typeAnnotation:i}=e,n=!(null==(t=s.trailingComments)||!t.length);this.print(s,e,!0,void 0,n),this.space(),this.word("TSAsExpression"===r?"as":"satisfies"),this.space(),this.print(i,e)},t.TSBigIntKeyword=function(){this.word("bigint")},t.TSBooleanKeyword=function(){this.word("boolean")},t.TSCallSignatureDeclaration=function(e){this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSConditionalType=function(e){this.print(e.checkType),this.space(),this.word("extends"),this.space(),this.print(e.extendsType),this.space(),this.tokenChar(63),this.space(),this.print(e.trueType),this.space(),this.tokenChar(58),this.space(),this.print(e.falseType)},t.TSConstructSignatureDeclaration=function(e){this.word("new"),this.space(),this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSConstructorType=function(e){e.abstract&&(this.word("abstract"),this.space()),this.word("new"),this.space(),this.tsPrintFunctionOrConstructorType(e)},t.TSDeclareFunction=function(e,t){e.declare&&(this.word("declare"),this.space()),this._functionHead(e,t),this.tokenChar(59)},t.TSDeclareMethod=function(e){this._classMethodHead(e),this.tokenChar(59)},t.TSEnumDeclaration=function(e){const{declare:t,const:s,id:i,members:n}=e;t&&(this.word("declare"),this.space()),s&&(this.word("const"),this.space()),this.word("enum"),this.space(),this.print(i,e),this.space(),r(this,n,e)},t.TSEnumMember=function(e){const{id:t,initializer:r}=e;this.print(t,e),r&&(this.space(),this.tokenChar(61),this.space(),this.print(r,e)),this.tokenChar(44)},t.TSExportAssignment=function(e){this.word("export"),this.space(),this.tokenChar(61),this.space(),this.print(e.expression,e),this.tokenChar(59)},t.TSExpressionWithTypeArguments=function(e){this.print(e.expression,e),this.print(e.typeParameters,e)},t.TSExternalModuleReference=function(e){this.token("require("),this.print(e.expression,e),this.tokenChar(41)},t.TSFunctionType=function(e){this.tsPrintFunctionOrConstructorType(e)},t.TSImportEqualsDeclaration=function(e){const{isExport:t,id:r,moduleReference:s}=e;t&&(this.word("export"),this.space()),this.word("import"),this.space(),this.print(r,e),this.space(),this.tokenChar(61),this.space(),this.print(s,e),this.tokenChar(59)},t.TSImportType=function(e){const{argument:t,qualifier:r,typeParameters:s}=e;this.word("import"),this.tokenChar(40),this.print(t,e),this.tokenChar(41),r&&(this.tokenChar(46),this.print(r,e)),s&&this.print(s,e)},t.TSIndexSignature=function(e){const{readonly:t,static:r}=e;r&&(this.word("static"),this.space()),t&&(this.word("readonly"),this.space()),this.tokenChar(91),this._parameters(e.parameters,e),this.tokenChar(93),this.print(e.typeAnnotation,e),this.tokenChar(59)},t.TSIndexedAccessType=function(e){this.print(e.objectType,e,!0),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.TSInferType=function(e){this.token("infer"),this.space(),this.print(e.typeParameter)},t.TSInstantiationExpression=function(e){this.print(e.expression,e),this.print(e.typeParameters,e)},t.TSInterfaceBody=function(e){this.tsPrintTypeLiteralOrInterfaceBody(e.body,e)},t.TSInterfaceDeclaration=function(e){const{declare:t,id:r,typeParameters:s,extends:i,body:n}=e;t&&(this.word("declare"),this.space()),this.word("interface"),this.space(),this.print(r,e),this.print(s,e),null!=i&&i.length&&(this.space(),this.word("extends"),this.space(),this.printList(i,e)),this.space(),this.print(n,e)},t.TSIntersectionType=function(e){s(this,e,"&")},t.TSIntrinsicKeyword=function(){this.word("intrinsic")},t.TSLiteralType=function(e){this.print(e.literal,e)},t.TSMappedType=function(e){const{nameType:t,optional:r,readonly:s,typeParameter:n}=e;this.tokenChar(123),this.space(),s&&(i(this,s),this.word("readonly"),this.space()),this.tokenChar(91),this.word(n.name),this.space(),this.word("in"),this.space(),this.print(n.constraint,n),t&&(this.space(),this.word("as"),this.space(),this.print(t,e)),this.tokenChar(93),r&&(i(this,r),this.tokenChar(63)),this.tokenChar(58),this.space(),this.print(e.typeAnnotation,e),this.space(),this.tokenChar(125)},t.TSMethodSignature=function(e){const{kind:t}=e;"set"!==t&&"get"!==t||(this.word(t),this.space()),this.tsPrintPropertyOrMethodName(e),this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSModuleBlock=function(e){r(this,e.body,e)},t.TSModuleDeclaration=function(e){const{declare:t,id:r}=e;if(t&&(this.word("declare"),this.space()),e.global||(this.word("Identifier"===r.type?"namespace":"module"),this.space()),this.print(r,e),!e.body)return void this.tokenChar(59);let s=e.body;for(;"TSModuleDeclaration"===s.type;)this.tokenChar(46),this.print(s.id,s),s=s.body;this.space(),this.print(s,e)},t.TSNamedTupleMember=function(e){this.print(e.label,e),e.optional&&this.tokenChar(63),this.tokenChar(58),this.space(),this.print(e.elementType,e)},t.TSNamespaceExportDeclaration=function(e){this.word("export"),this.space(),this.word("as"),this.space(),this.word("namespace"),this.space(),this.print(e.id,e)},t.TSNeverKeyword=function(){this.word("never")},t.TSNonNullExpression=function(e){this.print(e.expression,e),this.tokenChar(33)},t.TSNullKeyword=function(){this.word("null")},t.TSNumberKeyword=function(){this.word("number")},t.TSObjectKeyword=function(){this.word("object")},t.TSOptionalType=function(e){this.print(e.typeAnnotation,e),this.tokenChar(63)},t.TSParameterProperty=function(e){e.accessibility&&(this.word(e.accessibility),this.space()),e.readonly&&(this.word("readonly"),this.space()),this._param(e.parameter)},t.TSParenthesizedType=function(e){this.tokenChar(40),this.print(e.typeAnnotation,e),this.tokenChar(41)},t.TSPropertySignature=function(e){const{readonly:t,initializer:r}=e;t&&(this.word("readonly"),this.space()),this.tsPrintPropertyOrMethodName(e),this.print(e.typeAnnotation,e),r&&(this.space(),this.tokenChar(61),this.space(),this.print(r,e)),this.tokenChar(59)},t.TSQualifiedName=function(e){this.print(e.left,e),this.tokenChar(46),this.print(e.right,e)},t.TSRestType=function(e){this.token("..."),this.print(e.typeAnnotation,e)},t.TSStringKeyword=function(){this.word("string")},t.TSSymbolKeyword=function(){this.word("symbol")},t.TSThisType=function(){this.word("this")},t.TSTupleType=function(e){this.tokenChar(91),this.printList(e.elementTypes,e),this.tokenChar(93)},t.TSTypeAliasDeclaration=function(e){const{declare:t,id:r,typeParameters:s,typeAnnotation:i}=e;t&&(this.word("declare"),this.space()),this.word("type"),this.space(),this.print(r,e),this.print(s,e),this.space(),this.tokenChar(61),this.space(),this.print(i,e),this.tokenChar(59)},t.TSTypeAnnotation=function(e){this.tokenChar(58),this.space(),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t.TSTypeAssertion=function(e){const{typeAnnotation:t,expression:r}=e;this.tokenChar(60),this.print(t,e),this.tokenChar(62),this.space(),this.print(r,e)},t.TSTypeLiteral=function(e){this.tsPrintTypeLiteralOrInterfaceBody(e.members,e)},t.TSTypeOperator=function(e){this.word(e.operator),this.space(),this.print(e.typeAnnotation,e)},t.TSTypeParameter=function(e){e.in&&(this.word("in"),this.space()),e.out&&(this.word("out"),this.space()),this.word(e.name),e.constraint&&(this.space(),this.word("extends"),this.space(),this.print(e.constraint,e)),e.default&&(this.space(),this.tokenChar(61),this.space(),this.print(e.default,e))},t.TSTypeParameterDeclaration=t.TSTypeParameterInstantiation=function(e,t){this.tokenChar(60),this.printList(e.params,e,{}),"ArrowFunctionExpression"===t.type&&1===e.params.length&&this.tokenChar(44),this.tokenChar(62)},t.TSTypePredicate=function(e){e.asserts&&(this.word("asserts"),this.space()),this.print(e.parameterName),e.typeAnnotation&&(this.space(),this.word("is"),this.space(),this.print(e.typeAnnotation.typeAnnotation))},t.TSTypeQuery=function(e){this.word("typeof"),this.space(),this.print(e.exprName),e.typeParameters&&this.print(e.typeParameters,e)},t.TSTypeReference=function(e){this.print(e.typeName,e,!0),this.print(e.typeParameters,e,!0)},t.TSUndefinedKeyword=function(){this.word("undefined")},t.TSUnionType=function(e){s(this,e,"|")},t.TSUnknownKeyword=function(){this.word("unknown")},t.TSVoidKeyword=function(){this.word("void")},t.tsPrintClassMemberModifiers=function(e){const t="ClassAccessorProperty"===e.type||"ClassProperty"===e.type;t&&e.declare&&(this.word("declare"),this.space()),e.accessibility&&(this.word(e.accessibility),this.space()),e.static&&(this.word("static"),this.space()),e.override&&(this.word("override"),this.space()),e.abstract&&(this.word("abstract"),this.space()),t&&e.readonly&&(this.word("readonly"),this.space())},t.tsPrintFunctionOrConstructorType=function(e){const{typeParameters:t}=e,r=e.parameters;this.print(t,e),this.tokenChar(40),this._parameters(r,e),this.tokenChar(41),this.space(),this.token("=>"),this.space();const s=e.typeAnnotation;this.print(s.typeAnnotation,e)},t.tsPrintPropertyOrMethodName=function(e){e.computed&&this.tokenChar(91),this.print(e.key,e),e.computed&&this.tokenChar(93),e.optional&&this.tokenChar(63)},t.tsPrintSignatureDeclarationBase=function(e){const{typeParameters:t}=e,r=e.parameters;this.print(t,e),this.tokenChar(40),this._parameters(r,e),this.tokenChar(41);const s=e.typeAnnotation;this.print(s,e)},t.tsPrintTypeLiteralOrInterfaceBody=function(e,t){r(this,e,t)}},63692:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGenerator=void 0,t.default=function(e,t,r){return new n(e,t,r).generate()};var s=r(11693),i=r(60271);class n extends i.default{constructor(e,t={},r){const i=function(e,t){var r;const s={auxiliaryCommentBefore:t.auxiliaryCommentBefore,auxiliaryCommentAfter:t.auxiliaryCommentAfter,shouldPrintComment:t.shouldPrintComment,retainLines:t.retainLines,retainFunctionParens:t.retainFunctionParens,comments:null==t.comments||t.comments,compact:t.compact,minified:t.minified,concise:t.concise,indent:{adjustMultilineComment:!0,style:" "},jsescOption:Object.assign({quotes:"double",wrap:!0,minimal:!1},t.jsescOption),recordAndTupleSyntaxType:null!=(r=t.recordAndTupleSyntaxType)?r:"hash",topicToken:t.topicToken,importAttributesKeyword:t.importAttributesKeyword};s.decoratorsBeforeExport=t.decoratorsBeforeExport,s.jsescOption.json=t.jsonCompatibleStrings,s.minified?(s.compact=!0,s.shouldPrintComment=s.shouldPrintComment||(()=>s.comments)):s.shouldPrintComment=s.shouldPrintComment||(e=>s.comments||e.includes("@license")||e.includes("@preserve")),"auto"===s.compact&&(s.compact="string"==typeof e&&e.length>5e5,s.compact&&console.error(`[BABEL] Note: The code generator has deoptimised the styling of ${t.filename} as it exceeds the max of 500KB.`)),s.compact&&(s.indent.adjustMultilineComment=!1);const{auxiliaryCommentBefore:i,auxiliaryCommentAfter:n,shouldPrintComment:a}=s;return i&&!a(i)&&(s.auxiliaryCommentBefore=void 0),n&&!a(n)&&(s.auxiliaryCommentAfter=void 0),s}(r,t);super(i,t.sourceMaps?new s.default(t,r):null),this.ast=void 0,this.ast=e}generate(){return super.generate(this.ast)}}t.CodeGenerator=class{constructor(e,t,r){this._generator=void 0,this._generator=new n(e,t,r)}generate(){return this._generator.generate()}}},92505:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.needsParens=function(e,t,r){return!!t&&(!(!p(t)||t.callee!==e||!m(e))||f(h,e,t,r))},t.needsWhitespace=y,t.needsWhitespaceAfter=function(e,t){return y(e,t,2)},t.needsWhitespaceBefore=function(e,t){return y(e,t,1)};var s=r(65327),i=r(43161),n=r(81483);const{FLIPPED_ALIAS_KEYS:a,isCallExpression:o,isExpressionStatement:l,isMemberExpression:c,isNewExpression:p}=n;function u(e){const t={};function r(e,r){const s=t[e];t[e]=s?function(e,t,i){const n=s(e,t,i);return null==n?r(e,t,i):n}:r}for(const t of Object.keys(e)){const s=a[t];if(s)for(const i of s)r(i,e[t]);else r(t,e[t])}return t}const h=u(i),d=u(s.nodes);function f(e,t,r,s){const i=e[t.type];return i?i(t,r,s):null}function m(e){return!!o(e)||c(e)&&m(e.object)}function y(e,t,r){if(!e)return!1;l(e)&&(e=e.expression);const s=f(d,e,t);return"number"==typeof s&&0!=(s&r)}},43161:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowFunctionExpression=function(e,t){return y(t)||ae(e,t)},t.AssignmentExpression=function(e,t){return!!N(e.left)||ae(e,t)},t.Binary=function(e,t){if("**"===e.operator&&c(t,{operator:"**"}))return t.left===e;if(se(e,t))return!0;if(ie(e,t)||X(t)||o(t))return!0;if(l(t)){const r=t.operator,s=te[r],i=e.operator,n=te[i];if(s===n&&t.right===e&&!C(t)||s>n)return!0}},t.BinaryExpression=function(e,t){return"in"===e.operator&&(Y(t)||x(t))},t.ClassExpression=function(e,t,r){return oe(r,5)},t.ConditionalExpression=ae,t.DoExpression=function(e,t,r){return!e.async&&oe(r,1)},t.FunctionExpression=function(e,t,r){return oe(r,5)},t.FunctionTypeAnnotation=function(e,t,r){if(!(r.length<3))return J(t)||w(t)||i(t)||G(t)&&n(r[r.length-3])},t.Identifier=function(e,t,r){var s;return!(null==(s=e.extra)||!s.parenthesized||!a(t,{left:e})||!T(t.right)&&!d(t.right)||null!=t.right.id)||("let"===e.name?oe(r,I(t,{object:e,computed:!0})||D(t,{object:e,computed:!0,optional:!1})?57:32):"async"===e.name&&E(t)&&e===t.left)},t.LogicalExpression=function(e,t){if(re(t))return!0;switch(e.operator){case"||":return!!C(t)&&("??"===t.operator||"&&"===t.operator);case"&&":return C(t,{operator:"??"});case"??":return C(t)&&"??"!==t.operator}},t.NullableTypeAnnotation=function(e,t){return i(t)},t.ObjectExpression=function(e,t,r){return oe(r,3)},t.OptionalIndexedAccessType=function(e,t){return A(t,{objectType:e})},t.OptionalCallExpression=t.OptionalMemberExpression=function(e,t){return u(t,{callee:e})||I(t,{object:e})},t.SequenceExpression=function(e,t){return!(P(t)||z(t)||M(t)||S(t)&&t.test===e||Q(t)&&t.test===e||v(t)&&t.right===e||L(t)&&t.discriminant===e||b(t)&&t.expression===e)},t.TSTypeAssertion=t.TSSatisfiesExpression=t.TSAsExpression=function(){return!0},t.TSInferType=function(e,t){return R(t)||$(t)},t.TSInstantiationExpression=function(e,t){return(u(t)||O(t)||_(t)||B(t))&&!!t.typeParameters},t.TSIntersectionType=t.TSUnionType=function(e,t){return R(t)||$(t)||U(t)||W(t)||K(t)},t.UnaryLike=ne,t.IntersectionTypeAnnotation=t.UnionTypeAnnotation=function(e,t){return i(t)||k(t)||w(t)||J(t)},t.UpdateExpression=function(e,t){return ie(e,t)||se(e,t)},t.AwaitExpression=t.YieldExpression=function(e,t){return l(t)||X(t)||ie(e,t)||o(t)&&Z(e)||m(t)&&e===t.test||se(e,t)};var s=r(81483);const{isArrayTypeAnnotation:i,isArrowFunctionExpression:n,isAssignmentExpression:a,isAwaitExpression:o,isBinary:l,isBinaryExpression:c,isUpdateExpression:p,isCallExpression:u,isClass:h,isClassExpression:d,isConditional:f,isConditionalExpression:m,isExportDeclaration:y,isExportDefaultDeclaration:g,isExpressionStatement:b,isFor:x,isForInStatement:v,isForOfStatement:E,isForStatement:P,isFunctionExpression:T,isIfStatement:S,isIndexedAccessType:A,isIntersectionTypeAnnotation:w,isLogicalExpression:C,isMemberExpression:I,isNewExpression:_,isNullableTypeAnnotation:k,isObjectPattern:N,isOptionalCallExpression:O,isOptionalMemberExpression:D,isReturnStatement:M,isSequenceExpression:F,isSwitchStatement:L,isTSArrayType:R,isTSAsExpression:j,isTSInstantiationExpression:B,isTSIntersectionType:U,isTSNonNullExpression:V,isTSOptionalType:$,isTSRestType:K,isTSTypeAssertion:H,isTSUnionType:W,isTaggedTemplateExpression:q,isThrowStatement:z,isTypeAnnotation:G,isUnaryLike:X,isUnionTypeAnnotation:J,isVariableDeclarator:Y,isWhileStatement:Q,isYieldExpression:Z,isTSSatisfiesExpression:ee}=s,te={"||":0,"??":0,"|>":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,in:6,instanceof:6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};function re(e){return j(e)||ee(e)||H(e)}const se=(e,t)=>h(t,{superClass:e}),ie=(e,t)=>(I(t)||D(t))&&t.object===e||(u(t)||O(t)||_(t))&&t.callee===e||q(t)&&t.tag===e||V(t);function ne(e,t){return ie(e,t)||c(t,{operator:"**",left:e})||se(e,t)}function ae(e,t){return!!(X(t)||l(t)||m(t,{test:e})||o(t)||re(t))||ne(e,t)}function oe(e,t){const r=1&t,s=2&t,i=4&t,o=8&t,c=16&t,u=32&t;let h=e.length-1;if(h<=0)return;let d=e[h];h--;let m=e[h];for(;h>=0;){if(r&&b(m,{expression:d})||i&&g(m,{declaration:d})||s&&n(m,{body:d})||o&&P(m,{init:d})||c&&v(m,{left:d})||u&&E(m,{left:d}))return!0;if(!(h>0&&(ie(d,m)&&!_(m)||F(m)&&m.expressions[0]===d||p(m)&&!m.prefix||f(m,{test:d})||l(m,{left:d})||a(m,{left:d}))))return!1;d=m,h--,m=e[h]}return!1}},65327:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nodes=void 0;var s=r(81483);const{FLIPPED_ALIAS_KEYS:i,isArrayExpression:n,isAssignmentExpression:a,isBinary:o,isBlockStatement:l,isCallExpression:c,isFunction:p,isIdentifier:u,isLiteral:h,isMemberExpression:d,isObjectExpression:f,isOptionalCallExpression:m,isOptionalMemberExpression:y,isStringLiteral:g}=s;function b(e,t){return e?(d(e)||y(e)?(b(e.object,t),e.computed&&b(e.property,t)):o(e)||a(e)?(b(e.left,t),b(e.right,t)):c(e)||m(e)?(t.hasCall=!0,b(e.callee,t)):p(e)?t.hasFunction=!0:u(e)&&(t.hasHelper=t.hasHelper||e.callee&&v(e.callee)),t):t}function x(e){return b(e,{hasCall:!1,hasFunction:!1,hasHelper:!1})}function v(e){return!!e&&(d(e)?v(e.object)||v(e.property):u(e)?"require"===e.name||95===e.name.charCodeAt(0):c(e)?v(e.callee):!(!o(e)&&!a(e))&&(u(e.left)&&v(e.left)||v(e.right)))}function E(e){return h(e)||f(e)||n(e)||u(e)||d(e)}const P={AssignmentExpression(e){const t=x(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return t.hasFunction?3:2},SwitchCase:(e,t)=>(e.consequent.length||t.cases[0]===e?1:0)|(e.consequent.length||t.cases[t.cases.length-1]!==e?0:2),LogicalExpression(e){if(p(e.left)||p(e.right))return 2},Literal(e){if(g(e)&&"use strict"===e.value)return 2},CallExpression(e){if(p(e.callee)||v(e))return 3},OptionalCallExpression(e){if(p(e.callee))return 3},VariableDeclaration(e){for(let t=0;t<e.declarations.length;t++){const r=e.declarations[t];let s=v(r.id)&&!E(r.init);if(!s&&r.init){const e=x(r.init);s=v(r.init)&&e.hasCall||e.hasFunction}if(s)return 3}},IfStatement(e){if(l(e.consequent))return 3}};t.nodes=P,P.ObjectProperty=P.ObjectTypeProperty=P.ObjectMethod=function(e,t){if(t.properties[0]===e)return 1},P.ObjectTypeCallProperty=function(e,t){var r;if(t.callProperties[0]===e&&(null==(r=t.properties)||!r.length))return 1},P.ObjectTypeIndexer=function(e,t){var r,s;if(!(t.indexers[0]!==e||null!=(r=t.properties)&&r.length||null!=(s=t.callProperties)&&s.length))return 1},P.ObjectTypeInternalSlot=function(e,t){var r,s,i;if(!(t.internalSlots[0]!==e||null!=(r=t.properties)&&r.length||null!=(s=t.callProperties)&&s.length||null!=(i=t.indexers)&&i.length))return 1},[["Function",!0],["Class",!0],["Loop",!0],["LabeledStatement",!0],["SwitchStatement",!0],["TryStatement",!0]].forEach((function([e,t]){[e].concat(i[e]||[]).forEach((function(e){const r=t?3:0;P[e]=()=>r}))}))},60271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(69417),i=r(92505),n=r(81483),a=r(87817);const{isFunction:o,isStatement:l,isClassBody:c,isTSInterfaceBody:p,isTSEnumDeclaration:u}=n,h=/e/i,d=/\.0+$/,f=/^0[box]/,m=/^\s*[@#]__PURE__\s*$/,y=/[\n\r\u2028\u2029]/,g=/\*\//,{needsParens:b}=i;class x{constructor(e,t){this.inForStatementInitCounter=0,this._printStack=[],this._indent=0,this._indentChar=0,this._indentRepeat=0,this._insideAux=!1,this._parenPushNewlineState=null,this._noLineTerminator=!1,this._printAuxAfterOnNextUserNode=!1,this._printedComments=new Set,this._endsWithInteger=!1,this._endsWithWord=!1,this._lastCommentLine=0,this._endsWithInnerRaw=!1,this._indentInnerComments=!0,this.format=e,this._buf=new s.default(t),this._indentChar=e.indent.style.charCodeAt(0),this._indentRepeat=e.indent.style.length,this._inputMap=null==t?void 0:t._inputMap}generate(e){return this.print(e),this._maybeAddAuxComment(),this._buf.get()}indent(){this.format.compact||this.format.concise||this._indent++}dedent(){this.format.compact||this.format.concise||this._indent--}semicolon(e=!1){this._maybeAddAuxComment(),e?this._appendChar(59):this._queue(59),this._noLineTerminator=!1}rightBrace(e){this.format.minified&&this._buf.removeLastSemicolon(),this.sourceWithOffset("end",e.loc,-1),this.tokenChar(125)}rightParens(e){this.sourceWithOffset("end",e.loc,-1),this.tokenChar(41)}space(e=!1){if(!this.format.compact)if(e)this._space();else if(this._buf.hasContent()){const e=this.getLastChar();32!==e&&10!==e&&this._space()}}word(e,t=!1){this._maybePrintInnerComments(),(this._endsWithWord||47===e.charCodeAt(0)&&this.endsWith(47))&&this._space(),this._maybeAddAuxComment(),this._append(e,!1),this._endsWithWord=!0,this._noLineTerminator=t}number(e){this.word(e),this._endsWithInteger=Number.isInteger(+e)&&!f.test(e)&&!h.test(e)&&!d.test(e)&&46!==e.charCodeAt(e.length-1)}token(e,t=!1){this._maybePrintInnerComments();const r=this.getLastChar(),s=e.charCodeAt(0);(33===r&&("--"===e||61===s)||43===s&&43===r||45===s&&45===r||46===s&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._append(e,t),this._noLineTerminator=!1}tokenChar(e){this._maybePrintInnerComments();const t=this.getLastChar();(43===e&&43===t||45===e&&45===t||46===e&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._appendChar(e),this._noLineTerminator=!1}newline(e=1,t){if(!(e<=0)){if(!t){if(this.format.retainLines||this.format.compact)return;if(this.format.concise)return void this.space()}e>2&&(e=2),e-=this._buf.getNewlineCount();for(let t=0;t<e;t++)this._newline()}}endsWith(e){return this.getLastChar()===e}getLastChar(){return this._buf.getLastChar()}endsWithCharAndNewline(){return this._buf.endsWithCharAndNewline()}removeTrailingNewline(){this._buf.removeTrailingNewline()}exactSource(e,t){e?(this._catchUp("start",e),this._buf.exactSource(e,t)):t()}source(e,t){t&&(this._catchUp(e,t),this._buf.source(e,t))}sourceWithOffset(e,t,r){t&&(this._catchUp(e,t),this._buf.sourceWithOffset(e,t,r))}withSource(e,t,r){t?(this._catchUp(e,t),this._buf.withSource(e,t,r)):r()}sourceIdentifierName(e,t){if(!this._buf._canMarkIdName)return;const r=this._buf._sourcePosition;r.identifierNamePos=t,r.identifierName=e}_space(){this._queue(32)}_newline(){this._queue(10)}_append(e,t){this._maybeAddParen(e),this._maybeIndent(e.charCodeAt(0)),this._buf.append(e,t),this._endsWithWord=!1,this._endsWithInteger=!1}_appendChar(e){this._maybeAddParenChar(e),this._maybeIndent(e),this._buf.appendChar(e),this._endsWithWord=!1,this._endsWithInteger=!1}_queue(e){this._maybeAddParenChar(e),this._maybeIndent(e),this._buf.queue(e),this._endsWithWord=!1,this._endsWithInteger=!1}_maybeIndent(e){this._indent&&10!==e&&this.endsWith(10)&&this._buf.queueIndentation(this._indentChar,this._getIndent())}_shouldIndent(e){if(this._indent&&10!==e&&this.endsWith(10))return!0}_maybeAddParenChar(e){const t=this._parenPushNewlineState;t&&32!==e&&(10===e?(this.tokenChar(40),this.indent(),t.printed=!0):this._parenPushNewlineState=null)}_maybeAddParen(e){const t=this._parenPushNewlineState;if(!t)return;const r=e.length;let s;for(s=0;s<r&&32===e.charCodeAt(s);s++)continue;if(s===r)return;const i=e.charCodeAt(s);if(10!==i){if(47!==i||s+1===r)return void(this._parenPushNewlineState=null);const t=e.charCodeAt(s+1);if(42===t){if(m.test(e.slice(s+2,r-2)))return}else if(47!==t)return void(this._parenPushNewlineState=null)}this.tokenChar(40),this.indent(),t.printed=!0}catchUp(e){if(!this.format.retainLines)return;const t=e-this._buf.getCurrentLine();for(let e=0;e<t;e++)this._newline()}_catchUp(e,t){var r;if(!this.format.retainLines)return;const s=null==t||null==(r=t[e])?void 0:r.line;if(null!=s){const e=s-this._buf.getCurrentLine();for(let t=0;t<e;t++)this._newline()}}_getIndent(){return this._indentRepeat*this._indent}printTerminatorless(e,t,r){if(r)this._noLineTerminator=!0,this.print(e,t);else{const r={printed:!1};this._parenPushNewlineState=r,this.print(e,t),r.printed&&(this.dedent(),this.newline(),this.tokenChar(41))}}print(e,t,r,s,i){var n;if(!e)return;this._endsWithInnerRaw=!1;const a=e.type,o=this.format,l=o.concise;e._compact&&(o.concise=!0);const c=this[a];if(void 0===c)throw new ReferenceError(`unknown node of type ${JSON.stringify(a)} with constructor ${JSON.stringify(e.constructor.name)}`);this._printStack.push(e);const p=this._insideAux;this._insideAux=null==e.loc,this._maybeAddAuxComment(this._insideAux&&!p);const u=i||o.retainFunctionParens&&"FunctionExpression"===a&&(null==(n=e.extra)?void 0:n.parenthesized)||b(e,t,this._printStack);u&&(this.tokenChar(40),this._endsWithInnerRaw=!1),this._lastCommentLine=0,this._printLeadingComments(e,t);const h="Program"===a||"File"===a?null:e.loc;this.exactSource(h,c.bind(this,e,t)),u?(this._printTrailingComments(e,t),this.tokenChar(41),this._noLineTerminator=r):r&&!this._noLineTerminator?(this._noLineTerminator=!0,this._printTrailingComments(e,t)):this._printTrailingComments(e,t,s),this._printStack.pop(),o.concise=l,this._insideAux=p,this._endsWithInnerRaw=!1}_maybeAddAuxComment(e){e&&this._printAuxBeforeComment(),this._insideAux||this._printAuxAfterComment()}_printAuxBeforeComment(){if(this._printAuxAfterOnNextUserNode)return;this._printAuxAfterOnNextUserNode=!0;const e=this.format.auxiliaryCommentBefore;e&&this._printComment({type:"CommentBlock",value:e},0)}_printAuxAfterComment(){if(!this._printAuxAfterOnNextUserNode)return;this._printAuxAfterOnNextUserNode=!1;const e=this.format.auxiliaryCommentAfter;e&&this._printComment({type:"CommentBlock",value:e},0)}getPossibleRaw(e){const t=e.extra;if(null!=(null==t?void 0:t.raw)&&null!=t.rawValue&&e.value===t.rawValue)return t.raw}printJoin(e,t,r={}){if(null==e||!e.length)return;let{indent:s}=r;if(null==s&&this.format.retainLines){var i;const t=null==(i=e[0].loc)?void 0:i.start.line;null!=t&&t!==this._buf.getCurrentLine()&&(s=!0)}s&&this.indent();const n={addNewlines:r.addNewlines,nextNodeStartLine:0},a=r.separator?r.separator.bind(this):null,o=e.length;for(let s=0;s<o;s++){const i=e[s];if(i&&(r.statement&&this._printNewline(0===s,n),this.print(i,t,void 0,r.trailingCommentsLineOffset||0),null==r.iterator||r.iterator(i,s),s<o-1&&(null==a||a()),r.statement))if(s+1===o)this.newline(1);else{var l;const t=e[s+1];n.nextNodeStartLine=(null==(l=t.loc)?void 0:l.start.line)||0,this._printNewline(!0,n)}}s&&this.dedent()}printAndIndentOnComments(e,t){const r=e.leadingComments&&e.leadingComments.length>0;r&&this.indent(),this.print(e,t),r&&this.dedent()}printBlock(e){const t=e.body;"EmptyStatement"!==t.type&&this.space(),this.print(t,e)}_printTrailingComments(e,t,r){const{innerComments:s,trailingComments:i}=e;null!=s&&s.length&&this._printComments(2,s,e,t,r),null!=i&&i.length&&this._printComments(2,i,e,t,r)}_printLeadingComments(e,t){const r=e.leadingComments;null!=r&&r.length&&this._printComments(0,r,e,t)}_maybePrintInnerComments(){this._endsWithInnerRaw&&this.printInnerComments(),this._endsWithInnerRaw=!0,this._indentInnerComments=!0}printInnerComments(){const e=this._printStack[this._printStack.length-1],t=e.innerComments;if(null==t||!t.length)return;const r=this.endsWith(32),s=this._indentInnerComments,i=this._printedComments.size;s&&this.indent(),this._printComments(1,t,e),r&&i!==this._printedComments.size&&this.space(),s&&this.dedent()}noIndentInnerCommentsHere(){this._indentInnerComments=!1}printSequence(e,t,r={}){r.statement=!0,null!=r.indent||(r.indent=!1),this.printJoin(e,t,r)}printList(e,t,r={}){null==r.separator&&(r.separator=E),this.printJoin(e,t,r)}_printNewline(e,t){const r=this.format;if(r.retainLines||r.compact)return;if(r.concise)return void this.space();if(!e)return;const s=t.nextNodeStartLine,i=this._lastCommentLine;if(s>0&&i>0){const e=s-i;if(e>=0)return void this.newline(e||1)}this._buf.hasContent()&&this.newline(1)}_shouldPrintComment(e){return e.ignore||this._printedComments.has(e)?0:this._noLineTerminator&&(y.test(e.value)||g.test(e.value))?2:(this._printedComments.add(e),this.format.shouldPrintComment(e.value)?1:0)}_printComment(e,t){const r=this._noLineTerminator,s="CommentBlock"===e.type,i=s&&1!==t&&!this._noLineTerminator;i&&this._buf.hasContent()&&2!==t&&this.newline(1);const n=this.getLastChar();let a;if(91!==n&&123!==n&&this.space(),s){if(a=`/*${e.value}*/`,this.format.indent.adjustMultilineComment){var o;const t=null==(o=e.loc)?void 0:o.start.column;if(t){const e=new RegExp("\\n\\s{1,"+t+"}","g");a=a.replace(e,"\n")}let r=this.format.retainLines?0:this._buf.getCurrentColumn();(this._shouldIndent(47)||this.format.retainLines)&&(r+=this._getIndent()),a=a.replace(/\n(?!$)/g,`\n${" ".repeat(r)}`)}}else a=r?`/*${e.value}*/`:`//${e.value}`;this.endsWith(47)&&this._space(),this.source("start",e.loc),this._append(a,s),s||r||this.newline(1,!0),i&&3!==t&&this.newline(1)}_printComments(e,t,r,s,i=0){const n=r.loc,a=t.length;let h=!!n;const d=h?n.start.line:0,f=h?n.end.line:0;let m=0,g=0;const b=this._noLineTerminator?function(){}:this.newline.bind(this);for(let n=0;n<a;n++){const x=t[n],v=this._shouldPrintComment(x);if(2===v){h=!1;break}if(h&&x.loc&&1===v){const t=x.loc.start.line,r=x.loc.end.line;if(0===e){let e=0;0===n?!this._buf.hasContent()||"CommentLine"!==x.type&&t==r||(e=g=1):e=t-m,m=r,b(e),this._printComment(x,1),n+1===a&&(b(Math.max(d-m,g)),m=d)}else if(1===e){const e=t-(0===n?d:m);m=r,b(e),this._printComment(x,1),n+1===a&&(b(Math.min(1,f-m)),m=f)}else{const e=t-(0===n?f-i:m);m=r,b(e),this._printComment(x,1)}}else{if(h=!1,1!==v)continue;if(1===a){const t=x.loc?x.loc.start.line===x.loc.end.line:!y.test(x.value),i=t&&!l(r)&&!c(s)&&!p(s)&&!u(s);0===e?this._printComment(x,i&&"ObjectExpression"!==r.type||t&&o(s,{body:r})?1:0):i&&2===e?this._printComment(x,1):this._printComment(x,0)}else 1!==e||"ObjectExpression"===r.type&&r.properties.length>1||"ClassBody"===r.type||"TSInterfaceBody"===r.type?this._printComment(x,0):this._printComment(x,0===n?2:n===a-1?3:0)}}2===e&&h&&m&&(this._lastCommentLine=m)}}Object.assign(x.prototype,a),x.prototype.Noop=function(){};var v=x;function E(){this.tokenChar(44),this.space()}t.default=v},11693:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(65939),i=r(21076);t.default=class{constructor(e,t){var r;this._map=void 0,this._rawMappings=void 0,this._sourceFileName=void 0,this._lastGenLine=0,this._lastSourceLine=0,this._lastSourceColumn=0,this._inputMap=void 0;const n=this._map=new s.GenMapping({sourceRoot:e.sourceRoot});if(this._sourceFileName=null==(r=e.sourceFileName)?void 0:r.replace(/\\/g,"/"),this._rawMappings=void 0,e.inputSourceMap){this._inputMap=new i.TraceMap(e.inputSourceMap);const t=this._inputMap.resolvedSources;if(t.length)for(let e=0;e<t.length;e++){var a;(0,s.setSourceContent)(n,t[e],null==(a=this._inputMap.sourcesContent)?void 0:a[e])}}if("string"!=typeof t||e.inputSourceMap){if("object"==typeof t)for(const e of Object.keys(t))(0,s.setSourceContent)(n,e.replace(/\\/g,"/"),t[e])}else(0,s.setSourceContent)(n,this._sourceFileName,t)}get(){return(0,s.toEncodedMap)(this._map)}getDecoded(){return(0,s.toDecodedMap)(this._map)}getRawMappings(){return this._rawMappings||(this._rawMappings=(0,s.allMappings)(this._map))}mark(e,t,r,n,a,o){var l;let c;if(this._rawMappings=void 0,null!=t)if(this._inputMap){if(c=(0,i.originalPositionFor)(this._inputMap,{line:t,column:r}),!c.name&&a){const e=(0,i.originalPositionFor)(this._inputMap,a);e.name&&(n=e.name)}}else c={source:(null==o?void 0:o.replace(/\\/g,"/"))||this._sourceFileName,line:t,column:r};(0,s.maybeAddMapping)(this._map,{name:n,generated:e,source:null==(l=c)?void 0:l.source,original:c})}}},72773:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getInclusionReasons=function(e,t,r){const a=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const o=(0,n.getLowestImplementedVersion)(a,r),l=t[r];if(o){const t=(0,n.isUnreleasedVersion)(o,r);(0,n.isUnreleasedVersion)(l,r)||!t&&!s.lt(l.toString(),(0,n.semverify)(o))||(e[r]=(0,i.prettifyVersion)(l))}else e[r]=(0,i.prettifyVersion)(l);return e}),{})};var s=r(30266),i=r(50497),n=r(358)},44839:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,s,i,n,a){const l=new Set,c={compatData:e,includes:t,excludes:r};for(const t in e)if(o(t,s,c))l.add(t);else if(a){const e=a.get(t);e&&l.add(e)}return null==i||i.forEach((e=>!r.has(e)&&l.add(e))),null==n||n.forEach((e=>!t.has(e)&&l.delete(e))),l},t.isRequired=o,t.targetsSupported=a;var s=r(30266),i=r(18052),n=r(358);function a(e,t){const r=Object.keys(e);return 0!==r.length&&0===r.filter((r=>{const i=(0,n.getLowestImplementedVersion)(t,r);if(!i)return!0;const a=e[r];if((0,n.isUnreleasedVersion)(a,r))return!1;if((0,n.isUnreleasedVersion)(i,r))return!0;if(!s.valid(a.toString()))throw new Error(`Invalid version passed for target "${r}": "${a}". Versions must be in semver format (major.minor.patch)`);return s.gt((0,n.semverify)(i),a.toString())})).length}function o(e,t,{compatData:r=i,includes:s,excludes:n}={}){return!(null!=n&&n.has(e)||(null==s||!s.has(e))&&a(t,r[e]))}},49160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TargetNames",{enumerable:!0,get:function(){return c.TargetNames}}),t.default=function(e={},t={}){var r,n;let{browsers:a,esmodules:p}=e;const{configPath:u="."}=t;!function(e){f.invariant(void 0===e||m(e),`'${String(e)}' is not a valid browserslist query`)}(a);let h=function(e){const t=Object.keys(c.TargetNames);for(const r of Object.keys(e))if(!(r in c.TargetNames))throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,i.findSuggestion)(r,t)}'?`));return e}(function(e){const t=Object.assign({},e);return delete t.esmodules,delete t.browsers,t}(e));const y=!!a||Object.keys(h).length>0,v=!t.ignoreBrowserslistConfig&&!y;if(!a&&v&&(a=s.loadConfig({config:t.configFile,path:u,env:t.browserslistEnv}),null==a&&(a=[])),!p||"intersect"===p&&null!=(r=a)&&r.length||(a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", "),p=!1),null!=(n=a)&&n.length){const e=function(e,t){const r="string"==typeof e?e:e.join()+t;let i=x.get(r);return i||(i=function(e,t){return function(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" "),i=l.browserNameMap[r];if(!i)return e;try{const t=s.split("-")[0].toLowerCase(),r=(0,o.isUnreleasedVersion)(t,i);if(!e[i])return e[i]=r?t:(0,o.semverify)(t),e;const n=e[i],a=(0,o.isUnreleasedVersion)(n,i);if(a&&r)e[i]=(0,o.getLowestUnreleased)(n,t,i);else if(a)e[i]=(0,o.semverify)(t);else if(!a&&!r){const r=(0,o.semverify)(t);e[i]=(0,o.semverMin)(n,r)}}catch(e){}return e}),{})}(s(e,{mobileToDesktop:!0,env:t}))}(e,t),x.set(r,i)),Object.assign({},i)}(a,t.browserslistEnv);if("intersect"===p)for(const t of Object.keys(e))if("deno"!==t&&"ie"!==t){const r=d["opera_mobile"===t?"op_mob":t];if(r){const s=e[t];e[t]=(0,o.getHighestUnreleased)(s,(0,o.semverify)(r),t)}else delete e[t]}else delete e[t];h=Object.assign(e,h)}const E={},P=[];for(const e of Object.keys(h).sort()){const t=h[e];"number"==typeof t&&t%1!=0&&P.push({target:e,value:t});const[r,s]="node"===e?g(t):b(e,t);s&&(E[r]=s)}return(T=P).length&&(console.warn("Warning, the following targets are using a decimal version:\n"),T.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`))),console.warn("\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n")),E;var T},Object.defineProperty(t,"filterItems",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"getInclusionReasons",{enumerable:!0,get:function(){return u.getInclusionReasons}}),t.isBrowsersQueryValid=m,Object.defineProperty(t,"isRequired",{enumerable:!0,get:function(){return h.isRequired}}),Object.defineProperty(t,"prettifyTargets",{enumerable:!0,get:function(){return p.prettifyTargets}}),Object.defineProperty(t,"unreleasedLabels",{enumerable:!0,get:function(){return l.unreleasedLabels}});var s=r(70648),i=r(77515),n=r(45884),a=r(78722),o=r(358),l=r(83335),c=r(84124),p=r(50497),u=r(72773),h=r(44839);const d=n["es6.module"],f=new i.OptionValidator("@babel/helper-compilation-targets");function m(e){return"string"==typeof e||Array.isArray(e)&&e.every((e=>"string"==typeof e))}function y(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}function g(e){return["node",!0===e||"current"===e?process.versions.node:y("node",e)]}function b(e,t){return[e,(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():y(e,t)]}const x=new a({max:64})},84124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TargetNames=void 0,t.TargetNames={node:"node",deno:"deno",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino",opera_mobile:"opera_mobile"}},50497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prettifyTargets=function(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const a=i.unreleasedLabels[r];return"string"==typeof s&&a!==s&&(s=n(s)),t[r]=s,t}),{})},t.prettifyVersion=n;var s=r(30266),i=r(83335);function n(e){if("string"!=typeof e)return e;const{major:t,minor:r,patch:i}=s.parse(e),n=[t];return(r||i)&&n.push(r),i&&n.push(i),n.join(".")}},83335:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unreleasedLabels=t.browserNameMap=void 0,t.unreleasedLabels={safari:"tp"},t.browserNameMap={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",deno:"deno",op_mob:"opera_mobile",opera:"opera",safari:"safari",samsung:"samsung"}},358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHighestUnreleased=function(e,t,r){return c(e,t,r)===e?t:e},t.getLowestImplementedVersion=function(e,t){const r=e[t];return r||"android"!==t?r:e.chrome},t.getLowestUnreleased=c,t.isUnreleasedVersion=function(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()},t.semverMin=l,t.semverify=function(e){if("string"==typeof e&&s.valid(e))return e;o.invariant("number"==typeof e||"string"==typeof e&&a.test(e),`'${e}' is not a valid version`),e=e.toString();let t=0,r=0;for(;(t=e.indexOf(".",t+1))>0;)r++;return e+".0".repeat(2-r)};var s=r(30266),i=r(77515),n=r(83335);const a=/^(\d+|\d+.\d+)$/,o=new i.OptionValidator("@babel/helper-compilation-targets");function l(e,t){return e&&s.lt(e,t)?e:t}function c(e,t,r){const s=n.unreleasedLabels[r];return e===s?t:t===s?e:l(e,t)}},55740:(e,t)=>{"use strict";function r(e){const{context:t,node:r}=e;if(r.computed&&t.maybeQueue(e.get("key")),r.decorators)for(const r of e.get("decorators"))t.maybeQueue(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.requeueComputedKeyAndDecorators=r,t.skipAllButComputedKey=function(e){e.skip(),e.node.computed&&e.context.maybeQueue(e.get("key"))};var s={FunctionParent(e){e.isArrowFunctionExpression()||(e.skip(),e.isMethod()&&r(e))},Property(e){e.isObjectProperty()||(e.skip(),r(e))}};t.default=s},69434:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({node:e,parent:t,scope:r,id:s},i=!1,S=!1){if(e.id)return;if(!m(t)&&!f(t,{kind:"method"})||t.computed&&!h(t.key)){if(x(t)){if(s=t.id,u(s)&&!i){const t=r.parent.getBinding(s.name);if(t&&t.constant&&r.getBinding(s.name)===t)return e.id=a(s),void(e.id[n]=!0)}}else if(l(t,{operator:"="}))s=t.left;else if(!s)return}else s=t.key;let A;if(s&&h(s)?A=function(e){return d(e)?"null":y(e)?`_${e.pattern}_${e.flags}`:b(e)?e.quasis.map((e=>e.value.raw)).join(""):void 0!==e.value?e.value+"":""}(s):s&&u(s)&&(A=s.name),void 0===A)return;if(!S&&p(e)&&/[\uD800-\uDFFF]/.test(A))return;A=v(A);const w=o(A);return w[n]=!0,function(e,t,r,s){if(e.selfReference){if(!s.hasBinding(r.name)||s.hasGlobal(r.name)){if(!p(t))return;let e=E;t.generator&&(e=P);const i=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:s.generateUidIdentifier(r.name)}).expression,n=i.callee.body.body[0].params;for(let e=0,r=function(e){const t=e.params.findIndex((e=>c(e)||g(e)));return-1===t?e.params.length:t}(t);e<r;e++)n.push(s.generateUidIdentifier("x"));return i}s.rename(r.name)}t.id=r,s.getProgramParent().references[r.name]=!0}(function(e,t,r){const s={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(s.selfReference=!0):(s.outerDeclar||r.hasGlobal(t))&&r.traverse(e,T,s),s}(e,A,r),e,w,r)||e};var s=r(40589),i=r(81483);const{NOT_LOCAL_BINDING:n,cloneNode:a,identifier:o,isAssignmentExpression:l,isAssignmentPattern:c,isFunction:p,isIdentifier:u,isLiteral:h,isNullLiteral:d,isObjectMethod:f,isObjectProperty:m,isRegExpLiteral:y,isRestElement:g,isTemplateLiteral:b,isVariableDeclarator:x,toBindingIdentifierName:v}=i,E=s.default.statement("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),P=s.default.statement("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),T={"ReferencedIdentifier|BindingIdentifier"(e,t){e.node.name===t.name&&e.scope.getBindingIdentifier(t.name)===t.outerDeclar&&(t.selfReference=!0,e.stop())}}},61763:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r="var"){e.traverse(o,{kind:r,emit:t})};var s=r(81483);const{assignmentExpression:i,expressionStatement:n,identifier:a}=s,o={Scope(e,t){"let"===t.kind&&e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[],s=e.get("declarations");let o;for(const e of s){o=e.node.id,e.node.init&&r.push(n(i("=",e.node.id,e.node.init)));for(const r of Object.keys(e.getBindingIdentifiers()))t.emit(a(r),r,null!==e.node.init)}e.parentPath.isFor({left:e.node})?e.replaceWith(o):e.replaceWithMultiple(r)}}},14419:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(27790),i=r(81483);const{callExpression:n,cloneNode:a,expressionStatement:o,identifier:l,importDeclaration:c,importDefaultSpecifier:p,importNamespaceSpecifier:u,importSpecifier:h,memberExpression:d,stringLiteral:f,variableDeclaration:m,variableDeclarator:y}=i;t.default=class{constructor(e,t,r){this._statements=[],this._resultName=null,this._importedSource=void 0,this._scope=t,this._hub=r,this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){return this._statements.push(c([],f(this._importedSource))),this}require(){return this._statements.push(o(n(l("require"),[f(this._importedSource)]))),this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e),r=this._statements[this._statements.length-1];return s("ImportDeclaration"===r.type),s(0===r.specifiers.length),r.specifiers=[u(t)],this._resultName=a(t),this}default(e){const t=this._scope.generateUidIdentifier(e),r=this._statements[this._statements.length-1];return s("ImportDeclaration"===r.type),s(0===r.specifiers.length),r.specifiers=[p(t)],this._resultName=a(t),this}named(e,t){if("default"===t)return this.default(e);const r=this._scope.generateUidIdentifier(e),i=this._statements[this._statements.length-1];return s("ImportDeclaration"===i.type),s(0===i.specifiers.length),i.specifiers=[h(r,l(t))],this._resultName=a(r),this}var(e){const t=this._scope.generateUidIdentifier(e);let r=this._statements[this._statements.length-1];return"ExpressionStatement"!==r.type&&(s(this._resultName),r=o(this._resultName),this._statements.push(r)),this._statements[this._statements.length-1]=m("var",[y(t,r.expression)]),this._resultName=a(t),this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];return"ExpressionStatement"===t.type?t.expression=n(e,[t.expression]):"VariableDeclaration"===t.type?(s(1===t.declarations.length),t.declarations[0].init=n(e,[t.declarations[0].init])):s.fail("Unexpected type."),this}prop(e){const t=this._statements[this._statements.length-1];return"ExpressionStatement"===t.type?t.expression=d(t.expression,l(e)):"VariableDeclaration"===t.type?(s(1===t.declarations.length),t.declarations[0].init=d(t.declarations[0].init,l(e))):s.fail("Unexpected type:"+t.type),this}read(e){this._resultName=d(this._resultName,l(e))}}},14064:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(27790),i=r(81483),n=r(14419),a=r(95392);const{numericLiteral:o,sequenceExpression:l}=i;t.default=class{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:!1,ensureNoContext:!1,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s,this._programScope=s.scope,this._hub=s.hub,this._defaultOpts=this._applyDefaults(t,r,!0)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){return s("string"==typeof e),this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),void 0)}_applyDefaults(e,t,r=!1){let i;return"string"==typeof e?i=Object.assign({},this._defaultOpts,{importedSource:e},t):(s(!t,"Unexpected secondary arguments."),i=Object.assign({},this._defaultOpts,e)),!r&&t&&(void 0!==t.nameHint&&(i.nameHint=t.nameHint),void 0!==t.blockHoist&&(i.blockHoist=t.blockHoist)),i}_generateImport(e,t){const r="default"===t,s=!!t&&!r,i=null===t,{importedSource:c,importedType:p,importedInterop:u,importingInterop:h,ensureLiveReference:d,ensureNoContext:f,nameHint:m,importPosition:y,blockHoist:g}=e;let b=m||t;const x=(0,a.default)(this._programPath),v=x&&"node"===h,E=x&&"babel"===h;if("after"===y&&!x)throw new Error('"importPosition": "after" is only supported in modules');const P=new n.default(c,this._programScope,this._hub);if("es6"===p){if(!v&&!E)throw new Error("Cannot import an ES6 module from CommonJS");P.import(),i?P.namespace(m||c):(r||s)&&P.named(b,t)}else{if("commonjs"!==p)throw new Error(`Unexpected interopType "${p}"`);if("babel"===u)if(v){b="default"!==b?b:c;const e=`${c}$es6Default`;P.import(),i?P.default(e).var(b||c).wildcardInterop():r?d?P.default(e).var(b||c).defaultInterop().read("default"):P.default(e).var(b).defaultInterop().prop(t):s&&P.default(e).read(t)}else E?(P.import(),i?P.namespace(b||c):(r||s)&&P.named(b,t)):(P.require(),i?P.var(b||c).wildcardInterop():(r||s)&&d?r?(b="default"!==b?b:c,P.var(b).read(t),P.defaultInterop()):P.var(c).read(t):r?P.var(b).defaultInterop().prop(t):s&&P.var(b).prop(t));else if("compiled"===u)v?(P.import(),i?P.default(b||c):(r||s)&&P.default(c).read(b)):E?(P.import(),i?P.namespace(b||c):(r||s)&&P.named(b,t)):(P.require(),i?P.var(b||c):(r||s)&&(d?P.var(c).read(b):P.prop(t).var(b)));else{if("uncompiled"!==u)throw new Error(`Unknown importedInterop "${u}".`);if(r&&d)throw new Error("No live reference for commonjs default");v?(P.import(),i?P.default(b||c):r?P.default(b):s&&P.default(c).read(b)):E?(P.import(),i?P.default(b||c):r?P.default(b):s&&P.named(b,t)):(P.require(),i?P.var(b||c):r?P.var(b):s&&(d?P.var(c).read(b):P.var(b).prop(t)))}}const{statements:T,resultName:S}=P.done();return this._insertStatements(T,y,g),(r||s)&&f&&"Identifier"!==S.type?l([o(0),S]):S}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if("after"===t){for(let t=s.length-1;t>=0;t--)if(s[t].isImportDeclaration())return void s[t].insertAfter(e)}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t)return void t.insertBefore(e)}this._programPath.unshiftContainer("body",e)}}},5598:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImportInjector",{enumerable:!0,get:function(){return s.default}}),t.addDefault=function(e,t,r){return new s.default(e).addDefault(t,r)},t.addNamed=function(e,t,r,i){return new s.default(e).addNamed(t,r,i)},t.addNamespace=function(e,t,r){return new s.default(e).addNamespace(t,r)},t.addSideEffect=function(e,t,r){return new s.default(e).addSideEffect(t,r)},Object.defineProperty(t,"isModule",{enumerable:!0,get:function(){return i.default}});var s=r(14064),i=r(95392)},95392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"module"===e.node.sourceType}},28476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildDynamicImport=function(e,t,r,i){const[n]=e.arguments;if(s.types.isStringLiteral(n)||s.types.isTemplateLiteral(n)&&0===n.quasis.length)return t?s.template.expression.ast`
|
|
22
|
+
`,{placeholderPattern:!1,placeholderWhitelist:new Set(["DE_IDENTIFIER"])}),x=a.template.expression("(\n SYNC_RETURN_VALUE_IDENTIFIER = NODE,\n FUNCTION_STATE_IDENTIFIER === 'async' ? SYNC_RETURN_VALUE_IDENTIFIER : null\n )");return{pre(e){this.file=e},visitor:{BlockStatement(n){var a,m,y,x,v,E,P,T,S,A;if(!n.parentPath.isFunction())return;if(n.parentPath.getData(o))return;if(n.parentPath.node[t])return;if(n.parentPath.node[r])return;const w=void 0!==n.parent.start?this.file.code.slice(null!==(a=n.parent.start)&&void 0!==a?a:void 0,null!==(m=n.parent.end)&&void 0!==m?m:void 0):"function () { [unknown code] }",C=encodeURIComponent(w),I=e.expressionStatement(e.stringLiteral(`<async_rewriter>${C}</>`)),_=null===(y=n.findParent((e=>!!e.getData(o))))||void 0===y?void 0:y.getData(o),k=n.scope.generateUidIdentifier("fs"),N=n.scope.generateUidIdentifier("srv"),O=n.scope.generateUidIdentifier("arv"),D=null!==(x=null==_?void 0:_.expressionHolder)&&void 0!==x?x:n.scope.generateUidIdentifier("ex"),M=null!==(v=null==_?void 0:_.markSyntheticPromise)&&void 0!==v?v:n.scope.generateUidIdentifier("msp"),F=null!==(E=null==_?void 0:_.isSyntheticPromise)&&void 0!==E?E:n.scope.generateUidIdentifier("isp"),L=null!==(P=null==_?void 0:_.assertNotSyntheticPromise)&&void 0!==P?P:n.scope.generateUidIdentifier("ansp"),R=null!==(T=null==_?void 0:_.syntheticPromiseSymbol)&&void 0!==T?T:n.scope.generateUidIdentifier("sp"),j=null!==(S=null==_?void 0:_.demangleError)&&void 0!==S?S:n.scope.generateUidIdentifier("de"),B={functionState:k,synchronousReturnValue:N,asynchronousReturnValue:O,expressionHolder:D,markSyntheticPromise:M,isSyntheticPromise:F,assertNotSyntheticPromise:L,syntheticPromiseSymbol:R,demangleError:j};n.parentPath.setData(o,B);const U=_?[]:[Object.assign(l({SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(d({EXPRESSION_HOLDER_IDENTIFIER:D}),{[r]:!0})],V=_?[]:[...U,Object.assign(c({MSP_IDENTIFIER:M,SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(p({ISP_IDENTIFIER:F,SP_IDENTIFIER:R}),{[r]:!0}),Object.assign(b({DE_IDENTIFIER:j}),{[r]:!0})],$=[...U,Object.assign(u({ANSP_IDENTIFIER:L,SP_IDENTIFIER:R,CUSTOM_ERROR_BUILDER:null!==(A=this.opts.customErrorBuilder)&&void 0!==A?A:e.identifier("Error")}),{[r]:!0})];if(n.parentPath.node.async)return void n.replaceWith(e.blockStatement([I,...V,g({ORIGINAL_CODE:n.node.body})]));if(n.parentPath.node.generator||n.parentPath.isClassMethod()&&"Identifier"===n.parentPath.node.key.type&&"constructor"===n.parentPath.node.key.name)return Object.assign(n.parentPath.node,{[i]:!0}),void n.replaceWith(e.blockStatement([I,...$,g({ORIGINAL_CODE:n.node.body})]));const K=Object.assign(h({FUNCTION_STATE_IDENTIFIER:k,SYNC_RETURN_VALUE_IDENTIFIER:N,ORIGINAL_CODE:Object.assign(n.node,{[s]:!0})}),{[t]:!0}),H=f({FUNCTION_STATE_IDENTIFIER:k,SYNC_RETURN_VALUE_IDENTIFIER:N,ASYNC_RETURN_VALUE_IDENTIFIER:O,MSP_IDENTIFIER:M,ASYNC_TRY_CATCH_WRAPPER:K});n.replaceWith(e.blockStatement([I,...V,...H]))},UnaryExpression:{enter(t){"typeof"!==t.node.operator||"Identifier"!==t.node.argument.type||t.node[n]||t.replaceWith(e.conditionalExpression(e.binaryExpression("===",{...t.node,[r]:!0,[n]:!0},e.stringLiteral("undefined")),e.stringLiteral("undefined"),{...t.node,[n]:!0}))}},Expression:{enter(t){var s,i;if(t.parentPath.isArrowFunctionExpression()&&"body"===t.key&&t.replaceWith(e.blockStatement([e.returnStatement(t.node)])),null===(i=null===(s=t.find((e=>e.isFunction()||!!e.node[r])))||void 0===s?void 0:s.node)||void 0===i?void 0:i[r])return t.skip()},exit(n){var a,l,c,p,u,h;const d=n.getFunctionParent();if(!d)return;if(!d.node.async&&!d.node[i])return;let f;if(d.node[t]){if(!(null===(l=null===(a=n.findParent((e=>e.isFunction()||!!e.node[s])))||void 0===a?void 0:a.node)||void 0===l?void 0:l[s]))return;if(f=null===(p=null===(c=d.getFunctionParent())||void 0===c?void 0:c.getData)||void 0===p?void 0:p.call(c,o),!f)throw new Error("Parent of generated inner function does not have existing identifiers available");if(n.parentPath.isReturnStatement()&&!n.node[r])return void n.replaceWith(Object.assign(x({SYNC_RETURN_VALUE_IDENTIFIER:f.synchronousReturnValue,FUNCTION_STATE_IDENTIFIER:f.functionState,NODE:n.node}),{[r]:!0}))}else f=d.getData(o);if(n.parentPath.isCallExpression()&&"callee"===n.key&&(n.isMemberExpression()||n.isImport()||n.isIdentifier()&&"eval"===n.node.name))return;if(n.parentPath.isAssignmentExpression()&&"left"===n.key)return;if(n.parentPath.isForXStatement()&&"left"===n.key)return;if(n.parentPath.isUpdateExpression())return;if(n.parentPath.isUnaryExpression()&&"delete"===n.parentPath.node.operator)return;if(n.isLiteral()||n.isArrayExpression()||n.isObjectExpression()||n.isFunctionExpression()||n.isArrowFunctionExpression()||n.isClassExpression()||n.isAssignmentExpression()||n.isBinaryExpression()||n.isConditionalExpression()||n.isLogicalExpression()||n.isSequenceExpression()||n.isParenthesizedExpression()||n.isUnaryExpression()||n.isSuper()||n.isThisExpression()||n.isAwaitExpression()||n.parentPath.isAwaitExpression())return;if(n.isIdentifier()&&n.scope.hasBinding(n.node.name))return;const{expressionHolder:g,isSyntheticPromise:b,assertNotSyntheticPromise:v}=f,E=(24,(P=void 0!==n.node.start?this.file.code.slice(null!==(u=n.node.start)&&void 0!==u?u:void 0,null!==(h=n.node.end)&&void 0!==h?h:void 0):"<unknown>").length<=24?P:P.slice(0,.7*19)+" ... "+P.slice(P.length-5.7));var P;if(!d.node.async)return void n.replaceWith(Object.assign(y({ORIGINAL_SOURCE:e.stringLiteral(E),NODE:n.node,ANSP_IDENTIFIER:v}),{[r]:!0}));const T=e.stringLiteral("\ufeff"+E+"\ufeff");n.replaceWith(Object.assign(m({ORIGINAL_SOURCE:T,EXPRESSION_HOLDER:g,ISP_IDENTIFIER:b,NODE:n.node}),{[r]:!0})),n.skip()}},CatchClause:{exit(t){var s;if(t.node[r]||!t.node.param||"Identifier"!==t.node.param.type)return;const i=null===(s=t.findParent((e=>!!e.getData(o))))||void 0===s?void 0:s.getData(o);i&&t.replaceWith(Object.assign(e.catchClause(t.node.param,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",t.node.param,e.callExpression(i.demangleError,[t.node.param]))),t.node.body])),{[r]:!0}))}}}}}},23093:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const a=n(r(30302));t.default=({types:e})=>{const t=Symbol("isGeneratedTryCatch"),r=a.template.expression("\n (!ERR_IDENTIFIER || !ERR_IDENTIFIER[Symbol.for('@@mongosh.uncatchable')])\n ");return{visitor:{TryStatement(s){var i;if(s.node[t])return;const{block:n,finalizer:a}=s.node;let o,l;const c=s.scope.generateUidIdentifier("err");if(s.node.handler?"Identifier"===(null===(i=s.node.handler.param)||void 0===i?void 0:i.type)?(o=s.node.handler.param,l=s.node.handler):s.node.handler.param?(o=c,l=e.catchClause(o,e.blockStatement([e.variableDeclaration("let",[e.variableDeclarator(s.node.handler.param,o)]),s.node.handler.body]))):(o=c,l=s.node.handler):(o=c,l=e.catchClause(o,e.blockStatement([e.throwStatement(o)]))),a){const i=s.scope.generateUidIdentifier("_isCatchable"),c=s.scope.generateUidIdentifier("_innerExc");s.replaceWithMultiple([e.variableDeclaration("let",[e.variableDeclarator(i,e.booleanLiteral(!0))]),Object.assign(e.tryStatement(n,e.catchClause(o,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",i,r({ERR_IDENTIFIER:o}))),e.ifStatement(i,Object.assign(e.tryStatement(l.body,e.catchClause(c,e.blockStatement([e.expressionStatement(e.assignmentExpression("=",i,r({ERR_IDENTIFIER:c}))),e.throwStatement(c)]))),{[t]:!0}),e.throwStatement(o))])),e.blockStatement([e.ifStatement(i,a)])),{[t]:!0})])}else s.replaceWith(Object.assign(e.tryStatement(n,e.catchClause(o,e.blockStatement([e.ifStatement(r({ERR_IDENTIFIER:o}),l.body,e.throwStatement(o))]))),{[t]:!0}))}}}}},18937:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=({types:e})=>({pre(){this.movedStatements=[],this.functionDeclarations=[],this.hasFinishedMoving=!1,this.addedCompletionRecords=!1,this.variables=[]},visitor:{Statement(t){if(!this.hasFinishedMoving){if(t.isDeclaration()&&!t.getFunctionParent())if(t.isVariableDeclaration()){if(t.parentPath.isProgram()||"var"===t.node.kind){const r=[];for(const s of t.node.declarations){if(s.id.name===this.completionRecordId.name)return;if(this.variables.push(s.id.name),s.init){const i=e.assignmentExpression("=",s.id,s.init);r.push(e.variableDeclaration("const",[e.variableDeclarator(t.scope.generateUidIdentifier("v"),i)]))}}return void(t.parentPath.isProgram()?(this.movedStatements.push(...r),t.remove()):t.replaceWithMultiple(r))}}else{if(t.isFunctionDeclaration())return this.functionDeclarations.push(t.node),void(t.node.id?t.replaceWith(e.expressionStatement(t.node.id)):t.remove());if(t.isClassDeclaration()&&t.parentPath.isProgram())return this.variables.push(t.node.id.name),this.movedStatements.push(e.expressionStatement(e.assignmentExpression("=",t.node.id,e.classExpression(t.node.id,t.node.superClass,t.node.body)))),void t.replaceWith(e.expressionStatement(t.node.id))}!t.isExpressionWrapper()||t.getFunctionParent()||t.isExpressionStatement()&&"AssignmentExpression"===t.node.expression.type&&"Identifier"===t.node.expression.left.type&&t.node.expression.left.name===this.completionRecordId.name?t.parentPath.isProgram()&&this.movedStatements.push(t.node):t.replaceWith(e.expressionStatement(e.assignmentExpression("=",this.completionRecordId,t.node.expression)))}},Program:{enter(t){this.hasFinishedMoving||(this.completionRecordId=t.scope.generateUidIdentifier("cr"),1===t.node.directives.length&&"DirectiveLiteral"===t.node.directives[0].value.type&&0===t.node.body.length&&t.replaceWith(e.program([e.expressionStatement({...t.node.directives[0].value,type:"StringLiteral"})])))},exit(t){this.hasFinishedMoving||(this.hasFinishedMoving=!0,t.replaceWith(e.program([...this.variables.map((t=>e.variableDeclaration("var",[e.variableDeclarator(e.identifier(t))]))),...this.functionDeclarations,e.expressionStatement(e.callExpression(e.arrowFunctionExpression([],e.blockStatement([e.variableDeclaration("var",[e.variableDeclarator(this.completionRecordId)]),...this.movedStatements,e.returnStatement(this.completionRecordId)])),[]))],t.node.directives)))}}}})},77328:(e,t)=>{var r;t=e.exports=g,r="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var s=256,i=Number.MAX_SAFE_INTEGER||9007199254740991,n=s-6,a=t.re=[],o=t.safeRe=[],l=t.src=[],c=t.tokens={},p=0;function u(e){c[e]=p++}var h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",s],[h,n]];function f(e){for(var t=0;t<d.length;t++){var r=d[t][0],s=d[t][1];e=e.split(r+"*").join(r+"{0,"+s+"}").split(r+"+").join(r+"{1,"+s+"}")}return e}u("NUMERICIDENTIFIER"),l[c.NUMERICIDENTIFIER]="0|[1-9]\\d*",u("NUMERICIDENTIFIERLOOSE"),l[c.NUMERICIDENTIFIERLOOSE]="\\d+",u("NONNUMERICIDENTIFIER"),l[c.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-]"+h+"*",u("MAINVERSION"),l[c.MAINVERSION]="("+l[c.NUMERICIDENTIFIER]+")\\.("+l[c.NUMERICIDENTIFIER]+")\\.("+l[c.NUMERICIDENTIFIER]+")",u("MAINVERSIONLOOSE"),l[c.MAINVERSIONLOOSE]="("+l[c.NUMERICIDENTIFIERLOOSE]+")\\.("+l[c.NUMERICIDENTIFIERLOOSE]+")\\.("+l[c.NUMERICIDENTIFIERLOOSE]+")",u("PRERELEASEIDENTIFIER"),l[c.PRERELEASEIDENTIFIER]="(?:"+l[c.NUMERICIDENTIFIER]+"|"+l[c.NONNUMERICIDENTIFIER]+")",u("PRERELEASEIDENTIFIERLOOSE"),l[c.PRERELEASEIDENTIFIERLOOSE]="(?:"+l[c.NUMERICIDENTIFIERLOOSE]+"|"+l[c.NONNUMERICIDENTIFIER]+")",u("PRERELEASE"),l[c.PRERELEASE]="(?:-("+l[c.PRERELEASEIDENTIFIER]+"(?:\\."+l[c.PRERELEASEIDENTIFIER]+")*))",u("PRERELEASELOOSE"),l[c.PRERELEASELOOSE]="(?:-?("+l[c.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+l[c.PRERELEASEIDENTIFIERLOOSE]+")*))",u("BUILDIDENTIFIER"),l[c.BUILDIDENTIFIER]=h+"+",u("BUILD"),l[c.BUILD]="(?:\\+("+l[c.BUILDIDENTIFIER]+"(?:\\."+l[c.BUILDIDENTIFIER]+")*))",u("FULL"),u("FULLPLAIN"),l[c.FULLPLAIN]="v?"+l[c.MAINVERSION]+l[c.PRERELEASE]+"?"+l[c.BUILD]+"?",l[c.FULL]="^"+l[c.FULLPLAIN]+"$",u("LOOSEPLAIN"),l[c.LOOSEPLAIN]="[v=\\s]*"+l[c.MAINVERSIONLOOSE]+l[c.PRERELEASELOOSE]+"?"+l[c.BUILD]+"?",u("LOOSE"),l[c.LOOSE]="^"+l[c.LOOSEPLAIN]+"$",u("GTLT"),l[c.GTLT]="((?:<|>)?=?)",u("XRANGEIDENTIFIERLOOSE"),l[c.XRANGEIDENTIFIERLOOSE]=l[c.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*",u("XRANGEIDENTIFIER"),l[c.XRANGEIDENTIFIER]=l[c.NUMERICIDENTIFIER]+"|x|X|\\*",u("XRANGEPLAIN"),l[c.XRANGEPLAIN]="[v=\\s]*("+l[c.XRANGEIDENTIFIER]+")(?:\\.("+l[c.XRANGEIDENTIFIER]+")(?:\\.("+l[c.XRANGEIDENTIFIER]+")(?:"+l[c.PRERELEASE]+")?"+l[c.BUILD]+"?)?)?",u("XRANGEPLAINLOOSE"),l[c.XRANGEPLAINLOOSE]="[v=\\s]*("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+l[c.XRANGEIDENTIFIERLOOSE]+")(?:"+l[c.PRERELEASELOOSE]+")?"+l[c.BUILD]+"?)?)?",u("XRANGE"),l[c.XRANGE]="^"+l[c.GTLT]+"\\s*"+l[c.XRANGEPLAIN]+"$",u("XRANGELOOSE"),l[c.XRANGELOOSE]="^"+l[c.GTLT]+"\\s*"+l[c.XRANGEPLAINLOOSE]+"$",u("COERCE"),l[c.COERCE]="(^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])",u("COERCERTL"),a[c.COERCERTL]=new RegExp(l[c.COERCE],"g"),o[c.COERCERTL]=new RegExp(f(l[c.COERCE]),"g"),u("LONETILDE"),l[c.LONETILDE]="(?:~>?)",u("TILDETRIM"),l[c.TILDETRIM]="(\\s*)"+l[c.LONETILDE]+"\\s+",a[c.TILDETRIM]=new RegExp(l[c.TILDETRIM],"g"),o[c.TILDETRIM]=new RegExp(f(l[c.TILDETRIM]),"g"),u("TILDE"),l[c.TILDE]="^"+l[c.LONETILDE]+l[c.XRANGEPLAIN]+"$",u("TILDELOOSE"),l[c.TILDELOOSE]="^"+l[c.LONETILDE]+l[c.XRANGEPLAINLOOSE]+"$",u("LONECARET"),l[c.LONECARET]="(?:\\^)",u("CARETTRIM"),l[c.CARETTRIM]="(\\s*)"+l[c.LONECARET]+"\\s+",a[c.CARETTRIM]=new RegExp(l[c.CARETTRIM],"g"),o[c.CARETTRIM]=new RegExp(f(l[c.CARETTRIM]),"g"),u("CARET"),l[c.CARET]="^"+l[c.LONECARET]+l[c.XRANGEPLAIN]+"$",u("CARETLOOSE"),l[c.CARETLOOSE]="^"+l[c.LONECARET]+l[c.XRANGEPLAINLOOSE]+"$",u("COMPARATORLOOSE"),l[c.COMPARATORLOOSE]="^"+l[c.GTLT]+"\\s*("+l[c.LOOSEPLAIN]+")$|^$",u("COMPARATOR"),l[c.COMPARATOR]="^"+l[c.GTLT]+"\\s*("+l[c.FULLPLAIN]+")$|^$",u("COMPARATORTRIM"),l[c.COMPARATORTRIM]="(\\s*)"+l[c.GTLT]+"\\s*("+l[c.LOOSEPLAIN]+"|"+l[c.XRANGEPLAIN]+")",a[c.COMPARATORTRIM]=new RegExp(l[c.COMPARATORTRIM],"g"),o[c.COMPARATORTRIM]=new RegExp(f(l[c.COMPARATORTRIM]),"g"),u("HYPHENRANGE"),l[c.HYPHENRANGE]="^\\s*("+l[c.XRANGEPLAIN]+")\\s+-\\s+("+l[c.XRANGEPLAIN]+")\\s*$",u("HYPHENRANGELOOSE"),l[c.HYPHENRANGELOOSE]="^\\s*("+l[c.XRANGEPLAINLOOSE]+")\\s+-\\s+("+l[c.XRANGEPLAINLOOSE]+")\\s*$",u("STAR"),l[c.STAR]="(<|>)?=?\\s*\\*";for(var m=0;m<p;m++)r(m,l[m]),a[m]||(a[m]=new RegExp(l[m]),o[m]=new RegExp(f(l[m])));function y(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof g)return e;if("string"!=typeof e)return null;if(e.length>s)return null;if(!(t.loose?o[c.LOOSE]:o[c.FULL]).test(e))return null;try{return new g(e,t)}catch(e){return null}}function g(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof g){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>s)throw new TypeError("version is longer than "+s+" characters");if(!(this instanceof g))return new g(e,t);r("SemVer",e,t),this.options=t,this.loose=!!t.loose;var n=e.trim().match(t.loose?o[c.LOOSE]:o[c.FULL]);if(!n)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<i)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}t.parse=y,t.valid=function(e,t){var r=y(e,t);return r?r.version:null},t.clean=function(e,t){var r=y(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null},t.SemVer=g,g.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},g.prototype.toString=function(){return this.version},g.prototype.compare=function(e){return r("SemVer.compare",this.version,this.options,e),e instanceof g||(e=new g(e,this.options)),this.compareMain(e)||this.comparePre(e)},g.prototype.compareMain=function(e){return e instanceof g||(e=new g(e,this.options)),x(this.major,e.major)||x(this.minor,e.minor)||x(this.patch,e.patch)},g.prototype.comparePre=function(e){if(e instanceof g||(e=new g(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var s=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,s,i),void 0===s&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===s)return-1;if(s!==i)return x(s,i)}while(++t)},g.prototype.compareBuild=function(e){e instanceof g||(e=new g(e,this.options));var t=0;do{var s=this.build[t],i=e.build[t];if(r("prerelease compare",t,s,i),void 0===s&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===s)return-1;if(s!==i)return x(s,i)}while(++t)},g.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=function(e,t,r,s){"string"==typeof r&&(s=r,r=void 0);try{return new g(e,r).inc(t,s).version}catch(e){return null}},t.diff=function(e,t){if(T(e,t))return null;var r=y(e),s=y(t),i="";if(r.prerelease.length||s.prerelease.length){i="pre";var n="prerelease"}for(var a in r)if(("major"===a||"minor"===a||"patch"===a)&&r[a]!==s[a])return i+a;return n},t.compareIdentifiers=x;var b=/^[0-9]+$/;function x(e,t){var r=b.test(e),s=b.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1}function v(e,t,r){return new g(e,r).compare(new g(t,r))}function E(e,t,r){return v(e,t,r)>0}function P(e,t,r){return v(e,t,r)<0}function T(e,t,r){return 0===v(e,t,r)}function S(e,t,r){return 0!==v(e,t,r)}function A(e,t,r){return v(e,t,r)>=0}function w(e,t,r){return v(e,t,r)<=0}function C(e,t,r,s){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return T(e,r,s);case"!=":return S(e,r,s);case">":return E(e,r,s);case">=":return A(e,r,s);case"<":return P(e,r,s);case"<=":return w(e,r,s);default:throw new TypeError("Invalid operator: "+t)}}function I(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof I){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof I))return new I(e,t);e=e.trim().split(/\s+/).join(" "),r("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===_?this.value="":this.value=this.operator+this.semver.version,r("comp",this)}t.rcompareIdentifiers=function(e,t){return x(t,e)},t.major=function(e,t){return new g(e,t).major},t.minor=function(e,t){return new g(e,t).minor},t.patch=function(e,t){return new g(e,t).patch},t.compare=v,t.compareLoose=function(e,t){return v(e,t,!0)},t.compareBuild=function(e,t,r){var s=new g(e,r),i=new g(t,r);return s.compare(i)||s.compareBuild(i)},t.rcompare=function(e,t,r){return v(t,e,r)},t.sort=function(e,r){return e.sort((function(e,s){return t.compareBuild(e,s,r)}))},t.rsort=function(e,r){return e.sort((function(e,s){return t.compareBuild(s,e,r)}))},t.gt=E,t.lt=P,t.eq=T,t.neq=S,t.gte=A,t.lte=w,t.cmp=C,t.Comparator=I;var _={};function k(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof k)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new k(e.raw,t);if(e instanceof I)return new k(e.value,t);if(!(this instanceof k))return new k(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+this.raw);this.format()}function N(e,t){for(var r=!0,s=e.slice(),i=s.pop();r&&s.length;)r=s.every((function(e){return i.intersects(e,t)})),i=s.pop();return r}function O(e){return!e||"x"===e.toLowerCase()||"*"===e}function D(e,t,r,s,i,n,a,o,l,c,p,u,h){return((t=O(r)?"":O(s)?">="+r+".0.0":O(i)?">="+r+"."+s+".0":">="+t)+" "+(o=O(l)?"":O(c)?"<"+(+l+1)+".0.0":O(p)?"<"+l+"."+(+c+1)+".0":u?"<="+l+"."+c+"."+p+"-"+u:"<="+o)).trim()}function M(e,t,s){for(var i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!s.includePrerelease){for(i=0;i<e.length;i++)if(r(e[i].semver),e[i].semver!==_&&e[i].semver.prerelease.length>0){var n=e[i].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}function F(e,t,r){try{t=new k(t,r)}catch(e){return!1}return t.test(e)}function L(e,t,r,s){var i,n,a,o,l;switch(e=new g(e,s),t=new k(t,s),r){case">":i=E,n=w,a=P,o=">",l=">=";break;case"<":i=P,n=A,a=E,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(F(e,t,s))return!1;for(var c=0;c<t.set.length;++c){var p=t.set[c],u=null,h=null;if(p.forEach((function(e){e.semver===_&&(e=new I(">=0.0.0")),u=u||e,h=h||e,i(e.semver,u.semver,s)?u=e:a(e.semver,h.semver,s)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&n(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0}I.prototype.parse=function(e){var t=this.options.loose?o[c.COMPARATORLOOSE]:o[c.COMPARATOR],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new g(r[2],this.options.loose):this.semver=_},I.prototype.toString=function(){return this.value},I.prototype.test=function(e){if(r("Comparator.test",e,this.options.loose),this.semver===_||e===_)return!0;if("string"==typeof e)try{e=new g(e,this.options)}catch(e){return!1}return C(e,this.operator,this.semver,this.options)},I.prototype.intersects=function(e,t){if(!(e instanceof I))throw new TypeError("a Comparator is required");var r;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||(r=new k(e.value,t),F(this.value,r,t));if(""===e.operator)return""===e.value||(r=new k(this.value,t),F(e.semver,r,t));var s=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),n=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=C(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),l=C(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return s||i||n&&a||o||l},t.Range=k,k.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim(),this.range},k.prototype.toString=function(){return this.range},k.prototype.parseRange=function(e){var t=this.options.loose,s=t?o[c.HYPHENRANGELOOSE]:o[c.HYPHENRANGE];e=e.replace(s,D),r("hyphen replace",e),e=e.replace(o[c.COMPARATORTRIM],"$1$2$3"),r("comparator trim",e,o[c.COMPARATORTRIM]),e=(e=(e=e.replace(o[c.TILDETRIM],"$1~")).replace(o[c.CARETTRIM],"$1^")).split(/\s+/).join(" ");var i=t?o[c.COMPARATORLOOSE]:o[c.COMPARATOR],n=e.split(" ").map((function(e){return function(e,t){return r("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){r("caret",e,t);var s=t.loose?o[c.CARETLOOSE]:o[c.CARET];return e.replace(s,(function(t,s,i,n,a){var o;return r("caret",e,t,s,i,n,a),O(s)?o="":O(i)?o=">="+s+".0.0 <"+(+s+1)+".0.0":O(n)?o="0"===s?">="+s+"."+i+".0 <"+s+"."+(+i+1)+".0":">="+s+"."+i+".0 <"+(+s+1)+".0.0":a?(r("replaceCaret pr",a),o="0"===s?"0"===i?">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+i+"."+(+n+1):">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+(+i+1)+".0":">="+s+"."+i+"."+n+"-"+a+" <"+(+s+1)+".0.0"):(r("no pr"),o="0"===s?"0"===i?">="+s+"."+i+"."+n+" <"+s+"."+i+"."+(+n+1):">="+s+"."+i+"."+n+" <"+s+"."+(+i+1)+".0":">="+s+"."+i+"."+n+" <"+(+s+1)+".0.0"),r("caret return",o),o}))}(e,t)})).join(" ")}(e,t),r("caret",e),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){var s=t.loose?o[c.TILDELOOSE]:o[c.TILDE];return e.replace(s,(function(t,s,i,n,a){var o;return r("tilde",e,t,s,i,n,a),O(s)?o="":O(i)?o=">="+s+".0.0 <"+(+s+1)+".0.0":O(n)?o=">="+s+"."+i+".0 <"+s+"."+(+i+1)+".0":a?(r("replaceTilde pr",a),o=">="+s+"."+i+"."+n+"-"+a+" <"+s+"."+(+i+1)+".0"):o=">="+s+"."+i+"."+n+" <"+s+"."+(+i+1)+".0",r("tilde return",o),o}))}(e,t)})).join(" ")}(e,t),r("tildes",e),e=function(e,t){return r("replaceXRanges",e,t),e.split(/\s+/).map((function(e){return function(e,t){e=e.trim();var s=t.loose?o[c.XRANGELOOSE]:o[c.XRANGE];return e.replace(s,(function(s,i,n,a,o,l){r("xRange",e,s,i,n,a,o,l);var c=O(n),p=c||O(a),u=p||O(o),h=u;return"="===i&&h&&(i=""),l=t.includePrerelease?"-0":"",c?s=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(p&&(a=0),o=0,">"===i?(i=">=",p?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",p?n=+n+1:a=+a+1),s=i+n+"."+a+"."+o+l):p?s=">="+n+".0.0"+l+" <"+(+n+1)+".0.0"+l:u&&(s=">="+n+"."+a+".0"+l+" <"+n+"."+(+a+1)+".0"+l),r("xRange return",s),s}))}(e,t)})).join(" ")}(e,t),r("xrange",e),e=function(e,t){return r("replaceStars",e,t),e.trim().replace(o[c.STAR],"")}(e,t),r("stars",e),e}(e,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(n=n.filter((function(e){return!!e.match(i)}))),n.map((function(e){return new I(e,this.options)}),this)},k.prototype.intersects=function(e,t){if(!(e instanceof k))throw new TypeError("a Range is required");return this.set.some((function(r){return N(r,t)&&e.set.some((function(e){return N(e,t)&&r.every((function(r){return e.every((function(e){return r.intersects(e,t)}))}))}))}))},t.toComparators=function(e,t){return new k(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))},k.prototype.test=function(e){if(!e)return!1;if("string"==typeof e)try{e=new g(e,this.options)}catch(e){return!1}for(var t=0;t<this.set.length;t++)if(M(this.set[t],e,this.options))return!0;return!1},t.satisfies=F,t.maxSatisfying=function(e,t,r){var s=null,i=null;try{var n=new k(t,r)}catch(e){return null}return e.forEach((function(e){n.test(e)&&(s&&-1!==i.compare(e)||(i=new g(s=e,r)))})),s},t.minSatisfying=function(e,t,r){var s=null,i=null;try{var n=new k(t,r)}catch(e){return null}return e.forEach((function(e){n.test(e)&&(s&&1!==i.compare(e)||(i=new g(s=e,r)))})),s},t.minVersion=function(e,t){e=new k(e,t);var r=new g("0.0.0");if(e.test(r))return r;if(r=new g("0.0.0-0"),e.test(r))return r;r=null;for(var s=0;s<e.set.length;++s)e.set[s].forEach((function(e){var t=new g(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":r&&!E(r,t)||(r=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}));return r&&e.test(r)?r:null},t.validRange=function(e,t){try{return new k(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,r){return L(e,t,"<",r)},t.gtr=function(e,t,r){return L(e,t,">",r)},t.outside=L,t.prerelease=function(e,t){var r=y(e,t);return r&&r.prerelease.length?r.prerelease:null},t.intersects=function(e,t,r){return e=new k(e,r),t=new k(t,r),e.intersects(t)},t.coerce=function(e,t){if(e instanceof g)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;var r=null;if((t=t||{}).rtl){for(var s;(s=o[c.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),o[c.COERCERTL].lastIndex=s.index+s[1].length+s[2].length;o[c.COERCERTL].lastIndex=-1}else r=e.match(o[c.COERCE]);return null===r?null:y(r[2]+"."+(r[3]||"0")+"."+(r[4]||"0"),t)}},678:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MATCH_COMPLETIONS=t.BASE_COMPLETIONS=void 0;const i=r(46993),n=s(r(97699)),a=r(15403);t.BASE_COMPLETIONS=[].concat(a.EXPRESSION_OPERATORS,a.CONVERSION_OPERATORS,a.BSON_TYPES,a.STAGE_OPERATORS),t.MATCH_COMPLETIONS=[].concat(a.QUERY_OPERATORS,a.BSON_TYPES);const o=a.STAGE_OPERATORS.filter((({namespaces:e})=>1===e.length&&e[0]===a.DATABASE));function l(e,t,r){const s=e.connectionInfo(),i=e.apiVersionInfo();let o;o=(null==i?void 0:i.strict)&&t.apiVersions?t.apiVersions.includes(+i.version):!t[r]||!(null==s?void 0:s.server_version)||n.default.gte(s.server_version,t[r]);const l=!t.env||!s||(s.is_data_federation?t.env.includes(a.ADL):s.is_atlas||s.is_local_atlas?t.env.includes(a.ATLAS):t.env.includes(a.ON_PREM));return o&&l}function c(e,t){return t.includes("$project")?a.ACCUMULATORS.filter((t=>l(e,t,"projectVersion"))):t.includes("$group")?a.ACCUMULATORS:[]}function p(e,t,r,s){return t.filter((t=>t.name&&t.name.startsWith(r)&&l(e,t,"version"))).map((e=>`${s}${e.name}`))}function u(e,t,r,s){const i=Object.keys(t).filter((s=>{var i;if(!s.toLowerCase().startsWith(r.toLowerCase()))return!1;if(t[s].deprecated)return!1;const a=e.apiVersionInfo();let o,l;if((null==a?void 0:a.strict)&&(l=t[s].apiVersions))o=+a.version>=l[0]&&+a.version<=l[1];else{const r=null===(i=e.connectionInfo())||void 0===i?void 0:i.server_version;if(!r)return!0;const a=t[s].serverVersions;o=!a||n.default.gte(r,a[0])&&n.default.lte(r,a[1])}const c=t[s].topologies,p=!c||c.includes(e.topology());return o&&p}));return s?i.map((e=>`${s.slice(0,-1).join(".")}.${e}`)):i}t.default=async function(e,r){var s,n,a;const l=i.signatures.ShellApi.attributes,h=i.signatures.Collection.attributes,d=i.signatures.Database.attributes,f=i.signatures.AggregationCursor.attributes,m=i.signatures.Cursor.attributes,y=i.signatures.ReplicaSet.attributes,g=i.signatures.ShellConfig.attributes,b=i.signatures.Shard.attributes,x=r.split(/(?<!\S)(?=\S)/),v=x[0].trim();if(null===(s=l[v])||void 0===s?void 0:s.isDirectShellCommand){const t=l[v].shellCommandCompleter;return t?(1===x.length&&(x[0].trimEnd()===x[0]&&(x[0]+=" "),x.push("")),[(await t(e,x.map((e=>e.trim())))||[]).map((e=>[...x.slice(0,-1),e].join(""))),r,"exclusive"]):[[r],r,"exclusive"]}const E=r.split("."),P=E[0],T=E[E.length-1];if(E.length<=1){const t=u(e,l,T);return[t.length?t:[],r]}if(/\bdb\b/.exec(P)&&2===E.length){if(/aggregate\s*\(\s*\[\s*\{\s*/.exec(T)){const s=r.split("{"),i=(null===(n=s.pop())||void 0===n?void 0:n.trim())||"",a=i?r.split(i).shift():r,l=p(e,s.length<=2?o:[...t.BASE_COMPLETIONS,...c(e,T)],i,a);return[l.length?l:[],r]}const s=u(e,d,T,E),i=await e.getCollectionCompletionsForCurrentDb(T.trim());return s.push(...i.map((e=>`${E[0]}.${e}`))),[s.length?s:[],r]}if(/\bdb\b/.exec(P)&&E.length>2){if(!/^\s*\w+\s*$/.exec(E[1])&&!/\bgetCollection\b/.exec(E[1]))return[[],r];if(E.length>3){if(/\baggregate\b/.exec(E[2])){const t=u(e,f,T,E);return[t.length?t:[],r]}if(/\bfind\b/.exec(E[2])){const t=u(e,m,T,E);return[t.length?t:[],r]}return[[],r]}if(E[2].includes("([")||E[2].includes("({")){let s;s=/\baggregate\b/.exec(E[2])?[...t.BASE_COMPLETIONS,...c(e,T)]:t.MATCH_COMPLETIONS;const i=null===(a=r.split("{").pop())||void 0===a?void 0:a.trim(),n=p(e,s,i||"",i?r.split(i).shift():r);return[n.length?n:[],r]}const s=u(e,h,T,E);return[s.length?s:[],r]}if(/\bsh\b/.exec(P)&&2===E.length){const t=u(e,b,T,E);return[t.length?t:[],r]}if(/\brs\b/.exec(P)&&2===E.length){const t=u(e,y,T,E);return[t.length?t:[],r]}if(/\bconfig\b/.exec(P)&&2===E.length){const t=u(e,g,T,E);return[t.length?t:[],r]}return[[],r]}},14314:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Editor=t.createCommands=t.editorStyles=void 0;const a=n(r(99497)),o=r(30709),l=r(22970),c=()=>{};function p({state:e,dispatch:t}){return t(e.update({selection:{anchor:e.doc.length},scrollIntoView:!0,userEvent:"select"})),!0}function u(e){return[{key:"Enter",run:()=>(e.onEnter(),!0),preventDefault:!0},{key:"ArrowUp",run:t=>{const r=t.state.selection.main;return!!r.empty&&(0===t.lineBlockAt(r.from).from&&(e.onArrowUpOnFirstLine().then((e=>{e&&p(t)})),!0))},preventDefault:!0},{key:"ArrowDown",run:t=>{const r=t.state.selection.main;return!!r.empty&&(t.lineBlockAt(r.from).to===t.state.doc.length&&(e.onArrowDownOnLastLine().then((e=>{e&&p(t)})),!0))},preventDefault:!0},{key:"Mod-l",run:()=>(e.onClearCommand(),!0),preventDefault:!0},{key:"Ctrl-c",run:()=>(e.onSigInt(),!0),preventDefault:!0}]}t.editorStyles=(0,o.css)({"& .cm-content":{paddingTop:0,paddingBottom:0},"& .cm-line":{paddingLeft:1,paddingRight:1}}),t.createCommands=u;class h extends a.Component{constructor(e){super(e),this.editorId=Date.now(),this.autocompleter=e=>{var t;if(!(null===(t=this.props.autocompleter)||void 0===t?void 0:t.getCompletions))return null;const r=e.state.doc.lineAt(e.pos);return this.props.autocompleter.getCompletions(r.text).then((e=>e&&e.length>0?{from:r.from,options:e.map((({completion:e})=>({label:e})))}:null),(()=>null))},this.commands=u(this.props)}render(){return a.default.createElement(l.CodemirrorInlineEditor,{id:`mongosh-ace-${this.editorId}`,language:"javascript",ref:this.props.editorRef,readOnly:this.props.operationInProgress,text:this.props.value,onChangeText:this.props.onChange,commands:this.commands,maxLines:1/0,className:t.editorStyles,completer:this.autocompleter,lineHeight:24})}}t.Editor=h,h.defaultProps={onEnter:c,onArrowUpOnFirstLine:()=>Promise.resolve(!1),onArrowDownOnLastLine:()=>Promise.resolve(!1),onChange:c,onClearCommand:c,onSigInt:c,operationInProgress:!1,value:""}},43240:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordPrompt=void 0;const a=n(r(99497)),o=r(30709),l=(0,o.css)({paddingLeft:23,"& input":{fontSize:"13px",lineHeight:"24px",fontFamily:o.fontFamilies.code,backgroundColor:o.palette.gray.dark4,color:o.palette.gray.light3,padding:"0 3px",border:`1px solid ${o.palette.gray.light3}`,borderRadius:3}});class c extends a.Component{constructor(e){super(e),this.onKeyDown=e=>{switch(e.key){case"Enter":this.props.onFinish(e.target.value);break;case"Esc":case"Escape":this.props.onCancel()}}}render(){return a.default.createElement("label",{className:l},this.props.prompt,": ",a.default.createElement("input",{type:"password",onKeyDown:this.onKeyDown,autoFocus:!0}))}}t.PasswordPrompt=c},31801:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellInput=void 0;const o=n(r(99497)),l=r(30709),c=r(14314),p=a(r(13013)),u=r(558),h=(0,l.css)({padding:"0 8px",minHeight:"24px"});class d extends o.Component{constructor(e){super(e),this.state={currentValue:"",readOnly:!1},this.historyNavigationEntries=[],this.historyNavigationIndex=0,this.onChange=e=>{this.setState({currentValue:e})},this.historyBack=()=>new Promise((e=>{if(this.historyNavigationIndex>=this.historyNavigationEntries.length-1)return e(!1);this.historyNavigationIndex++,this.syncCurrentValueWithHistoryNavigation(e)})),this.historyNext=()=>new Promise((e=>{if(this.historyNavigationIndex<=0)return e(!1);this.historyNavigationIndex--,this.syncCurrentValueWithHistoryNavigation(e)})),this.onEnter=async()=>{this.props.onInput&&await this.props.onInput(this.state.currentValue),this.setState({currentValue:""})},this.initializeHistoryNavigation()}componentDidUpdate(e){e.history!==this.props.history&&this.initializeHistoryNavigation(),0===this.historyNavigationIndex&&(this.historyNavigationEntries[0]=this.state.currentValue)}initializeHistoryNavigation(){this.historyNavigationEntries=[this.state.currentValue,...this.props.history||[]],this.historyNavigationIndex=0}syncCurrentValueWithHistoryNavigation(e){const t=this.historyNavigationEntries[this.historyNavigationIndex];if(void 0===t)return e(!1);this.setState({currentValue:t},(()=>{e(!0)}))}render(){let e;if(this.props.operationInProgress)e=o.default.createElement(p.default,null);else if(this.props.prompt){const t=this.props.prompt.trim();e=t.endsWith(">")?o.default.createElement(o.default.Fragment,null,o.default.createElement("span",null,t.replace(/>$/g,"")),o.default.createElement(l.Icon,{size:12,glyph:"ChevronRight"})):o.default.createElement("span",null,t)}else e=o.default.createElement(l.Icon,{size:12,glyph:"ChevronRight"});const t=o.default.createElement(c.Editor,{autocompleter:this.props.autocompleter,onArrowUpOnFirstLine:this.historyBack,onArrowDownOnLastLine:this.historyNext,onChange:this.onChange,onEnter:this.onEnter,onClearCommand:this.props.onClearCommand,editorRef:this.props.editorRef,value:this.state.currentValue,operationInProgress:this.props.operationInProgress,onSigInt:this.props.onSigInt});return o.default.createElement(u.LineWithIcon,{className:h,icon:e,"data-testid":"shell-input"},t)}}t.ShellInput=d},13013:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const a=n(r(99497)),o=r(30709),l=(0,o.css)({"& div":{borderTopColor:o.palette.green.light2}});class c extends a.Component{render(){const{size:e}=this.props;return a.default.createElement("div",{className:l},a.default.createElement(o.SpinLoader,{size:e}))}}c.defaultProps={size:"12px"},t.default=c},44790:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellOutputLine=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(30709),p=r(558),u=r(79395),h=r(9274),d=r(68661),f=r(15484),m=r(17680),y=r(84050),g=r(65734),b=r(98222),x=r(99489),v=r(38616),E=r(25572),P=(0,c.css)({padding:"0 8px"}),T=(0,c.css)({backgroundColor:c.palette.red.light2,color:c.palette.red.dark3}),S=(0,c.css)({color:c.palette.gray.dark1}),A=(0,c.css)({color:"inherit"});class w extends o.Component{renderValue(){const{type:e,value:t,format:r}=this.props.entry;return"input"===r||this.isPreformattedResult(t,e)?o.default.createElement("pre",null,t):"string"==typeof t&&"InspectResult"===e?o.default.createElement(x.SimpleTypeOutput,{value:t,raw:!0}):this.isPrimitiveOrFunction(t)?o.default.createElement(x.SimpleTypeOutput,{value:t}):"Help"===e?o.default.createElement(u.HelpOutput,{value:t}):"ShowDatabasesResult"===e?o.default.createElement(d.ShowDbsOutput,{value:t}):"StatsResult"===e?o.default.createElement(b.StatsResultOutput,{value:t}):"ListCommandsResult"===e?o.default.createElement(x.SimpleTypeOutput,{value:t}):"ShowCollectionsResult"===e?o.default.createElement(f.ShowCollectionsOutput,{value:t}):"ShowBannerResult"===e?o.default.createElement(h.ShowBannerResultOutput,{value:t}):"Cursor"===e||"AggregationCursor"===e?o.default.createElement(m.CursorOutput,{value:t}):"CursorIterationResult"===e?o.default.createElement(y.CursorIterationResultOutput,{value:t}):"ShowProfileResult"===e?o.default.createElement(E.ShowProfileOutput,{value:t}):this.isError(t)?o.default.createElement(v.ErrorOutput,{value:t}):o.default.createElement(g.ObjectOutput,{value:t})}isError(e){return"string"==typeof e.message&&"string"==typeof e.stack}isPreformattedResult(e,t){return"string"==typeof e&&("Database"===t||"Collection"===t||!t)}isPrimitiveOrFunction(e){return e!==Object(e)||"function"==typeof e}getIconGlyph(){const{format:e}=this.props.entry;return"input"===e?"ChevronRight":"error"===e?"XWithCircle":"ChevronLeft"}render(){const{format:e}=this.props.entry,t=o.default.createElement(c.Icon,{size:12,glyph:this.getIconGlyph(),className:(0,c.cx)("error"===e?A:S)});return o.default.createElement(p.LineWithIcon,{className:(0,c.cx)(P,"error"===e&&T),icon:t,"data-testid":"shell-output"},this.renderValue())}}t.ShellOutputLine=w,w.propTypes={entry:l.default.object.isRequired}},91295:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(44790);class p extends o.Component{constructor(){super(...arguments),this.renderLine=(e,t)=>o.default.createElement(c.ShellOutputLine,{key:`shell-output-entry-${t}`,entry:e})}render(){return this.props.output.filter((e=>void 0!==e.value)).map(this.renderLine)}}t.ShellOutput=p,p.propTypes={output:l.default.arrayOf(l.default.any).isRequired}},29103:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Shell=void 0;const a=n(r(99497)),o=r(30709),l=r(46177),c=r(43240),p=r(31801),u=r(91295),h=(0,o.css)({fontSize:"13px",lineHeight:"24px",fontFamily:o.fontFamilies.code,backgroundColor:o.palette.gray.dark4,color:o.palette.gray.light3,padding:"4px 0",width:"100%",height:"100%",overflowY:"scroll",overflowX:"hidden","& a, & a:link, & a:visited, & a:hover, & a:active":{fontWeight:"bold",color:"inherit",backgroundColor:"transparent",textDecoration:"underline",cursor:"pointer"},"& pre, & code":{background:"transparent",border:"0px transparent",padding:0,margin:0,fontSize:"inherit",borderRadius:0,color:"inherit",tabSize:2}}),d=()=>{};class f extends a.Component{constructor(){super(...arguments),this.shellInputElement=null,this.editor=null,this.onFinishPasswordPrompt=d,this.onCancelPasswordPrompt=d,this.state={operationInProgress:!1,output:this.props.initialOutput.slice(-this.props.maxOutputLength),history:this.props.initialHistory.slice(0,this.props.maxHistoryLength),passwordPrompt:"",shellPrompt:">"},this.evaluate=async e=>{let t;try{this.props.onOperationStarted(),this.props.runtime.setEvaluationListener(this);const r=await this.props.runtime.evaluate(e);t={format:"output",type:r.type,value:r.printable}}catch(e){t={format:"error",value:e}}finally{await this.updateShellPrompt(),this.props.onOperationEnd()}return t},this.onClearCommand=()=>{const e=[];Object.freeze(e),this.setState({output:e}),this.props.onOutputChanged(e)},this.onPrint=e=>{const t=this.addEntriesToOutput(e.map((e=>({format:"output",type:e.type,value:e.printable}))));this.setState({output:t}),this.props.onOutputChanged(t)},this.onPrompt=(e,t)=>{if("password"!==t)return Promise.reject(new Error("yes/no prompts not implemented yet"));const r=()=>{this.onFinishPasswordPrompt=d,this.onCancelPasswordPrompt=d,this.setState({passwordPrompt:""}),setTimeout(this.focusEditor,1)},s=new Promise(((e,t)=>{this.onFinishPasswordPrompt=t=>{r(),e(t)},this.onCancelPasswordPrompt=()=>{r(),t(new Error("Canceled by user"))}}));return this.setState({passwordPrompt:e}),s},this.onInput=async e=>{if(!e||""===e.trim())return void this.appendEmptyInput();const t={format:"input",value:e};let r=this.addEntriesToOutput([t]);this.setState({operationInProgress:!0,output:r}),this.props.onOutputChanged(r);const s=await this.evaluate(e);r=this.addEntriesToOutput([s]);const i=this.addEntryToHistory(e);this.setState({operationInProgress:!1,output:r,history:i}),this.props.onOutputChanged(r),this.props.onHistoryChanged(i)},this.onShellClicked=e=>{e.currentTarget===e.target&&this.focusEditor()},this.setEditor=e=>{this.editor=e},this.focusEditor=()=>{var e;null===(e=this.editor)||void 0===e||e.focus()},this.onSigInt=()=>this.state.operationInProgress&&this.props.runtime.interrupt?this.props.runtime.interrupt():Promise.resolve(!1)}componentDidMount(){this.scrollToBottom(),this.updateShellPrompt()}componentDidUpdate(){this.scrollToBottom()}async updateShellPrompt(){var e;let t=">",r=!1;try{this.props.runtime.setEvaluationListener(this);const e=await this.props.runtime.evaluate("\n (() => {\n switch (typeof prompt) {\n case 'function':\n return prompt();\n case 'string':\n return prompt;\n }\n })()");null===e.type&&"string"==typeof e.printable&&(t=e.printable,r=!0)}catch(e){}if(!r)try{t=null!==(e=await this.props.runtime.getShellPrompt())&&void 0!==e?e:">"}catch(e){}this.setState({shellPrompt:t})}addEntryToHistory(e){const t=[e,...this.state.history];return(0,l.changeHistory)(t,this.props.redactInfo?"redact-sensitive-data":"keep-sensitive-data"),t.splice(this.props.maxHistoryLength),Object.freeze(t),t}addEntriesToOutput(e){const t=[...this.state.output,...e];return t.splice(0,t.length-this.props.maxOutputLength),Object.freeze(t),t}appendEmptyInput(){const e=this.addEntriesToOutput([{format:"input",value:" "}]);this.setState({output:e})}scrollToBottom(){this.shellInputElement&&this.shellInputElement.scrollIntoView()}renderInput(){return this.state.passwordPrompt?a.default.createElement(c.PasswordPrompt,{onFinish:this.onFinishPasswordPrompt,onCancel:this.onCancelPasswordPrompt,prompt:this.state.passwordPrompt}):a.default.createElement(p.ShellInput,{prompt:this.state.shellPrompt,autocompleter:this.props.runtime,history:this.state.history,onClearCommand:this.onClearCommand,onInput:this.onInput,operationInProgress:this.state.operationInProgress,editorRef:this.setEditor,onSigInt:this.onSigInt})}render(){return a.default.createElement(o.ThemeProvider,{theme:{theme:o.Theme.Dark,enabled:!0}},a.default.createElement("div",{"data-testid":"shell",className:h,onClick:this.onShellClicked},a.default.createElement("div",null,a.default.createElement(u.ShellOutput,{output:this.state.output})),a.default.createElement("div",{ref:e=>{this.shellInputElement=e}},this.renderInput())))}}t.Shell=f,f.defaultProps={onHistoryChanged:d,onOperationStarted:d,onOperationEnd:d,onOutputChanged:d,maxOutputLength:1e3,maxHistoryLength:1e3,initialOutput:[],initialHistory:[]}},84050:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorIterationResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(65734),p=a(r(2416));class u extends o.Component{constructor(){super(...arguments),this.renderDocument=(e,t)=>o.default.createElement(c.ObjectOutput,{key:`document-${t}`,value:e})}render(){if(!this.props.value.documents.length)return o.default.createElement("div",null,p.default.__("shell-api.classes.Cursor.iteration.no-cursor"));const e=this.props.value.cursorHasMore?o.default.createElement("pre",null,p.default.__("shell-api.classes.Cursor.iteration.type-it-for-more")):"";return o.default.createElement("div",null,this.props.value.documents.map(this.renderDocument),e)}}t.CursorIterationResultOutput=u,u.propTypes={value:l.default.arrayOf(l.default.object).isRequired}},17680:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(84050);class p extends o.Component{render(){return this.props.value.documents.length?o.default.createElement(c.CursorIterationResultOutput,{value:this.props.value}):o.default.createElement("pre",null)}}t.CursorOutput=p,p.propTypes={value:l.default.arrayOf(l.default.object).isRequired}},38616:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(6534),p=r(99489),u=r(60868);class h extends o.Component{renderCollapsed(e){return o.default.createElement("div",null,o.default.createElement("pre",null,o.default.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),e()}},this.props.value.name||"Error",":")," ",this.props.value.message))}formatStack(){return this.props.value.stack.split("\n").slice(1).join("\n")}formatErrorBugReportInfo(){if((0,c.isShouldReportAsBugError)(this.props.value))return o.default.createElement("div",null,"This is an error inside mongosh. Please"," ",o.default.createElement("a",{href:"https://jira.mongodb.org/projects/MONGOSH/issues",target:"_blank",rel:"noreferrer"},"file a bug report for the MONGOSH project"),".")}formatErrorInfo(){if(this.props.value.errInfo)return o.default.createElement("div",null,"Additional information:",o.default.createElement(p.SimpleTypeOutput,{value:this.props.value.errInfo}))}formatErrorResult(){if(this.props.value.result)return o.default.createElement("div",null,"Result:",o.default.createElement(p.SimpleTypeOutput,{value:this.props.value.result}))}renderExpanded(e){return o.default.createElement("div",null,this.renderCollapsed(e),o.default.createElement("div",null,this.formatErrorBugReportInfo(),this.formatErrorInfo(),this.formatErrorResult(),o.default.createElement("pre",null,this.formatStack())))}render(){return o.default.createElement(u.Expandable,null,((e,t)=>e?this.renderExpanded(t):this.renderCollapsed(t)))}}t.ErrorOutput=h,h.propTypes={value:l.default.any}},79395:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HelpOutput=void 0;const o=n(r(99497)),l=r(30709),c=a(r(13980)),p=a(r(2416)),u=(0,l.css)({"& table, & caption, & tbody, & tfoot, & thead, & tr, & th, & td":{margin:0,padding:0,border:0,outline:0,fontSize:"100%",verticalAlign:"baseline",background:"transparent"},"& table":{width:"100%",tableLayout:"fixed",overflowWrap:"break-word",textAlign:"left",margin:"1em 0","& th":{width:"25%",fontWeight:"bold"},"& th, & td":{textAlign:"left"}}});class h extends o.Component{constructor(){super(...arguments),this.renderAttrTable=e=>{if(e&&e.length)return o.default.createElement("table",null,o.default.createElement("tbody",null,e.map(this.renderAttrTableRow)))},this.renderAttrTableRow=(e,t)=>o.default.createElement("tr",{key:`row-${t}`},o.default.createElement("th",null,e.name),o.default.createElement("td",null,e.description))}renderHelpDocsLink(e){if(e)return o.default.createElement("div",null,p.default.__("cli-repl.args.moreInformation")," ",o.default.createElement("a",{href:e,target:"_blank",rel:"noreferrer"},e))}renderHelpText(e){if(e)return o.default.createElement("div",null,e)}render(){const e=this.props.value;return o.default.createElement("div",{className:u},this.renderHelpText(e.help),this.renderAttrTable(e.attr),this.renderHelpDocsLink(e.docs))}}t.HelpOutput=h,h.propTypes={value:c.default.object.isRequired}},65734:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(29824),p=r(46403);class u extends o.Component{render(){return o.default.createElement(c.SyntaxHighlight,{code:(0,p.inspect)(this.props.value)})}}t.ObjectOutput=u,u.propTypes={value:l.default.any}},9274:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowBannerResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(30709);class p extends o.Component{render(){var e,t;return o.default.createElement(o.default.Fragment,null,(null===(e=this.props.value)||void 0===e?void 0:e.header)&&o.default.createElement(c.H3,null,this.props.value.header),(null===(t=this.props.value)||void 0===t?void 0:t.content)&&o.default.createElement("pre",null,this.props.value.content))}}t.ShowBannerResultOutput=p,p.propTypes={value:l.default.any}},15484:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowCollectionsOutput=void 0;const o=r(30709),l=a(r(13980)),c=n(r(99497)),p=(0,o.css)({fontWeight:"bold"}),u=(0,o.css)({color:o.palette.gray.base});function h(e){return e.name.startsWith("system.")||e.name.startsWith("enxcol_.")}class d extends c.Component{constructor(){super(...arguments),this.renderTable=e=>{const t=[],r=[];let s=0;e.forEach((e=>{s=Math.max(s,e.name.length),h(e)?t.push(e):r.push(e)}));const i=[];return[...r,...t].forEach(((e,t)=>{const r=s-e.name.length+1,n=(0,o.cx)(p,h(e)&&u);i.push(c.default.createElement("span",{key:`row-${t}`},c.default.createElement("span",{className:n},e.name),e.badge?e.badge.padStart(e.badge.length+r):"",c.default.createElement("br",null)))})),c.default.createElement(c.default.Fragment,null,i)}}render(){return c.default.createElement("pre",null,this.renderTable(this.props.value))}}t.ShowCollectionsOutput=d,d.propTypes={value:l.default.array}},68661:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowDbsOutput=void 0;const o=n(r(99497)),l=a(r(54699)),c=a(r(13980)),p=a(r(90082));function u(e){const t=e<=1e3?"0":"0.00";return(0,l.default)(e).format(t+" ib")}class h extends o.Component{constructor(){super(...arguments),this.renderTable=e=>{const t=e.map((e=>[e.name,u(e.sizeOnDisk)]));return(0,p.default)(t,{align:["l","r"]})}}render(){return o.default.createElement("pre",null,this.renderTable(this.props.value))}}t.ShowDbsOutput=h,h.propTypes={value:c.default.any}},25572:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShowProfileOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(99489),p=r(46403);class u extends o.Component{render(){if(0===this.props.value.count)return o.default.createElement(c.SimpleTypeOutput,{value:'db.system.profile is empty.\\nUse db.setProfilingLevel(2) will enable profiling.\\nUse db.getCollection("system.profile").find() to show raw profile entries.'});const e=this.props.value.result.map((e=>{const t=`${e.op} ${e.ns} ${e.millis}ms ${String(e.ts).substring(0,24)}\n`;let r="";for(const t in e){if("op"===t||"ns"===t||"millis"===t||"ts"===t)continue;const s=e[t],i=typeof s;r+="object"===i?t+":"+(0,p.inspect)(s)+" ":"boolean"===i?t+" ":t+":"+s+" "}return`${t}${r}`}));return o.default.createElement(c.SimpleTypeOutput,{value:e})}}t.ShowProfileOutput=u,u.propTypes={value:l.default.object}},99489:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleTypeOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(29824),p=r(46403);class u extends o.Component{render(){const e=this.props.raw?this.props.value:(0,p.inspect)(this.props.value);return o.default.createElement(c.SyntaxHighlight,{code:e})}}t.SimpleTypeOutput=u,u.propTypes={value:l.default.any,raw:l.default.bool}},98222:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsResultOutput=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(65734);class p extends o.Component{render(){const e=[];for(const[t,r]of Object.entries(this.props.value))e.length>0&&e.push(o.default.createElement("hr",{key:`${t}-separator`})),e.push(o.default.createElement("div",{key:t},o.default.createElement("h4",null,t),o.default.createElement(c.ObjectOutput,{value:r})));return o.default.createElement("div",null,e)}}t.StatsResultOutput=p,p.propTypes={value:l.default.any}},60868:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Expandable=void 0;const a=n(r(99497)),o=r(30709),l=r(30709),c=r(558),p=(0,o.css)({cursor:"pointer"});class u extends a.Component{constructor(){super(...arguments),this.state={expanded:!1},this.toggle=()=>{this.setState({expanded:!this.state.expanded})}}render(){const e=a.default.createElement(l.Icon,{size:12,glyph:this.state.expanded?"CaretDown":"CaretRight",className:p,onClick:this.toggle});return a.default.createElement(c.LineWithIcon,{icon:e,"data-testid":"shell-output"},"function"==typeof this.props.children?this.props.children(this.state.expanded,this.toggle):this.props.children)}}t.Expandable=u,u.propTypes={}},46403:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inspect=void 0;const s=r(21764),i=r(67802),n=s.inspect.custom||"inspect",a=new WeakSet;function o(e,t){try{Object.defineProperty(e,n,{writable:!0,configurable:!0,enumerable:!1,value:function(...e){try{return t.call(this,...e)}catch(e){return console.warn("Could not inspect bson object",{obj:this,err:e}),(0,s.inspect)(this,{customInspect:!1})}}})}catch(t){console.warn("Could not add inspect key to object",{obj:e,err:t})}}function l(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return;if(a.has(e))return;a.add(e),l(Object.getPrototypeOf(e));const t=Object.getOwnPropertyDescriptors(e);for(const{value:e}of Object.values(t))l(e);const r=e._bsontype;r&&r in i.bsonStringifiers&&i.bsonStringifiers[r]&&!t[n]&&!Object.isSealed(e)?o(e,i.bsonStringifiers[r]):function(e){try{return Date.prototype.getTime.call(e),!0}catch(e){return!1}}(e)&&o(e,(function(){return this.toISOString()}))}t.inspect=function(e){return l(e),(0,s.inspect)(e,{customInspect:!0,depth:1e3,breakLength:0})}},558:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LineWithIcon=void 0;const o=n(r(99497)),l=r(30709),c=a(r(13980)),p=(0,l.css)({display:"flex",flexDirection:"row"}),u=(0,l.css)({display:"flex",alignItems:"center",marginRight:"3px",maxHeight:"24px"}),h=(0,l.css)({flex:1,overflowX:"auto"});class d extends o.Component{render(){return o.default.createElement("div",{className:(0,l.cx)(this.props.className,p),"data-testid":this.props["data-testid"]},o.default.createElement("span",{className:u},this.props.icon),o.default.createElement("div",{className:h},this.props.children))}}t.LineWithIcon=d,d.propTypes={icon:c.default.object.isRequired,className:c.default.string,"data-testid":c.default.string}},29824:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SyntaxHighlight=void 0;const o=n(r(99497)),l=a(r(13980)),c=r(22970),p=r(14314);class u extends o.Component{render(){return o.default.createElement(c.CodemirrorInlineEditor,{readOnly:!0,initialText:this.props.code,maxLines:1/0,lineHeight:24,className:p.editorStyles})}}t.SyntaxHighlight=u,u.propTypes={code:l.default.string.isRequired}},77371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeInterpreterEnvironment=void 0,t.IframeInterpreterEnvironment=class{constructor(e){this.window=e,this.sloppyEval("delete window.prompt")}sloppyEval(e){return this.window.eval(e)}getContextObject(){return this.window}}},3055:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeRuntime=void 0;const s=r(77371),i=r(92081);t.IframeRuntime=class{constructor(e){this.openContextRuntime=null,this.readyPromise=null,this.iframe=null,this.container=null,this.evaluationListener=null,this.serviceProvider=e}setEvaluationListener(e){const t=this.evaluationListener;return this.evaluationListener=e,this.openContextRuntime&&this.openContextRuntime.setEvaluationListener(e),t}async evaluate(e){const t=await this.initialize();return await t.evaluate(e)}async getCompletions(e){const t=await this.initialize();return await t.getCompletions(e)}async getShellPrompt(){const e=await this.initialize();return await e.getShellPrompt()}async initialize(){if(null!==this.readyPromise)return await this.readyPromise,this.openContextRuntime;this.container=document.createElement("div"),this.container.style.display="none",this.container.insertAdjacentHTML("beforeend",'<iframe src="about:blank" style="display: none" sandbox="allow-same-origin" />');const e=this.container.firstElementChild;this.iframe=e,this.readyPromise=new Promise((t=>{e.onload=()=>{t()}})),document.body.appendChild(this.container);const t=new s.IframeInterpreterEnvironment(e.contentWindow);return this.openContextRuntime=new i.OpenContextRuntime(this.serviceProvider,t),this.evaluationListener&&this.openContextRuntime.setEvaluationListener(this.evaluationListener),this.initialize()}async destroy(){if(!this.iframe)return;const e=this.iframe.parentNode;e&&e.removeChild(this.iframe)}}},88617:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(3055),t)},72519:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeRuntime=t.Shell=void 0;var s=r(29103);Object.defineProperty(t,"Shell",{enumerable:!0,get:function(){return s.Shell}});var i=r(88617);Object.defineProperty(t,"IframeRuntime",{enumerable:!0,get:function(){return i.IframeRuntime}})},54699:function(e,t,r){var s,i;s=function(){var e,t,r,s,i,n={},a={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},l={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function c(e,t){this._input=e,this._value=t}return(e=function(r){var s,i,a,o;if(e.isNumeral(r))s=r.value();else if(0===r||void 0===r)s=0;else if(null===r||t.isNaN(r))s=null;else if("string"==typeof r)if(l.zeroFormat&&r===l.zeroFormat)s=0;else if(l.nullFormat&&r===l.nullFormat||!r.replace(/[^0-9]+/g,"").length)s=null;else{for(i in n)if((o="function"==typeof n[i].regexps.unformat?n[i].regexps.unformat():n[i].regexps.unformat)&&r.match(o)){a=n[i].unformat;break}s=(a=a||e._.stringToNumber)(r)}else s=Number(r)||null;return new c(r,s)}).version="2.0.6",e.isNumeral=function(e){return e instanceof c},e._=t={numberToFormat:function(t,r,s){var i,n,o,l,c,p,u,h,d=a[e.options.currentLocale],f=!1,m=!1,y="",g=1e12,b=1e9,x=1e6,v="",E=!1;if(t=t||0,n=Math.abs(t),e._.includes(r,"(")?(f=!0,r=r.replace(/[\(|\)]/g,"")):(e._.includes(r,"+")||e._.includes(r,"-"))&&(c=e._.includes(r,"+")?r.indexOf("+"):t<0?r.indexOf("-"):-1,r=r.replace(/[\+|\-]/g,"")),e._.includes(r,"a")&&(i=!!(i=r.match(/a(k|m|b|t)?/))&&i[1],e._.includes(r," a")&&(y=" "),r=r.replace(new RegExp(y+"a[kmbt]?"),""),n>=g&&!i||"t"===i?(y+=d.abbreviations.trillion,t/=g):n<g&&n>=b&&!i||"b"===i?(y+=d.abbreviations.billion,t/=b):n<b&&n>=x&&!i||"m"===i?(y+=d.abbreviations.million,t/=x):(n<x&&n>=1e3&&!i||"k"===i)&&(y+=d.abbreviations.thousand,t/=1e3)),e._.includes(r,"[.]")&&(m=!0,r=r.replace("[.]",".")),o=t.toString().split(".")[0],l=r.split(".")[1],p=r.indexOf(","),h=(r.split(".")[0].split(",")[0].match(/0/g)||[]).length,l?(e._.includes(l,"[")?(l=(l=l.replace("]","")).split("["),v=e._.toFixed(t,l[0].length+l[1].length,s,l[1].length)):v=e._.toFixed(t,l.length,s),o=v.split(".")[0],v=e._.includes(v,".")?d.delimiters.decimal+v.split(".")[1]:"",m&&0===Number(v.slice(1))&&(v="")):o=e._.toFixed(t,0,s),y&&!i&&Number(o)>=1e3&&y!==d.abbreviations.trillion)switch(o=String(Number(o)/1e3),y){case d.abbreviations.thousand:y=d.abbreviations.million;break;case d.abbreviations.million:y=d.abbreviations.billion;break;case d.abbreviations.billion:y=d.abbreviations.trillion}if(e._.includes(o,"-")&&(o=o.slice(1),E=!0),o.length<h)for(var P=h-o.length;P>0;P--)o="0"+o;return p>-1&&(o=o.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),0===r.indexOf(".")&&(o=""),u=o+v+(y||""),f?u=(f&&E?"(":"")+u+(f&&E?")":""):c>=0?u=0===c?(E?"-":"+")+u:u+(E?"-":"+"):E&&(u="-"+u),u},stringToNumber:function(e){var t,r,s,i=a[l.currentLocale],n=e,o={thousand:3,million:6,billion:9,trillion:12};if(l.zeroFormat&&e===l.zeroFormat)r=0;else if(l.nullFormat&&e===l.nullFormat||!e.replace(/[^0-9]+/g,"").length)r=null;else{for(t in r=1,"."!==i.delimiters.decimal&&(e=e.replace(/\./g,"").replace(i.delimiters.decimal,".")),o)if(s=new RegExp("[^a-zA-Z]"+i.abbreviations[t]+"(?:\\)|(\\"+i.currency.symbol+")?(?:\\))?)?$"),n.match(s)){r*=Math.pow(10,o[t]);break}r*=(e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1,e=e.replace(/[^0-9\.]+/g,""),r*=Number(e)}return r},isNaN:function(e){return"number"==typeof e&&isNaN(e)},includes:function(e,t){return-1!==e.indexOf(t)},insert:function(e,t,r){return e.slice(0,r)+t+e.slice(r)},reduce:function(e,t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var r,s=Object(e),i=s.length>>>0,n=0;if(3===arguments.length)r=arguments[2];else{for(;n<i&&!(n in s);)n++;if(n>=i)throw new TypeError("Reduce of empty array with no initial value");r=s[n++]}for(;n<i;n++)n in s&&(r=t(r,s[n],n,s));return r},multiplier:function(e){var t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)},correctionFactor:function(){return Array.prototype.slice.call(arguments).reduce((function(e,r){var s=t.multiplier(r);return e>s?e:s}),1)},toFixed:function(e,t,r,s){var i,n,a,o,l=e.toString().split("."),c=t-(s||0);return i=2===l.length?Math.min(Math.max(l[1].length,c),t):c,a=Math.pow(10,i),o=(r(e+"e+"+i)/a).toFixed(i),s>t-i&&(n=new RegExp("\\.?0{1,"+(s-(t-i))+"}$"),o=o.replace(n,"")),o}},e.options=l,e.formats=n,e.locales=a,e.locale=function(e){return e&&(l.currentLocale=e.toLowerCase()),l.currentLocale},e.localeData=function(e){if(!e)return a[l.currentLocale];if(e=e.toLowerCase(),!a[e])throw new Error("Unknown locale : "+e);return a[e]},e.reset=function(){for(var e in o)l[e]=o[e]},e.zeroFormat=function(e){l.zeroFormat="string"==typeof e?e:null},e.nullFormat=function(e){l.nullFormat="string"==typeof e?e:null},e.defaultFormat=function(e){l.defaultFormat="string"==typeof e?e:"0.0"},e.register=function(e,t,r){if(t=t.toLowerCase(),this[e+"s"][t])throw new TypeError(t+" "+e+" already registered.");return this[e+"s"][t]=r,r},e.validate=function(t,r){var s,i,n,a,o,l,c,p;if("string"!=typeof t&&(t+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",t)),(t=t.trim()).match(/^\d+$/))return!0;if(""===t)return!1;try{c=e.localeData(r)}catch(t){c=e.localeData(e.locale())}return n=c.currency.symbol,o=c.abbreviations,s=c.delimiters.decimal,i="."===c.delimiters.thousands?"\\.":c.delimiters.thousands,!(null!==(p=t.match(/^[^\d]+/))&&(t=t.substr(1),p[0]!==n)||null!==(p=t.match(/[^\d]+$/))&&(t=t.slice(0,-1),p[0]!==o.thousand&&p[0]!==o.million&&p[0]!==o.billion&&p[0]!==o.trillion)||(l=new RegExp(i+"{2}"),t.match(/[^\d.,]/g)||(a=t.split(s)).length>2||(a.length<2?!a[0].match(/^\d+.*\d$/)||a[0].match(l):1===a[0].length?!a[0].match(/^\d+$/)||a[0].match(l)||!a[1].match(/^\d+$/):!a[0].match(/^\d+.*\d$/)||a[0].match(l)||!a[1].match(/^\d+$/))))},e.fn=c.prototype={clone:function(){return e(this)},format:function(t,r){var s,i,a,o=this._value,c=t||l.defaultFormat;if(r=r||Math.round,0===o&&null!==l.zeroFormat)i=l.zeroFormat;else if(null===o&&null!==l.nullFormat)i=l.nullFormat;else{for(s in n)if(c.match(n[s].regexps.format)){a=n[s].format;break}i=(a=a||e._.numberToFormat)(o,c,r)}return i},value:function(){return this._value},input:function(){return this._input},set:function(e){return this._value=Number(e),this},add:function(e){var r=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([this._value,e],(function(e,t,s,i){return e+Math.round(r*t)}),0)/r,this},subtract:function(e){var r=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([e],(function(e,t,s,i){return e-Math.round(r*t)}),Math.round(this._value*r))/r,this},multiply:function(e){return this._value=t.reduce([this._value,e],(function(e,r,s,i){var n=t.correctionFactor(e,r);return Math.round(e*n)*Math.round(r*n)/Math.round(n*n)}),1),this},divide:function(e){return this._value=t.reduce([this._value,e],(function(e,r,s,i){var n=t.correctionFactor(e,r);return Math.round(e*n)/Math.round(r*n)})),this},difference:function(t){return Math.abs(e(this._value).subtract(t).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},currency:{symbol:"$"}}),e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(t,r,s){var i,n=e._.includes(r," BPS")?" ":"";return t*=1e4,r=r.replace(/\s?BPS/,""),i=e._.numberToFormat(t,r,s),e._.includes(i,")")?((i=i.split("")).splice(-1,0,n+"BPS"),i=i.join("")):i=i+n+"BPS",i},unformat:function(t){return+(1e-4*e._.stringToNumber(t)).toFixed(15)}}),s={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},i="("+(i=(r={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}).suffixes.concat(s.suffixes.filter((function(e){return r.suffixes.indexOf(e)<0}))).join("|")).replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(i)},format:function(t,i,n){var a,o,l,c=e._.includes(i,"ib")?s:r,p=e._.includes(i," b")||e._.includes(i," ib")?" ":"";for(i=i.replace(/\s?i?b/,""),a=0;a<=c.suffixes.length;a++)if(o=Math.pow(c.base,a),l=Math.pow(c.base,a+1),null===t||0===t||t>=o&&t<l){p+=c.suffixes[a],o>0&&(t/=o);break}return e._.numberToFormat(t,i,n)+p},unformat:function(t){var i,n,a=e._.stringToNumber(t);if(a){for(i=r.suffixes.length-1;i>=0;i--){if(e._.includes(t,r.suffixes[i])){n=Math.pow(r.base,i);break}if(e._.includes(t,s.suffixes[i])){n=Math.pow(s.base,i);break}}a*=n||1}return a}}),e.register("format","currency",{regexps:{format:/(\$)/},format:function(t,r,s){var i,n,a=e.locales[e.options.currentLocale],o={before:r.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:r.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(r=r.replace(/\s?\$\s?/,""),i=e._.numberToFormat(t,r,s),t>=0?(o.before=o.before.replace(/[\-\(]/,""),o.after=o.after.replace(/[\-\)]/,"")):t<0&&!e._.includes(o.before,"-")&&!e._.includes(o.before,"(")&&(o.before="-"+o.before),n=0;n<o.before.length;n++)switch(o.before[n]){case"$":i=e._.insert(i,a.currency.symbol,n);break;case" ":i=e._.insert(i," ",n+a.currency.symbol.length-1)}for(n=o.after.length-1;n>=0;n--)switch(o.after[n]){case"$":i=n===o.after.length-1?i+a.currency.symbol:e._.insert(i,a.currency.symbol,-(o.after.length-(1+n)));break;case" ":i=n===o.after.length-1?i+" ":e._.insert(i," ",-(o.after.length-(1+n)+a.currency.symbol.length-1))}return i}}),e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(t,r,s){var i=("number"!=typeof t||e._.isNaN(t)?"0e+0":t.toExponential()).split("e");return r=r.replace(/e[\+|\-]{1}0/,""),e._.numberToFormat(Number(i[0]),r,s)+"e"+i[1]},unformat:function(t){var r=e._.includes(t,"e+")?t.split("e+"):t.split("e-"),s=Number(r[0]),i=Number(r[1]);return i=e._.includes(t,"e-")?i*=-1:i,e._.reduce([s,Math.pow(10,i)],(function(t,r,s,i){var n=e._.correctionFactor(t,r);return t*n*(r*n)/(n*n)}),1)}}),e.register("format","ordinal",{regexps:{format:/(o)/},format:function(t,r,s){var i=e.locales[e.options.currentLocale],n=e._.includes(r," o")?" ":"";return r=r.replace(/\s?o/,""),n+=i.ordinal(t),e._.numberToFormat(t,r,s)+n}}),e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(t,r,s){var i,n=e._.includes(r," %")?" ":"";return e.options.scalePercentBy100&&(t*=100),r=r.replace(/\s?\%/,""),i=e._.numberToFormat(t,r,s),e._.includes(i,")")?((i=i.split("")).splice(-1,0,n+"%"),i=i.join("")):i=i+n+"%",i},unformat:function(t){var r=e._.stringToNumber(t);return e.options.scalePercentBy100?.01*r:r}}),e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(e,t,r){var s=Math.floor(e/60/60),i=Math.floor((e-60*s*60)/60),n=Math.round(e-60*s*60-60*i);return s+":"+(i<10?"0"+i:i)+":"+(n<10?"0"+n:n)},unformat:function(e){var t=e.split(":"),r=0;return 3===t.length?(r+=60*Number(t[0])*60,r+=60*Number(t[1]),r+=Number(t[2])):2===t.length&&(r+=60*Number(t[0]),r+=Number(t[1])),Number(r)}}),e},void 0===(i=s.call(t,r,t,e))||(e.exports=i)},43819:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShellApiAutocompleter=void 0;const i=s(r(678));t.ShellApiAutocompleter=class{constructor(e){this.parameters=e}async getCompletions(e){if(!e)return[];const t=await(0,i.default)(this.parameters,e);return t&&t.length?t[0].map((e=>({completion:e}))):[]}}},92081:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenContextRuntime=void 0;var s=r(60484);Object.defineProperty(t,"OpenContextRuntime",{enumerable:!0,get:function(){return s.OpenContextRuntime}})},60484:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenContextRuntime=void 0;const s=r(43819),i=r(17702),n=r(46993),a=r(1136);t.OpenContextRuntime=class{constructor(e,t,r){this.autocompleter=null,this.evaluationListener=null,this.updatedConnectionInfoPromise=null,this.interpreterEnvironment=t,this.instanceState=new n.ShellInstanceState(e,r||new i.EventEmitter),this.instanceState.isInteractive=!0,this.shellEvaluator=new a.ShellEvaluator(this.instanceState),this.instanceState.setCtx(this.interpreterEnvironment.getContextObject())}async getCompletions(e){var t;return this.autocompleter||(this.autocompleter=new s.ShellApiAutocompleter(this.instanceState.getAutocompleteParameters()),null!==(t=this.updatedConnectionInfoPromise)&&void 0!==t||(this.updatedConnectionInfoPromise=this.instanceState.fetchConnectionInfo()),await this.updatedConnectionInfoPromise),this.autocompleter.getCompletions(e)}async evaluate(e){const t=this.interpreterEnvironment.sloppyEval.bind(this.interpreterEnvironment),{type:r,printable:s,source:i}=await this.shellEvaluator.customEval(t,e,this.interpreterEnvironment.getContextObject(),"");return{type:r,printable:s,source:i}}setEvaluationListener(e){const t=this.evaluationListener;return this.evaluationListener=e,this.instanceState.setEvaluationListener(e),t}async getShellPrompt(){var e;return null!==(e=this.updatedConnectionInfoPromise)&&void 0!==e||(this.updatedConnectionInfoPromise=this.instanceState.fetchConnectionInfo()),await this.updatedConnectionInfoPromise,await this.instanceState.getDefaultPrompt()}}},29830:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.CommonErrors=void 0,function(e){e.InvalidArgument="COMMON-10001",e.InvalidOperation="COMMON-10002",e.Deprecated="COMMON-10003",e.CommandFailed="COMMON-10004",e.UnexpectedInternalError="COMMON-90001",e.NotImplemented="COMMON-90002"}(r||(t.CommonErrors=r={}))},6534:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommonErrors=t.MongoshCommandFailed=t.MongoshDeprecatedError=t.MongoshUnimplementedError=t.MongoshInvalidInputError=t.MongoshInternalError=t.MongoshRuntimeError=t.MongoshWarning=t.MongoshBaseError=t.isShouldReportAsBugError=t.getScopeFromErrorCode=void 0;const s=r(29830);function i(e){if(!e)return;const t=/^([a-zA-Z0-9]+)-/.exec(e);return t?t[1]:void 0}Object.defineProperty(t,"CommonErrors",{enumerable:!0,get:function(){return s.CommonErrors}}),t.getScopeFromErrorCode=i,t.isShouldReportAsBugError=function(e){return(null==e?void 0:e.code)===s.CommonErrors.UnexpectedInternalError};class n extends Error{constructor(e,t,r,s){super(r?`[${r}] ${t}`:t),this.name=e,this.code=r,this.scope=i(r),this.metadata=s}}t.MongoshBaseError=n,t.MongoshRuntimeError=class extends n{constructor(e,t,r){super("MongoshRuntimeError",e,t,r)}},t.MongoshInternalError=class extends n{constructor(e,t){super("MongoshInternalError",e,s.CommonErrors.UnexpectedInternalError,t)}},t.MongoshUnimplementedError=class extends n{constructor(e,t,r){super("MongoshUnimplementedError",e,t,r)}},t.MongoshInvalidInputError=class extends n{constructor(e,t,r){super("MongoshInvalidInputError",e,t,r)}},t.MongoshWarning=class extends n{constructor(e,t,r){super("MongoshWarning",e,t,r)}},t.MongoshDeprecatedError=class extends n{constructor(e,t){super("MongoshDeprecatedError",e,s.CommonErrors.Deprecated,t)}},t.MongoshCommandFailed=class extends n{constructor(e,t){super("MongoshCommandFailed",`Command ${e} returned ok: 0. To see the raw results of the command, use 'runCommand' instead.`,s.CommonErrors.CommandFailed,t)}}},2416:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(64647));t.default=new i.default},8155:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i={...s(r(27098)).default};t.default=i},27098:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={"browser-repl":{},build:{},"cli-repl":{args:{usage:"$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]",options:"Options:",file:"Load the specified mongosh script",help:"Show this usage information",ipv6:"Enable IPv6 support (disabled by default)",host:"Server to connect to",port:"Port to connect to",version:"Show version information",quiet:"Silence output from the shell during the connection process",shell:"Run the shell after executing files",nodb:"Don't connect to mongod on startup - no 'db address' [arg] expected",norc:"Will not run the '.mongoshrc.js' file on start up",eval:"Evaluate javascript",json:"Print result of --eval as Extended JSON, including errors",retryWrites:"Automatically retry write operations upon transient network errors (Default: true)",authenticationOptions:"Authentication Options:",username:"Username for authentication",password:"Password for authentication",authenticationDatabase:"User source (defaults to dbname)",authenticationMechanism:"Authentication mechanism",awsIamSessionToken:"AWS IAM Temporary Session Token ID",gssapiServiceName:"Service name to use when authenticating using GSSAPI/Kerberos",gssapiHostName:"Remote host name to use for purpose of GSSAPI/Kerberos authentication",sspiHostnameCanonicalization:"Specify the SSPI hostname canonicalization (none or forward, available on Windows)",sspiRealmOverride:"Specify the SSPI server realm (available on Windows)",tlsOptions:"TLS Options:",tls:"Use TLS for all connections",tlsCertificateKeyFile:"PEM certificate/key file for TLS",tlsCertificateKeyFilePassword:"Password for key in PEM file for TLS",tlsCAFile:"Certificate Authority file for TLS",tlsCRFile:"Certificate Revocation List file for TLS",tlsAllowInvalidHostnames:"Allow connections to servers with non-matching hostnames",tlsAllowInvalidCertificates:"Allow connections to servers with invalid certificates",tlsCertificateSelector:"TLS Certificate in system store (Windows and macOS only)",tlsCRLFile:"Specifies the .pem file that contains the Certificate Revocation List",tlsDisabledProtocols:"Comma separated list of TLS protocols to disable [TLS1_0,TLS1_1,TLS1_2]",tlsUseSystemCA:"Load the operating system trusted certificate list",tlsFIPSMode:"Enable the system TLS library's FIPS mode",apiVersionOptions:"API version options:",apiVersion:"Specifies the API version to connect with",apiStrict:"Use strict API version mode",apiDeprecationErrors:"Fail deprecated commands for the specified API version",fleOptions:"FLE Options:",awsAccessKeyId:"AWS Access Key for FLE Amazon KMS",awsSecretAccessKey:"AWS Secret Key for FLE Amazon KMS",awsSessionToken:"Optional AWS Session Token ID",keyVaultNamespace:"database.collection to store encrypted FLE parameters",kmsURL:"Test parameter to override the URL of the KMS endpoint",dbAddressOptions:"DB Address Examples:","dbAddress/foo":"Foo database on local machine","dbAddress/192/foo":"Foo database on 192.168.0.5 machine","dbAddress/192/host/foo":"Foo database on 192.168.0.5 machine on port 9999","dbAddress/connectionURI":"Connection string URI can also be used",fileNames:"File Names:",filenameDescription:"A list of files to run. Files must end in .js and will exit after unless --shell is specified.",examples:"Examples:",connectionExampleWithDatabase:"Start mongosh using 'ships' database on specified connection string:",moreInformation:"For more information on usage:"},"arg-parser":{"unknown-option":"Error parsing command line: unrecognized option:"},"cli-repl":{connecting:"Connecting to:",telemetry:"To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).",disableTelemetry:"You can opt-out by running the ",command:"command.",enabledTelemetry:"Telemetry is now enabled.",disabledTelemetry:"Telemetry is now disabled.",wiki:{info:"For mongosh info see:",link:"https://docs.mongodb.com/mongodb-shell/"},additionalErrorInfo:"Additional information",additionalErrorResult:"Result",additionalErrorViolations:"Violations",additionalErrorWriteErrors:"Write Errors",errorCausedBy:"Caused by"},"uri-generator":{"no-host-port":"If a full URI is provided, you cannot also specify --host or --port","invalid-host":"The --host argument contains an invalid character","host-list-port-mismatch":"The host list contains different ports than provided by --port","diverging-service-name":"Either the --gssapiServiceName parameter or the SERVICE_NAME authentication mechanism property in the connection string can be used but not both.","gssapi-service-name-unsupported":"The gssapiServiceName query parameter is not supported anymore. Please use the --gssapiServiceName argument or the SERVICE_NAME authentication mechanism property (e.g. ?authMechanismProperties=SERVICE_NAME:<value>)."}},"service-provider-browser":{},"service-provider-core":{},"service-provider-server":{},"shell-api":{classes:{ShellApi:{help:{description:"Shell Help",link:"https://docs.mongodb.com/manual/reference/method",attributes:{use:{description:"Set current database"},it:{description:"result of the last line evaluated; use to further iterate"},exit:{description:"Quit the MongoDB shell with exit/exit()/.exit"},quit:{description:"Quit the MongoDB shell with quit/quit()"},show:{description:"'show databases'/'show dbs': Print a list of all available databases.\n'show collections'/'show tables': Print a list of all collections for current database.\n'show profile': Prints system.profile information.\n'show users': Print a list of all users for current database.\n'show roles': Print a list of all roles for current database.\n'show log <type>': log for current connection, if type is not set uses 'global'\n'show logs': Print all logs.\n"},connect:{description:"Create a new connection and return the Database object. Usage: connect(URI, username [optional], password [optional])",link:"https://docs.mongodb.com/manual/reference/method/connect"},Mongo:{description:"Create a new connection and return the Mongo object. Usage: new Mongo(URI, options [optional])",link:"https://docs.mongodb.com/manual/reference/method/Mongo/#Mongo"},version:{description:"Shell version",link:"https://docs.mongodb.com/manual/reference/method/version/"},load:{description:"Loads and runs a JavaScript file into the current shell environment",example:'load("path/to/file.js")'},enableTelemetry:{description:"Enables collection of anonymous usage data to improve the mongosh CLI"},disableTelemetry:{description:"Disables collection of anonymous usage data to improve the mongosh CLI"},passwordPrompt:{description:"Prompts the user for a password",link:"https://docs.mongodb.com/manual/reference/method/passwordPrompt/"},sleep:{description:"Sleep for the specified number of milliseconds",link:"https://docs.mongodb.com/manual/reference/method/sleep/",example:"sleep(5000)"},cls:{description:"Clears the screen like console.clear()"},print:{description:"Prints the contents of an object to the output",example:'print({ some: "value" })'},printjson:{description:"Alias for print()"},isInteractive:{description:"Returns whether the shell will enter or has entered interactive mode"},convertShardKeyToHashed:{description:"Returns the hashed value for the input using the same hashing function as a hashed index.",link:"https://www.mongodb.com/docs/manual/reference/method/convertShardKeyToHashed/"}}}},ShellConfig:{help:{description:"Shell configuration methods",attributes:{get:{description:"Get a configuration value with config.get(key)"},set:{description:"Change a configuration value with config.set(key, value)"},reset:{description:"Reset a configuration value to its default value with config.reset(key)"}}}},AggregationCursor:{help:{description:"Aggregation Class",attributes:{close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option.",example:"db.collection.aggregate(pipeline, options).close()"},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor.",example:"db.collection.aggregate(pipeline, options).forEach(function)"},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.aggregate() can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.aggregate(pipeline, options).hasNext()"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed.",example:"db.collection.aggregate(pipeline, options).isClosed()"},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch.",example:"db.collection.aggregate(pipeline, options).isExhausted()"},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process.",example:"db.collection.aggregate(pipeline, options).itcount()"},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array.",example:"db.collection.aggregate(pipeline, options).map(function)"},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor.",example:"db.collection.aggregate(pipeline, options).maxTimeMS(timeLimit)"},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.aggregate() method. NOTE: if the cursor is tailable with awaitData then next will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.aggregate(pipeline, options).next()"},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"},explain:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Provides information on the query plan for db.collection.aggregate() method.",example:"db.collection.aggregate(pipeline, options).explain([verbosity])"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch.",example:"db.collection.aggregate(pipeline, options).objsLeftInBatch()"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.",example:"db.collection.aggregate(pipeline, options).toArray()"},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},batchSize:{description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance.",example:"db.collection.aggregate(pipeline, options).batchSize(10)"},projection:{link:"",description:"Sets a field projection for the query.",example:"db.collection.aggregate(pipeline, options).projection(field)"},sort:{link:"https://docs.mongodb.com/manual/reference/method/cursor.sort",description:"Specifies the order in which the query returns matching documents. You must apply sort() to the cursor before retrieving any documents from the database.",example:"db.collection.aggregate(pipeline, options).sort(sortDocument)"},skip:{link:"https://docs.mongodb.com/manual/reference/method/cursor.skip",description:"Call the cursor.skip() method on a cursor to control where MongoDB begins returning results. This approach may be useful in implementing paginated results.",example:"db.collection.aggregate(pipeline, options).skip(offsetNumber)"}}}},BulkWriteResult:{help:{description:"BulkWriteResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedCount:{description:"Number of documents inserted"},insertedIds:{description:"Array of ObjectIds inserted"},matchedCount:{description:"Number of documents matched"},modifiedCount:{description:"Number of documents modified"},deletedCount:{description:"Number of documents deleted"},upsertedCount:{description:"Number of documents upserted"},upsertedIds:{description:"Array of ObjectIds upserted"}}}},CommandResult:{help:{description:"CommandResult Class"}},InsertManyResult:{help:{description:"InsertManyResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedIds:{description:"Array of ObjectIds inserted"}}}},InsertOneResult:{help:{description:"InsertOneResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedId:{description:"ObjectId of document inserted"}}}},UpdateResult:{help:{description:"CommandResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},insertedId:{description:"ObjectId inserted"},matchedCount:{description:"Number of documents matched"},modifiedCount:{description:"Number of documents modified"},upsertedCount:{description:"Number of documents upserted"}}}},DeleteResult:{help:{description:"CommandResult Class",attributes:{acknowledged:{description:"Acknowledged returned from the server"},deletedCount:{description:"Number of documents deleted"}}}},ShowDbsResult:{help:{description:"ShowDatabasesResult Class"}},Collection:{help:{description:"Collection Class",attributes:{watch:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.watch",description:"Opens a change stream cursor on the collection",example:"const cursor = db.collection.watch(pipeline, options)"},aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.aggregate",description:"Calculates aggregate values for the data in a collection or a view.",example:"db.collection.aggregate(pipeline, options)"},bulkWrite:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite",description:"Performs multiple write operations with controls for order of execution.",example:"db.collection.bulkWrite(operations, options)"},countDocuments:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.countDocuments",description:"Returns the count of documents that match the query for a collection or view.",example:"db.collection.countDocuments(query, options)"},count:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.count",description:"Returns the count of documents that would match a find() query for the collection or view.",example:"db.collection.count(query, options)"},dataSize:{link:"hhttps://docs.mongodb.com/manual/reference/method/db.collection.dataSize",description:"This method provides a wrapper around the size output of the collStats (i.e. db.collection.stats()) command.",example:"db.collection.dataSize()"},deleteMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany",description:"Removes all documents that match the filter from a collection.",example:"db.collection.deleteMany()"},deleteOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.deleteOne",description:"Removes a single document from a collection.",example:"db.collection.deleteOne(filter, options)"},distinct:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.distinct",description:"Finds the distinct values for a specified field across a single collection or view and returns the results in an array.",example:"db.collection.distinct(field, query, options)"},estimatedDocumentCount:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount",description:"Returns the count of all documents in a collection or view.",example:"db.collection.estimatedDocumentCount(options)"},find:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.find",description:"Selects documents in a collection or view.",example:"db.collection.find(query, projection)"},findAndModify:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findAndModify",description:"Modifies and returns a single document.",example:"db.collection.findAndModify(spec)"},findOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOne",description:"Selects documents in a collection or view.",example:"db.collection.findOne(query, projection)"},findOneAndDelete:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndDelete",description:"Deletes a single document based on the filter and sort criteria, returning the deleted document.",example:"db.collection.findOneAndDelete(filter, options)"},findOneAndReplace:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndReplace",description:"Modifies and replaces a single document based on the filter and sort criteria.",example:"db.collection.findOneAndReplace(filter, replacement, options)"},findOneAndUpdate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndUpdate",description:"Updates a single document based on the filter and sort criteria.",example:"db.collection.findOneAndUpdate(filter, update, options)"},getIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndexes()"},getIndices:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Alias for getIndexes. Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndices()"},insert:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insert",description:"Inserts a document or documents into a collection.",example:"db.collection.insert(document, options)"},insertMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insertMany",description:"Inserts multiple documents into a collection.",example:"db.collection.insertMany(documents, options)"},insertOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.insertOne",description:"Inserts a document into a collection.",example:"db.collection.insertOne(document, options)"},isCapped:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.isCapped",description:"Checks if a collection is capped",example:"db.collection.isCapped()"},remove:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.remove",description:"Removes documents from a collection.",example:"db.collection.remove(query, options)"},stats:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.stats",description:"Returns statistics about the collection.",example:"db.collection.stats(options)"},storageSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.storageSize",description:"The total amount of storage allocated to this collection for document storage.",example:"db.collection.storageSize()"},replaceOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne",description:"Replaces a single document within the collection based on the filter.",example:"db.collection.replaceOne(filter, replacement, options)"},totalSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.totalSize",description:"The total size in bytes of the data in the collection plus the size of every index on the collection.",example:"db.collection.totalSize()"},update:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.update",description:"Modifies an existing document or documents in a collection.",example:"db.collection.update(query, update, options)"},updateMany:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateMany",description:"Updates all documents that match the specified filter for a collection.",example:"db.collection.updateMany(filter, update, options)"},compactStructuredEncryptionData:{link:"",description:"Compacts structured encryption data",example:"db.collection.compactStructuredEncryptionData()"},convertToCapped:{link:"",description:"calls {convertToCapped:'coll', size:maxBytes}} command",example:"db.coll.convertToCapped(10000)"},createIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createIndexes",description:"Creates one or more indexes on a collection",example:"db.coll.createIndexes([{ category: 1 }], { name: 'index-1' })"},createIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createIndex",description:"Creates one index on a collection",example:"db.coll.createIndex({ category: 1 }, { name: 'index-1' })"},ensureIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.ensureIndex",description:"Creates one index on a collection",example:"db.coll.ensureIndex({ category: 1 }, { name: 'index-1' })"},getDB:{link:"",description:"Get current database.",example:"db.collection.getDB()"},getIndexKeys:{link:"",description:"Return an array of key patterns for indexes defined on collection",example:"db.collection.getIndexKeys()"},getIndexSpecs:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getIndexes",description:"Alias for getIndexes. Returns an array that holds a list of documents that identify and describe the existing indexes on the collection.",example:"db.collection.getIndexSpecs()"},totalIndexSize:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.totalIndexSize",description:"Reports the total size used by the indexes on a collection.",example:"db.collection.totalIndexSize()"},dropIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropIndexes",description:"Drops the specified index or indexes (except the index on the _id field) from a collection.",example:"db.collection.dropIndexes()"},dropIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropIndex",description:"Drops or removes the specified index from a collection.",example:"db.collection.dropIndex()"},reIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.reIndex",description:"Rebuilds all existing indexes on a collection.",example:""},hideIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.hideIndex",description:"Hides an existing index from the query planner.",example:'db.collection.hideIndex("index_1")'},unhideIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.unhideIndex",description:"Unhides an existing index from the query planner.",example:'db.collection.unhideIndex("index_1")'},drop:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.drop",description:"Removes a collection or view from the database.",example:"db.students.drop()"},exists:{link:"",description:"Returns collection infos if the collection exists or null otherwise.",example:"db.coll.exists()"},getFullName:{link:"",description:"Returns the name of the collection prefixed with the database name.",example:"db.coll.getFullName()"},getName:{link:"",description:"Returns the name of the collection.",example:"db.coll.getName()"},renameCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.renameCollection/",description:"Renames a collection.",example:'db.coll.renameCollection("newName")'},runCommand:{link:"",description:"Runs a db command with the given name where the first param is the collection name.",example:'db.collection.runCommand("text", { search: "searchKeywords" })'},explain:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan.",example:"db.collection.explain().<method(...)>"},updateOne:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateOne",description:"Updates a single document within the collection based on the filter.",example:"db.collection.updateOne(filter, update, options)"},getMongo:{description:"Returns the Mongo object.",example:"db.collection.getMongo()"},latencyStats:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.latencyStats",description:"returns the $latencyStats aggregation for the collection. Takes an options document with an optional boolean 'histograms' field.",example:"db.latencyStats({ histograms: true })"},initializeUnorderedBulkOp:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.initializeUnorderedBulkOp",description:"Initializes an unordered bulk command. Returns an instance of Bulk",example:"db.coll.initializeUnorderedBulkOp()"},initializeOrderedBulkOp:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.initializeOrderedBulkOp",description:"Initializes an ordered bulk command. Returns an instance of Bulk",example:"db.coll.initializeOrderedBulkOp()"},getPlanCache:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getPlanCache/",description:"Returns an interface to access the query plan cache for a collection. The interface provides methods to view and clear the query plan cache.",example:"db.coll.getPlanCache()"},validate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.validate",description:"Calls the validate command. Default full value is false",example:"db.coll.validate(<full>)"},mapReduce:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.mapReduce",description:"Calls the mapReduce command",example:"db.coll.mapReduce(mapFn, reduceFn, options)"},getShardVersion:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getShardVersion",description:"Calls the getShardVersion command",example:"db.coll.getShardVersion()"},getShardDistribution:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getShardDistribution",description:"Prints the data distribution statistics for a sharded collection.",example:"db.coll.getShardDistribution()"},analyzeShardKey:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.analyzeShardKey",description:"Returns metrics for evaluating a shard key. That is, ‘key’ can be a candidate shard key for an unsharded or sharded collection, or the current shard key for a sharded collection.",example:"db.coll.analyzeShardKey(key)"},configureQueryAnalyzer:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.configureQueryAnalyzer",description:"Starts or stops collecting metrics about reads and writes against an unsharded or sharded collection.",example:"db.coll.configureQueryAnalyzer(options)"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"db.coll.checkMetadataConsistency(<options>)"},getSearchIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.getSearchIndexes",description:"Returns an array that holds a list of documents that identify and describe the existing search indexes on the collection.",example:"db.coll.getSearchIndexes(<name>)"},createSearchIndexes:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createSearchIndexes",description:"Creates one or more search indexes on a collection",example:"db.coll.createSearchIndexes(specs)"},createSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.createSearchIndex",description:"Creates one search indexes on a collection",example:"db.coll.createSearchIndex(<name>, definition)"},dropSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.dropSearchIndex",description:"Drops or removes the specified search index from a collection.",example:"db.coll.dropSearchIndex(name)"},updateSearchIndex:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.updateSearchIndex",description:"Updates the sepecified search index.",example:"db.coll.updateSearchIndex(name, definition)"}}}},ChangeStreamCursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Change Stream Cursor",attributes:{close:{description:"Instructs the server to close a cursor and free associated server resources."},isClosed:{description:"Returns true if the cursor is closed"},itcount:{description:"Returns the number of documents in the current batch. NOTE: this method exhausts the cursor batch"},getResumeToken:{description:"Returns the ResumeToken of the change stream"},hasNext:{description:"WARNING: on change streams this method will block unless the cursor is closed. Use tryNext to check if there are any documents in the batch. This is a breaking change"},next:{description:"WARNING: on change streams this method will block unless the cursor is closed. Use tryNext to get the next document in the batch. This is a breaking change"},tryNext:{description:"If there is a document in the change stream, it will be returned. Otherwise returns null."},isExhausted:{description:"This method is deprecated because because after closing a cursor, the remaining documents in the batch are no longer accessible. If you want to see if the cursor is closed use cursor.isClosed. If you want to see if there are documents left in the batch, use cursor.tryNext. This is a breaking change"}}}},Cursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Collection Cursor",attributes:{addOption:{link:"https://docs.mongodb.com/manual/reference/method/cursor.addOption",description:"Adds OP_QUERY wire protocol flags, such as the tailable flag, to change the behavior of queries. Accepts: DBQuery.Option fields tailable, slaveOk, noTimeout, awaitData, exhaust, partial.",example:"db.collection.find(query, projection).addOption(flag)"},allowPartialResults:{link:"https://docs.mongodb.com/manual/reference/method/cursor.allowPartialResults",description:"Sets the 'partial' option to true.",example:"db.collection.find(query, projection).allowPartialResults()"},allowDiskUse:{link:"https://docs.mongodb.com/manual/reference/method/cursor.allowDiskUse",description:"Sets the 'allowDiskUse' option. If no argument is passed, the default is true.",example:"db.collection.find(query, projection).sort(sort).allowDiskUse(false)"},batchSize:{link:"https://docs.mongodb.com/manual/reference/method/cursor.batchSize",description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance. In most cases, modifying the batch size will not affect the user or the application, as the mongo shell and most drivers return results as if MongoDB returned a single batch.",example:"db.collection.find(query, projection).batchSize(10)"},close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option.",example:"db.collection.find(query, projection).close()"},collation:{link:"https://docs.mongodb.com/manual/reference/method/cursor.collation",description:"Specifies the collation for the cursor returned by the db.collection.find(). To use, append to the db.collection.find().",example:"db.collection.find(query, projection).collation(collationDocument)"},comment:{link:"https://docs.mongodb.com/manual/reference/method/cursor.comment",description:"Adds a comment field to the query.",example:"db.collection.find(query, projection).comment('Comment')"},count:{link:"https://docs.mongodb.com/manual/reference/method/cursor.count",description:"Counts the number of documents referenced by a cursor.",example:"db.collection.find(query, projection).count()"},explain:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Provides information on the query plan for the db.collection.find() method.",example:"db.collection.find(query, projection).explain()"},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor.",example:"db.collection.find(query, projection).forEach(function)"},getQueryPlan:{link:"https://docs.mongodb.com/manual/reference/method/cursor.explain",description:"Runs cursor.explain()",example:"db.collection.find(query, projection).getQueryPlan()"},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.find() query can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.find(query, projection).hasNext()"},hint:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hint",description:"Call this method on a query to override MongoDB’s default index selection and query optimization process. Use db.collection.getIndexes() to return the list of current indexes on a collection.",example:"db.collection.find(query, projection).hint(index)"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed.",example:"db.collection.find(query, projection).isClosed()"},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch.",example:"db.collection.find(query, projection).isExhausted()"},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process.",example:"db.collection.find(query, projection).itcount()"},length:{link:"https://docs.mongodb.com/manual/reference/method/cursor.count",description:"Runs cursor.count()",example:"db.collection.find(query, projection).length()"},limit:{link:"https://docs.mongodb.com/manual/reference/method/cursor.limit",description:"Use the limit() method on a cursor to specify the maximum number of documents the cursor will return.",example:"db.collection.find(query, projection).limit(2)"},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array.",example:"db.collection.find(query, projection).map(function)"},max:{link:"https://docs.mongodb.com/manual/reference/method/cursor.max",description:"Specifies the exclusive upper bound for a specific index in order to constrain the results of find(). max() provides a way to specify an upper bound on compound key indexes.",example:"db.collection.find(query, projection).max(indexBoundsDocument)"},maxScan:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxScan",description:"deprecated, non-functional"},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor.",example:"db.collection.find(query, projection).maxTimeMS(timeLimit)"},maxAwaitTimeMS:{description:"Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)",example:"db.collection.find(query, projection).maxAwaitTimeMS(timeLimit)"},min:{link:"https://docs.mongodb.com/manual/reference/method/cursor.min",description:"Specifies the inclusive lower bound for a specific index in order to constrain the results of find(). min() provides a way to specify lower bounds on compound key indexes.",example:"db.collection.find(query, projection).min(indexBoundsDocument)"},modifiers:{link:"",description:"Get query modifiers.",example:"db.collection.find(query, projection).modifiers()"},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.find() method. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead",example:"db.collection.find(query, projection).next()"},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"},noCursorTimeout:{link:"https://docs.mongodb.com/manual/reference/method/cursor.noCursorTimeout",description:"Instructs the server to avoid closing a cursor automatically after a period of inactivity.",example:"db.collection.find(query, projection).noCursorTimeout()"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch.",example:"db.collection.find(query, projection).objsLeftInBatch()"},oplogReplay:{link:"",description:"Sets oplogReplay cursor flag to true.",example:"db.collection.find(query, projection).oplogReplay()"},projection:{link:"",description:"Sets a field projection for the query.",example:"db.collection.find(query, projection).projection(field)"},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},readConcern:{link:"https://docs.mongodb.com/manual/reference/method/cursor.readConcern",description:"Specify a read concern for the db.collection.find() method.",example:"db.collection.find(query, projection).readConcern(level)"},readonly:{link:"",description:"",example:""},readPref:{link:"https://docs.mongodb.com/manual/reference/method/cursor.readPref",description:"Append readPref() to a cursor to control how the client routes the query to members of the replica set.",example:"db.collection.find(query, projection).readPref(mode, tagSet)"},returnKey:{link:"https://docs.mongodb.com/manual/reference/method/cursor.returnKey",description:"Modifies the cursor to return index keys rather than the documents.",example:"db.collection.find(query, projection).returnKey()"},showDiskLoc:{link:"",description:"The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY style find.",example:"db.collection.find(query, projection).showDiskLoc()"},showRecordId:{link:"https://docs.mongodb.com/manual/reference/method/cursor.showRecordId",description:"Modifies the output of a query by adding a field $recordId to matching documents. $recordId is the internal key which uniquely identifies a document in a collection.",example:"db.collection.find(query, projection).showRecordId"},size:{link:"https://docs.mongodb.com/manual/reference/method/cursor.size",description:"A count of the number of documents that match the db.collection.find() query after applying any cursor.skip() and cursor.limit() methods.",example:"db.collection.find(query, projection).size()"},skip:{link:"https://docs.mongodb.com/manual/reference/method/cursor.skip",description:"Call the cursor.skip() method on a cursor to control where MongoDB begins returning results. This approach may be useful in implementing paginated results.",example:"db.collection.find(query, projection).skip(offsetNumber)"},snapshot:{link:"",description:"The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document",example:"db.collection.find(query, projection).snapshot()"},sort:{link:"https://docs.mongodb.com/manual/reference/method/cursor.sort",description:"Specifies the order in which the query returns matching documents. You must apply sort() to the cursor before retrieving any documents from the database.",example:"db.collection.find(query, projection).sort(sortDocument)"},tailable:{link:"https://docs.mongodb.com/manual/reference/method/cursor.tailable",description:"Marks the cursor as tailable.",example:"db.collection.find(query, projection).tailable({ awaitData: true })"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.",example:"db.collection.find(query, projection).toArray()"}}}},Database:{help:{description:"Database Class",attributes:{sql:{link:"https://docs.mongodb.com/manual/reference/method/db.sql",description:"(Experimental) Runs a SQL query against Atlas Data Lake. Note: this is an experimental feature that may be subject to change in future releases.",example:'const cursor = db.sql("SELECT * FROM myCollection", options)'},watch:{link:"https://docs.mongodb.com/manual/reference/method/db.watch",description:"Opens a change stream cursor on the database",example:"const cursor = db.watch(pipeline, options)"},aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.aggregate",description:"Runs a specified admin/diagnostic pipeline which does not require an underlying collection.",example:"db.aggregate(pipeline, options)"},runCommand:{link:"https://docs.mongodb.com/manual/reference/method/db.runCommand",description:"Runs an arbitrary command on the database.",example:'db.runCommand({ text: "myCollection", search: "searchKeywords" })'},dropDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.dropDatabase",description:"Removes the current database, deleting the associated data files.",example:"db.dropDatabase([writeConcern])"},adminCommand:{link:"https://docs.mongodb.com/manual/reference/method/db.adminCommand",description:"Runs an arbitrary command against the admin database.",example:"db.adminCommand({ serverStatus: 1 })"},getCollectionInfos:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollectionInfos",description:"Returns an array of documents with collection information, i.e. collection name and options, for the current database.",example:"db.getCollectionInfos()"},getCollectionNames:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollectionNames",description:"Returns an array containing the names of all collections in the current database.",example:"db.getCollectionNames"},getSiblingDB:{link:"https://docs.mongodb.com/manual/reference/method/db.getSiblingDB",description:"Returns another database without modifying the db variable in the shell environment.",example:"db.getSiblingDB(name)"},getCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.getCollection",description:"Returns a collection or a view object that is functionally equivalent to using the db.<collectionName>.",example:"db.getCollection(name)"},getMongo:{link:"https://docs.mongodb.com/manual/reference/method/db.getMongo/",description:"Returns the current database connection",example:"connection = db.getMongo()"},getName:{link:"https://docs.mongodb.com/manual/reference/method/db.getName",description:"Returns the name of the DB",example:"db.getName()"},createCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.createCollection/",description:"Create new collection",example:"db.createCollection('collName')"},createEncryptedCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.createEncryptedCollection/",description:"Creates a new collection with a list of encrypted fields each with unique and auto-created data encryption keys (DEKs). This is a utility function that internally utilises ClientEnryption.createEncryptedCollection.",example:'db.createEncryptedCollection( "collName", { "provider": "<kmsProvider>", "createCollectionOptions": { "encryptedFields": { ... }, ...<otherOptions> } })'},createView:{link:"https://docs.mongodb.com/manual/reference/method/db.createView/",description:"Create new view",example:"db.createCollection('viewName', 'source', [])"},createUser:{link:"https://docs.mongodb.com/manual/reference/method/db.createUser",description:"Creates a new user for the database on which the method is run. db.createUser() returns a duplicate user error if the user already exists on the database.",example:"db.createUser(user, writeConcern)"},updateUser:{link:"https://docs.mongodb.com/manual/reference/method/db.updateUser",description:"Updates the user’s profile on the database on which you run the method. An update to a field completely replaces the previous field’s values. This includes updates to the user’s roles array.",example:"db.updateUser(username, update, writeConcern)"},changeUserPassword:{link:"https://docs.mongodb.com/manual/reference/method/db.changeUserPassword",description:"Updates a user’s password. Run the method in the database where the user is defined, i.e. the database you created the user.",example:"db.changeUserPassword(username, password)"},logout:{link:"https://docs.mongodb.com/manual/reference/method/db.logout",description:"Ends the current authentication session. This function has no effect if the current session is not authenticated.",example:"db.logout()"},dropUser:{link:"https://docs.mongodb.com/manual/reference/method/db.dropUser",description:"Removes the user from the current database.",example:"db.dropUser(username, writeConcern)"},dropAllUsers:{link:"https://docs.mongodb.com/manual/reference/method/db.dropAllUsers",description:"Removes all users from the current database.",example:"db.dropAllUsers(writeConcern)"},auth:{link:"https://docs.mongodb.com/manual/reference/method/db.auth",description:"Allows a user to authenticate to the database from within the shell.",example:"db.auth(username, password)"},grantRolesToUser:{link:"https://docs.mongodb.com/manual/reference/method/db.grantRolesToUser",description:"Grants additional roles to a user.",example:'db.grantRolesToUser( "<username>", [ <roles> ], { <writeConcern> } )'},revokeRolesFromUser:{link:"https://docs.mongodb.com/manual/reference/method/db.revokeRolesFromUser",description:"Removes a one or more roles from a user on the current database.",example:'db.revokeRolesFromUser( "<username>", [ <roles> ], { <writeConcern> } )'},getUser:{link:"https://docs.mongodb.com/manual/reference/method/db.getUser",description:"Returns user information for a specified user. Run this method on the user’s database. The user must exist on the database on which the method runs.",example:"db.getUser(username, args)"},getUsers:{link:"https://docs.mongodb.com/manual/reference/method/db.getUsers",description:"Returns information for all the users in the database.",example:"db.getUsers(<options>)"},createRole:{link:"https://docs.mongodb.com/manual/reference/method/db.createRole",description:"Creates a new role.",example:"db.createRole(role, writeConcern)"},updateRole:{link:"https://docs.mongodb.com/manual/reference/method/db.updateRole",description:"Updates the role’s profile on the database on which you run the method. An update to a field completely replaces the previous field’s values.",example:"db.updateRole(rolename, update, writeConcern)"},dropRole:{link:"https://docs.mongodb.com/manual/reference/method/db.dropRole",description:"Removes the role from the current database.",example:"db.dropRole(rolename, writeConcern)"},dropAllRoles:{link:"https://docs.mongodb.com/manual/reference/method/db.dropAllRoles",description:"Removes all roles from the current database.",example:"db.dropAllRoles(writeConcern)"},grantRolesToRole:{link:"https://docs.mongodb.com/manual/reference/method/db.grantRolesToRole",description:"Grants additional roles to a role.",example:'db.grantRolesToRole( "<rolename>", [ <roles> ], { <writeConcern> } )'},revokeRolesFromRole:{link:"https://docs.mongodb.com/manual/reference/method/db.revokeRolesFromRole",description:"Removes a one or more roles from a role on the current database.",example:'db.revokeRolesFromRole( "<rolename>", [ <roles> ], { <writeConcern> } )'},grantPrivilegesToRole:{link:"https://docs.mongodb.com/manual/reference/method/db.grantPrivilegesToRole",description:"Grants additional privileges to a role.",example:'db.grantPrivilegesToRole( "<rolename>", [ <privileges> ], { <writeConcern> } )'},revokePrivilegesFromRole:{link:"https://docs.mongodb.com/manual/reference/method/db.revokePrivilegesFromRole",description:"Removes a one or more privileges from a role on the current database.",example:'db.revokeRolesFromRole( "<rolename>", [ <privileges> ], { <writeConcern> } )'},getRole:{link:"https://docs.mongodb.com/manual/reference/method/db.getRole",description:"Returns role information for a specified role. Run this method on the role’s database. The role must exist on the database on which the method runs.",example:"db.getRole(rolename, args)"},getRoles:{link:"https://docs.mongodb.com/manual/reference/method/db.getRoles",description:"Returns information for all the roles in the database.",example:"db.getRoles(<options>)"},currentOp:{link:"https://docs.mongodb.com/manual/reference/method/db.currentOp",description:"Runs an aggregation using $currentOp operator. Returns a document that contains information on in-progress operations for the database instance. For further information, see $currentOp.",example:"db.currentOp()"},killOp:{link:"https://docs.mongodb.com/manual/reference/method/db.killOp",description:"Calls the killOp command. Terminates an operation as specified by the operation ID. To find operations and their corresponding IDs, see $currentOp or db.currentOp().",example:"db.killOp(<options>)"},shutdownServer:{link:"https://docs.mongodb.com/manual/reference/method/db.shutdownServer",description:"Calls the shutdown command. Shuts down the current mongod or mongos process cleanly and safely. You must issue the db.shutdownServer() operation against the admin database.",example:"db.shutdownServer(<options>)"},fsyncLock:{link:"https://docs.mongodb.com/manual/reference/method/db.fsyncLock",description:"Calls the fsync command. Forces the mongod to flush all pending write operations to disk and locks the entire mongod instance to prevent additional writes until the user releases the lock with a corresponding db.fsyncUnlock() command.",example:"db.fsyncLock(<options>)"},fsyncUnlock:{link:"https://docs.mongodb.com/manual/reference/method/db.fsyncUnlock",description:"Calls the fsyncUnlock command. Reduces the lock taken by db.fsyncLock() on a mongod instance by 1.",example:"db.fsyncUnlock(<options>)"},version:{link:"https://docs.mongodb.com/manual/reference/method/db.version",description:"returns the db version. uses the buildinfo command",example:"db.version()"},serverBits:{link:"https://docs.mongodb.com/manual/reference/method/db.serverBits",description:"returns the db serverBits. uses the buildInfo command",example:"db.serverBits()"},isMaster:{link:"https://docs.mongodb.com/manual/reference/method/db.isMaster",description:"Calls the isMaster command",example:"db.isMaster()"},hello:{link:"https://docs.mongodb.com/manual/reference/method/db.hello",description:"Calls the hello command",example:"db.hello()"},rotateCertificates:{link:"https://docs.mongodb.com/manual/reference/method/db.rotateCertificates",description:"Calls the rotateCertificates command",example:"db.rotateCertificates()"},serverBuildInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.serverBuildInfo",description:"returns the db serverBuildInfo. uses the buildInfo command",example:"db.serverBuildInfo()"},serverStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.serverStatus",description:"returns the server stats. uses the serverStatus command",example:"db.serverStatus(<opts>)"},stats:{link:"https://docs.mongodb.com/manual/reference/method/db.stats",description:"returns the db stats. uses the dbStats command",example:"db.stats(<scale>) or db.stats({ scale: <scale> })"},hostInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.hostInfo",description:"Calls the hostInfo command",example:"db.hostInfo()"},serverCmdLineOpts:{link:"https://docs.mongodb.com/manual/reference/method/db.serverCmdLineOpts",description:"returns the db serverCmdLineOpts. uses the getCmdLineOpts command",example:"db.serverCmdLineOpts()"},printCollectionStats:{link:"https://docs.mongodb.com/manual/reference/method/db.printCollectionStats",description:"Prints the collection.stats for each collection in the db.",example:"db.printCollectionStats(scale)"},getProfilingStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.getProfilingStatus",description:"returns the db getProfilingStatus. uses the profile command",example:"db.getProfilingStatus()"},setProfilingLevel:{link:"https://docs.mongodb.com/manual/reference/method/db.setProfilingLevel",description:"returns the db setProfilingLevel. uses the profile command",example:"db.setProfilingLevel(level, <options>)"},setLogLevel:{link:"https://docs.mongodb.com/manual/reference/method/db.setLogLevel",description:"returns the db setLogLevel. uses the setParameter command",example:"db.setLogLevel(logLevel, <component>)"},getLogComponents:{link:"https://docs.mongodb.com/manual/reference/method/db.getLogComponents",description:"returns the db getLogComponents. uses the getParameter command",example:"db.getLogComponents()"},cloneDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.cloneDatabase",description:"deprecated, non-functional"},copyDatabase:{link:"https://docs.mongodb.com/manual/reference/method/db.copyDatabase",description:"deprecated, non-functional"},cloneCollection:{link:"https://docs.mongodb.com/manual/reference/method/db.cloneCollection",description:"deprecated, non-functional"},listCommands:{link:"https://docs.mongodb.com/manual/reference/method/db.listCommands",description:"Calls the listCommands command",example:"db.listCommands()"},commandHelp:{link:"https://docs.mongodb.com/manual/reference/method/db.commandHelp",description:"returns the db commandHelp. uses the passed in command with help: true",example:"db.commandHelp(<command>)"},getLastError:{link:"https://docs.mongodb.com/manual/reference/method/db.getLastError",description:"Calls the getLastError command",example:"db.getLastError(<w>, <wTimeout>)"},getLastErrorObj:{link:"https://docs.mongodb.com/manual/reference/method/db.getLastErrorObj",description:"Calls the getLastError command",example:"db.getLastErrorObj(<w>, <wTimeout>, <j>)"},printShardingStatus:{link:"https://docs.mongodb.com/manual/reference/method/db.printShardingStatus",description:"Calls sh.status(verbose)",example:"db.printShardingStatus(verbose?)"},printSecondaryReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printSecondaryReplicationInfo",description:"Prints secondary replicaset information",example:"db.printSecondaryReplicationInfo()"},printSlaveReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printSlaveReplicationInfo",description:"DEPRECATED. Use db.printSecondaryReplicationInfo",example:"db.printSlaveReplicationInfo()"},getReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.getReplicationInfo",description:"Returns replication information",example:"db.getReplicationInfo()"},printReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/db.printReplicationInfo",description:"Formats sh.getReplicationInfo",example:"db.printReplicationInfo()"},setSecondaryOk:{description:"This method is deprecated. Use db.getMongo().setReadPref() instead"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/db.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"db.checkMetadataConsistency(<options>)"}}}},DBQuery:{help:{description:'Deprecated -- use config.set("displayBatchSize", value) instead of DBQuery.shellBatchSize = value'}},Explainable:{help:{description:"Explainable Class",attributes:{aggregate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Provides information on the query plan for db.collection.aggregate() method.",example:"db.coll.explain().aggregate()"},find:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan.",example:"db.coll.explain().find()"},count:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.count().",example:"db.coll.explain().count()"},remove:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.remove().",example:"db.coll.explain().remove({})"},update:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.update().",example:"db.coll.explain().update({}, { $inc: ${ a: 1 } })"},distinct:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.distinct().",example:'db.coll.explain().distinct("_id")'},mapReduce:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.mapReduce().",example:"db.coll.explain().mapReduce(map, reduce, options)"},findAndModify:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findAndModify().",example:"db.coll.explain().findAndModify({ query: { ... }, update: { ... } })"},findOneAndDelete:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndDelete().",example:"db.coll.explain().findOneAndDelete({ ... query ... })"},findOneAndReplace:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndReplace().",example:"db.coll.explain().findOneAndReplace({ ... query ... }, { ... replacement ... })"},findOneAndUpdate:{link:"https://docs.mongodb.com/manual/reference/method/db.collection.explain",description:"Returns information on the query plan for db.collection.findOneAndUpdate().",example:"db.coll.explain().findOneAndUpdate({ ... query ... }, { ... update operators ... })"},getCollection:{link:"",description:"Returns the explainable collection.",example:"db.coll.explain().getCollection()"},getVerbosity:{link:"",description:"Returns the explainable verbosity.",example:"db.coll.explain().getVerbosity()"},setVerbosity:{link:"",description:"Sets the explainable verbosity.",example:'db.coll.explain().setVerbosity("queryPlanner")'}}}},ExplainableCursor:{iteration:{"no-cursor":"no cursor","type-it-for-more":'Type "it" for more'},help:{description:"Explainable Cursor. See the Cursor class help methods for more information"}},RunCommandCursor:{help:{description:"RunCommandCursor Class",attributes:{batchSize:{description:"Specifies the number of documents to return in each batch of the response from the MongoDB instance."},close:{link:"https://docs.mongodb.com/manual/reference/method/cursor.close",description:"Instructs the server to close a cursor and free associated server resources. The server will automatically close cursors that have no remaining results, as well as cursors that have been idle for a period of time and lack the cursor.noCursorTimeout() option."},forEach:{link:"https://docs.mongodb.com/manual/reference/method/cursor.forEach",description:"Iterates the cursor to apply a JavaScript function to each document from the cursor."},hasNext:{link:"https://docs.mongodb.com/manual/reference/method/cursor.hasNext",description:"cursor.hasNext() returns true if the cursor returned by the db.collection.aggregate() can iterate further to return more documents. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead"},isClosed:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isClosed",description:"Returns true if the cursor is closed."},isExhausted:{link:"https://docs.mongodb.com/manual/reference/method/cursor.isExhausted",description:"cursor.isExhausted() returns true if the cursor is closed and there are no remaining objects in the batch."},itcount:{link:"https://docs.mongodb.com/manual/reference/method/cursor.itcount",description:"Counts the number of documents remaining in a cursor. itcount() is similar to cursor.count(), but actually executes the query on an existing iterator, exhausting its contents in the process."},map:{link:"https://docs.mongodb.com/manual/reference/method/cursor.map",description:"Applies the first argument, a function, to each document visited by the cursor and collects the return values from successive application into an array."},maxTimeMS:{link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS",description:"Specifies a cumulative time limit in milliseconds for processing operations on a cursor."},next:{link:"https://docs.mongodb.com/manual/reference/method/cursor.next",description:"The next document in the cursor returned by the db.collection.aggregate() method. NOTE: if the cursor is tailable with awaitData then next will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead"},objsLeftInBatch:{link:"https://docs.mongodb.com/manual/reference/method/cursor.objsLeftInBatch",description:"cursor.objsLeftInBatch() returns the number of documents remaining in the current batch."},pretty:{description:"Deprecated. The shell provides auto-formatting so this method is no longer useful"},toArray:{link:"https://docs.mongodb.com/manual/reference/method/cursor.toArray",description:"The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor."},tryNext:{description:"If a document is in the cursor's batch it will be returned, otherwise null will be returned"}}}},ReplicaSet:{help:{description:"Replica Set Class",link:"https://docs.mongodb.com/manual/reference/method/js-replication/",attributes:{initiate:{link:"https://docs.mongodb.com/manual/reference/method/rs.initiate",description:"Initiates the replica set.",example:"rs.initiate()"},config:{link:"https://docs.mongodb.com/manual/reference/method/rs.conf",description:"Returns a document that contains the current replica set configuration.",example:"rs.config()"},reconfig:{link:"https://docs.mongodb.com/manual/reference/method/rs.reconfig",description:"Reconfigures an existing replica set, overwriting the existing replica set configuration.",example:"rs.reconfig()"},reconfigForPSASet:{link:"https://docs.mongodb.com/manual/reference/method/rs.reconfigForPSASet",description:"Reconfigures an existing replica set, overwriting the existing replica set configuration, if the reconfiguration is a transition from a Primary-Arbiter to a Primary-Secondary-Arbiter set.",example:"rs.reconfigForPSASet(indexOfNewMemberInMembersArray, config)"},conf:{link:"https://docs.mongodb.com/manual/reference/method/rs.conf",description:"Calls replSetConfig",example:"rs.conf()"},status:{link:"https://docs.mongodb.com/manual/reference/method/rs.status",description:"Calls replSetGetStatus",example:"rs.status()"},isMaster:{link:"https://docs.mongodb.com/manual/reference/method/rs.isMaster",description:"Calls isMaster",example:"rs.isMaster()"},hello:{link:"https://docs.mongodb.com/manual/reference/method/rs.hello",description:"Calls hello",example:"rs.hello()"},printSecondaryReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printSecondaryReplicationInfo",description:"Calls db.printSecondaryReplicationInfo",example:"rs.printSecondaryReplicationInfo()"},printSlaveReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printSlaveReplicationInfo",description:"DEPRECATED. Use rs.printSecondaryReplicationInfo",example:"rs.printSlaveReplicationInfo()"},printReplicationInfo:{link:"https://docs.mongodb.com/manual/reference/method/rs.printReplicationInfo",description:"Calls db.printReplicationInfo",example:"rs.printReplicationInfo()"},add:{link:"https://docs.mongodb.com/manual/reference/method/rs.add",description:"Adds replica set member to replica set.",example:"rs.add(hostport, arbiterOnly?)"},addArb:{link:"https://docs.mongodb.com/manual/reference/method/rs.addArb",description:"Calls rs.add with arbiterOnly=true",example:"rs.addArb(hostname)"},remove:{link:"https://docs.mongodb.com/manual/reference/method/rs.remove",description:"Removes a replica set member.",example:"rs.remove(hostname)"},freeze:{link:"https://docs.mongodb.com/manual/reference/method/rs.freeze",description:"Prevents the current member from seeking election as primary for a period of time. Uses the replSetFreeze command",example:"rs.freeze(secs)"},stepDown:{link:"https://docs.mongodb.com/manual/reference/method/rs.stepDown",description:"Causes the current primary to become a secondary which forces an election. If no stepDownSecs is provided, uses 60 seconds. Uses the replSetStepDown command",example:"rs.stepDown(stepDownSecs?, catchUpSecs?)"},syncFrom:{link:"https://docs.mongodb.com/manual/reference/method/rs.syncFrom",description:"Sets the member that this replica set member will sync from, overriding the default sync target selection logic.",example:"rs.syncFrom(host)"},secondaryOk:{description:"This method is deprecated. Use db.getMongo().setReadPref() instead"}}}},Shard:{help:{description:"The Shard Class",attributes:{enableSharding:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableSharding",description:"Enables sharding on a specific database. Uses the enableSharding command",example:"sh.enableSharding(database, primaryShard?)"},shardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.shardCollection",description:"Enables sharding for a collection. Uses the shardCollection command",example:"sh.shardCollection(namespace, key, unique?, options?)"},reshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.reshardCollection",description:"Enables sharding for a collection. Uses the reshardCollection command",example:"sh.reshardCollection(namespace, key, unique?, options?)"},commitReshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.commitReshardCollection",description:"Commits the current reshardCollection on a given collection",example:"sh.commitReshardCollection(namespace)"},abortReshardCollection:{link:"https://docs.mongodb.com/manual/reference/method/sh.abortReshardCollection",description:"Abort the current reshardCollection on a given collection",example:"sh.abortReshardCollection(namespace)"},status:{link:"https://docs.mongodb.com/manual/reference/method/sh.status",description:"Prints a formatted report of the sharding configuration and the information regarding existing chunks in a sharded cluster. The default behavior suppresses the detailed chunk information if the total number of chunks is greater than or equal to 20.",example:"sh.status(verbose?)"},addShard:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShard",description:"Adds a shard to a sharded cluster. Uses the addShard command",example:"sh.addShard(url)"},addShardToZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShardToZone",description:"Associates a shard to a zone. Uses the addShardToZone command",example:"sh.addShardToZone(shard, zone)"},addShardTag:{link:"https://docs.mongodb.com/manual/reference/method/sh.addShardTag",description:"3.4+ only. Calls addShardTag for a sharded DB. Aliases to sh.addShardToZone().",example:"sh.addShardTag(shard, tag)"},updateZoneKeyRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.updateZoneKeyRange",description:"Associates a range of shard keys to a zone. Uses the updateZoneKeyRange command",example:"sh.updateZoneKeyRange(ns, min, max, zone)"},addTagRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.addTagRange",description:"3.4+ only. Adds a tag range for a sharded DB. This method aliases to sh.updateZoneKeyRange()",example:"sh.addTagRange(ns, min, max, zone)"},removeRangeFromZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeRangeFromZone",description:"3.4+ only. Removes an association between a range of shard keys and a zone.",example:"sh.removeRangeFromZone(ns, min, max)"},removeTagRange:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeTagRange",description:"3.4+ only. Removes tag range for a sharded DB. Aliases to sh.removeRangeFromZone",example:"sh.removeTagRange(ns, min, max)"},removeShardFromZone:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeShardFromZone",description:"3.4+ only. Removes the association between a shard and a zone. Uses the removeShardFromZone command",example:"sh.removeShardFromZone(shard, zone)"},removeShardTag:{link:"https://docs.mongodb.com/manual/reference/method/sh.removeShardTag",description:"3.4+ only. Removes a shard tag for a sharded DB. Aliases to sh.removeShardFromZone",example:"sh.removeShardTag(shard, zone)"},enableAutoSplit:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableAutoSplit",description:"Enables auto-splitting for the sharded cluster. Calls update on the config.settings collection",example:"sh.enableAutoSplit()"},disableAutoSplit:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableAutoSplit",description:"Disables auto-splitting for the sharded cluster. Calls update on the config.settings collection",example:"sh.disableAutoSplit()"},splitAt:{link:"https://docs.mongodb.com/manual/reference/method/sh.splitAt",description:"Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point. Uses the split command",example:"sh.splitAt(ns, query)"},splitFind:{link:"https://docs.mongodb.com/manual/reference/method/sh.splitFind",description:"Splits a chunk at the shard key value specified by the query at the median. Uses the split command",example:"sh.splitFind(ns, query)"},moveChunk:{link:"https://docs.mongodb.com/manual/reference/method/sh.moveChunk",description:"Moves the chunk that contains the document specified by the query to the destination shard. Uses the moveChunk command",example:"sh.moveChunk(ns, query, destination)"},balancerCollectionStatus:{link:"https://docs.mongodb.com/manual/reference/method/sh.balancerCollectionStatus",description:"Returns information on whether the chunks of a sharded collection are balanced. Uses the balancerCollectionStatus command",example:"sh.balancerCollectionStatus(ns)"},enableBalancing:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableBalancing",description:"Activates the sharded collection balancer process.",example:"sh.enableBalancing(ns)"},disableBalancing:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableBalancing",description:"Disable balancing on a single collection in a sharded database. Does not affect balancing of other collections in a sharded cluster.",example:"sh.disableBalancing(ns)"},getBalancerState:{link:"https://docs.mongodb.com/manual/reference/method/sh.getBalancerState",description:"Returns true when the balancer is enabled and false if the balancer is disabled. This does not reflect the current state of balancing operations: use sh.isBalancerRunning() to check the balancer’s current state.",example:"sh.getBalancerState()"},isBalancerRunning:{link:"https://docs.mongodb.com/manual/reference/method/sh.isBalancerRunning",description:"Returns true if the balancer process is currently running and migrating chunks and false if the balancer process is not running. Uses the balancerStatus command",example:"sh.isBalancerRunning()"},startBalancer:{link:"https://docs.mongodb.com/manual/reference/method/sh.startBalancer",description:"Enables the balancer. Uses the balancerStart command",example:"sh.startBalancer(timeout)"},stopBalancer:{link:"https://docs.mongodb.com/manual/reference/method/sh.stopBalancer",description:"Disables the balancer. uses the balancerStop command",example:"sh.stopBalancer(timeout)"},setBalancerState:{link:"https://docs.mongodb.com/manual/reference/method/sh.setBalancerState",description:"Calls sh.startBalancer if state is true, otherwise calls sh.stopBalancer",example:"sh.setBalancerState(state)"},getShardedDataDistribution:{description:"Returns data-size distribution information for all existing sharded collections",example:"sh.getShardedDataDistribution()"},startAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.startAutoMerger",description:"Globally enable auto-merger (active only if balancer is up)",example:"sh.startAutoMerger()"},stopAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.stopAutoMerger",description:"Globally disable auto-merger",example:"sh.stopAutoMerger()"},isAutoMergerEnabled:{link:"https://docs.mongodb.com/manual/reference/method/sh.isAutoMergerEnabled",description:"Returns whether the auto-merger is enabled",example:"sh.isAutoMergerEnabled()"},disableAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.disableAutoMerger",description:"Disable auto-merging on one collection",example:"sh.disableAutoMerger(ns)"},enableAutoMerger:{link:"https://docs.mongodb.com/manual/reference/method/sh.enableAutoMerger",description:"Re-enable auto-merge on one collection",example:"sh.enableAutoMerger(ns)"},checkMetadataConsistency:{link:"https://docs.mongodb.com/manual/reference/method/sh.checkMetadataConsistency",description:"Returns a cursor with information about metadata inconsistencies",example:"sh.checkMetadataConsistency(<options>)"}}}},Session:{help:{description:"The Session Class. Represents a server session",link:"https://docs.mongodb.com/manual/reference/method/Session/",attributes:{getDatabase:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getDatabase",description:"Returns a database class that will pass the session to the server with every command"},advanceOperationTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.advanceOperationTime",description:"Updates the operation time"},endSession:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.endSession",description:"Ends the session"},hasEnded:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.hasEnded",description:"Returns a boolean that specifies whether the session has ended."},getClusterTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getClusterTime",description:"Returns the most recent cluster time as seen by the session. Applicable for replica sets and sharded clusters only."},getOperationTime:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getOperationTime",description:"Returns the timestamp of the last acknowledged operation for the session."},getOptions:{link:"https://docs.mongodb.com/manual/reference/method/Session/#Session.getOptions",description:"Returns the options object passed to startSession"},startTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.startTransaction/#Session.startTransaction",description:"Starts a multi-document transaction for the session."},commitTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.commitTransaction/#Session.commitTransaction",description:"Commits the session’s transaction."},abortTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.abortTransaction/#Session.abortTransaction",description:"Aborts the session’s transaction."},withTransaction:{link:"https://docs.mongodb.com/manual/reference/method/Session.abortTransaction/#Session.withTransaction",description:"Run a function within a transaction context.",example:'session.withTransaction(() => { session.getDatabase("test").test.insertOne({ doc: 1 }); })'},advanceClusterTime:{description:"Advances the clusterTime for a Session to the provided clusterTime."}}}},Mongo:{help:{description:"The Mongo Class. Represents a connection to a server",link:"https://docs.mongodb.com/manual/reference/method/Mongo/#Mongo",attributes:{watch:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.watch",description:"Opens a change stream cursor on the connection",example:"const cursor = db.getMongo().watch(pipeline, options)"},startSession:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.startSession/",description:"Starts a session for the connection."},getCollection:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getCollection",description:"Returns the specified Collection of the Mongo object.",example:'const collection = db.getMongo().getCollection("databaseName.collectionName")'},getDB:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDB",description:"Returns the specified Database of the Mongo object."},getDBs:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDBs",description:"Returns information about all databases. Uses the listDatabases command."},getDBNames:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getDBs",description:"Returns an array of all database names. Uses the listDatabases command.",example:"db.getMongo().getDBNames().map(name => db.getSiblingDB(name).getCollectionNames())"},getURI:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getURI",description:"Returns the connection string for current session"},connect:{link:"https://docs.mongodb.com/manual/reference/method/connect",description:"Creates a connection to a MongoDB instance and returns the reference to the database."},close:{description:"Closes a Mongo object, disposing of related resources and closing the underlying connection."},getReadConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadConcern",description:"Returns the ReadConcern set for the connection.",example:"db.getMongo().getReadConcern()"},getWriteConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getWriteConcern",description:"Returns the WriteConcern set for the connection.",example:"db.getMongo().getWriteConcern()"},getReadPref:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPref",description:"Returns the ReadPreference set for the connection.",example:"db.getMongo().getReadPref()"},getReadPrefMode:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPrefMode",description:"Returns the ReadPreference Mode set for the connection.",example:"db.getMongo().getReadPrefMode()"},getReadPrefTagSet:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.getReadPrefTagSet",description:"Returns the ReadPreference TagSet set for the connection.",example:"db.getMongo().getReadPrefTagSet()"},setReadPref:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setReadPref",description:"Sets the ReadPreference for the connection",example:"db.getMongo().setReadPref(mode, tagSets, hedgeOptions)"},setReadConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setReadConcern",description:"Sets the ReadConcern for the connection",example:"db.getMongo().setReadConcern(level)"},setWriteConcern:{link:"https://docs.mongodb.com/manual/reference/method/Mongo.setWriteConcern",description:"Sets the WriteConcern for the connection",example:"db.getMongo().setWriteConcern('majority')"},setCausalConsistency:{description:"This method is deprecated. It is not possible to set causal consistency for an entire connection due to driver limitations, use startSession({causalConsistency: <>}) instead."},setSlaveOk:{description:"This method is deprecated"},setSecondaryOk:{description:"This method is deprecated. Use .setReadPref() instead"},isCausalConsistency:{description:"This method is deprecated. Causal consistency for drivers is set via Mongo.startSession and can be checked via session.getOptions. The default value is true"},getKeyVault:{description:"Returns the KeyVault object for the current database connection. The KeyVault object supports data encryption key management for Client-side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/getKeyVault/#getKeyVault"},getClientEncryption:{description:"Returns the ClientEncryption object for the current database collection. The ClientEncryption object supports explicit (manual) encryption and decryption of field values for Client-Side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/getClientEncryption/#getClientEncryption"},convertShardKeyToHashed:{description:"Returns the hashed value for the input using the same hashing function as a hashed index.",link:"https://www.mongodb.com/docs/manual/reference/method/convertShardKeyToHashed/"}}}},DBRef:{help:{description:"The DBRef BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/DBRef.html",example:"new DBRef(namespace: string, oid: ObjectId, db: string [optional])"},attributes:{}},MaxKey:{help:{description:"The MaxKey BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/MaxKey.html",example:"new MaxKey()"},attributes:{}},MinKey:{help:{description:"The MinKey BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/MinKey.html",example:"new MinKey()"},attributes:{}},ObjectId:{help:{description:"The ObjectId BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/ObjectID.html",example:"new ObjectId(id: string|number [optional])"},attributes:{}},BSONSymbol:{help:{description:"The Symbol BSON Class. Deprecated since server version 1.6",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Symbol.html",example:'new BSONSymbol("abc")'},attributes:{}},Timestamp:{help:{description:"The Timestamp BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Timestamp.html",example:"new Timestamp(low: signed 32 bit number, high: signed 32 bit number)"},attributes:{}},Code:{help:{description:"The Code BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Code.html",example:'new Code("x", { x: 1 } [optional])'},attributes:{}},NumberDecimal:{help:{description:"A helper method that constructs a Decimal128 BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Decimal128.html",example:'NumberDecimal("1.23423423")'}},Decimal128:{help:{description:"The Decimal128 BSON Class. Takes a Buffer as an argument.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Decimal128.html"},attributes:{}},NumberInt:{help:{description:"A helper method that constructs an Int32 BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Int32.html",example:'NumberInt("123")'}},Int32:{help:{description:"The 32-bit Integer BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Int32.html",example:"new Int32(123)"},attributes:{}},Long:{help:{description:"The Long BSON Class",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:"new Long(low: signed 32 bit number, high: signed 32 bit number)"},attributes:{}},Double:{help:{description:"The Double BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:"new Double(123)"},attributes:{}},NumberLong:{help:{description:"A helper method that constructs a Long BSON Class from a string",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Long.html",example:'NumberLong("123")'}},Date:{help:{description:"The Date Class"}},ISODate:{help:{description:"Helper method for creating dates using ISO"}},BinData:{help:{description:"A helper method that constructs a Binary BSON Class.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Binary.html",example:"BinData(subtype: number, base64string)"}},Binary:{help:{description:"The Binary BSON Class that takes in (Buffer, subtype: number) as arguments.",link:"https://mongodb.github.io/node-mongodb-native/3.6/api/Binary.html"},attributes:{SUBTYPE_BYTE_ARRAY:{description:"The byte array BSON type"},SUBTYPE_DEFAULT:{description:"The default BSON type"},SUBTYPE_FUNCTION:{description:"The function BSON type"},SUBTYPE_MD5:{description:"The MD5 BSON type"},SUBTYPE_USER_DEFINED:{description:"The user BSON type"},SUBTYPE_UUID:{description:"The UUID BSON type"},SUBTYPE_UUID_OLD:{description:"The Old UUID BSON type"}}},HexData:{help:{description:"Helper method to create BinData. Accepts subtype hex string",example:'HexData(0, "0123456789abcdef")'}},UUID:{help:{description:"Helper method to create BinData with subtype UUID. Accepts hex string (with optional dashes)",example:'UUID("01234567-89ab-cdef-0123-456789abcdef")'}},MD5:{help:{description:"Helper method to create BinData with subtype MD5. Accepts hex string",example:'MD5("0123456789abcdef0123456789abcdef")'}},bsonsize:{help:{description:"Helper method to calculate BSON object size",example:'bsonsize({ foo: "bar" })'}},Map:{help:{description:"BSON Map"}},Bulk:{help:{link:"https://docs.mongodb.com/manual/reference/method/Bulk",description:"Bulk operations builder used to construct a list of write operations to perform in bulk for a single collection. To instantiate the builder, use either the db.collection.initializeOrderedBulkOp() or the db.collection.initializeUnorderedBulkOp() method.",attributes:{insert:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.insert/",description:"Adds an insert to the bulk operation.",example:"db.insert(<document>)"},execute:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.execute/",description:"Executes the bulk operation.",example:"bulkOp.execute()"},find:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find/",description:"Adds a find to the bulk operation.",example:"bulkOp.find(<filter>)"},getOperations:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.getOperations/",description:"Returns the batches executed by the bulk write.",example:"bulkOp.getOperations()"},tojson:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.tojson/",description:"Returns a JSON document that contains the number of operations and batches in the Bulk() object.",example:"bulkOp.tojson()"},toString:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.toString/",description:"Returns as a string a JSON document that contains the number of operations and batches in the Bulk() object.",example:"bulkOp.toString()"}}}},BulkFindOp:{help:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find",description:"Bulk operations builder returned after Bulk.find()",attributes:{arrayFilters:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.arrayFilters/",description:"Adds an arrayFilter to the bulk operation.",example:"bulkOp.find(...).arrayFilters(<array of filters)"},hint:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.hint/",description:"Adds an hint to the bulk operation.",example:"bulkOp.find(...).hint(<hintd document>)"},collation:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.collation/",description:"Adds collation options to the bulk operation.",example:"bulkOp.find(...).collation(<collation doc>)"},remove:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.remove/",description:"Adds an remove to the bulk operation.",example:"bulkOp.find(...).remove()"},removeOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.removeOne/",description:"Adds an removeOne to the bulk operation.",example:"bulkOp.find(...).removeOne()"},delete:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.delete/",description:"Adds an delete to the bulk operation.",example:"bulkOp.find(...).delete()"},deleteOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.deleteOne/",description:"Adds an deleteOne to the bulk operation.",example:"bulkOp.find(...).deleteOne()"},replaceOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.replaceOne/",description:"Adds an replaceOne to the bulk operation.",example:"bulkOp.find(...).replaceOne(<document>)"},updateOne:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.updateOne/",description:"Adds an updateOne to the bulk operation.",example:"bulkOp.find(...).updateOne(<document>)"},update:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.update/",description:"Adds an update to the bulk operation.",example:"bulkOp.find(...).update(<document>)"},upsert:{link:"https://docs.mongodb.com/manual/reference/method/Bulk.find.upsert/",description:"Adds an upsert to the bulk operation updates for this find(...).",example:"bulkOp.find(...).upsert()"}}}},PlanCache:{help:{link:"https://docs.mongodb.com/manual/reference/method/js-plan-cache/",description:"An interface to access the query plan cache object and associated PlanCache methods for a collection.",attributes:{clear:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.clear",description:"Removes cached query plan(s) for a collection.",example:"db.coll.getPlanCache().clear()"},clearPlansByQuery:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.clearPlansByQuery",description:"Removes cached query plan(s) for a collection of the specified query shape.",example:"db.coll.getPlanCache().clearPlansByQuery(<query>, <projection?>, <sort?>)"},list:{link:"https://docs.mongodb.com/manual/reference/method/PlanCache.list",description:"Lists cached query plan(s) for a collection.",example:"db.coll.getPlanCache().list(<pipeline>)"},getPlansByQuery:{description:"Deprecated. Please use PlanCache.list instead"},listQueryShapes:{description:"Deprecated. Please use PlanCache.list instead"}}}},Document:{help:{link:"https://docs.mongodb.com/manual/core/document/",description:"A generic MongoDB document, without any methods.",attributes:{}}},KeyVault:{help:{link:"https://docs.mongodb.com/manual/core/security-client-side-encryption/",description:"The key vault object for the current MongoDB connection",attributes:{createKey:{description:"Creates a data encryption key for use with client-side field level encryption.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.createKey/#KeyVault.createKey"},deleteKey:{description:"Deletes the specified data encryption key from the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.deleteKey/#KeyVault.deleteKey"},getKey:{description:"Retreives the specified data encryption key from the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKey/#KeyVault.getKey"},getKeys:{description:"Retrieves all keys in the key vault.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKeys/#KeyVault.getKeys"},addKeyAlternateName:{description:"Associates a key alternative name to the specified data encryption key.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.addKeyAlternateName/#KeyVault.addKeyAlternateName"},removeKeyAlternateName:{description:"Removes a key alternative name from the specified data encryption key.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.removeKeyAlternateName/#KeyVault.removeKeyAlternateName"},getKeyByAltName:{description:"Retrieves keys with the specified key alternative name.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.getKeyByAltName/#KeyVault.getKeyByAltName"},rewrapManyDataKey:{description:"Re-wrap one, more, or all data keys with another KMS provider, or re-wrap using the same one.",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.rewrapManyDataKey/#KeyVault.rewrapManyDataKey"},createDataKey:{description:"Alias of KeyVault.createKey()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.createKey/#KeyVault.createKey"},removeKeyAltName:{description:"Alias of KeyVault.removeKeyAlternateName()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.removeKeyAlternateName/#KeyVault.removeKeyAlternateName"},addKeyAltName:{description:"Alias of KeyVault.addKeyAlternateName()",link:"https://docs.mongodb.com/manual/reference/method/KeyVault.addKeyAlternateName/#KeyVault.addKeyAlternateName"}}}},ClientEncryption:{help:{link:"https://docs.mongodb.com/manual/core/security-client-side-encryption/",description:"The ClientEncryption object for the current database collection.",attributes:{encrypt:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encrypt",description:"Encrypts the value using the specified encryptionKeyId and encryptionAlgorithm. encrypt supports explicit (manual) encryption of field values."},encryptExpression:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encryptExpression",description:"Encrypts an MQL expression using the specified encryptionKeyId and encryptionAlgorithm."},decrypt:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.decrypt/#ClientEncryption.decrypt",description:"decrypts the encryptionValue if the current database connection was configured with access to the Key Management Service (KMS) and key vault used to encrypt encryptionValue."},createEncryptedCollection:{link:"https://docs.mongodb.com/manual/reference/method/ClientEncryption.createEncryptedCollection/#ClientEncryption.createEncryptedCollection",description:"Creates a new collection with a list of encrypted fields each with unique and auto-created data encryption keys (DEKs). This method should be invoked on a connection instantiated with queryable encryption options.",example:'db.getMongo().getClientEncryption().createEncryptedCollection( "dbName", "collName", { "provider": "<kmsProvider>", "createCollectionOptions": { "encryptedFields": { ... }, ...<otherOptions> } })'}}}},Streams:{help:{description:"Streams",attributes:{process:{description:"Allows a user to process streams of data in the shell interactively and quickly iterate building a stream processor as they go."},createStreamProcessor:{description:"Create a named stream processor."},getProcessor:{description:"Get a stream processor with specified name."},listStreamProcessors:{description:"Show a list of all the named stream processors."},listConnections:{description:"Show a list of all the named connections for this instance from the Connection Registry."}}}},StreamProcessor:{help:{description:"Stream processor",attributes:{start:{description:"Start a named stream processor."},stop:{description:"Stop a named stream processor."},drop:{description:"Drop a named stream processor."},sample:{description:"Return a sample of the results from a named stream processor."},stats:{description:"Return stats captured from a named stream processor."}}}}}},"transport-browser":{"stitch-browser-transport":{"auth-error":"Error authenticating with Stitch."}},"transport-core":{"stitch-transport":{"not-implemented":"is not implemented in the Stitch SDK","agg-on-db":"Aggregations run on the database is not allowed via Stitch"}},"transport-server":{}}},64647:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=s(r(16599)),a=s(r(8155)),o=s(r(27098)),l="en_US",c={en_US:o.default,de_DE:a.default};t.default=class{__(e){const t=this.translate(e);if(void 0===t)throw new i.MongoshInternalError(`Could not translate key ${JSON.stringify(e)}`);return t}constructor(e){this.locale=l,this.catalog=e||c[this.locale]}setLocale(e){Object.prototype.hasOwnProperty.call(c,e)?(this.locale=e,this.catalog=c[e]):(this.locale=l,this.catalog=c[l])}translate(e){return this.find(e)}translateApiHelp(e){const t=this.find(e);if(t)return"string"==typeof t?t:n.default.render("{{description}}\n\n{{link}}\n\n{{example}}\n\n{{returns}}",t)}find(e){return e.split(".").reduce(((e,t)=>e?e[t]:void 0),this.catalog)}}},11866:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},47735:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},62393:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bson=void 0;const s=r(30345);t.bson={ObjectId:s.ObjectId,DBRef:s.DBRef,MaxKey:s.MaxKey,MinKey:s.MinKey,Timestamp:s.Timestamp,BSONSymbol:s.BSONSymbol,Code:s.Code,Decimal128:s.Decimal128,Int32:s.Int32,Long:s.Long,Binary:s.Binary,calculateObjectSize:s.calculateObjectSize,Double:s.Double,EJSON:s.EJSON,BSONRegExp:s.BSONRegExp}},41282:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(59176));t.default=function(e,t,r,s,n,a){var o;null!=r||(r={});const{isGenuine:l,serverName:c}=i.default.getGenuineMongoDB(e),{isDataLake:p,dlVersion:u}=i.default.getDataLake(r),h=n.s.credentials?n.s.credentials.mechanism:null,{serverOs:d,serverArch:f}=i.default.getBuildEnv(r);return{is_atlas:!!(null==s?void 0:s.atlasVersion)||i.default.isAtlas(e),is_localhost:i.default.isLocalhost(e),is_do:i.default.isDigitalOcean(e),server_version:r.version,node_version:process.version,mongosh_version:t,server_os:d,uri:e,server_arch:f,is_enterprise:i.default.isEnterprise(r),auth_type:h,is_data_federation:p,is_stream:i.default.isAtlasStream(e),dl_version:u,atlas_version:null!==(o=null==s?void 0:s.atlasVersion)&&void 0!==o?o:null,is_genuine:l,non_genuine_server_name:c,is_local_atlas:a}}},67802:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.bsonStringifiers=t.ServiceProviderCore=t.DEFAULT_DB=t.getConnectInfo=t.bson=void 0,r(97922);const a=r(3506);Object.defineProperty(t,"ServiceProviderCore",{enumerable:!0,get:function(){return a.ServiceProviderCore}});const o=n(r(41282));t.getConnectInfo=o.default,t.DEFAULT_DB="test";const l=r(15499);Object.defineProperty(t,"bsonStringifiers",{enumerable:!0,get:function(){return l.bsonStringifiers}}),i(r(47735),t),i(r(11866),t);var c=r(62393);Object.defineProperty(t,"bson",{enumerable:!0,get:function(){return c.bson}})},15499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makePrintableBson=t.bsonStringifiers=void 0;const s=r(62393),i=r(21764),n=Symbol.for("nodejs.util.inspect.custom");function a(e){const t=s.bson[e].prototype.inspect;return function(...e){return r=t.apply(this,e),String(r).replace(/^(\s*)(new )/,"$1");var r}}t.bsonStringifiers={ObjectId:a("ObjectId"),ObjectID:a("ObjectId"),DBRef:function(e,t){return`DBRef("${this.collection}", `+(0,i.inspect)(this.oid,t)+(this.db?`, ${(0,i.inspect)(this.db,t)}`:"")+")"},MaxKey:a("MaxKey"),MinKey:a("MinKey"),Timestamp:a("Timestamp"),BSONSymbol:a("BSONSymbol"),Code:a("Code"),Decimal128:a("Decimal128"),Int32:a("Int32"),Long:a("Long"),Double:a("Double"),BSONRegExp:a("BSONRegExp"),Binary:function(){const e=this.toString("hex");switch(this.sub_type){case s.bson.Binary.SUBTYPE_MD5:return`MD5("${e}")`;case s.bson.Binary.SUBTYPE_UUID:if(32===e.length)return`UUID("${/^(.{8})(.{4})(.{4})(.{4})(.{12})$/.exec(e).slice(1,6).join("-")}")`;default:return`Binary.createFromBase64("${this.toString("base64")}", ${this.sub_type})`}}},t.makePrintableBson=function(e){e||(e=s.bson);for(const[r,s]of Object.entries(t.bsonStringifiers)){if(!(r in e))continue;const t=e[r];for(const e of[n,"inspect"])t.prototype[e]=s}}},3506:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceProviderCore=void 0;const s=r(6534),i=r(15499);t.ServiceProviderCore=class{constructor(e){if(void 0===e)throw new s.MongoshInternalError("BSON Library is undefined.");(0,i.makePrintableBson)(e),this.bsonLibrary=e}}},97922:(e,t)=>{"use strict";function r(){return{TextDecoder:class{decode(e){const t=Buffer.from(e).toString("utf8");return t.slice(+t.startsWith("\ufeff"))}},TextEncoder:class{encode(e){return Buffer.from(e,"utf8")}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.textEncodingPolyfill=void 0,"function"==typeof TextDecoder&&"function"==typeof TextEncoder||Object.assign(Function("return this")(),r()),t.textEncodingPolyfill=r},35551:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractCursor=void 0;const i=r(40191),n=r(86930),a=r(58744),o=r(86901);let l=t.AbstractCursor=class extends i.ShellApiWithMongoClass{constructor(e,t){super(),this._currentIterationResult=null,this._mongo=e,this._cursor=t,this._transform=null}async[n.asPrintable](){var e;return(await(0,i.toShellResult)(null!==(e=this._currentIterationResult)&&void 0!==e?e:await this._it())).printable}async _it(){const e=this._currentIterationResult=new a.CursorIterationResult;return await(0,o.iterate)(e,this,await this._mongo._displayBatchSize()),e.cursorHasMore=!this.isExhausted(),e}batchSize(e){return this._cursor.batchSize(e),this}async close(){await this._cursor.close()}async forEach(e){for await(const t of this)if(!1===await e(t))break}async hasNext(){return this._cursor.hasNext()}async tryNext(){let e=await this._cursor.tryNext();return null!==e&&null!==this._transform&&(e=await this._transform(e)),e}async*[Symbol.asyncIterator](){let e;for(;null!=(e=await this.tryNext());)yield e}isClosed(){return this._cursor.closed}isExhausted(){return this.isClosed()&&0===this.objsLeftInBatch()}async itcount(){let e=0;for(;await this.tryNext();)e++;return e}async toArray(){const e=[];for await(const t of this)e.push(t);return e}pretty(){return this}map(e){if(null===this._transform)this._transform=e;else{const t=this._transform;this._transform=r=>e(t(r))}return this}maxTimeMS(e){return this._cursor.maxTimeMS(e),this}async next(){let e=await this._cursor.next();return null!==e&&null!==this._transform&&(e=await this._transform(e)),e}objsLeftInBatch(){return this._cursor.bufferedCount()}};s([(0,i.returnType)("this")],l.prototype,"batchSize",null),s([i.returnsPromise],l.prototype,"close",null),s([i.returnsPromise],l.prototype,"forEach",null),s([i.returnsPromise],l.prototype,"hasNext",null),s([i.returnsPromise],l.prototype,"tryNext",null),s([i.returnsPromise],l.prototype,"itcount",null),s([i.returnsPromise],l.prototype,"toArray",null),s([(0,i.returnType)("this")],l.prototype,"pretty",null),s([(0,i.returnType)("this")],l.prototype,"map",null),s([(0,i.returnType)("this")],l.prototype,"maxTimeMS",null),s([i.returnsPromise],l.prototype,"next",null),t.AbstractCursor=l=s([i.shellApiClassNoHelp],l)},73251:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateOrFindCursor=void 0;const i=r(40191),n=r(86901),a=r(35551);let o=t.AggregateOrFindCursor=class extends a.AbstractCursor{projection(e){return this._cursor.project(e),this}skip(e){return this._cursor.skip(e),this}sort(e){return this._cursor.sort(e),this}async explain(e){e=(0,n.validateExplainableVerbosity)(e);const t={...await this._cursor.explain(e)};return"executionStats"!==e&&"allPlansExecution"!==e&&t.executionStats&&delete t.executionStats,"executionStats"===e&&t.executionStats&&t.executionStats.allPlansExecution&&delete t.executionStats.allPlansExecution,(0,n.markAsExplainOutput)(t)}};s([(0,i.returnType)("this")],o.prototype,"projection",null),s([(0,i.returnType)("this")],o.prototype,"skip",null),s([(0,i.returnType)("this")],o.prototype,"sort",null),s([i.returnsPromise,(0,i.apiVersions)([1])],o.prototype,"explain",null),t.AggregateOrFindCursor=o=s([i.shellApiClassNoHelp],o)},20371:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(73251);let a=class extends n.AggregateOrFindCursor{constructor(e,t){super(e,t)}};a=s([i.shellApiClassDefault],a),t.default=a},22234:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.BulkFindOp=void 0;const i=r(40191),n=r(6534),a=r(86930),o=r(86901),l=r(58744);let c=t.BulkFindOp=class extends i.ShellApiWithMongoClass{constructor(e,t){super(),this._serviceProviderBulkFindOp=e,this._parentBulk=t}get _mongo(){return this._parentBulk._mongo}[a.asPrintable](){return"BulkFindOp"}collation(e){return this._serviceProviderBulkFindOp.collation(e),this}arrayFilters(e){return this._serviceProviderBulkFindOp.arrayFilters(e),this}hint(e){return(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.hint"),this._serviceProviderBulkFindOp.hint(e),this}delete(){return this._parentBulk._batchCounts.nRemoveOps++,this._serviceProviderBulkFindOp.delete(),this._parentBulk}deleteOne(){return this._parentBulk._batchCounts.nRemoveOps++,this._serviceProviderBulkFindOp.deleteOne(),this._parentBulk}remove(){return this.delete()}removeOne(){return this.deleteOne()}replaceOne(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.replacement");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.replaceOne(t),this._parentBulk}updateOne(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.update");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.updateOne(t),this._parentBulk}update(e){this._parentBulk._batchCounts.nUpdateOps++,(0,o.assertArgsDefinedType)([e],[!0],"BulkFindOp.update");const t=(0,o.shallowClone)(e);return this._serviceProviderBulkFindOp.update(t),this._parentBulk}upsert(){return this._serviceProviderBulkFindOp.upsert(),this}};s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"collation",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"arrayFilters",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],c.prototype,"hint",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"delete",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"deleteOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1]),i.deprecated],c.prototype,"remove",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1]),i.deprecated],c.prototype,"removeOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"replaceOne",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],c.prototype,"updateOne",null),s([(0,i.returnType)("Bulk")],c.prototype,"update",null),s([(0,i.returnType)("Bulk")],c.prototype,"upsert",null),t.BulkFindOp=c=s([i.shellApiClassDefault],c);let p=class extends i.ShellApiWithMongoClass{constructor(e,t,r=!1){super(),this._collection=e,this._mongo=e._mongo,this._serviceProviderBulkOp=t,this._batchCounts={nInsertOps:0,nUpdateOps:0,nRemoveOps:0},this._executed=!1,this._ordered=r}[a.asPrintable](){return this.toJSON()}_emitBulkApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Bulk",db:this._collection._database._name,coll:this._collection._name,arguments:t})}async execute(e){const t=await this._serviceProviderBulkOp.execute();return this._executed=!0,this._emitBulkApiCall("execute",{writeConcern:e}),new l.BulkWriteResult(!!t.ok,t.insertedCount,t.insertedIds,t.matchedCount,t.modifiedCount,t.deletedCount,t.upsertedCount,t.upsertedIds)}find(e){return(0,o.assertArgsDefinedType)([e],[!0],"Bulk.find"),new c(this._serviceProviderBulkOp.find(e),this)}insert(e){return this._batchCounts.nInsertOps++,(0,o.assertArgsDefinedType)([e],[!0],"Bulk.insert"),this._serviceProviderBulkOp.insert(e),this}toJSON(){const e=this._serviceProviderBulkOp.batches.length;return{...this._batchCounts,nBatches:e}}toString(){return JSON.stringify(this.toJSON())}getOperations(){if(!this._executed)throw new n.MongoshInvalidInputError("Cannot call getOperations on an unexecuted Bulk operation",n.CommonErrors.InvalidOperation);return this._serviceProviderBulkOp.batches.map((e=>({originalZeroIndex:e.originalZeroIndex,batchType:e.batchType,operations:e.operations})))}};s([i.returnsPromise,(0,i.apiVersions)([1])],p.prototype,"execute",null),s([(0,i.returnType)("BulkFindOp"),(0,i.apiVersions)([1])],p.prototype,"find",null),s([(0,i.returnType)("Bulk"),(0,i.apiVersions)([1])],p.prototype,"insert",null),p=s([i.shellApiClassDefault],p),t.default=p},88494:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(58744),a=r(86930),o=r(6534),l=r(86901);let c=class extends i.ShellApiWithMongoClass{constructor(e,t,r){super(),this._currentIterationResult=null,this._cursor=e,this._on=t,this._mongo=r}async _it(){if(this._cursor.closed)throw new o.MongoshRuntimeError("ChangeStreamCursor is closed");const e=this._currentIterationResult=new n.CursorIterationResult;return(0,l.iterate)(e,this,await this._mongo._displayBatchSize())}[a.asPrintable](){return`ChangeStreamCursor on ${this._on}`}async close(){await this._cursor.close()}async hasNext(){return await this._instanceState.printWarning("If there are no documents in the batch, hasNext will block. Use tryNext if you want to check if there are any documents without waiting."),this._cursor.hasNext()}async tryNext(){if(this._cursor.closed)throw new o.MongoshRuntimeError("Cannot call tryNext on closed cursor");return this._cursor.tryNext()}async*[Symbol.asyncIterator](){let e;for(;null!==(e=await this.tryNext());)yield e}isClosed(){return this._cursor.closed}isExhausted(){throw new o.MongoshInvalidInputError("isExhausted is not implemented for ChangeStreams because after closing a cursor, the remaining documents in the batch are no longer accessible. If you want to see if the cursor is closed use isClosed. If you want to see if there are documents left in the batch, use tryNext.")}async itcount(){let e=0;for(;await this.tryNext();)e++;return e}async next(){return await this._instanceState.printWarning("If there are no documents in the batch, next will block. Use tryNext if you want to check if there are any documents without waiting."),this._cursor.next()}getResumeToken(){return this._cursor.resumeToken}map(){throw new o.MongoshUnimplementedError("Cannot call map on a change stream cursor")}forEach(){throw new o.MongoshUnimplementedError("Cannot call forEach on a change stream cursor")}toArray(){throw new o.MongoshUnimplementedError("Cannot call toArray on a change stream cursor")}objsLeftInBatch(){throw new o.MongoshUnimplementedError("Cannot call objsLeftInBatch on a change stream cursor")}pretty(){return this}};s([i.returnsPromise],c.prototype,"close",null),s([i.returnsPromise,i.deprecated],c.prototype,"hasNext",null),s([i.returnsPromise],c.prototype,"tryNext",null),s([i.returnsPromise],c.prototype,"itcount",null),s([i.returnsPromise],c.prototype,"next",null),s([(0,i.returnType)("ChangeStreamCursor")],c.prototype,"pretty",null),c=s([i.shellApiClassDefault],c),t.default=c},6988:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=r(86901),l=r(46993),c=r(6534),p=i(r(22234)),u=r(46177),h=i(r(20541)),d=i(r(88494)),f=r(73041);let m=class extends n.ShellApiWithMongoClass{constructor(e,t,r){return super(),this._mongo=e,this._database=t,this._name=r,new Proxy(this,{get:(e,s)=>s in e?e[s]:"string"==typeof s&&!s.startsWith("_")&&(0,o.isValidCollectionName)(s)?t.getCollection(`${r}.${s}`):void 0})}[a.namespaceInfo](){return{db:this._database.getName(),collection:this._name}}[a.asPrintable](){return`${this._database.getName()}.${this._name}`}_emitCollectionApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Collection",db:this._database._name,coll:this._name,arguments:t})}async aggregate(...e){let t,r;0===e.length||Array.isArray(e[0])?(t=e[1]||{},r=e[0]||[]):(t={},r=e||[]),this._emitCollectionApiCall("aggregate",{options:t,pipeline:r});const{aggOptions:s,dbOptions:i,explain:n}=(0,o.adaptAggregateOptions)(t),a=this._mongo._serviceProvider.aggregate(this._database._name,this._name,r,{...await this._database._baseOptions(),...s},i),c=new l.AggregationCursor(this._mongo,a);return n?await c.explain(n):((0,o.shouldRunAggregationImmediately)(r)&&await c.hasNext(),this._mongo._instanceState.currentCursor=c,c)}async bulkWrite(e,t={}){this._emitCollectionApiCall("bulkWrite",{options:t});const r=await this._mongo._serviceProvider.bulkWrite(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return new l.BulkWriteResult(!!r.ok,r.insertedCount,r.insertedIds,r.matchedCount,r.modifiedCount,r.deletedCount,r.upsertedCount,r.upsertedIds)}async count(e={},t={}){return await this._instanceState.printDeprecationWarning("Collection.count() is deprecated. Use countDocuments or estimatedDocumentCount."),this._emitCollectionApiCall("count",{query:e,options:t}),this._mongo._serviceProvider.count(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async countDocuments(e,t={}){return this._emitCollectionApiCall("countDocuments",{query:e,options:t}),this._mongo._serviceProvider.countDocuments(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async deleteMany(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.deleteMany"),this._emitCollectionApiCall("deleteMany",{filter:e,options:t});const r=await this._mongo._serviceProvider.deleteMany(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain?(0,o.markAsExplainOutput)(r):new l.DeleteResult(!!r.acknowledged,r.deletedCount)}async deleteOne(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.deleteOne"),this._emitCollectionApiCall("deleteOne",{filter:e,options:t});const r=await this._mongo._serviceProvider.deleteOne(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain?(0,o.markAsExplainOutput)(r):new l.DeleteResult(!!r.acknowledged,r.deletedCount)}async distinct(e,t,r={}){return this._emitCollectionApiCall("distinct",{field:e,query:t,options:r}),(0,o.maybeMarkAsExplainOutput)(await this._mongo._serviceProvider.distinct(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}),r)}async estimatedDocumentCount(e={}){return this._emitCollectionApiCall("estimatedDocumentCount",{options:e}),this._mongo._serviceProvider.estimatedDocumentCount(this._database._name,this._name,{...await this._database._baseOptions(),...e})}async find(e,t,r={}){t&&(r.projection=t),this._emitCollectionApiCall("find",{query:e,options:r});const s=new l.Cursor(this._mongo,this._mongo._serviceProvider.find(this._database._name,this._name,e,{...await this._database._baseOptions(),...r}));return this._mongo._instanceState.currentCursor=s,s}async findAndModify(e){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findAndModify"),(0,o.assertKeysDefined)(e,["query"]),this._emitCollectionApiCall("findAndModify",{options:{...e,update:!!e.update}});const t={...e};if(delete t.query,delete t.update,e.remove)return this.findOneAndDelete(e.query,t);const{update:r}=e;if(!r)throw new c.MongoshInvalidInputError("Must specify options.update or options.remove",c.CommonErrors.InvalidArgument);return Array.isArray(r)||Object.keys(r).some((e=>e.startsWith("$")))?this.findOneAndUpdate(e.query,r,t):this.findOneAndReplace(e.query,r,t)}async findOne(e={},t,r={}){return t&&(r.projection=t),this._emitCollectionApiCall("findOne",{query:e,options:r}),new l.Cursor(this._mongo,this._mongo._serviceProvider.find(this._database._name,this._name,e,{...await this._database._baseOptions(),...r})).limit(1).tryNext()}async renameCollection(e,t){(0,o.assertArgsDefinedType)([e],["string"],"Collection.renameCollection"),this._emitCollectionApiCall("renameCollection",{newName:e,dropTarget:t});try{return await this._mongo._serviceProvider.renameCollection(this._database._name,this._name,e,{...await this._database._baseOptions(),dropTarget:!!t}),{ok:1}}catch(e){if("MongoError"===(null==e?void 0:e.name))return{ok:0,errmsg:e.errmsg,code:e.code,codeName:e.codeName};throw e}}async findOneAndDelete(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndDelete"),this._emitCollectionApiCall("findOneAndDelete",{filter:e,options:t});const r=await this._mongo._serviceProvider.findOneAndDelete(this._database._name,this._name,e,{...await this._database._baseOptions(),...t});return t.explain&&r?(0,o.markAsExplainOutput)(r):null==r?void 0:r.value}async findOneAndReplace(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndReplace");const s=(0,o.processFindAndModifyOptions)({...await this._database._baseOptions(),...r});this._emitCollectionApiCall("findOneAndReplace",{filter:e,findOneAndReplaceOptions:s});const i=await this._mongo._serviceProvider.findOneAndReplace(this._database._name,this._name,e,t,s);return r.explain?(0,o.markAsExplainOutput)(i):i.value}async findOneAndUpdate(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.findOneAndUpdate");const s=(0,o.processFindAndModifyOptions)({...await this._database._baseOptions(),...r});this._emitCollectionApiCall("findOneAndUpdate",{filter:e,findOneAndUpdateOptions:s});const i=await this._mongo._serviceProvider.findOneAndUpdate(this._database._name,this._name,e,t,s);return r.explain?(0,o.markAsExplainOutput)(i):i.value}async insert(e,t={}){await this._instanceState.printDeprecationWarning("Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite."),(0,o.assertArgsDefinedType)([e],[!0],"Collection.insert");const r=Array.isArray(e)?e.map((e=>({...e}))):[{...e}];this._emitCollectionApiCall("insert",{options:t});const s=await this._mongo._serviceProvider.insertMany(this._database._name,this._name,r,{...await this._database._baseOptions(),...t});return new l.InsertManyResult(!!s.acknowledged,s.insertedIds)}async insertMany(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.insertMany");const r=Array.isArray(e)?e.map((e=>({...e}))):e;this._emitCollectionApiCall("insertMany",{options:t});const s=await this._mongo._serviceProvider.insertMany(this._database._name,this._name,r,{...await this._database._baseOptions(),...t});return new l.InsertManyResult(!!s.acknowledged,s.insertedIds)}async insertOne(e,t={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.insertOne"),this._emitCollectionApiCall("insertOne",{options:t});const r=await this._mongo._serviceProvider.insertOne(this._database._name,this._name,{...e},{...await this._database._baseOptions(),...t});return new l.InsertOneResult(!!r.acknowledged,r.insertedId)}async isCapped(){var e,t;this._emitCollectionApiCall("isCapped");const r=await this._database._listCollections({name:this._name},{nameOnly:!1});if(0===r.length)throw new c.MongoshRuntimeError(`collection ${this.getFullName()} not found`);return!!(null===(t=null===(e=r[0])||void 0===e?void 0:e.options)||void 0===t?void 0:t.capped)}async remove(e,t={}){await this._instanceState.printDeprecationWarning("Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite."),(0,o.assertArgsDefinedType)([e],[!0],"Collection.remove");const r=(0,o.processRemoveOptions)(t),s=r.justOne?"deleteOne":"deleteMany";delete r.justOne,this._emitCollectionApiCall("remove",{query:e,removeOptions:r});const i=await this._mongo._serviceProvider[s](this._database._name,this._name,e,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(i):new l.DeleteResult(!!i.acknowledged,i.deletedCount)}async replaceOne(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.replaceOne"),this._emitCollectionApiCall("replaceOne",{filter:e,options:r});const s=await this._mongo._serviceProvider.replaceOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async update(e,t,r={}){let s;return await this._instanceState.printDeprecationWarning("Collection.update() is deprecated. Use updateOne, updateMany, or bulkWrite."),(0,o.assertArgsDefinedType)([e,t],[!0,!0],"Collection.update"),this._emitCollectionApiCall("update",{filter:e,options:r}),s=r.multi?await this._mongo._serviceProvider.updateMany(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}):await this._mongo._serviceProvider.updateOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r}),r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async updateMany(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.updateMany"),this._emitCollectionApiCall("updateMany",{filter:e,options:r});const s=await this._mongo._serviceProvider.updateMany(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async updateOne(e,t,r={}){(0,o.assertArgsDefinedType)([e],[!0],"Collection.updateOne"),this._emitCollectionApiCall("updateOne",{filter:e,options:r});const s=await this._mongo._serviceProvider.updateOne(this._database._name,this._name,e,t,{...await this._database._baseOptions(),...r});return r.explain?(0,o.markAsExplainOutput)(s):new l.UpdateResult(!!s.acknowledged,s.matchedCount,s.modifiedCount,s.upsertedCount,s.upsertedId)}async compactStructuredEncryptionData(){if(!this._mongo._fleOptions)throw new c.MongoshInvalidInputError('The "compactStructuredEncryptionData" command requires Mongo instance configured with auto encryption.',c.CommonErrors.InvalidArgument);return this._emitCollectionApiCall("compactStructuredEncryptionData"),await this._database._runCommand({compactStructuredEncryptionData:this._name})}async convertToCapped(e){return this._emitCollectionApiCall("convertToCapped",{size:e}),await this._database._runCommand({convertToCapped:this._name,size:e})}async _createIndexes(e,t={},r){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.createIndexes"),"object"!=typeof t||Array.isArray(t))throw new c.MongoshInvalidInputError('The "options" argument must be an object.',c.CommonErrors.InvalidArgument);const s=e.map((e=>({...t,key:e}))),i={...await this._database._baseOptions(),...t};return void 0!==r&&(i.commitQuorum=r),await this._mongo._serviceProvider.createIndexes(this._database._name,this._name,s,i)}async createIndexes(e,t={},r){const s=e.map((e=>({...t,key:e})));return this._emitCollectionApiCall("createIndexes",{specs:s}),this._createIndexes(e,t,r)}async createIndex(e,t={},r){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.createIndex"),"object"!=typeof t||Array.isArray(t))throw new c.MongoshInvalidInputError('The "options" argument must be an object.',c.CommonErrors.InvalidArgument);this._emitCollectionApiCall("createIndex",{keys:e,options:t});const s=await this._createIndexes([e],t,r);if(!Array.isArray(s)||1!==s.length)throw new c.MongoshInternalError(`Expected createIndexes() to return array of length 1, saw ${s.toString()}`);return s[0]}async ensureIndex(e,t={},r){return this._emitCollectionApiCall("ensureIndex",{keys:e,options:t}),await this._createIndexes([e],t,r)}async getIndexes(){return this._emitCollectionApiCall("getIndexes"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndexSpecs(){return this._emitCollectionApiCall("getIndexSpecs"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndices(){return this._emitCollectionApiCall("getIndices"),await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())}async getIndexKeys(){return this._emitCollectionApiCall("getIndexKeys"),(await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())).map((e=>e.key))}async dropIndexes(e="*"){this._emitCollectionApiCall("dropIndexes",{indexes:e});try{return await this._database._runCommand({dropIndexes:this._name,index:e})}catch(t){if(("IndexNotFound"===(null==t?void 0:t.codeName)||void 0===(null==t?void 0:t.codeName))&&("invalid index name spec"===(null==t?void 0:t.errmsg)||void 0===(null==t?void 0:t.errmsg))&&Array.isArray(e)&&e.length>0&&/^4\.0\./.exec(await this._database.version())){const t=await Promise.all(e.map((async e=>await this.dropIndexes(e))));return t.find((e=>!e.ok))||t.sort(((e,t)=>t.nIndexesWas-e.nIndexesWas))[0]}if("IndexNotFound"===(null==t?void 0:t.codeName))return{ok:t.ok,errmsg:t.errmsg,code:t.code,codeName:t.codeName};throw t}}async dropIndex(e){if((0,o.assertArgsDefinedType)([e],[!0],"Collection.dropIndex"),this._emitCollectionApiCall("dropIndex",{index:e}),"*"===e)throw new c.MongoshInvalidInputError("To drop indexes in the collection using '*', use db.collection.dropIndexes().",c.CommonErrors.InvalidArgument);if(Array.isArray(e))throw new c.MongoshInvalidInputError("The index to drop must be either the index name or the index specification document.",c.CommonErrors.InvalidArgument);return this.dropIndexes(e)}async _getSingleStorageStatValue(e){const t=await this.aggregate([{$collStats:{storageStats:{}}},{$group:{_id:null,value:{$sum:`$storageStats.${e}`}}}]),[{value:r}]=await t.toArray();return r}async totalIndexSize(...e){if(this._emitCollectionApiCall("totalIndexSize"),e.length)throw new c.MongoshInvalidInputError('"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.',c.CommonErrors.InvalidArgument);return this._getSingleStorageStatValue("totalIndexSize")}async reIndex(){return this._emitCollectionApiCall("reIndex"),await this._database._runCommand({reIndex:this._name})}getDB(){return this._emitCollectionApiCall("getDB"),this._database}getMongo(){return this._emitCollectionApiCall("getMongo"),this._mongo}async dataSize(){return this._emitCollectionApiCall("dataSize"),this._getSingleStorageStatValue("size")}async storageSize(){return this._emitCollectionApiCall("storageSize"),this._getSingleStorageStatValue("storageSize")}async totalSize(){return this._emitCollectionApiCall("totalSize"),this._getSingleStorageStatValue("totalSize")}async drop(e={}){var t,r,s;this._emitCollectionApiCall("drop");let i={};const n=null===(t=this._mongo._fleOptions)||void 0===t?void 0:t.encryptedFieldsMap;if(!(null==n?void 0:n[`${this._database._name}.${this._name}`])&&!e.encryptedFields)try{const e=await this._mongo._serviceProvider.listCollections(this._database._name,{name:this._name},await this._database._baseOptions()),t=null===(s=null===(r=null==e?void 0:e[0])||void 0===r?void 0:r.options)||void 0===s?void 0:s.encryptedFields;t&&(i={encryptedFields:t})}catch(e){}try{return await this._mongo._serviceProvider.dropCollection(this._database._name,this._name,{...await this._database._baseOptions(),...e,...i})}catch(e){if("NamespaceNotFound"===(null==e?void 0:e.codeName))return this._mongo._instanceState.messageBus.emit("mongosh:warn",{method:"drop",class:"Collection",message:`Namespace not found: ${this._name}`}),!1;throw e}}async exists(){return this._emitCollectionApiCall("exists"),(await this._mongo._serviceProvider.listCollections(this._database._name,{name:this._name},await this._database._baseOptions()))[0]||null}getFullName(){return this._emitCollectionApiCall("getFullName"),`${this._database._name}.${this._name}`}getName(){return this._emitCollectionApiCall("getName"),`${this._name}`}async runCommand(e,t){if((0,o.assertArgsDefinedType)([e],[["string","object"]],"Collection.runCommand"),t){if("string"!=typeof e)throw new c.MongoshInvalidInputError("Collection.runCommand takes a command string as its first arugment",c.CommonErrors.InvalidArgument);if(e in t)throw new c.MongoshInvalidInputError('The "commandName" argument cannot be passed as an option to "runCommand".',c.CommonErrors.InvalidArgument)}const r=new RegExp(u.HIDDEN_COMMANDS);"string"!=typeof e||r.test(e)||this._emitCollectionApiCall("runCommand",{commandName:e});const s="string"==typeof e?{[e]:this._name,...t}:e;return await this._database._runCommand(s)}explain(e="queryPlanner"){return e=(0,o.validateExplainableVerbosity)(e),this._emitCollectionApiCall("explain",{verbosity:e}),new l.Explainable(this._mongo,this,e)}async _getLegacyCollStats(e){const t=await this._database._runReadCommand({collStats:this._name,scale:e||1});if(!t)throw new c.MongoshRuntimeError(`Error running collStats command on ${this.getFullName()}`,c.CommonErrors.CommandFailed);return t}async _aggregateAndScaleCollStats(e,t){var r;const s={ok:1},i={},n={},a={},l={};let c,p=0,u=0,h=0,d=0;for(const f of e){const e=f.storageStats,m=e.count,y=void 0!==m?m:0;for(const t of Object.keys(e))if(!["ns","ok","lastExtentSize","paddingFactor"].includes(t))if(["userFlags","capped","max","paddingFactorNote","indexDetails","wiredTiger"].includes(t))null!==(r=s[t])&&void 0!==r||(s[t]=e[t]);else if("timeseries"===t){const r=e[t];for(const[e,t]of Object.entries(r))"string"==typeof t?c||(c=t):"avgBucketSize"===e?d+=(0,o.coerceToJSNumber)(r.bucketCount)*(0,o.coerceToJSNumber)(t):(void 0===l[e]&&(l[e]=0),l[e]+=(0,o.coerceToJSNumber)(t))}else if(["count","size","storageSize","totalIndexSize","totalSize","numOrphanDocs"].includes(t))void 0===n[t]&&(n[t]=0),n[t]+=(0,o.coerceToJSNumber)(e[t]);else if("avgObjSize"===t)u+=(0,o.coerceToJSNumber)(e[t])*y;else if("maxSize"===t){const r=(0,o.coerceToJSNumber)(e[t]);p=Math.max(p,r)}else if("indexSizes"===t)for(const r of Object.keys(e[t]))void 0===a[r]&&(a[r]=0),a[r]+=(0,o.coerceToJSNumber)(e[t][r]);else if("nindexes"===t){const r=e[t];(0===h||r>h)&&(h=r)}f.shard&&(i[f.shard]=(0,o.scaleIndividualShardStatistics)(e,t))}const f=`${this._database._name}.${this._name}`,m=this._mongo.getDB("config");e[0].shard&&(s.shards=i);try{s.sharded=!!await m.getCollection("collections").findOne({_id:null!=c?c:f,dropped:{$ne:!0}})}catch(t){s.sharded=e.length>1}for(const[e,r]of Object.entries(n))["size","storageSize","totalIndexSize","totalSize"].includes(e)?s[e]=r/t:s[e]=r;c&&Object.keys(l).length>0&&(s.timeseries={...l,avgBucketSize:l.bucketCount?d/l.bucketCount:0,bucketsNs:c}),s.indexSizes={};for(const[e,r]of Object.entries(a))s.indexSizes[e]=r/t;return n.count>0?s.avgObjSize=u/n.count:s.avgObjSize=0,s.capped&&(s.maxSize=p/t),s.ns=f,s.nindexes=h,void 0!==e[0].storageStats.scaleFactor&&(s.scaleFactor=t),s.ok=1,s}async _getAggregatedCollStats(e){try{const t=await(await this.aggregate([{$collStats:{storageStats:{scale:1}}}])).toArray();if(!t||void 0===t[0])throw new c.MongoshRuntimeError(`Error running $collStats aggregation stage on ${this.getFullName()}`,c.CommonErrors.CommandFailed);return await this._aggregateAndScaleCollStats(t,e)}catch(t){if("StaleConfig"===(null==t?void 0:t.codeName)||13388===(null==t?void 0:t.code))try{return await this._getLegacyCollStats(e)}catch(e){throw t}throw t}}async stats(e={}){var t;const r="number"==typeof e?{scale:e}:e;if(r.indexDetailsKey&&r.indexDetailsName)throw new c.MongoshInvalidInputError("Cannot filter indexDetails on both indexDetailsKey and indexDetailsName",c.CommonErrors.InvalidArgument);if(r.indexDetailsKey&&"object"!=typeof r.indexDetailsKey)throw new c.MongoshInvalidInputError("Expected options.indexDetailsKey to be a document, got "+typeof r.indexDetailsKey,c.CommonErrors.InvalidArgument);if(r.indexDetailsName&&"string"!=typeof r.indexDetailsName)throw new c.MongoshInvalidInputError("Expected options.indexDetailsName to be a string, got "+typeof r.indexDetailsName,c.CommonErrors.InvalidArgument);r.scale=r.scale||1,r.indexDetails=r.indexDetails||!1,this._emitCollectionApiCall("stats",{options:r});const s=await this._getAggregatedCollStats(r.scale);let i=r.indexDetailsName;!i&&r.indexDetailsKey&&(await this._mongo._serviceProvider.getIndexes(this._database._name,this._name,await this._database._baseOptions())).forEach((e=>{JSON.stringify(e.key)===JSON.stringify(r.indexDetailsKey)&&(i=e.name)}));const n=e=>{if(e.indexDetails)if(r.indexDetails){if(i)for(const t of Object.keys(e.indexDetails))t!==i&&delete e.indexDetails[t]}else delete e.indexDetails};n(s);for(const e of Object.keys(null!==(t=s.shards)&&void 0!==t?t:{}))n(s.shards[e]);return s}async latencyStats(e={}){return this._emitCollectionApiCall("latencyStats",{options:e}),await(await this.aggregate([{$collStats:{latencyStats:e}}])).toArray()}async initializeOrderedBulkOp(){this._emitCollectionApiCall("initializeOrderedBulkOp");const e=await this._mongo._serviceProvider.initializeBulkOp(this._database._name,this._name,!0,await this._database._baseOptions());return new p.default(this,e,!0)}async initializeUnorderedBulkOp(){this._emitCollectionApiCall("initializeUnorderedBulkOp");const e=await this._mongo._serviceProvider.initializeBulkOp(this._database._name,this._name,!1,await this._database._baseOptions());return new p.default(this,e)}getPlanCache(){return this._emitCollectionApiCall("getPlanCache"),new h.default(this)}async mapReduce(e,t,r){await this._instanceState.printDeprecationWarning("Collection.mapReduce() is deprecated. Use an aggregation instead.\nSee https://docs.mongodb.com/manual/core/map-reduce for details."),(0,o.assertArgsDefinedType)([e,t,r],[!0,!0,!0],"Collection.mapReduce"),this._emitCollectionApiCall("mapReduce",{map:e,reduce:t,out:r});let s={mapReduce:this._name,map:e,reduce:t,...(0,o.processMapReduceOptions)(r)};if(s.explain){const e=s.explain;delete s.explain,s={explain:s,verbosity:e}}return await this._database._runCommand(s)}async validate(e=!1){return this._emitCollectionApiCall("validate",{options:e}),"boolean"==typeof e&&(e={full:e}),await this._database._runReadCommand({validate:this._name,...e})}async getShardVersion(){return this._emitCollectionApiCall("getShardVersion",{}),await this._database._runAdminCommand({getShardVersion:`${this._database._name}.${this._name}`})}async getShardDistribution(){this._emitCollectionApiCall("getShardDistribution",{});const e={},t=this._mongo.getDB("config"),r=`${this._database._name}.${this._name}`,s=await t.getCollection("collections").findOne({_id:r,dropped:{$ne:!0}});if(!s)throw new c.MongoshInvalidInputError(`Collection ${this._name} is not sharded`,f.ShellApiErrors.NotConnectedToShardedCluster);const i=await(await this.aggregate({$collStats:{storageStats:{}}})).toArray(),n={numChunks:0,size:0,count:0},a=[];await Promise.all(i.map((r=>(async()=>{const{shard:i}=r,l={...(0,o.buildConfigChunksCollectionMatch)(s),shard:i},[c,p]=await Promise.all([t.getCollection("shards").findOne({_id:r.shard}),t.getCollection("chunks").countDocuments(l)]),u={shardId:i,host:null!==c?c.host:null,size:r.storageStats.size,count:r.storageStats.count,numChunks:p,avgObjSize:r.storageStats.avgObjSize},h=`Shard ${u.shardId} at ${u.host}`,d=0===u.numChunks?0:u.size/u.numChunks,f=0===u.numChunks?0:Math.floor(u.count/u.numChunks);e[h]={data:(0,o.dataFormat)((0,o.coerceToJSNumber)(u.size)),docs:u.count,chunks:u.numChunks,"estimated data per chunk":(0,o.dataFormat)(d),"estimated docs per chunk":f},n.size+=(0,o.coerceToJSNumber)(u.size),n.count+=(0,o.coerceToJSNumber)(u.count),n.numChunks+=(0,o.coerceToJSNumber)(u.numChunks),a.push(u)})())));const p={data:(0,o.dataFormat)(n.size),docs:n.count,chunks:n.numChunks};for(const e of a){const t=0===n.size?0:Math.floor(e.size/n.size*1e4)/100,r=0===n.count?0:Math.floor(e.count/n.count*1e4)/100;p[`Shard ${e.shardId}`]=[`${t} % data`,`${r} % docs in cluster`,`${(0,o.dataFormat)(e.avgObjSize)} avg obj size on shard`]}return e.Totals=p,new l.CommandResult("StatsResult",e)}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitCollectionApiCall("watch",{pipeline:e,options:t});const r=new d.default(this._mongo._serviceProvider.watch(e,{...await this._database._baseOptions(),...t},{},this._database._name,this._name),this._name,this._mongo);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._mongo._instanceState.currentCursor=r,r}async hideIndex(e){return this._emitCollectionApiCall("hideIndex"),(0,o.setHideIndex)(this,e,!0)}async unhideIndex(e){return this._emitCollectionApiCall("unhideIndex"),(0,o.setHideIndex)(this,e,!1)}async analyzeShardKey(e,t={}){return(0,o.assertArgsDefinedType)([e],[!0],"Collection.analyzeShardKey"),this._emitCollectionApiCall("analyzeShardKey",{key:e}),await this._database._runAdminCommand({analyzeShardKey:this.getFullName(),key:e,...t})}async configureQueryAnalyzer(e){return this._emitCollectionApiCall("configureQueryAnalyzer",e),await this._database._runAdminCommand({configureQueryAnalyzer:this.getFullName(),...e})}async checkMetadataConsistency(e={}){return this._emitCollectionApiCall("checkMetadataConsistency",{options:e}),this._database._runCursorCommand({checkMetadataConsistency:this._name})}async getSearchIndexes(e,t){return"object"==typeof e&&null!==e&&(t=e,e=void 0),this._emitCollectionApiCall("getSearchIndexes",{options:t}),await this._mongo._serviceProvider.getSearchIndexes(this._database._name,this._name,e,{...await this._database._baseOptions(),...t})}async createSearchIndex(e,t){var r;return"object"==typeof e&&null!==e&&(t=e,e=void 0),this._emitCollectionApiCall("createSearchIndex",{indexName:e,definition:t}),(await this._mongo._serviceProvider.createSearchIndexes(this._database._name,this._name,[{name:null!==(r=e)&&void 0!==r?r:"default",definition:{...t}}]))[0]}async createSearchIndexes(e){return this._emitCollectionApiCall("createSearchIndexes",{specs:e}),await this._mongo._serviceProvider.createSearchIndexes(this._database._name,this._name,e)}async dropSearchIndex(e){return this._emitCollectionApiCall("dropSearchIndex",{indexName:e}),await this._mongo._serviceProvider.dropSearchIndex(this._database._name,this._name,e)}async updateSearchIndex(e,t){return this._emitCollectionApiCall("updateSearchIndex",{indexName:e,definition:t}),await this._mongo._serviceProvider.updateSearchIndex(this._database._name,this._name,e,t)}};s([n.returnsPromise,(0,n.returnType)("AggregationCursor"),(0,n.apiVersions)([1])],m.prototype,"aggregate",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"bulkWrite",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"]),(0,n.apiVersions)([])],m.prototype,"count",null),s([n.returnsPromise,(0,n.serverVersions)(["4.0.3",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"countDocuments",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"deleteMany",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"deleteOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"distinct",null),s([n.returnsPromise,(0,n.serverVersions)(["4.0.3",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"estimatedDocumentCount",null),s([(0,n.returnType)("Cursor"),(0,n.apiVersions)([1]),n.returnsPromise],m.prototype,"find",null),s([n.returnsPromise,n.deprecated,(0,n.apiVersions)([1])],m.prototype,"findAndModify",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.apiVersions)([1])],m.prototype,"findOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"renameCollection",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndDelete",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndReplace",null),s([n.returnsPromise,(0,n.returnType)("Document"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"findOneAndUpdate",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.6.0"]),(0,n.apiVersions)([1])],m.prototype,"insert",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"insertMany",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"insertOne",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"isCapped",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"]),(0,n.apiVersions)([1])],m.prototype,"remove",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"replaceOne",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"]),(0,n.apiVersions)([1])],m.prototype,"update",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"updateMany",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"updateOne",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"compactStructuredEncryptionData",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"convertToCapped",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"createIndexes",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"createIndex",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"ensureIndex",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexes",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexSpecs",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"getIndices",null),s([n.returnsPromise,(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([1])],m.prototype,"getIndexKeys",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"dropIndexes",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"dropIndex",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"totalIndexSize",null),s([n.returnsPromise,n.deprecated,(0,n.topologies)([a.Topologies.Standalone]),(0,n.apiVersions)([])],m.prototype,"reIndex",null),s([(0,n.returnType)("Database")],m.prototype,"getDB",null),s([(0,n.returnType)("Mongo")],m.prototype,"getMongo",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"dataSize",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"storageSize",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"totalSize",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"drop",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"exists",null),s([n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"runCommand",null),s([(0,n.returnType)("Explainable"),(0,n.apiVersions)([1])],m.prototype,"explain",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"stats",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"latencyStats",null),s([n.returnsPromise,(0,n.returnType)("Bulk"),(0,n.apiVersions)([1])],m.prototype,"initializeOrderedBulkOp",null),s([n.returnsPromise,(0,n.returnType)("Bulk"),(0,n.apiVersions)([1])],m.prototype,"initializeUnorderedBulkOp",null),s([(0,n.returnType)("PlanCache"),(0,n.apiVersions)([])],m.prototype,"getPlanCache",null),s([n.returnsPromise,n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.9.0"]),(0,n.apiVersions)([])],m.prototype,"mapReduce",null),s([n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"validate",null),s([n.returnsPromise,(0,n.topologies)([a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"getShardVersion",null),s([n.returnsPromise,(0,n.topologies)([a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"getShardDistribution",null),s([(0,n.serverVersions)(["3.1.0",a.ServerVersions.latest]),(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([1]),n.returnsPromise],m.prototype,"watch",null),s([(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"hideIndex",null),s([(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([1])],m.prototype,"unhideIndex",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"analyzeShardKey",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.topologies)([a.Topologies.ReplSet,a.Topologies.Sharded]),(0,n.apiVersions)([])],m.prototype,"configureQueryAnalyzer",null),s([(0,n.serverVersions)(["7.0.0",a.ServerVersions.latest]),(0,n.topologies)([a.Topologies.Sharded]),n.returnsPromise],m.prototype,"checkMetadataConsistency",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"getSearchIndexes",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"createSearchIndex",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"createSearchIndexes",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"dropSearchIndex",null),s([(0,n.serverVersions)(["6.0.0",a.ServerVersions.latest]),n.returnsPromise,(0,n.apiVersions)([])],m.prototype,"updateSearchIndex",null),m=s([n.shellApiClassDefault,n.addSourceToResults],m),t.default=m},4564:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(40191),a=r(86930),o=r(73251);let l=class extends o.AggregateOrFindCursor{constructor(e,t){super(e,t),this._tailable=!1}_addFlag(e){this._cursor.addCursorFlag(e,!0)}addOption(e){if(4===e)throw new i.MongoshUnimplementedError("the slaveOk option is not supported.",i.CommonErrors.NotImplemented);const t=a.CURSOR_FLAGS[e];if(!t)throw new i.MongoshInvalidInputError(`Unknown option flag number: ${e}.`,i.CommonErrors.InvalidArgument);return this._cursor.addCursorFlag(t,!0),this}allowDiskUse(e){return this._cursor.allowDiskUse(e),this}allowPartialResults(){return this._addFlag("partial"),this}collation(e){return this._cursor.collation(e),this}comment(e){return this._cursor.comment(e),this}async count(){return this._cursor.count()}async hasNext(){return this._tailable&&await this._instanceState.printWarning("If this is a tailable cursor with awaitData, and there are no documents in the batch, this method will will block. Use tryNext if you want to check if there are any documents without waiting."),super.hasNext()}hint(e){return this._cursor.hint(e),this}limit(e){return this._cursor.limit(e),this}max(e){return this._cursor.max(e),this}maxAwaitTimeMS(e){return this._cursor.maxAwaitTimeMS(e),this}min(e){return this._cursor.min(e),this}async next(){return this._tailable&&await this._instanceState.printWarning("If this is a tailable cursor with awaitData, and there are no documents in the batch, this method will will block. Use tryNext if you want to check if there are any documents without waiting."),super.next()}noCursorTimeout(){return this._addFlag("noCursorTimeout"),this}oplogReplay(){return this._addFlag("oplogReplay"),this}readPref(e,t,r){let s;return s=t||r?this._mongo._serviceProvider.readPreferenceFromOptions({readPreference:e,readPreferenceTags:t,hedge:r}):e,this._cursor=this._cursor.withReadPreference(s),this}returnKey(e){return this._cursor.returnKey(e),this}async size(){return this._cursor.count()}tailable(e={awaitData:!1}){return this._tailable=!0,this._addFlag("tailable"),e.awaitData&&this._addFlag("awaitData"),this}maxScan(){throw new i.MongoshDeprecatedError("`maxScan()` was removed because it was deprecated in MongoDB 4.0")}showRecordId(){return this._cursor.showRecordId(!0),this}readConcern(e){return this._cursor=this._cursor.withReadConcern({level:e}),this}};s([(0,n.returnType)("Cursor"),(0,n.serverVersions)([a.ServerVersions.earliest,"3.2.0"])],l.prototype,"addOption",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["4.4.0",a.ServerVersions.latest])],l.prototype,"allowDiskUse",null),s([(0,n.returnType)("Cursor")],l.prototype,"allowPartialResults",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.4.0",a.ServerVersions.latest])],l.prototype,"collation",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"comment",null),s([(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"]),n.returnsPromise,n.deprecated],l.prototype,"count",null),s([n.returnsPromise],l.prototype,"hasNext",null),s([(0,n.returnType)("Cursor")],l.prototype,"hint",null),s([(0,n.returnType)("Cursor")],l.prototype,"limit",null),s([(0,n.returnType)("Cursor")],l.prototype,"max",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"maxAwaitTimeMS",null),s([(0,n.returnType)("Cursor")],l.prototype,"min",null),s([n.returnsPromise],l.prototype,"next",null),s([(0,n.returnType)("Cursor")],l.prototype,"noCursorTimeout",null),s([(0,n.returnType)("Cursor")],l.prototype,"oplogReplay",null),s([(0,n.returnType)("Cursor")],l.prototype,"readPref",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"returnKey",null),s([n.returnsPromise],l.prototype,"size",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest]),(0,n.apiVersions)([])],l.prototype,"tailable",null),s([n.deprecated,(0,n.serverVersions)([a.ServerVersions.earliest,"4.0.0"])],l.prototype,"maxScan",null),s([(0,n.returnType)("Cursor"),(0,n.serverVersions)(["3.2.0",a.ServerVersions.latest])],l.prototype,"showRecordId",null),s([(0,n.returnType)("Cursor")],l.prototype,"readConcern",null),l=s([n.shellApiClassDefault],l),t.default=l},78041:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(r(6988)),a=r(40191),o=r(86930),l=r(86901),c=r(46993),p=r(6534),u=r(46177),h=i(r(88494)),d=r(73041);let f=class extends a.ShellApiWithMongoClass{constructor(e,t,r){super(),this._cachedCollectionNames=[],this._cachedHello=null,this._mongo=e,this._name=t;const s=Object.create(null);this._collections=s,this._session=r;const i=new Proxy(this,{get:(t,r)=>r in t?t[r]:"string"==typeof r&&!r.startsWith("_")&&(0,l.isValidCollectionName)(r)?(s[r]||(s[r]=new n.default(e,i,r)),s[r]):void 0});return i}async _baseOptions(){const e={};this._session&&(e.session=this._session._session);const t=await this._instanceState.shellApi.config.get("maxTimeMS");return"number"==typeof t&&(e.maxTimeMS=t),e}async _maybeCachedHello(){var e;return null!==(e=this._cachedHello)&&void 0!==e?e:await this.hello()}[o.asPrintable](){return this._name}_emitDatabaseApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Database",db:this._name,arguments:t})}async _runCommand(e,t={}){return this._mongo._serviceProvider.runCommandWithCheck(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...await this._baseOptions(),...t})}async _runReadCommand(e,t={}){return this._mongo._serviceProvider.runCommandWithCheck(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t})}async _runAdminCommand(e,t={}){return this.getSiblingDB("admin")._runCommand(e,{...await this._baseOptions(),...t})}async _runCursorCommand(e,t={}){const r=this._mongo._serviceProvider.runCursorCommand(this._name,(0,l.adjustRunCommand)(e,this._instanceState.shellBson),{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t}),s=new c.RunCommandCursor(this._mongo,r);return this._mongo._instanceState.currentCursor=s,s}async _runAdminCursorCommand(e,t={}){return this.getSiblingDB("admin")._runCursorCommand(e,t)}async _listCollections(e,t){return await this._mongo._serviceProvider.listCollections(this._name,e,{...this._mongo._getExplicitlyRequestedReadPref(),...await this._baseOptions(),...t})||[]}async _getCollectionNames(e){const t=await this._listCollections({},{...e,nameOnly:!0});return this._cachedCollectionNames=t.map((e=>e.name)),this._cachedCollectionNames}async _getCollectionNamesWithTypes(e){let t=await this._listCollections({},{...e,nameOnly:!0});return t=t.sort(((e,t)=>e.name.localeCompare(t.name))),this._cachedCollectionNames=t.map((e=>e.name)),t.map(((e,r)=>({name:e.name,badge:(0,l.getBadge)(t,r)})))}async _getCollectionNamesForCompletion(){return await Promise.race([(async()=>await this._getCollectionNames({readPreference:"primaryPreferred"}))(),(async()=>(await new Promise((e=>setTimeout(e,200).unref())),this._cachedCollectionNames))()])}async _getLastErrorObj(e,t,r){const s={getlasterror:1};e&&(s.w=e),t&&(s.wtimeout=t),void 0!==r&&(s.j=r);try{return await this._mongo._serviceProvider.runCommand(this._name,s,await this._baseOptions())}catch(e){return e}}getMongo(){return this._mongo}getName(){return this._name}async getCollectionNames(){return this._emitDatabaseApiCall("getCollectionNames"),this._getCollectionNames()}async getCollectionInfos(e={},t={}){return this._emitDatabaseApiCall("getCollectionInfos",{filter:e,options:t}),await this._listCollections(e,t)}async runCommand(e,t){(0,l.assertArgsDefinedType)([e],[["string","object"]],"Database.runCommand"),"string"==typeof e&&(e={[e]:1});const r=new RegExp(u.HIDDEN_COMMANDS);return Object.keys(e).some((e=>r.test(e)))||this._emitDatabaseApiCall("runCommand",{cmd:e,options:t}),this._runCommand(e,t)}async adminCommand(e){(0,l.assertArgsDefinedType)([e],[["string","object"]],"Database.adminCommand"),"string"==typeof e&&(e={[e]:1});const t=new RegExp(u.HIDDEN_COMMANDS);return Object.keys(e).some((e=>t.test(e)))||this._emitDatabaseApiCall("adminCommand",{cmd:e}),await this._runAdminCommand(e,{})}async aggregate(e,t){(0,l.assertArgsDefinedType)([e],[!0],"Database.aggregate"),this._emitDatabaseApiCall("aggregate",{options:t,pipeline:e});const{aggOptions:r,dbOptions:s,explain:i}=(0,l.adaptAggregateOptions)(t),n=this._mongo._serviceProvider.aggregateDb(this._name,e,{...await this._baseOptions(),...r},s),a=new c.AggregationCursor(this._mongo,n);return i?await a.explain(i):((0,l.shouldRunAggregationImmediately)(e)&&await a.hasNext(),this._mongo._instanceState.currentCursor=a,a)}getSiblingDB(e){return(0,l.assertArgsDefinedType)([e],["string"],"Database.getSiblingDB"),this._emitDatabaseApiCall("getSiblingDB",{db:e}),this._session?this._session.getDatabase(e):this._mongo._getDb(e)}getCollection(e){if((0,l.assertArgsDefinedType)([e],["string"],"Database.getColl"),this._emitDatabaseApiCall("getCollection",{coll:e}),!(0,l.isValidCollectionName)(e))throw new p.MongoshInvalidInputError(`Invalid collection name: ${e}`,p.CommonErrors.InvalidArgument);const t=this._collections;return t[e]||(t[e]=new n.default(this._mongo,this,e)),t[e]}async dropDatabase(e){return await this._mongo._serviceProvider.dropDatabase(this._name,{...await this._baseOptions(),writeConcern:e})}async createUser(e,t){if((0,l.assertArgsDefinedType)([e],["object"],"Database.createUser"),(0,l.assertKeysDefined)(e,["user","roles"]),"$external"===this._name){if("pwd"in e)throw new p.MongoshInvalidInputError("Cannot set password for users on the $external database",p.CommonErrors.InvalidArgument)}else(0,l.assertKeysDefined)(e,["pwd"]);if(this._emitDatabaseApiCall("createUser",{}),e.createUser)throw new p.MongoshInvalidInputError("Cannot set createUser field in helper method",p.CommonErrors.InvalidArgument);const r=(0,l.adaptOptions)({user:"createUser",passwordDigestor:null},{},e);t&&(r.writeConcern=t);const s=(0,l.processDigestPassword)(e.user,e.passwordDigestor,r),i={createUser:r.createUser,...r,...s};return await this._runCommand(i)}async updateUser(e,t,r){if((0,l.assertArgsDefinedType)([e,t],["string","object"],"Database.updateUser"),this._emitDatabaseApiCall("updateUser",{}),t.passwordDigestor&&"server"!==t.passwordDigestor&&"client"!==t.passwordDigestor)throw new p.MongoshInvalidInputError(`Invalid field: passwordDigestor must be 'client' or 'server', got ${t.passwordDigestor}`,p.CommonErrors.InvalidArgument);const s=(0,l.adaptOptions)({passwordDigestor:null},{updateUser:e},t);r&&(s.writeConcern=r);const i=(0,l.processDigestPassword)(e,t.passwordDigestor,s),n={updateUser:s.updateUser,...s,...i};return await this._runCommand(n)}async changeUserPassword(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string","string"],"Database.changeUserPassword"),this._emitDatabaseApiCall("changeUserPassword",{});const s=(0,l.adaptOptions)({},{updateUser:e,pwd:t},{});r&&(s.writeConcern=r);const i={updateUser:s.updateUser,...s};return await this._runCommand(i)}async logout(){return this._emitDatabaseApiCall("logout",{}),this._mongo._instanceState.currentCursor=null,await this._runCommand({logout:1})}async dropUser(e,t){(0,l.assertArgsDefinedType)([e],["string"],"Database.dropUser"),this._emitDatabaseApiCall("dropUser",{});const r={dropUser:e};return t&&(r.writeConcern=t),await this._runCommand(r)}async dropAllUsers(e){this._emitDatabaseApiCall("dropAllUsers",{});const t={dropAllUsersFromDatabase:1};return e&&(t.writeConcern=e),await this._runCommand(t)}async auth(...e){let t;if(this._emitDatabaseApiCall("auth",{}),1===e.length){const{evaluationListener:r}=this._mongo._instanceState;t="string"==typeof e[0]&&r.onPrompt?{user:e[0],pwd:await r.onPrompt("Enter password","password")}:e[0]}else{if(2!==e.length)throw new p.MongoshInvalidInputError("auth expects (username), (username, password), or ({ user: username, pwd: password })",p.CommonErrors.InvalidArgument);t={user:e[0],pwd:e[1]}}if(!(t.user&&t.pwd||t.mechanism))throw new p.MongoshInvalidInputError("auth expects user document with at least 'user' and 'pwd' or 'mechanism' fields",p.CommonErrors.InvalidArgument);if("digestPassword"in t)throw new p.MongoshUnimplementedError("digestPassword is not supported for authentication.",p.CommonErrors.NotImplemented);return t.authDb=this._name,this._mongo._instanceState.currentCursor=null,await this._mongo._serviceProvider.authenticate(t)}async grantRolesToUser(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantRolesToUser"),this._emitDatabaseApiCall("grantRolesToUser",{});const s={grantRolesToUser:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokeRolesFromUser(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokeRolesFromUser"),this._emitDatabaseApiCall("revokeRolesFromUser",{});const s={revokeRolesFromUser:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async getUser(e,t={}){(0,l.assertArgsDefinedType)([e],["string"],"Database.getUser"),this._emitDatabaseApiCall("getUser",{username:e});const r=(0,l.adaptOptions)({},{usersInfo:{user:e,db:this._name}},t),s=await this._runReadCommand(r);if(void 0===s.users)throw new p.MongoshInternalError("No users were returned from the userInfo command");for(let t=0;t<s.users.length;t++)if(s.users[t].user===e)return s.users[t];return null}async getUsers(e={}){this._emitDatabaseApiCall("getUsers",{options:e});const t=(0,l.adaptOptions)({},{usersInfo:1},e);return await this._runReadCommand(t)}async createCollection(e,t={}){return(0,l.assertArgsDefinedType)([e],["string"],"Database.createCollection"),this._emitDatabaseApiCall("createCollection",{name:e,options:t}),await this._mongo._serviceProvider.createCollection(this._name,e,{...await this._baseOptions(),...t})}async createEncryptedCollection(e,t){return this._emitDatabaseApiCall("createEncryptedCollection",{name:e,options:t}),this._mongo.getClientEncryption().createEncryptedCollection(this._name,e,t)}async createView(e,t,r,s={}){(0,l.assertArgsDefinedType)([e,t,r],["string","string",!0],"Database.createView"),this._emitDatabaseApiCall("createView",{name:e,source:t,pipeline:r,options:s});const i={...await this._baseOptions(),viewOn:t,pipeline:r};return s.collation&&(i.collation=s.collation),await this._mongo._serviceProvider.createCollection(this._name,e,i)}async createRole(e,t){if((0,l.assertArgsDefinedType)([e],["object"],"Database.createRole"),(0,l.assertKeysDefined)(e,["role","privileges","roles"]),this._emitDatabaseApiCall("createRole",{}),e.createRole)throw new p.MongoshInvalidInputError("Cannot set createRole field in helper method",p.CommonErrors.InvalidArgument);const r=(0,l.adaptOptions)({role:"createRole"},{},e);t&&(r.writeConcern=t);const s={createRole:r.createRole,...r};return await this._runCommand(s)}async updateRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string","object"],"Database.updateRole"),this._emitDatabaseApiCall("updateRole",{});const s=(0,l.adaptOptions)({},{updateRole:e},t);r&&(s.writeConcern=r);const i={updateRole:s.updateRole,...s};return await this._runCommand(i)}async dropRole(e,t){(0,l.assertArgsDefinedType)([e],["string"],"Database.dropRole"),this._emitDatabaseApiCall("dropRole",{});const r={dropRole:e};return t&&(r.writeConcern=t),await this._runCommand(r)}async dropAllRoles(e){this._emitDatabaseApiCall("dropAllRoles",{});const t={dropAllRolesFromDatabase:1};return e&&(t.writeConcern=e),await this._runCommand(t)}async grantRolesToRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantRolesToRole"),this._emitDatabaseApiCall("grantRolesToRole",{});const s={grantRolesToRole:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokeRolesFromRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokeRolesFromRole"),this._emitDatabaseApiCall("revokeRolesFromRole",{});const s={revokeRolesFromRole:e,roles:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async grantPrivilegesToRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.grantPrivilegesToRole"),this._emitDatabaseApiCall("grantPrivilegesToRole",{});const s={grantPrivilegesToRole:e,privileges:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async revokePrivilegesFromRole(e,t,r){(0,l.assertArgsDefinedType)([e,t],["string",!0],"Database.revokePrivilegesFromRole"),this._emitDatabaseApiCall("revokePrivilegesFromRole",{});const s={revokePrivilegesFromRole:e,privileges:t};return r&&(s.writeConcern=r),await this._runCommand(s)}async getRole(e,t={}){(0,l.assertArgsDefinedType)([e],["string"],"Database.getRole"),this._emitDatabaseApiCall("getRole",{rolename:e});const r=(0,l.adaptOptions)({},{rolesInfo:{role:e,db:this._name}},t),s=await this._runReadCommand(r);if(void 0===s.roles)throw new p.MongoshInternalError("No roles returned from rolesInfo command");for(let t=0;t<s.roles.length;t++)if(s.roles[t].role===e)return s.roles[t];return null}async getRoles(e={}){this._emitDatabaseApiCall("getRoles",{options:e});const t=(0,l.adaptOptions)({},{rolesInfo:1},e);return await this._runReadCommand(t)}async _getCurrentOperations(e){const t="boolean"==typeof e?{$all:e,$ownOps:!1}:{$all:!!e.$all,$ownOps:!!e.$ownOps},r=[{$currentOp:{allUsers:!t.$ownOps,idleConnections:t.$all,truncateOps:!1}}];if("object"==typeof e){const t={};for(const r of Object.keys(e))"$ownOps"!==r&&"$all"!==r&&"$truncateOps"!==r&&(t[r]=e[r]);r.push({$match:t})}const s=this.getSiblingDB("admin"),i={$readPreference:{mode:"primaryPreferred"}};try{const e=await s.aggregate(r,i);return await e.toArray()}catch(e){if("FailedToParse"===(null==e?void 0:e.codeName)){delete r[0].$currentOp.truncateOps;const e=await s.aggregate(r,i);return await e.toArray()}throw e}}async currentOp(e={}){return this._emitDatabaseApiCall("currentOp",{opts:e}),{inprog:await this._getCurrentOperations(e),ok:1}}async killOp(e){return this._emitDatabaseApiCall("killOp",{opId:e}),await this._runAdminCommand({killOp:1,op:e})}async shutdownServer(e={}){return this._emitDatabaseApiCall("shutdownServer",{opts:e}),await this._runAdminCommand({shutdown:1,...e})}async fsyncLock(){return this._emitDatabaseApiCall("fsyncLock",{}),await this._runAdminCommand({fsync:1,lock:!0})}async fsyncUnlock(){return this._emitDatabaseApiCall("fsyncUnlock",{}),await this._runAdminCommand({fsyncUnlock:1})}async version(){this._emitDatabaseApiCall("version",{});const e=await this._runAdminCommand({buildInfo:1});if(!e||void 0===e.version)throw new p.MongoshRuntimeError(`Error running command serverBuildInfo ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.version}async serverBits(){this._emitDatabaseApiCall("serverBits",{});const e=await this._runAdminCommand({buildInfo:1});if(!e||void 0===e.bits)throw new p.MongoshRuntimeError(`Error running command serverBuildInfo ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.bits}async isMaster(){this._emitDatabaseApiCall("isMaster",{});const e=await this._runReadCommand({isMaster:1});return e.isWritablePrimary=e.ismaster,e}async hello(){this._emitDatabaseApiCall("hello",{});try{return this._cachedHello=await this._runReadCommand({hello:1}),this._cachedHello}catch(e){if("CommandNotFound"===(null==e?void 0:e.codeName)){const e=await this.isMaster();return delete e.ismaster,this._cachedHello=e,this._cachedHello}throw e}}async serverBuildInfo(){return this._emitDatabaseApiCall("serverBuildInfo",{}),await this._runAdminCommand({buildInfo:1})}async serverStatus(e={}){return this._emitDatabaseApiCall("serverStatus",{options:e}),await this._runAdminCommand({serverStatus:1,...e})}async stats(e=1){return(0,l.assertArgsDefinedType)([e],[["number","object"]],"Database.stats"),"number"==typeof e&&(e={scale:e}),this._emitDatabaseApiCall("stats",{scale:e.scale}),await this._runReadCommand({dbStats:1,scale:1,...e})}async hostInfo(){return this._emitDatabaseApiCall("hostInfo",{}),await this._runAdminCommand({hostInfo:1})}async serverCmdLineOpts(){return this._emitDatabaseApiCall("serverCmdLineOpts",{}),await this._runAdminCommand({getCmdLineOpts:1})}async rotateCertificates(e){return this._emitDatabaseApiCall("rotateCertificates",{message:e}),await this._runAdminCommand({rotateCertificates:1,message:e})}async printCollectionStats(e=1){if("number"!=typeof e||e<1)throw new p.MongoshInvalidInputError(`scale has to be a number >=1, got ${e}`,p.CommonErrors.InvalidArgument);this._emitDatabaseApiCall("printCollectionStats",{scale:e});const t=await this.getCollectionNames(),r={};for(const s of t)try{r[s]=await this.getCollection(s).stats({scale:e})}catch(e){r[s]={ok:0,errmsg:null==e?void 0:e.message}}return new c.CommandResult("StatsResult",r)}async getProfilingStatus(){return this._emitDatabaseApiCall("getProfilingStatus",{}),await this._runReadCommand({profile:-1})}async setProfilingLevel(e,t={}){if((0,l.assertArgsDefinedType)([e],["number"],"Database.setProfilingLevel"),e<0||e>2)throw new p.MongoshInvalidInputError(`Input level ${e} is out of range [0..2]`,p.CommonErrors.InvalidArgument);return"number"==typeof t&&(t={slowms:t}),this._emitDatabaseApiCall("setProfilingLevel",{opts:t}),await this._runCommand({profile:e,...t})}async setLogLevel(e,t){(0,l.assertArgsDefinedType)([e],["number"],"Database.setLogLevel"),this._emitDatabaseApiCall("setLogLevel",{logLevel:e,component:t});let r=[];if("string"==typeof t)r=t.split(".");else if(void 0!==t)throw new p.MongoshInvalidInputError("setLogLevel component must be a string: got "+typeof t,p.CommonErrors.InvalidArgument);let s={verbosity:e};for(;r.length>0;)s={[r.pop()]:s};const i={setParameter:1,logComponentVerbosity:s};return await this._runAdminCommand(i)}async getLogComponents(){this._emitDatabaseApiCall("getLogComponents",{});const e=await this._runAdminCommand({getParameter:1,logComponentVerbosity:1});if(!e||void 0===e.logComponentVerbosity)throw new p.MongoshRuntimeError(`Error running command ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);return e.logComponentVerbosity}cloneDatabase(){throw new p.MongoshDeprecatedError("`cloneDatabase()` was removed because it was deprecated in MongoDB 4.0")}cloneCollection(){throw new p.MongoshDeprecatedError("`cloneCollection()` was removed because it was deprecated in MongoDB 4.0")}copyDatabase(){throw new p.MongoshDeprecatedError("`copyDatabase()` was removed because it was deprecated in MongoDB 4.0")}async commandHelp(e){(0,l.assertArgsDefinedType)([e],["string"],"Database.commandHelp"),this._emitDatabaseApiCall("commandHelp",{name:e});const t={};t[e]=1,t.help=!0;const r=await this._runCommand(t);if(!r||void 0===r.help)throw new p.MongoshRuntimeError(`Error running command commandHelp ${r&&r.errmsg||""}`,p.CommonErrors.CommandFailed);return r.help}async listCommands(){this._emitDatabaseApiCall("listCommands",{});const e=await this._runReadCommand({listCommands:1});if(!e||void 0===e.commands)throw new p.MongoshRuntimeError(`Error running command listCommands ${e&&e.errmsg||""}`,p.CommonErrors.CommandFailed);for(const t of Object.values(e.commands))"slaveOk"in t&&(t.secondaryOk=t.slaveOk,delete t.slaveOk),"slaveOverrideOk"in t&&(t.secondaryOverrideOk=t.slaveOverrideOk,delete t.slaveOverrideOk);return new c.CommandResult("ListCommandsResult",e.commands)}async getLastErrorObj(e,t,r){return await this._instanceState.printDeprecationWarning("Database.getLastErrorObj() is deprecated and will be removed in the future."),this._emitDatabaseApiCall("getLastErrorObj",{w:e,wTimeout:t,j:r}),await this._getLastErrorObj(e,t,r)}async getLastError(e,t){return await this._instanceState.printDeprecationWarning("Database.getLastError() is deprecated and will be removed in the future."),this._emitDatabaseApiCall("getLastError",{w:e,wTimeout:t}),(await this._getLastErrorObj(e,t)).err||null}async printShardingStatus(e=!1){this._emitDatabaseApiCall("printShardingStatus",{verbose:e});const t=await(0,l.getPrintableShardStatus)(await(0,l.getConfigDB)(this),e);return new c.CommandResult("StatsResult",t)}async printSecondaryReplicationInfo(){let e=null;const t=this.getSiblingDB("local");if(0!==await t.getCollection("system.replset").countDocuments({})){const t=await this._runAdminCommand({replSetGetStatus:1});let r=null;for(const e of t.members)if(1===e.state){r=e;break}if(r)e=r.optimeDate;else{e=new Date(0,0);for(const r of t.members)r.optimeDate>e&&(e=r.optimeDate)}const s={};for(const i of t.members){const t={};if(null==i)throw new p.MongoshRuntimeError("Member returned from command replSetGetStatus is null",p.CommonErrors.CommandFailed);if(1!==i.state&&7!==i.state){if(i.optime&&0!==i.health){if(null==e)throw new p.MongoshRuntimeError("getReplLag startOptimeDate is null",p.CommonErrors.CommandFailed);e&&(t.syncedTo=i.optimeDate.toString());const s=(i.optimeDate-e)/1e3,n=Math.round(s/36)/100;let a="";a=r?"primary ":"freshest member (no primary available at the moment)",t.replLag=`${Math.round(s)} secs (${n} hrs) behind the ${a}`}else t["no replication info, yet. State"]=i.stateStr;s[`source: ${i.name}`]=t}}return new c.CommandResult("StatsResult",s)}throw new p.MongoshInvalidInputError("local.system.replset is empty. Are you connected to a replica set?",d.ShellApiErrors.NotConnectedToReplicaSet)}async getReplicationInfo(){const e=this.getSiblingDB("local"),t={},r="oplog.rs";if(!(await e.getCollectionNames()).includes(r))throw new p.MongoshInvalidInputError("Replication not detected. Are you connected to a replset?",d.ShellApiErrors.NotConnectedToReplicaSet);const s=e.getCollection(r),[i,n,a]=await Promise.all([s.stats(),(async()=>(await s.find()).sort({$natural:1}).limit(1).tryNext())(),(async()=>(await s.find()).sort({$natural:-1}).limit(1).tryNext())()]);if(!(null==i?void 0:i.maxSize))throw new p.MongoshRuntimeError(`Could not get stats for local.${r} collection. collstats returned ${JSON.stringify(i)}`,p.CommonErrors.CommandFailed);if(t.configuredLogSizeMB=i.maxSize/1048576,t.logSizeMB=Math.max(i.maxSize,i.size)/1048576,t.usedMB=i.size/1048576,t.usedMB=Math.ceil(100*t.usedMB)/100,null===n||null===a)throw new p.MongoshRuntimeError("objects not found in local.oplog.$main -- is this a new and empty db instance?",p.CommonErrors.CommandFailed);let o=n.ts,c=a.ts;return o&&c?(o=(0,l.tsToSeconds)(o),c=(0,l.tsToSeconds)(c),t.timeDiff=c-o,t.timeDiffHours=Math.round(t.timeDiff/36)/100,t.tFirst=new Date(1e3*o).toString(),t.tLast=new Date(1e3*c).toString(),t.now=Date()):t.errmsg="ts element not found in oplog objects",t}async printReplicationInfo(){const e={};let t;try{t=await this.getReplicationInfo()}catch(e){const t=await this.hello();if(t.arbiterOnly)return new c.CommandResult("StatsResult",{message:"cannot provide replication status from an arbiter"});if(!t.isWritablePrimary){const e=await this.printSecondaryReplicationInfo();return new c.CommandResult("StatsResult",{message:"this is a secondary, printing secondary replication info.",...e.value})}throw e}return e["actual oplog size"]=`${t.logSizeMB} MB`,e["configured oplog size"]=`${t.configuredLogSizeMB} MB`,e["log length start to end"]=`${t.timeDiff} secs (${t.timeDiffHours} hrs)`,e["oplog first event time"]=t.tFirst,e["oplog last event time"]=t.tLast,e.now=t.now,new c.CommandResult("StatsResult",e)}printSlaveReplicationInfo(){throw new p.MongoshDeprecatedError("Method deprecated, use db.printSecondaryReplicationInfo instead")}async setSecondaryOk(){await this._mongo.setSecondaryOk()}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitDatabaseApiCall("watch",{pipeline:e,options:t});const r=new h.default(this._mongo._serviceProvider.watch(e,{...await this._baseOptions(),...t},{},this._name),this._name,this._mongo);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._mongo._instanceState.currentCursor=r,r}async sql(e,t){var r;this._emitDatabaseApiCall("sql",{sqlString:e,options:t}),await this._instanceState.shellApi.print("Note: this is an experimental feature that may be subject to change in future releases.");const s=await this.aggregate([{$sql:{statement:e,format:"jdbc",dialect:"mongosql",formatVersion:1}}],t);try{await s.hasNext()}catch(e){if(40324===(null===(r=e.code)||void 0===r?void 0:r.valueOf()))throw new p.MongoshRuntimeError("db.sql currently only works when connected to a Data Lake",p.CommonErrors.CommandFailed);throw e}return s}async checkMetadataConsistency(e={}){return this._emitDatabaseApiCall("checkMetadataConsistency",{options:e}),this._runCursorCommand({checkMetadataConsistency:1})}};s([(0,a.returnType)("Mongo")],f.prototype,"getMongo",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"getCollectionNames",null),s([a.returnsPromise,(0,a.serverVersions)(["3.0.0",o.ServerVersions.latest]),(0,a.apiVersions)([1])],f.prototype,"getCollectionInfos",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"runCommand",null),s([a.returnsPromise,(0,a.serverVersions)(["3.4.0",o.ServerVersions.latest]),(0,a.apiVersions)([1])],f.prototype,"adminCommand",null),s([a.returnsPromise,(0,a.returnType)("AggregationCursor"),(0,a.apiVersions)([1])],f.prototype,"aggregate",null),s([(0,a.returnType)("Database")],f.prototype,"getSiblingDB",null),s([(0,a.returnType)("Collection")],f.prototype,"getCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"dropDatabase",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"createUser",null),s([a.returnsPromise],f.prototype,"updateUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"changeUserPassword",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"logout",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropAllUsers",null),s([a.returnsPromise],f.prototype,"auth",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"grantRolesToUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokeRolesFromUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getUser",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getUsers",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createEncryptedCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"createView",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"createRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"updateRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"dropRole",null),s([a.returnsPromise],f.prototype,"dropAllRoles",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"grantRolesToRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokeRolesFromRole",null),s([a.returnsPromise],f.prototype,"grantPrivilegesToRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"revokePrivilegesFromRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getRole",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getRoles",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"currentOp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"killOp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"shutdownServer",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"fsyncLock",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"fsyncUnlock",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"version",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverBits",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"isMaster",null),s([a.returnsPromise,(0,a.apiVersions)([1]),(0,a.serverVersions)(["5.0.0",o.ServerVersions.latest])],f.prototype,"hello",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverBuildInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverStatus",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"stats",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"hostInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"serverCmdLineOpts",null),s([a.returnsPromise,(0,a.serverVersions)(["5.0.0",o.ServerVersions.latest]),(0,a.apiVersions)([])],f.prototype,"rotateCertificates",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"printCollectionStats",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getProfilingStatus",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"setProfilingLevel",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"setLogLevel",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLogComponents",null),s([a.deprecated],f.prototype,"cloneDatabase",null),s([a.deprecated],f.prototype,"cloneCollection",null),s([a.deprecated],f.prototype,"copyDatabase",null),s([a.returnsPromise,(0,a.apiVersions)([1])],f.prototype,"commandHelp",null),s([a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"listCommands",null),s([(0,a.serverVersions)([o.ServerVersions.earliest,"5.1.0"]),a.deprecated,a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLastErrorObj",null),s([a.deprecated,a.returnsPromise,(0,a.apiVersions)([])],f.prototype,"getLastError",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.Sharded]),(0,a.apiVersions)([1])],f.prototype,"printShardingStatus",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.ReplSet]),(0,a.apiVersions)([])],f.prototype,"printSecondaryReplicationInfo",null),s([a.returnsPromise,(0,a.topologies)([o.Topologies.ReplSet]),(0,a.apiVersions)([])],f.prototype,"getReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([]),(0,a.topologies)([o.Topologies.ReplSet])],f.prototype,"printReplicationInfo",null),s([a.deprecated],f.prototype,"printSlaveReplicationInfo",null),s([a.deprecated,a.returnsPromise],f.prototype,"setSecondaryOk",null),s([(0,a.serverVersions)(["3.1.0",o.ServerVersions.latest]),(0,a.topologies)([o.Topologies.ReplSet,o.Topologies.Sharded]),(0,a.apiVersions)([1]),a.returnsPromise],f.prototype,"watch",null),s([(0,a.serverVersions)(["4.4.0",o.ServerVersions.latest]),a.returnsPromise,(0,a.returnType)("AggregationCursor")],f.prototype,"sql",null),s([(0,a.serverVersions)(["7.0.0",o.ServerVersions.latest]),(0,a.topologies)([o.Topologies.Sharded]),a.returnsPromise],f.prototype,"checkMetadataConsistency",null),f=s([a.shellApiClassDefault],f),t.default=f},9461:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.DBQuery=void 0;const i=r(40191);let n=t.DBQuery=class extends i.ShellApiClass{constructor(e){super(),this._instanceState=e}get shellBatchSize(){return this._instanceState.displayBatchSizeFromDBQuery}set shellBatchSize(e){this._instanceState.printDeprecationWarning('DBQuery.shellBatchSize is deprecated, please use config.set("displayBatchSize") instead'),this._instanceState.displayBatchSizeFromDBQuery=e}};t.DBQuery=n=s([i.shellApiClassDefault,i.classDeprecated],n)},40191:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.addSourceToResults=t.classPlatforms=t.platforms=t.classDeprecated=t.returnType=t.shellCommandCompleter=t.directShellCommand=t.returnsPromise=t.nonAsyncFunctionsReturningPromises=t.topologies=t.deprecated=t.apiVersions=t.serverVersions=t.shellApiClassNoHelp=t.shellApiClassDefault=t.toIgnore=t.signatures=t.toShellResult=t.getShellApiType=t.ShellApiValueClass=t.ShellApiWithMongoClass=t.ShellApiClass=void 0;const i=r(6534),n=r(86930),a=s(r(55179)),o=r(86901),l=Symbol.for("@@mongosh.addSourceToResults"),c=Symbol.for("@@mongosh.resultSource");class p{get[n.shellApiType](){throw new i.MongoshInternalError("Shell API Type did not use decorators")}set[n.shellApiType](e){(0,o.addHiddenDataProperty)(this,n.shellApiType,e)}[n.asPrintable](){return Array.isArray(this)?[...this]:{...this}}}function u(e){var t;return null!==(t=null==e?void 0:e[n.shellApiType])&&void 0!==t?t:null}function h(e){function t(t,r){if("object"==typeof t&&null!==t){const s={namespace:r[n.namespaceInfo]()};(0,o.addHiddenDataProperty)(t,c,s),void 0===t[n.shellApiType]&&e.returnType&&(0,o.addHiddenDataProperty)(t,n.shellApiType,e.returnType)}return t}const r=e.returnsPromise?x((async function(...r){return t(await e.call(this,...r),this)})):function(...r){return t(e.call(this,...r),this)};return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)),r}function d(e,t){const r=e.returnsPromise?x((async function(...r){var s,i;const n=m(this);f(n,t,e,!0);const a=null==n?void 0:n.interrupted;null==a||a.checkpoint();const o=null==a?void 0:a.asPromise();let l;try{n&&n.apiCallDepth++,l=await Promise.race([null!==(s=null==o?void 0:o.promise)&&void 0!==s?s:new Promise((()=>{})),e.call(this,...r)])}catch(e){throw null!==(i=null==n?void 0:n.transformError(e))&&void 0!==i?i:e}finally{n&&n.apiCallDepth--,o&&o.destroy()}return null==a||a.checkpoint(),l})):function(...r){var s;const i=m(this);f(i,t,e,!1);const n=null==i?void 0:i.interrupted;let a;null==n||n.checkpoint();try{i&&i.apiCallDepth++,a=e.call(this,...r)}catch(e){throw null!==(s=null==i?void 0:i.transformError(e))&&void 0!==s?s:e}finally{i&&i.apiCallDepth--}return null==n||n.checkpoint(),a};return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)),r}function f(e,t,r,s){var i;null===(i=null==e?void 0:e.emitApiCall)||void 0===i||i.call(e,{method:r.name,class:t,deprecated:!!r.deprecated,isAsync:s})}function m(e){if(!e[n.shellApiType])throw new i.MongoshInternalError("getShellInstanceState can only be called for functions from shell API classes");return e._instanceState}t.ShellApiClass=p,t.ShellApiWithMongoClass=class extends p{get _instanceState(){var e;return null===(e=this._mongo)||void 0===e?void 0:e._instanceState}},t.ShellApiValueClass=class extends p{get _mongo(){throw new i.MongoshInternalError("Not supported on this value class")}get _instanceState(){throw new i.MongoshInternalError("Not supported on this value class")}},t.getShellApiType=u,t.toShellResult=async function e(t){var r;if("object"!=typeof t&&"function"!=typeof t||null===t)return{type:null,rawValue:t,printable:t};if("then"in t&&"function"==typeof t.then)return e(await t);const s="function"==typeof t[n.asPrintable]?await t[n.asPrintable]():t,i=null!==(r=t[c])&&void 0!==r?r:void 0;return{type:u(t),rawValue:t,printable:s,source:i}};const y="@@@mdb.signatures@@@";r.g[y]||(r.g[y]={});const g=r.g[y];function b(e,r){const s=e.name,i=`shell-api.classes.${s}.help`,c={help:`${i}.description`,docs:`${i}.link`,attr:[]},u={type:s,returnsPromise:e.prototype.returnsPromise||!1,deprecated:e.prototype.deprecated||!1,attributes:{}},f=Object.getOwnPropertyNames(e.prototype);for(const r of f){const o=Object.getOwnPropertyDescriptor(e.prototype,r);if(!(null==o?void 0:o.value)||"function"!=typeof o.value||t.toIgnore.includes(r)||r.startsWith("_"))continue;let p=o.value;e[l]&&(p=h(p)),p=d(p,s),p.serverVersions=p.serverVersions||n.ALL_SERVER_VERSIONS,p.apiVersions=p.apiVersions||n.ALL_API_VERSIONS,p.topologies=p.topologies||n.ALL_TOPOLOGIES,p.returnType=p.returnType||{type:"unknown",attributes:{}},p.returnsPromise=p.returnsPromise||!1,p.deprecated=p.deprecated||!1,p.platforms=p.platforms||n.ALL_PLATFORMS,p.isDirectShellCommand=p.isDirectShellCommand||!1,p.acceptsRawInput=p.acceptsRawInput||!1,p.shellCommandCompleter=p.shellCommandCompleter||void 0,u.attributes[r]={type:"function",serverVersions:p.serverVersions,apiVersions:p.apiVersions,topologies:p.topologies,returnType:"this"===p.returnType?s:p.returnType,returnsPromise:p.returnsPromise,deprecated:p.deprecated,platforms:p.platforms,isDirectShellCommand:p.isDirectShellCommand,acceptsRawInput:p.acceptsRawInput,shellCommandCompleter:p.shellCommandCompleter};const f=`${i}.attributes.${r}`,m={help:`${f}.example`,docs:`${f}.link`,attr:[{description:`${f}.description`}]},y=new a.default(m);p.help=()=>y,Object.setPrototypeOf(p.help,y),c.attr.push({name:r,description:`${f}.description`}),Object.defineProperty(e.prototype,r,{...o,value:p})}let m=e.prototype;for(;null!==(m=Object.getPrototypeOf(m))&&"ShellApiClass"!==m.constructor.name&&m.constructor!==Array;){const e=`shell-api.classes.${m.constructor.name}.help`;for(const r of Object.getOwnPropertyNames(m)){const i=Object.getOwnPropertyDescriptor(m,r),n=(null==i?void 0:i.value)&&"function"==typeof i.value;if(f.includes(r)||!n||t.toIgnore.includes(r)||r.startsWith("_"))continue;const a=i.value;u.attributes[r]={type:"function",serverVersions:a.serverVersions,apiVersions:a.apiVersions,topologies:a.topologies,returnType:"this"===a.returnType?s:a.returnType,returnsPromise:a.returnsPromise,deprecated:a.deprecated,platforms:a.platforms,isDirectShellCommand:a.isDirectShellCommand,acceptsRawInput:a.acceptsRawInput,shellCommandCompleter:a.shellCommandCompleter};const o=`${e}.attributes.${r}`;c.attr.push({name:r,description:`${o}.description`})}}const y=new a.default(c);e.prototype.help=()=>y,Object.setPrototypeOf(e.prototype.help,y),e.prototype[n.asPrintable]=e.prototype[n.asPrintable]||p.prototype[n.asPrintable],(0,o.addHiddenDataProperty)(e.prototype,n.shellApiType,s),r&&(g[s]=u)}function x(e){function t(...t){const r=e.call(this,...t);return(0,o.addHiddenDataProperty)(r,Symbol.for("@@mongosh.syntheticPromise"),!0)}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),t}t.signatures=g,g.Document={type:"Document",attributes:{}},t.toIgnore=["constructor","help","toJSON"],t.shellApiClassDefault=function(e){b(e,!0)},t.shellApiClassNoHelp=function(e){b(e,!1)},t.serverVersions=function(e){return function(t,r,s){s.value.serverVersions=e}},t.apiVersions=function(e){return function(t,r,s){0===e.length?e=[0,0]:1===e.length&&(e=[e[0],1/0]),s.value.apiVersions=e}},t.deprecated=function(e,t,r){r.value.deprecated=!0},t.topologies=function(e){return function(t,r,s){s.value.topologies=e}},t.nonAsyncFunctionsReturningPromises=[],t.returnsPromise=function(e,r,s){const i=s.value;async function n(...e){try{return await i.call(this,...e)}finally{"function"==typeof setTimeout&&"function"==typeof setImmediate&&await new Promise(setImmediate)}}i.returnsPromise=!0,Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)),s.value=x(n),"AsyncFunction"!==i.constructor.name&&t.nonAsyncFunctionsReturningPromises.push(i.name)},t.directShellCommand=function(e,t,r){r.value.isDirectShellCommand=!0},t.shellCommandCompleter=function(e){return function(t,r,s){s.value.shellCommandCompleter=e}},t.returnType=function(e){return function(t,r,s){s.value.returnType=e}},t.classDeprecated=function(e){e.prototype.deprecated=!0},t.platforms=function(e){return function(t,r,s){s.value.platforms=e}},t.classPlatforms=function(e){return function(t){t.prototype.platforms=e}},t.addSourceToResults=function(e){e[l]=!0}},86930:(e,t)=>{"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.ADMIN_DB=t.namespaceInfo=t.asPrintable=t.shellApiType=t.CURSOR_FLAGS=t.ALL_API_VERSIONS=t.ALL_PLATFORMS=t.ALL_TOPOLOGIES=t.ALL_SERVER_VERSIONS=t.Topologies=t.ServerVersions=void 0,function(e){e.latest="999.999.999",e.earliest="0.0.0"}(r||(t.ServerVersions=r={})),function(e){e.ReplSet="ReplSet",e.Standalone="Standalone",e.Sharded="Sharded",e.LoadBalanced="LoadBalanced"}(s||(t.Topologies=s={})),t.ALL_SERVER_VERSIONS=[r.earliest,r.latest],t.ALL_TOPOLOGIES=[s.ReplSet,s.Sharded,s.LoadBalanced,s.Standalone],t.ALL_PLATFORMS=["Compass","Browser","CLI"],t.ALL_API_VERSIONS=[0,1/0],t.CURSOR_FLAGS={2:"tailable",4:"SlaveOk",8:"oplogReplay",16:"noTimeout",32:"awaitData",64:"exhaust",128:"partial"},t.shellApiType=Symbol.for("@@mongosh.shellApiType"),t.asPrintable=Symbol.for("@@mongosh.asPrintable"),t.namespaceInfo=Symbol.for("@@mongosh.namespaceInfo"),t.ADMIN_DB="admin"},73041:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ShellApiErrors=t.blockedByDriverMetadata=void 0,t.blockedByDriverMetadata=function(e){return{driverCaused:!0,api:e}},function(e){e.NotConnectedToShardedCluster="SHAPI-10001",e.NotConnectedToReplicaSet="SHAPI-10002",e.NotConnectedToMongos="SHAPI-10003",e.NotConnected="SHAPI-10004",e.NotUsingFLE="SHAPI-10005"}(r||(t.ShellApiErrors=r={}))},93379:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=i(r(4564)),o=r(86930);let l=class extends a.default{constructor(e,t,r){super(e,t._cursor),this._baseCursor=t,this._verbosity=r,this._explained=null}async[o.asPrintable](){var e;return null!==(e=this._explained)&&void 0!==e||(this._explained=await this._baseCursor.explain(this._verbosity)),this._explained}};l=s([n.shellApiClassDefault],l),t.default=l},37149:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(r(93379)),a=r(40191),o=r(86930),l=r(86901);let c=class extends a.ShellApiWithMongoClass{constructor(e,t,r){super(),this._mongo=e,this._collection=t,this._verbosity=r}[o.asPrintable](){return`Explainable(${this._collection.getFullName()})`}_emitExplainableApiCall(e,t={}){this._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Explainable",db:this._collection._database._name,coll:this._collection._name,arguments:t})}getCollection(){return this._emitExplainableApiCall("getCollection"),this._collection}getVerbosity(){return this._emitExplainableApiCall("getVerbosity"),this._verbosity}setVerbosity(e){e=(0,l.validateExplainableVerbosity)(e),this._emitExplainableApiCall("setVerbosity",{verbosity:e}),this._verbosity=e}async find(e,t){this._emitExplainableApiCall("find",{query:e,projection:t});const r=await this._collection.find(e,t);return new n.default(this._mongo,r,this._verbosity)}async aggregate(...e){var t;let r,s;return this._emitExplainableApiCall("aggregate",{args:e}),Array.isArray(e[0])?(s=e[0],r=null!==(t=e[1])&&void 0!==t?t:{}):(s=e,r={}),await this._collection.aggregate(s,{...r,explain:this._verbosity})}async count(e={},t={}){return this._emitExplainableApiCall("count",{query:e,options:t}),(0,l.markAsExplainOutput)(await this._collection._database._runReadCommand({explain:{count:`${this._collection._name}`,query:e,...t},verbosity:this._verbosity}))}async distinct(e,t,r={}){return this._emitExplainableApiCall("distinct",{field:e,query:t,options:r}),this._collection.distinct(e,null!=t?t:{},{...r,explain:this._verbosity})}async findAndModify(e){return this._emitExplainableApiCall("findAndModify",{options:e}),this._collection.findAndModify({...e,explain:this._verbosity})}async findOneAndDelete(e,t={}){return this._emitExplainableApiCall("findOneAndDelete",{filter:e,options:t}),this._collection.findOneAndDelete(e,{...t,explain:this._verbosity})}async findOneAndReplace(e,t,r={}){return this._emitExplainableApiCall("findOneAndReplace",{filter:e,options:r}),this._collection.findOneAndReplace(e,t,{...r,explain:this._verbosity})}async findOneAndUpdate(e,t,r={}){return this._emitExplainableApiCall("findOneAndUpdate",{filter:e,options:r}),this._collection.findOneAndUpdate(e,t,{...r,explain:this._verbosity})}async remove(e,t={}){return this._emitExplainableApiCall("remove",{query:e,options:t}),t={...(0,l.processRemoveOptions)(t),explain:this._verbosity},this._collection.remove(e,t)}async update(e,t,r={}){return this._emitExplainableApiCall("update",{filter:e,update:t,options:r}),this._collection.update(e,t,{...r,explain:this._verbosity})}async mapReduce(e,t,r){this._emitExplainableApiCall("mapReduce",{map:e,reduce:t,optionsOrOutString:r});const s={...(0,l.processMapReduceOptions)(r),explain:this._verbosity};return this._collection.mapReduce(e,t,s)}};s([(0,a.returnType)("ExplainableCursor"),(0,a.apiVersions)([1]),a.returnsPromise],c.prototype,"find",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"aggregate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"count",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"distinct",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findAndModify",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndDelete",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndReplace",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"findOneAndUpdate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"remove",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"update",null),s([a.returnsPromise,(0,a.serverVersions)(["4.4.0",o.ServerVersions.latest]),(0,a.apiVersions)([])],c.prototype,"mapReduce",null),c=s([a.shellApiClassDefault],c),t.default=c},99232:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KeyVault=t.ClientEncryption=void 0;const n=r(40191),a=i(r(4564)),o=r(86901),l=r(86930),c=r(46177),p=r(6534),u=e=>!Array.isArray(e)&&"object"==typeof e&&("masterKey"in e||"keyAltNames"in e||"keyMaterial"in e);let h=t.ClientEncryption=class extends n.ShellApiWithMongoClass{constructor(e){super(),this._mongo=e;const t={...this._mongo._fleOptions};if(delete t.schemaMap,delete t.encryptedFieldsMap,!e._serviceProvider.createClientEncryption)throw new p.MongoshRuntimeError("FLE API is not available");this._libmongocrypt=e._serviceProvider.createClientEncryption(t)}[l.asPrintable](){return`ClientEncryption class for ${(0,c.redactURICredentials)(this._mongo._uri)}`}async encrypt(e,t,r){let s;return s="object"==typeof r?{keyId:e,...r}:{keyId:e,algorithm:r},(0,o.assertArgsDefinedType)([e,t,s],[!0,!0,!0],"ClientEncryption.encrypt"),await this._libmongocrypt.encrypt(t,s)}async decrypt(e){return(0,o.assertArgsDefinedType)([e],[!0],"ClientEncryption.decrypt"),await this._libmongocrypt.decrypt(e)}async encryptExpression(e,t,r){return(0,o.assertArgsDefinedType)([e,t,r],[!0,!0,!0],"ClientEncryption.encryptExpression"),await this._libmongocrypt.encryptExpression(t,{keyId:e,...r})}async createEncryptedCollection(e,t,r){if((0,o.assertArgsDefinedType)([e],["string"],"ClientEncryption.createEncryptedCollection"),(0,o.assertArgsDefinedType)([t],["string"],"ClientEncryption.createEncryptedCollection"),(0,o.assertArgsDefinedType)([r],["object"],"ClientEncryption.createEncryptedCollection"),(0,o.assertKeysDefined)(r,["provider","createCollectionOptions"]),!this._mongo._serviceProvider.createEncryptedCollection)throw new p.MongoshRuntimeError("Runtime does not support createEncryptedCollection yet");const{encryptedFields:s}=await this._mongo._serviceProvider.createEncryptedCollection(e,t,r,this._libmongocrypt);return{collection:this._mongo.getDB(e).getCollection(t),encryptedFields:s}}};s([n.returnsPromise],h.prototype,"encrypt",null),s([n.returnsPromise],h.prototype,"decrypt",null),s([n.returnsPromise],h.prototype,"encryptExpression",null),s([n.returnsPromise,(0,n.apiVersions)([1])],h.prototype,"createEncryptedCollection",null),t.ClientEncryption=h=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],h);let d=t.KeyVault=class extends n.ShellApiWithMongoClass{constructor(e){var t,r,s;super(),this._mongo=e._mongo,this._clientEncryption=e;const i=null===(r=null===(t=this._mongo)||void 0===t?void 0:t._fleOptions)||void 0===r?void 0:r.keyVaultNamespace;if(!i)throw new p.MongoshInvalidInputError("FLE options must be passed to the Mongo object");const n=null===(s=i.match(/^(?<db>[^.]+)\.(?<coll>.+)$/))||void 0===s?void 0:s.groups;if(!n)throw new p.MongoshInvalidInputError(`Invalid keyVaultNamespace '${i}'`);const{db:a,coll:o}=n;this._keyColl=this._mongo.getDB(a).getCollection(o)}async _init(){try{if((await this._keyColl.getIndexKeys()).some((e=>e.keyAltNames)))return}catch(e){}try{await this._keyColl.updateMany({keyAltNames:{$size:0}},{$unset:{keyAltNames:""},$currentDate:{updateDate:!0}}),await this._keyColl.createIndex({keyAltNames:1},{unique:!0,partialFilterExpression:{keyAltNames:{$exists:!0}}})}catch(e){await this._instanceState.printWarning(`Creating 'keyAltNames' index on '${this._keyColl.getFullName()}' failed: ${e.message}`)}}[l.asPrintable](){return`KeyVault class for ${(0,c.redactURICredentials)(this._mongo._uri)}`}async createKey(e,t,r){let s,i,n,a;if(u(t)?(s=null==t?void 0:t.masterKey,i=null==t?void 0:t.keyAltNames,n=null==t?void 0:t.keyMaterial):(e=>!Array.isArray(e)&&"object"==typeof e&&!u(e))(t)&&(s=t),r&&(i=r),(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.createKey"),"string"==typeof t){if("local"!==e||""!==t)throw new p.MongoshInvalidInputError('KeyVault.createKey does not support providing masterKey as string anymore. For AWS please use createKey("aws", { region: ..., key: ... })',p.CommonErrors.Deprecated);s=void 0}else if(Array.isArray(t)){if("local"!==e)throw new p.MongoshInvalidInputError("KeyVault.createKey requires masterKey to be given as second argument if KMS is not local",p.CommonErrors.InvalidArgument);if(i)throw new p.MongoshInvalidInputError("KeyVault.createKey was supplied with an array for the masterKey and keyAltNames - either specify keyAltNames as second argument or set undefined for masterKey",p.CommonErrors.InvalidArgument);i=t,s=void 0}return s&&(a={...null!=a?a:{},masterKey:s}),i&&(a={...null!=a?a:{},keyAltNames:i}),n&&(a={...null!=a?a:{},keyMaterial:n}),await this._clientEncryption._libmongocrypt.createDataKey(e,a)}async getKey(e){(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.getKey");const t=await this._keyColl.find({_id:e});return await t.limit(1).next()}async getKeyByAltName(e){(0,o.assertArgsDefinedType)([e],["string"],"KeyVault.getKeyByAltName");const t=await this._keyColl.find({keyAltNames:e});return await t.limit(1).next()}async getKeys(){return new a.default(this._mongo,this._clientEncryption._libmongocrypt.getKeys())}async deleteKey(e){return(0,o.assertArgsDefinedType)([e],[!0],"KeyVault.deleteKey"),await this._clientEncryption._libmongocrypt.deleteKey(e)}async addKeyAlternateName(e,t){return(0,o.assertArgsDefinedType)([e,t],[!0,"string"],"KeyVault.addKeyAlternateName"),await this._clientEncryption._libmongocrypt.addKeyAltName(e,t)}async removeKeyAlternateName(e,t){return(0,o.assertArgsDefinedType)([e,t],[!0,"string"],"KeyVault.removeKeyAlternateName"),await this._clientEncryption._libmongocrypt.removeKeyAltName(e,t)}async rewrapManyDataKey(e,t){return await this._clientEncryption._libmongocrypt.rewrapManyDataKey(e,t)}async createDataKey(...e){return await this.createKey(...e)}async removeKeyAltName(...e){return await this.removeKeyAlternateName(...e)}async addKeyAltName(...e){return await this.addKeyAlternateName(...e)}};s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"createKey",null),s([(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKey",null),s([(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKeyByAltName",null),s([(0,n.returnType)("Cursor"),(0,n.apiVersions)([1]),n.returnsPromise],d.prototype,"getKeys",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"deleteKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"addKeyAlternateName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"removeKeyAlternateName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"rewrapManyDataKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"createDataKey",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"removeKeyAltName",null),s([n.returnsPromise,(0,n.apiVersions)([1])],d.prototype,"addKeyAltName",null),t.KeyVault=d=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],d)},55179:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(r(2416)),n=r(86930),a=i.default.translateApiHelp.bind(i.default);class o{constructor(e,t={translate:a}){this.attr=[],this.help=t.translate(e.help),this.docs=t.translate(e.docs),this.attr=(e.attr||[]).map((e=>({name:e.name,description:t.translate(e.description)}))).filter((e=>e.description))}[n.asPrintable](){const{help:e,docs:t,attr:r}=this;return{help:e,docs:t,attr:r}}get[n.shellApiType](){return"Help"}}t.default=o},86901:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildConfigChunksCollectionMatch=t.pickWithExactKeyMatch=t.assignAll=t.functionCtorWithoutProps=t.shallowClone=t.getBadge=t.adjustRunCommand=t.shouldRunAggregationImmediately=t.isValidCollectionName=t.isValidDatabaseName=t.markAsExplainOutput=t.maybeMarkAsExplainOutput=t.processFLEOptions=t.assertCLI=t.setHideIndex=t.processMapReduceOptions=t.processRemoveOptions=t.processFindAndModifyOptions=t.iterate=t.addHiddenDataProperty=t.tsToSeconds=t.scaleIndividualShardStatistics=t.dataFormat=t.coerceToJSNumber=t.getConfigDB=t.getPrintableShardStatus=t.processDigestPassword=t.adaptOptions=t.assertKeysDefined=t.assertArgsDefinedType=t.validateExplainableVerbosity=t.adaptAggregateOptions=void 0;const i=r(6534),n=s(r(84770)),a=r(73041),o=r(86930),l=r(21764);function c(e){if(!0===e?e="allPlansExecution":!1!==e&&void 0!==e||(e="queryPlanner"),"string"!=typeof e)throw new i.MongoshInvalidInputError("verbosity must be a string",i.CommonErrors.InvalidArgument);return e}function p(e){return e?` (${e})`:""}function u(e,t){for(const r of t)if(void 0===e[r])throw new i.MongoshInvalidInputError(`Missing required property: ${JSON.stringify(r)}`,i.CommonErrors.InvalidArgument)}function h(e){return"number"==typeof e?e:"toNumber"in e?e.toNumber():e.valueOf()}function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0}),e}function f(e){return null!==e&&"object"==typeof e&&d(e,o.shellApiType,"ExplainOutput"),e}function m(e){return"number"==typeof e&&Number.isInteger(e)||"Int32"===(null==e?void 0:e._bsontype)}function y(e){return Object.prototype.hasOwnProperty.call(e,"timestamp")?{uuid:e.uuid}:{ns:e._id}}t.adaptAggregateOptions=function(e={}){const t={...e},r={};let s;return"readConcern"in t&&(r.readConcern=e.readConcern,delete t.readConcern),"writeConcern"in t&&(Object.assign(r,e.writeConcern),delete t.writeConcern),"explain"in t&&(s=c(t.explain),delete t.explain),{aggOptions:t,dbOptions:r,explain:s}},t.validateExplainableVerbosity=c,t.assertArgsDefinedType=function(e,t,r){e.forEach(((e,s)=>{const n=t[s];if(void 0===e){if(!0!==n&&Array.isArray(n)&&n.includes(void 0))return;throw new i.MongoshInvalidInputError(`Missing required argument at position ${s}${p(r)}`,i.CommonErrors.InvalidArgument)}if(!0===n)return;const a="string"==typeof n?[n]:n,o=a.includes(typeof e),l=a.includes(`bson:${null==e?void 0:e._bsontype}`);if(!o&&!l){const t=a.filter((e=>void 0!==e)).map((e=>null==e?void 0:e.replace(/^bson:/,""))).join(" or ");throw new i.MongoshInvalidInputError(`Argument at position ${s} must be of type ${t}, got ${typeof e} instead${p(r)}`,i.CommonErrors.InvalidArgument)}}))},t.assertKeysDefined=u,t.adaptOptions=function(e,t,r){return Object.keys(r).reduce(((t,s)=>(null===e[s]||(t[e[s]||s]=r[s]),t)),t)},t.processDigestPassword=function(e,t,r){if(void 0===t)return{};if("server"!==t&&"client"!==t)throw new i.MongoshInvalidInputError(`Invalid field: passwordDigestor must be 'client' or 'server', got ${t}`,i.CommonErrors.InvalidArgument);if("client"===t){if("string"!=typeof r.pwd)throw new i.MongoshInvalidInputError("User passwords must be of type string. Was given password with type "+typeof r.pwd,i.CommonErrors.InvalidArgument);const t=n.default.createHash("md5");return t.update(`${e}:mongo:${r.pwd}`),{digestPassword:!1,pwd:t.digest("hex")}}return{digestPassword:!0}},t.getPrintableShardStatus=async function(e,t){const r={},s=e.getCollection("mongos"),n=e.getCollection("version"),o=e.getCollection("shards"),c=e.getCollection("chunks"),p=e.getCollection("settings"),u=e.getCollection("changelog"),[h,d,f]=await Promise.all([n.findOne({},{minCompatibleVersion:0,excluding:0,upgradeId:0,upgradeState:0}),o.find().then((e=>e.sort({_id:1}).toArray())),s.find().then((e=>e.sort({ping:-1}).limit(1).tryNext()))]);if(null===h)throw new i.MongoshInvalidInputError("This db does not have sharding enabled. Be sure you are connecting to a mongos from the shell and not to a mongod.",a.ShellApiErrors.NotConnectedToMongos);r.shardingVersion=h,r.shards=d;let m=null,g="most recently active";if(null!==f&&(m=f.ping,m.getTime()>=Date.now()-6e4&&(g="active")),g=`${g} mongoses`,null===m)r[g]="none";else{const e={ping:{$gt:(()=>{const e=m;return e.setTime(e.getTime()-6e4),e})()}};r[g]=t?await(await s.find(e)).sort({ping:-1}).toArray():(await(await s.aggregate([{$match:e},{$group:{_id:"$mongoVersion",num:{$sum:1}}},{$sort:{num:-1}}])).toArray()).map((e=>({[e._id]:e.num})))}const b={};await Promise.all([(async()=>{const e=await p.findOne({_id:"autosplit"});r.autosplit={"Currently enabled":null===e||e.enabled?"yes":"no"}})(),(async()=>{const e=await p.findOne({_id:"balancer"});b["Currently enabled"]=null!==e&&e.stopped?"no":"yes"})(),(async()=>{let t="unknown";try{t=(await e.adminCommand({balancerStatus:1})).inBalancerRound?"yes":"no"}catch(e){}b["Currently running"]=t})(),(async()=>{const e=await p.findOne({_id:"balancer"});if(null!==e&&Object.prototype.hasOwnProperty.call(e,"activeWindow")){const t=e.activeWindow;b["Balancer active window is set between"]=`${t.start} and ${t.stop} server local time`}})(),(async()=>{const t=await(await e.getCollection("locks").find({state:{$eq:2}})).toArray();(null==t?void 0:t.length)>0&&(b["Collections with active migrations"]=t.map((e=>`${e._id} started at ${e.when}`)))})(),(async()=>{let t=!h.currentVersion;const r=h.currentVersion;if(r>5&&(t=!0),5===r){const r=(await e.serverBuildInfo()).versionArray;2===r[0]&&r[1]>6&&(t=!0)}if(t){const t=await(await e.getCollection("actionlog").find({what:"balancer.round"})).sort({time:-1}).limit(5).toArray(),r={count:0,lastErr:"",lastTime:" "};null!==t&&t.forEach((e=>{e.details.errorOccured&&(r.count+=1,1===r.count&&(r.lastErr=e.details.errmsg,r.lastTime=e.time))})),b["Failed balancer rounds in last 5 attempts"]=r.count,r.count>0&&(b["Last reported error"]=r.lastErr,b["Time of Reported error"]=r.lastTime);const s=new Date;s.setDate(s.getDate()-1);let i=await(await u.aggregate([{$match:{time:{$gt:s},what:"moveChunk.from","details.errmsg":{$exists:!1},"details.note":"success"}},{$group:{_id:{msg:"$details.errmsg"},count:{$sum:1}}},{$project:{_id:{$ifNull:["$_id.msg","Success"]},count:"$count"}}])).toArray();i=i.concat(await(await u.aggregate([{$match:{time:{$gt:s},what:"moveChunk.from",$or:[{"details.errmsg":{$exists:!0}},{"details.note":{$ne:"success"}}]}},{$group:{_id:{msg:"$details.errmsg",from:"$details.from",to:"$details.to"},count:{$sum:1}}},{$project:{_id:{$ifNull:["$_id.msg","aborted"]},from:"$_id.from",to:"$_id.to",count:"$count"}}])).toArray());const n={};i.forEach((e=>{"Success"===e._id?n[e.count]=e._id:n[e.count]=`Failed with error '${e._id}', from ${e.from} to ${e.to}`})),0===i.length?b["Migration Results for the last 24 hours"]="No recent migrations":b["Migration Results for the last 24 hours"]=n}})()]),r.balancer=b;const x=await(await e.getCollection("databases").find()).sort({name:1}).toArray();return x.push({_id:"config",primary:"config",partitioned:!0}),x.sort(((e,t)=>e._id.localeCompare(t._id))),r.databases=await Promise.all(x.map((async r=>{const s=await(await e.getCollection("collections").find({_id:new RegExp("^"+(i=r._id,i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")+"\\."))})).sort({_id:1}).toArray();var i;const n=await Promise.all(s.filter((e=>!e.dropped)).map((async r=>{const s={};s.shardKey=r.key,s.unique=!!r.unique,"boolean"!=typeof r.unique&&void 0!==r.unique&&(s.unique=[!!r.unique,{unique:r.unique}]),s.balancing=!r.noBalance,"boolean"!=typeof r.noBalance&&void 0!==r.noBalance&&(s.balancing=[!r.noBalance,{noBalance:r.noBalance}]);const i=[],n=y(r),a=await(await c.aggregate([{$match:n},{$group:{_id:"$shard",cnt:{$sum:1}}},{$project:{_id:0,shard:"$_id",nChunks:"$cnt"}},{$sort:{shard:1}}])).toArray();let o=0;if(s.chunkMetadata=[],a.forEach((e=>{o+=e.nChunks,s.chunkMetadata.push({shard:e.shard,nChunks:e.nChunks})})),o<20||t)for await(const e of(await c.find(n)).sort({min:1})){const t={min:e.min,max:e.max,"on shard":e.shard,"last modified":e.lastmod};Object.defineProperty(t,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t){return(0,l.inspect)({...this},{...t,breakLength:1/0})},writable:!0,configurable:!0}),e.jumbo&&(t.jumbo="yes"),i.push(t)}else i.push("too many chunks to print, use verbose if you want to force print");const p=[];for await(const t of(await e.getCollection("tags").find({ns:r._id})).sort({min:1}))p.push({tag:t.tag,min:t.min,max:t.max});return s.chunks=i,s.tags=p,[r._id,s]})));return{database:r,collections:Object.fromEntries(n)}}))),delete r.shardingVersion.currentVersion,r},t.getConfigDB=async function(e){return"isdbgrid"!==(await e._maybeCachedHello()).msg&&await e._instanceState.printWarning("MongoshWarning: [SHAPI-10003] You are not connected to a mongos. This command may not work as expected."),e.getSiblingDB("config")},t.coerceToJSNumber=h,t.dataFormat=function(e){return null==e?"0B":e<1024?Math.floor(e)+"B":e<1048576?Math.floor(e/1024)+"KiB":e<1073741824?Math.floor(Math.floor(e/1024)/1024*100)/100+"MiB":Math.floor(Math.floor(e/1048576)/1024*100)/100+"GiB"},t.scaleIndividualShardStatistics=function(e,t){const r={};for(const s of Object.keys(e))if(["size","maxSize","storageSize","totalIndexSize","totalSize"].includes(s))r[s]=h(e[s])/t;else if("scaleFactor"===s)r[s]=t;else if("indexSizes"===s){const i={};for(const r of Object.keys(e[s]))i[r]=h(e[s][r])/t;r[s]=i}else r[s]=e[s];return r},t.tsToSeconds=function(e){return"object"==typeof e&&e&&"getHighBits"in e&&"getLowBits"in e?e.getHighBits():Number(e)/4294967296},t.addHiddenDataProperty=d,t.iterate=async function(e,t,r){if(t.isClosed())return e;for(let s=0;s<r;s++){const r=await t.tryNext();if(null===r){e.cursorHasMore=!1;break}e.documents.push(r)}return e},t.processFindAndModifyOptions=function(e){if("returnDocument"in(e={...e})){if("before"!==e.returnDocument&&"after"!==e.returnDocument)throw new i.MongoshInvalidInputError("returnDocument needs to be either 'before' or 'after'",i.CommonErrors.InvalidArgument);return delete e.returnNewDocument,delete e.returnOriginal,e}return"returnOriginal"in e?(e.returnDocument=e.returnOriginal?"before":"after",delete e.returnOriginal,delete e.returnNewDocument,e):"returnNewDocument"in e?(e.returnDocument=e.returnNewDocument?"after":"before",delete e.returnOriginal,delete e.returnNewDocument,delete e.new,e):"new"in e?(e.returnDocument=e.new?"after":"before",delete e.returnOriginal,delete e.returnNewDocument,delete e.new,e):(e.returnDocument="before",e)},t.processRemoveOptions=function(e){return"boolean"==typeof e?{justOne:e}:{justOne:!1,...e}},t.processMapReduceOptions=function(e){if("string"==typeof e)return{out:e};if(void 0===e.out)throw new i.MongoshInvalidInputError("Missing 'out' option",i.CommonErrors.InvalidArgument);return e},t.setHideIndex=async function(e,t,r){const s="string"==typeof t?{name:t,hidden:r}:{keyPattern:t,hidden:r};return await e._database._runCommand({collMod:e._name,index:s})},t.assertCLI=function(e,t){if("CLI"!==e)throw new i.MongoshUnimplementedError(`${t} are not supported for current platform: ${e}`,i.CommonErrors.NotImplemented)},t.processFLEOptions=function(e){var t,r;u(e,["keyVaultNamespace","kmsProviders"]),Object.keys(e).forEach((e=>{if(-1===["keyVaultClient","keyVaultNamespace","kmsProviders","schemaMap","bypassAutoEncryption","tlsOptions","bypassQueryAnalysis","encryptedFieldsMap"].indexOf(e))throw new i.MongoshInvalidInputError(`Unrecognized FLE Client Option ${e}`)}));const s={keyVaultClient:null===(t=e.keyVaultClient)||void 0===t?void 0:t._serviceProvider.getRawClient(),keyVaultNamespace:e.keyVaultNamespace},n=null===(r=e.kmsProviders.local)||void 0===r?void 0:r.key;if(n&&"Binary"===n._bsontype){const t=n.value();if(!Buffer.isBuffer(t))throw new i.MongoshInvalidInputError("When specifying the key of a local KMS as BSON binary it must be constructed from a base64 encoded string");s.kmsProviders={...e.kmsProviders,local:{key:t}}}else s.kmsProviders={...e.kmsProviders};return e.schemaMap&&(s.schemaMap=e.schemaMap),void 0!==e.bypassAutoEncryption&&(s.bypassAutoEncryption=e.bypassAutoEncryption),e.encryptedFieldsMap&&(s.encryptedFieldsMap=e.encryptedFieldsMap),void 0!==e.bypassQueryAnalysis&&(s.bypassQueryAnalysis=e.bypassQueryAnalysis),void 0!==e.tlsOptions&&(s.tlsOptions=e.tlsOptions),s},t.maybeMarkAsExplainOutput=function(e,t){return"explain"in t?f(e):e},t.markAsExplainOutput=f,t.isValidDatabaseName=function(e){return!!e&&!/[/\\. "\0]/.test(e)},t.isValidCollectionName=function(e){return!!e&&!/[$\0]/.test(e)},t.shouldRunAggregationImmediately=function(e){return e.some((e=>Object.keys(e).some((e=>"$merge"===e||"$out"===e))))},t.adjustRunCommand=function e(t,r){if(void 0!==t.replSetResizeOplog){if("size"in t&&m(t.size))return e({...t,size:new r.Double(+t.size)},r);if("minRetentionHours"in t&&m(t.minRetentionHours))return e({...t,minRetentionHours:new r.Double(+t.minRetentionHours)},r)}return void 0!==t.profile&&"sampleRate"in t&&m(t.sampleRate)?e({...t,sampleRate:new r.Double(+t.sampleRate)},r):void 0!==t.setParameter&&void 0!==t.mirrorReads&&"samplingRate"in t.mirrorReads&&m(t.mirrorReads.samplingRate)?e({...t,mirrorReads:{...t.mirrorReads,samplingRate:new r.Double(+t.mirrorReads.samplingRate)}},r):"configureQueryAnalyzer"in t&&m(t.sampleRate)?e({...t,sampleRate:new r.Double(+t.sampleRate)},r):t},t.getBadge=function(e,t){return"timeseries"===e[t].type?"[time-series]":"view"===e[t].type?"[view]":((e,t)=>!e[t].name.startsWith("enxcol_.")&&e.some((r=>r.name===`enxcol_.${e[t].name}.esc`))&&e.some((r=>r.name===`enxcol_.${e[t].name}.ecc`))&&e.some((r=>r.name===`enxcol_.${e[t].name}.ecoc`)))(e,t)?"[queryable-encryption]":""},t.shallowClone=function(e){return e&&"object"==typeof e?Array.isArray(e)?[...e]:{...e}:e},t.functionCtorWithoutProps=function(e){function t(...t){return new.target?Reflect.construct(e,t,new.target):new e(...t)}Object.setPrototypeOf(t,Object.getPrototypeOf(e));const r=Object.getOwnPropertyDescriptor(e,"name");return r&&Object.defineProperty(t,"name",r),t},t.assignAll=function(e,...t){var r;const s=[];for(const e of t)s.push(...Object.entries(Object.getOwnPropertyDescriptors(e)));const i=Object.fromEntries(s);for(const t of Object.getOwnPropertyNames(i))!1===(null===(r=Object.getOwnPropertyDescriptor(e,t))||void 0===r?void 0:r.configurable)&&(e[t]=i[t].value,delete i[t]);return Object.defineProperties(e,i),e},t.pickWithExactKeyMatch=function(e,t){return Object.create(Object.getPrototypeOf(e),Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(e)).filter((([e])=>t.includes(e)))))},t.buildConfigChunksCollectionMatch=y},46993:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.InterruptFlag=t.getShellApiType=t.toShellResult=t.Topologies=t.ServerVersions=t.ShellApi=t.signatures=t.UpdateResult=t.ReplicaSet=t.Shard=t.Mongo=t.InsertOneResult=t.InsertManyResult=t.DeleteResult=t.CommandResult=t.BulkWriteResult=t.ShellInstanceState=t.Help=t.ExplainableCursor=t.Explainable=t.Collection=t.Database=t.CursorIterationResult=t.Cursor=t.RunCommandCursor=t.AggregationCursor=void 0;const i=s(r(20371));t.AggregationCursor=i.default;const n=s(r(7191));t.RunCommandCursor=n.default;const a=s(r(6988));t.Collection=a.default;const o=s(r(4564));t.Cursor=o.default;const l=s(r(78041));t.Database=l.default;const c=s(r(37149));t.Explainable=c.default;const p=s(r(93379));t.ExplainableCursor=p.default;const u=s(r(55179));t.Help=u.default;const h=s(r(75794));t.ShellInstanceState=h.default;const d=s(r(91923));t.Shard=d.default;const f=s(r(35215));t.ReplicaSet=f.default;const m=s(r(15826));t.ShellApi=m.default;const y=r(58744);Object.defineProperty(t,"BulkWriteResult",{enumerable:!0,get:function(){return y.BulkWriteResult}}),Object.defineProperty(t,"CommandResult",{enumerable:!0,get:function(){return y.CommandResult}}),Object.defineProperty(t,"CursorIterationResult",{enumerable:!0,get:function(){return y.CursorIterationResult}}),Object.defineProperty(t,"DeleteResult",{enumerable:!0,get:function(){return y.DeleteResult}}),Object.defineProperty(t,"InsertManyResult",{enumerable:!0,get:function(){return y.InsertManyResult}}),Object.defineProperty(t,"InsertOneResult",{enumerable:!0,get:function(){return y.InsertOneResult}}),Object.defineProperty(t,"UpdateResult",{enumerable:!0,get:function(){return y.UpdateResult}});const g=s(r(69483));t.Mongo=g.default;const b=r(40191);Object.defineProperty(t,"signatures",{enumerable:!0,get:function(){return b.signatures}}),Object.defineProperty(t,"toShellResult",{enumerable:!0,get:function(){return b.toShellResult}}),Object.defineProperty(t,"getShellApiType",{enumerable:!0,get:function(){return b.getShellApiType}});const x=r(86930);Object.defineProperty(t,"Topologies",{enumerable:!0,get:function(){return x.Topologies}}),Object.defineProperty(t,"ServerVersions",{enumerable:!0,get:function(){return x.ServerVersions}});const v=r(38961);Object.defineProperty(t,"InterruptFlag",{enumerable:!0,get:function(){return v.InterruptFlag}})},38961:(e,t,r)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.InterruptFlag=t.MongoshInterruptedError=void 0;const i=r(6534),n=Symbol.for("@@mongosh.uncatchable");class a extends i.MongoshBaseError{constructor(){super("MongoshInterruptedError","execution was interrupted"),this[s]=!0}}t.MongoshInterruptedError=a,s=n,t.InterruptFlag=class{constructor(){this.interrupted=!1,this.onInterruptListeners=new Set}isSet(){return this.interrupted}checkpoint(){if(this.interrupted)throw new a}asPromise(){if(this.interrupted){const e=Promise.reject(new a);return e.catch((()=>{})),{destroy:()=>{},promise:e}}let e;const t=new Promise(((t,r)=>{e=()=>{this.onInterruptListeners.delete(r),r(null)},this.onInterruptListeners.add(r)}));return t.catch((()=>{})),{destroy:e,promise:t}}async set(){this.interrupted=!0;const e=new a;for(const t of[...this.onInterruptListeners])try{await t(e)}catch(e){}}reset(){this.interrupted=!1}async withOverrideInterruptBehavior(e,t){const r=this.asPromise();let s;const i=new Promise((e=>{s=async()=>{const r=t();return e(r),r}}));this.onInterruptListeners.add(s);try{this.checkpoint();const t=e(r);return t.catch((()=>{})),await Promise.race([t,r.promise])}catch(e){throw this.interrupted&&await i,e}finally{r.destroy(),this.onInterruptListeners.delete(s)}}}},91616:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseAnyLogEntry=void 0,t.parseAnyLogEntry=function(e){var t;try{const r=JSON.parse(e);return{id:r.id,timestamp:null===(t=r.t)||void 0===t?void 0:t.$date,severity:r.s,component:r.c,context:r.ctx,message:r.msg,attr:r.attr}}catch(t){return function(e){const t=/^(?<timestamp>\S*) *(?<severity>\S*) *(?<component>\S*) *\[(?<context>[^\]]+)\]\s*(?<message>.*)$/.exec(e.trim());if(!t)throw new Error(`Could not parse line ${JSON.stringify(e)}`);return t.groups}(e)}}},72292:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransformMongoErrorPlugin=t.rephraseMongoError=void 0;const r=[{code:13435,replacement:"not primary and secondaryOk=false - consider using db.getMongo().setReadPref() or readPreference in the connection string"}];function s(e){if(!function(e){var t,r,s;return/^Mongo([A-Z].*)?Error$/.test(null!==(s=null===(r=null===(t=Object.getPrototypeOf(e))||void 0===t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==s?s:"")}(e))return e;const t=e,s=t.message,i=r.find((e=>e.matchMessage?"string"==typeof e.matchMessage?s.includes(e.matchMessage):e.matchMessage.test(s):void 0!==e.code&&t.code===e.code));return i&&(t.message="function"==typeof i.replacement?i.replacement(s):i.replacement),t}t.rephraseMongoError=s,t.TransformMongoErrorPlugin=class{transformError(e){return s(e)}}},69483:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(6534),a=r(40191),o=r(35935),l=i(r(78041)),c=r(58744),p=r(46177),u=r(86930),h=i(r(82428)),d=r(86901),f=i(r(88494)),m=r(73041),y=r(99232),g=r(73041),b=r(91616);let x=class extends a.ShellApiClass{constructor(e,t,r,s,i){var a,l,c;if(super(),this.__serviceProvider=null,this._explicitEncryptionOnly=!1,this._readPreferenceWasExplicitlyRequested=!1,this._cachedDatabaseNames=[],this._instanceState=e,this._databases={},i&&(this.__serviceProvider=i),"object"==typeof t&&null!==t&&"string"==typeof t._uri?t=t._uri:"string"!=typeof t&&(t=null!==(l=null===(a=null==i?void 0:i.getURI)||void 0===a?void 0:a.call(i))&&void 0!==l?l:"mongodb://localhost/"),this._connectionInfo=(0,o.generateConnectionInfoFromCliArgs)({connectionSpecifier:t}),this._readPreferenceWasExplicitlyRequested=/\breadPreference=/i.test(this._uri),r){if(void 0!==r.explicitEncryptionOnly){if(void 0!==r.schemaMap)throw new n.MongoshInvalidInputError("explicitEncryptionOnly and schemaMap are mutually exclusive",n.CommonErrors.InvalidArgument);r={...r},this._explicitEncryptionOnly=!!r.explicitEncryptionOnly,delete r.explicitEncryptionOnly}this._connectionInfo.driverOptions.autoEncryption=(0,d.processFLEOptions)(r)}else{const e=null===(c=null==i?void 0:i.getFleOptions)||void 0===c?void 0:c.call(i);e&&(this._connectionInfo.driverOptions.autoEncryption=e)}(null==s?void 0:s.api)&&("string"==typeof s.api?this._connectionInfo.driverOptions.serverApi={version:s.api}:this._connectionInfo.driverOptions.serverApi=s.api)}get _uri(){return this._connectionInfo.connectionString}get _fleOptions(){return this._connectionInfo.driverOptions.autoEncryption}get _serviceProvider(){if(null===this.__serviceProvider)throw new n.MongoshInternalError("No ServiceProvider available for this mongo",g.ShellApiErrors.NotConnected);return this.__serviceProvider}set _serviceProvider(e){this.__serviceProvider=e}async _displayBatchSize(){var e;return null!==(e=this._instanceState.displayBatchSizeFromDBQuery)&&void 0!==e?e:await this._instanceState.shellApi.config.get("displayBatchSize")}[u.asPrintable](){return(0,p.redactURICredentials)(this._uri)}_emitMongoApiCall(e,t={}){this._instanceState.emitApiCallWithArgs({method:e,class:"Mongo",uri:this._uri,arguments:t})}async connect(e,t){var r,s,i,n;(e||t)&&(this._connectionInfo=(0,o.mapCliToDriver)({username:e,password:t},this._connectionInfo));const a={...this._connectionInfo.driverOptions};this._explicitEncryptionOnly?delete a.autoEncryption:a.autoEncryption&&(a.autoEncryption.extraOptions={...a.autoEncryption.extraOptions,...await(null===(s=null===(r=this._instanceState.evaluationListener)||void 0===r?void 0:r.getCryptLibraryOptions)||void 0===s?void 0:s.call(r))});const l=this._instanceState.initialServiceProvider;try{this.__serviceProvider=await l.getNewConnection(this._uri,a)}catch(e){throw"MongoServerSelectionError"===(null==e?void 0:e.name)&&(null===(n=null===(i=l.getRawClient())||void 0===i?void 0:i.options)||void 0===n?void 0:n.tls)&&!/\b(ssl|tls)=/.exec(this._uri)&&(e.message+=" (is ?tls=true missing from the connection string?)"),e}}_getDb(e){if((0,d.assertArgsDefinedType)([e],["string"]),!(0,d.isValidDatabaseName)(e))throw new n.MongoshInvalidInputError(`Invalid database name: ${e}`,n.CommonErrors.InvalidArgument);return e in this._databases||(this._databases[e]=new l.default(this,e)),this._databases[e]}getDB(e){return(0,d.assertArgsDefinedType)([e],["string"],"Mongo.getDB"),this._instanceState.messageBus.emit("mongosh:getDB",{db:e}),this._getDb(e)}getCollection(e){var t,r;(0,d.assertArgsDefinedType)([e],["string"]);const{db:s,coll:i}=null!==(r=null===(t=/^(?<db>[^.]+)\.(?<coll>.+)$/.exec(e))||void 0===t?void 0:t.groups)&&void 0!==r?r:{};if(!s||!i)throw new n.MongoshInvalidInputError("Collection must be of the format <db>.<collection>",n.CommonErrors.InvalidArgument);return this._getDb(s).getCollection(i)}getURI(){return this._uri}use(e){var t;let r,s;(0,d.assertArgsDefinedType)([e],["string"],"Mongo.use"),this._instanceState.messageBus.emit("mongosh:use",{db:e});try{const e=this._instanceState.context.db;r=null===(t=null==e?void 0:e.getName)||void 0===t?void 0:t.call(e),s=null==e?void 0:e._mongo}catch(e){if((null==e?void 0:e.code)!==g.ShellApiErrors.NotConnected)throw e}return this._instanceState.context.db=this._getDb(e),e===r&&s===this?`already on db ${e}`:`switched to db ${e}`}async _listDatabases(e={}){const t=await this._serviceProvider.listDatabases("admin",{...this._getExplicitlyRequestedReadPref(),...e});if(!("databases"in t)){const e=new n.MongoshRuntimeError('Got invalid result from "listDatabases"',n.CommonErrors.CommandFailed);throw this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),e}return this._cachedDatabaseNames=t.databases.map((e=>e.name)),t}async _getDatabaseNamesForCompletion(){return await Promise.race([(async()=>(await this._listDatabases({readPreference:"primaryPreferred"})).databases.map((e=>e.name)))(),(async()=>(await new Promise((e=>setTimeout(e,200).unref())),this._cachedDatabaseNames))()])}async getDBs(e={}){return this._emitMongoApiCall("getDBs",{options:e}),await this._listDatabases(e)}async getDBNames(e={}){return this._emitMongoApiCall("getDBNames",{options:e}),(await this._listDatabases(e)).databases.map((e=>e.name))}async show(e,t){var r,s,i;const a=this._instanceState.currentDb;switch(this._instanceState.messageBus.emit("mongosh:show",{method:`show ${e}`}),e){case"databases":case"dbs":const o=(await this._listDatabases({readPreference:"primaryPreferred",promoteLongs:!0})).databases;return new c.CommandResult("ShowDatabasesResult",o);case"collections":case"tables":const l=await a._getCollectionNamesWithTypes({readPreference:"primaryPreferred",promoteLongs:!0});return new c.CommandResult("ShowCollectionsResult",l);case"profile":const p=a.getCollection("system.profile"),u={count:await p.countDocuments({})};return 0!==u.count&&(u.result=await(await p.find({millis:{$gt:0}})).sort({$natural:-1}).limit(5).toArray()),new c.CommandResult("ShowProfileResult",u);case"users":const h=await a.getUsers();return new c.CommandResult("ShowResult",h.users);case"roles":const d=await a.getRoles({showBuiltinRoles:!0});return new c.CommandResult("ShowResult",d.roles);case"log":const f=await a.adminCommand({getLog:t||"global"});return new c.CommandResult("ShowResult",f.log);case"logs":const m=await a.adminCommand({getLog:"*"});return new c.CommandResult("ShowResult",m.names);case"startupWarnings":{let e;try{if(e=await a.adminCommand({getLog:"startupWarnings"}),!e)throw new n.MongoshCommandFailed("adminCommand getLog unexpectedly returned no result")}catch(e){return this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),new c.CommandResult("ShowBannerResult",null)}if(!e.log||!e.log.length)return new c.CommandResult("ShowBannerResult",null);const t=e.log.map((e=>{try{const t=(0,b.parseAnyLogEntry)(e);return`${t.timestamp}: ${t.message}`}catch(t){return`Unexpected log line format: ${e}`}}));return new c.CommandResult("ShowBannerResult",{header:"The server generated these startup warnings when booting",content:t.join("\n")})}case"automationNotices":{let e;try{e=await a.hello()}catch(e){return this._instanceState.messageBus.emit("mongosh:error",e,"shell-api"),new c.CommandResult("ShowBannerResult",null)}return e.automationServiceDescriptor?new c.CommandResult("ShowBannerResult",{content:`This server is managed by automation service '${e.automationServiceDescriptor}'.\nMany administrative actions are inappropriate, and may be automatically reverted.`}):new c.CommandResult("ShowBannerResult",null)}case"nonGenuineMongoDBCheck":return null===(i=null===(s=null===(r=this._instanceState.connectionInfo)||void 0===r?void 0:r.extraInfo)||void 0===s?void 0:s.is_genuine)||void 0===i||i?new c.CommandResult("ShowBannerResult",null):new c.CommandResult("ShowBannerResult",{header:"Warning: Non-Genuine MongoDB Detected",content:["This server or service appears to be an emulation of MongoDB rather than an official MongoDB product.","Some documented MongoDB features may work differently, be entirely missing or incomplete, or have unexpected performance characteristics.","To learn more please visit: https://dochub.mongodb.org/core/non-genuine-mongodb-server-warning."].join("\n")});default:const y=new n.MongoshInvalidInputError(`'${e}' is not a valid argument for "show".`,n.CommonErrors.InvalidArgument);throw this._instanceState.messageBus.emit("mongosh:error",y,"shell-api"),y}}async close(e){const t=this._instanceState.mongos.indexOf(this);-1===t?process.emitWarning(new n.MongoshInternalError(`Closing untracked Mongo instance ${this[u.asPrintable]()}`)):this._instanceState.mongos.splice(t,1),await this._serviceProvider.close(e)}async _suspend(){return await this._serviceProvider.suspend()}getReadPrefMode(){return this._serviceProvider.getReadPreference().mode}getReadPrefTagSet(){return this._serviceProvider.getReadPreference().tags}getReadPref(){return this._serviceProvider.getReadPreference()}_getExplicitlyRequestedReadPref(){return this._readPreferenceWasExplicitlyRequested?{readPreference:this.getReadPref()}:void 0}getReadConcern(){try{const e=this._serviceProvider.getReadConcern();return e?e.level:void 0}catch(e){throw new n.MongoshInternalError("Error retrieving ReadConcern.")}}getWriteConcern(){try{return this._serviceProvider.getWriteConcern()}catch(e){throw new n.MongoshInternalError("Error retrieving WriteConcern.")}}async setReadPref(e,t,r){await this._serviceProvider.resetConnectionOptions({readPreference:this._serviceProvider.readPreferenceFromOptions({readPreference:e,readPreferenceTags:t,hedge:r})}),this._readPreferenceWasExplicitlyRequested=!0}async setReadConcern(e){await this._serviceProvider.resetConnectionOptions({readConcern:{level:e}})}async setWriteConcern(e,t,r){const s={};let i;if("object"==typeof e){if(void 0!==t||void 0!==r)throw new n.MongoshInvalidInputError("If concern is given as an object no other arguments must be specified",n.CommonErrors.InvalidArgument);i=e}else{if(i={},"string"!=typeof e&&"number"!=typeof e)throw new n.MongoshInvalidInputError("w value must be a number or string, got: "+typeof e,n.CommonErrors.InvalidArgument);if("number"==typeof e&&e<0)throw new n.MongoshInvalidInputError(`w value must be equal to or greather than 0, got: ${e}`,n.CommonErrors.InvalidArgument);if(i.w=e,void 0!==t){if("number"!=typeof t)throw new n.MongoshInvalidInputError("wtimeoutMS value must be a number, got: "+typeof t,n.CommonErrors.InvalidArgument);if(t<0)throw new n.MongoshInvalidInputError(`wtimeoutMS must be equal to or greather than 0, got: ${t}`,n.CommonErrors.InvalidArgument);i.wtimeout=t}if(void 0!==r){if("boolean"!=typeof r)throw new n.MongoshInvalidInputError("j value must be a boolean, got: "+typeof r,n.CommonErrors.InvalidArgument);i.j=r}}void 0!==i.w&&(s.w=i.w),void 0!==i.wtimeout&&(s.wtimeoutMS=i.wtimeout),void 0!==i.j&&(s.journal=i.j),void 0!==i.fsync&&(s.journal=!!i.fsync),await this._serviceProvider.resetConnectionOptions(s)}startSession(e={}){const t=["readConcern","writeConcern","readPreference","maxCommitTimeMS"],r={};for(const s of t)void 0!==e[s]&&(r[s]=e[s]);const s=["causalConsistency","snapshot"],i={};Object.keys(r).length>0&&(i.defaultTransactionOptions=r);for(const t of s)void 0!==e[t]&&(i[t]=e[t]);return new h.default(this,i,this._serviceProvider.startSession(i))}setCausalConsistency(){throw new n.MongoshUnimplementedError("It is not possible to set causal consistency for an entire connection due to the driver, use startSession({causalConsistency: <>}) instead.",n.CommonErrors.NotImplemented,(0,m.blockedByDriverMetadata)("Mongo.setCausalConsistency"))}isCausalConsistency(){throw new n.MongoshUnimplementedError("Causal consistency for drivers is set via Mongo.startSession and can be checked via session.getOptions. The default value is true",n.CommonErrors.NotImplemented,(0,m.blockedByDriverMetadata)("Mongo.isCausalConsistency"))}setSlaveOk(){throw new n.MongoshDeprecatedError("Setting slaveOk is deprecated, use setReadPref instead.")}async setSecondaryOk(){await this._instanceState.printDeprecationWarning('.setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead');const e=this.getReadPrefMode();"primary"===e?(await this._instanceState.shellApi.print('Setting read preference from "primary" to "primaryPreferred"'),await this.setReadPref("primaryPreferred")):await this._instanceState.shellApi.print(`Leaving read preference unchanged (is already "${e}")`)}async watch(e=[],t={}){Array.isArray(e)||(t=e,e=[]),this._emitMongoApiCall("watch",{pipeline:e,options:t});const r=new f.default(this._serviceProvider.watch(e,t),(0,p.redactURICredentials)(this._uri),this);return t.resumeAfter||t.startAfter||t.startAtOperationTime||await r.tryNext(),this._instanceState.currentCursor=r,r}getClientEncryption(){if(!this._fleOptions)throw new n.MongoshInvalidInputError("Cannot call getClientEncryption() without field-level encryption options",g.ShellApiErrors.NotUsingFLE);return this._clientEncryption||(this._clientEncryption=new y.ClientEncryption(this)),this._clientEncryption}async getKeyVault(){return this._keyVault||(this._keyVault=new y.KeyVault(this.getClientEncryption()),await this._keyVault._init()),this._keyVault}async convertShardKeyToHashed(e){const t=[{$limit:1},{$project:{_id:{$toHashedIndexKey:{$literal:e}}}}];let r;for(const e of[()=>this.getDB("_fakeDbForMongoshCSKTH").aggregate([{$documents:[{}]},...t]),()=>this.getDB("admin").aggregate([{$documents:[{}]},...t]),()=>this.getDB("admin").getCollection("system.version").aggregate(t),()=>this.getDB("local").getCollection("oplog.rs").aggregate([{$collStats:{}},...t])]){try{r=await(await e()).next()}catch(e){continue}if(r)break}if(!r)throw new n.MongoshRuntimeError("Could not find a suitable way to run convertShardKeyToHashed() -- tried $documents and aggregating on admin.system.version and local.oplog.rs",n.CommonErrors.CommandFailed);return r._id}};s([(0,a.returnType)("Database")],x.prototype,"getDB",null),s([(0,a.returnType)("Collection")],x.prototype,"getCollection",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"getDBs",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"getDBNames",null),s([a.returnsPromise,(0,a.apiVersions)([1])],x.prototype,"show",null),s([a.returnsPromise],x.prototype,"setReadPref",null),s([a.returnsPromise],x.prototype,"setReadConcern",null),s([a.returnsPromise],x.prototype,"setWriteConcern",null),s([(0,a.topologies)([u.Topologies.ReplSet])],x.prototype,"startSession",null),s([a.deprecated],x.prototype,"setSlaveOk",null),s([a.deprecated,a.returnsPromise],x.prototype,"setSecondaryOk",null),s([(0,a.serverVersions)(["3.1.0",u.ServerVersions.latest]),(0,a.topologies)([u.Topologies.ReplSet,u.Topologies.Sharded]),(0,a.apiVersions)([1]),a.returnsPromise],x.prototype,"watch",null),s([(0,a.platforms)(["CLI"]),(0,a.serverVersions)(["4.2.0",u.ServerVersions.latest]),(0,a.returnType)("ClientEncryption")],x.prototype,"getClientEncryption",null),s([(0,a.platforms)(["CLI"]),(0,a.serverVersions)(["4.2.0",u.ServerVersions.latest]),(0,a.returnType)("KeyVault"),a.returnsPromise],x.prototype,"getKeyVault",null),s([a.returnsPromise],x.prototype,"convertShardKeyToHashed",null),x=s([a.shellApiClassDefault,(0,a.classPlatforms)(["CLI"])],x),t.default=x},51238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=r(6534),i=r(73041);t.default=class{constructor(){return this._mongo=new n,new Proxy(this,{get:(e,t)=>{if("_mongo"===t)return this._mongo;throw new s.MongoshInvalidInputError("No connected database",i.ShellApiErrors.NotConnected)}})}};class n{constructor(){return new Proxy(this,{get:()=>{throw new s.MongoshInvalidInputError("No connected database",i.ShellApiErrors.NotConnected)}})}}},20541:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(86930),a=r(6534);let o=class extends i.ShellApiWithMongoClass{constructor(e){super(),this._collection=e}get _mongo(){return this._collection._mongo}[n.asPrintable](){return`PlanCache for collection ${this._collection._name}.`}async clear(){return await this._collection.runCommand("planCacheClear")}async clearPlansByQuery(e,t,r){const s={query:e};return t&&(s.projection=t),r&&(s.sort=r),await this._collection.runCommand("planCacheClear",s)}async list(e){const t=e||[],r=await this._collection.aggregate([{$planCacheStats:{}},...t]);return await r.toArray()}listQueryShapes(){throw new a.MongoshDeprecatedError("PlanCache.listQueryShapes was deprecated, please use PlanCache.list instead")}getPlansByQuery(){throw new a.MongoshDeprecatedError("PlanCache.getPlansByQuery was deprecated, please use PlanCache.list instead")}};s([i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"clear",null),s([i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"clearPlansByQuery",null),s([(0,i.serverVersions)(["4.4.0",n.ServerVersions.latest]),i.returnsPromise,(0,i.apiVersions)([])],o.prototype,"list",null),s([i.deprecated],o.prototype,"listQueryShapes",null),s([i.deprecated],o.prototype,"getPlansByQuery",null),o=s([i.shellApiClassDefault],o),t.default=o},35215:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(46177),a=r(40191),o=r(86930),l=r(86901);let c=class extends a.ShellApiWithMongoClass{constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}async initiate(e={}){return this._emitReplicaSetApiCall("initiate",{config:e}),this._database._runAdminCommand({replSetInitiate:e})}async _getConfig(){try{const e=await this._database._runAdminCommand({replSetGetConfig:1});if(void 0===e.config)throw new i.MongoshRuntimeError("Documented returned from command replSetGetConfig does not contain 'config'",i.CommonErrors.CommandFailed);return e.config}catch(e){if("CommandNotFound"===(null==e?void 0:e.codeName)||"APIStrictError"===(null==e?void 0:e.codeName)){const e=await this._database.getSiblingDB("local").getCollection("system.replset").findOne();if(null===e)throw new i.MongoshRuntimeError("No documents in local.system.replset",i.CommonErrors.CommandFailed);return e}throw e}}async config(){return this._emitReplicaSetApiCall("config",{}),this._getConfig()}async conf(){return this._emitReplicaSetApiCall("conf",{}),this._getConfig()}async reconfig(e,t={}){var r;(0,l.assertArgsDefinedType)([e,t],["object",[void 0,"object"]],"ReplicaSet.reconfig"),this._emitReplicaSetApiCall("reconfig",{config:e,options:t});const s=await this._getConfig();e.version=s.version?s.version+1:1,null!==(r=e.protocolVersion)&&void 0!==r||(e.protocolVersion=s.protocolVersion);const i={replSetReconfig:e,...t};return await this._database._runAdminCommand(i)}async reconfigForPSASet(e,t,r={}){var s;(0,l.assertArgsDefinedType)([e,t,r],["number","object",[void 0,"object"]],"ReplicaSet.reconfigForPSASet"),this._emitReplicaSetApiCall("reconfigForPSASet",{newMemberIndex:e,config:t,options:r});const n=e=>this._instanceState.shellApi.print(e),a=null===(s=t.members)||void 0===s?void 0:s[e];if(!a)throw new i.MongoshInvalidInputError(`Node at index ${e} does not exist in the new config`,i.CommonErrors.InvalidArgument);if(1!==a.votes)throw new i.MongoshInvalidInputError(`Node at index ${e} must have { votes: 1 } in the new config (actual: { votes: ${a.votes} })`,i.CommonErrors.InvalidArgument);const o=await this._getConfig(),c=o.members.find((e=>e._id===a._id));if(c){if(c.votes)throw new i.MongoshInvalidInputError(`Node at index ${e} must have { votes: 0 } in the old config (actual: { votes: ${c.votes} })`,i.CommonErrors.InvalidArgument)}else o.members.find((e=>e.host===a.host))&&await n(`Warning: Node at index ${e} has { host: "${a.host}" }, which is also present in the old config, but with a different _id field.`);const p=a.priority;await n(`Running first reconfig to give member at index ${e} { votes: 1, priority: 0 }`),a.votes=1,a.priority=0;const u=await this.reconfig(t,r);if(0===p)return await n("No second reconfig necessary because .priority = 0"),u;await n(`Running second reconfig to give member at index ${e} { priority: ${p} }`),a.priority=p;try{return await this.reconfig(t,r)}catch(e){throw await n("Second reconfig did not succeed, giving up"),await n(`Attempted command: rs.reconfig(${JSON.stringify(t,null," ")}, ${JSON.stringify(r)})`),e}}async status(){return this._emitReplicaSetApiCall("status",{}),this._database._runAdminCommand({replSetGetStatus:1})}async isMaster(){return this._emitReplicaSetApiCall("isMaster",{}),this._database.getSiblingDB("admin").isMaster()}async hello(){return this._emitReplicaSetApiCall("hello",{}),this._database.getSiblingDB("admin").hello()}async printSecondaryReplicationInfo(){return this._emitReplicaSetApiCall("printSecondaryReplicationInfo",{}),this._database.printSecondaryReplicationInfo()}printSlaveReplicationInfo(){throw new i.MongoshDeprecatedError("printSlaveReplicationInfo has been deprecated. Use printSecondaryReplicationInfo instead")}async printReplicationInfo(){return this._emitReplicaSetApiCall("printReplicationInfo",{}),this._database.printReplicationInfo()}async add(e,t){(0,l.assertArgsDefinedType)([e,t],[["string","object"],[void 0,"boolean"]],"ReplicaSet.add"),this._emitReplicaSetApiCall("add",{hostport:e,arb:t});const r=await this._getConfig();r.version++;const s=Math.max(...r.members.map((e=>e._id)));let n;if("string"==typeof e)n={_id:s+1,host:e},t&&(n.arbiterOnly=!0);else{if(!0===t)throw new i.MongoshInvalidInputError(`Expected first parameter to be a host-and-port string of arbiter, but got ${JSON.stringify(e)}`,i.CommonErrors.InvalidArgument);n=e,null!==n._id&&void 0!==n._id||(n._id=s+1)}return r.members.push(n),this._database._runAdminCommand({replSetReconfig:r})}async addArb(e){return this._emitReplicaSetApiCall("addArb",{hostname:e}),this.add(e,!0)}async remove(e){(0,l.assertArgsDefinedType)([e],["string"],"ReplicaSet.remove"),this._emitReplicaSetApiCall("remove",{hostname:e});const t=await this._getConfig();t.version++;for(let r=0;r<t.members.length;r++)if(t.members[r].host===e)return t.members.splice(r,1),this._database._runAdminCommand({replSetReconfig:t});throw new i.MongoshInvalidInputError(`Couldn't find ${e} in ${JSON.stringify(t.members)}. Is ${e} a member of this replset?`,i.CommonErrors.InvalidArgument)}async freeze(e){return(0,l.assertArgsDefinedType)([e],["number"],"ReplicaSet.freeze"),this._emitReplicaSetApiCall("freeze",{secs:e}),this._database._runAdminCommand({replSetFreeze:e})}async stepDown(e,t){(0,l.assertArgsDefinedType)([e,t],[[void 0,"number"],[void 0,"number"]],"ReplicaSet.stepDown"),this._emitReplicaSetApiCall("stepDown",{stepdownSecs:e,catchUpSecs:t});const r={replSetStepDown:void 0===e?60:e};return void 0!==t&&(r.secondaryCatchUpPeriodSecs=t),this._database._runAdminCommand(r)}async syncFrom(e){return(0,l.assertArgsDefinedType)([e],["string"],"ReplicaSet.syncFrom"),this._emitReplicaSetApiCall("syncFrom",{host:e}),this._database._runAdminCommand({replSetSyncFrom:e})}async secondaryOk(){await this._mongo.setSecondaryOk()}[o.asPrintable](){return`ReplicaSet class connected to ${(0,n.redactURICredentials)(this._database._mongo._uri)} via db ${this._database._name}`}_emitReplicaSetApiCall(e,t={}){this._database._mongo._instanceState.emitApiCallWithArgs({method:e,class:"ReplicaSet",arguments:t})}};s([a.returnsPromise],c.prototype,"initiate",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"config",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"conf",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"reconfig",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"reconfigForPSASet",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"status",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"isMaster",null),s([a.returnsPromise,(0,a.apiVersions)([1])],c.prototype,"hello",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"printSecondaryReplicationInfo",null),s([a.deprecated,(0,a.apiVersions)([])],c.prototype,"printSlaveReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"printReplicationInfo",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"add",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"addArb",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"remove",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"freeze",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"stepDown",null),s([a.returnsPromise,(0,a.apiVersions)([])],c.prototype,"syncFrom",null),s([a.deprecated,a.returnsPromise],c.prototype,"secondaryOk",null),c=s([a.shellApiClassDefault],c),t.default=c},58744:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.CursorIterationResult=t.DeleteResult=t.UpdateResult=t.InsertOneResult=t.InsertManyResult=t.BulkWriteResult=t.CommandResult=void 0;const i=r(40191),n=r(86930);let a=t.CommandResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.type=e,this.value=t,this[n.shellApiType]=e}[n.asPrintable](){return this.value}toJSON(){return this.value}};t.CommandResult=a=s([i.shellApiClassDefault],a);let o=t.BulkWriteResult=class extends i.ShellApiValueClass{constructor(e,t,r,s,i,n,a,o){super(),this.acknowledged=e,this.insertedCount=t,this.insertedIds=r,this.matchedCount=s,this.modifiedCount=i,this.deletedCount=n,this.upsertedCount=a,this.upsertedIds=o}};t.BulkWriteResult=o=s([i.shellApiClassDefault],o);let l=t.InsertManyResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.insertedIds=t}};t.InsertManyResult=l=s([i.shellApiClassDefault],l);let c=t.InsertOneResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.insertedId=t}};t.InsertOneResult=c=s([i.shellApiClassDefault],c);let p=t.UpdateResult=class extends i.ShellApiValueClass{constructor(e,t,r,s,i){super(),this.acknowledged=e,this.insertedId=i,this.matchedCount=t,this.modifiedCount=r,this.upsertedCount=s}};t.UpdateResult=p=s([i.shellApiClassDefault],p);let u=t.DeleteResult=class extends i.ShellApiValueClass{constructor(e,t){super(),this.acknowledged=e,this.deletedCount=t}};t.DeleteResult=u=s([i.shellApiClassDefault],u);let h=t.CursorIterationResult=class extends i.ShellApiValueClass{constructor(){super(),this.cursorHasMore=!0,this.documents=[]}};t.CursorIterationResult=h=s([i.shellApiClassDefault],h)},7191:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(40191),n=r(35551);let a=class extends n.AbstractCursor{constructor(e,t){super(e,t)}};a=s([i.shellApiClassDefault],a),t.default=a},82428:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=i(r(78041)),l=r(6534),c=r(86901);let p=class extends n.ShellApiWithMongoClass{constructor(e,t,r){super(),this._session=r,this._options=t,this._mongo=e,this._databases={},this.id=r.id}[a.asPrintable](){return this._session.id}getDatabase(e){if((0,c.assertArgsDefinedType)([e],["string"],"Session.getDatabase"),!(0,c.isValidDatabaseName)(e))throw new l.MongoshInvalidInputError(`Invalid database name: ${e}`,l.CommonErrors.InvalidArgument);return e in this._databases||(this._databases[e]=new o.default(this._mongo,e,this)),this._databases[e]}advanceOperationTime(e){this._session.advanceOperationTime(e)}advanceClusterTime(e){this._session.advanceClusterTime(e)}async endSession(){return await this._session.endSession()}hasEnded(){return this._session.hasEnded}getClusterTime(){return this._session.clusterTime}getOperationTime(){return this._session.operationTime}getOptions(){return this._options}startTransaction(e={}){return this._session.startTransaction(e)}async commitTransaction(){await this._session.commitTransaction()}async abortTransaction(){await this._session.abortTransaction()}async withTransaction(e,t={}){return(0,c.assertArgsDefinedType)([e,t],["function",[void 0,"object"]]),await this._session.withTransaction((async()=>await e()),t)}};s([n.returnsPromise],p.prototype,"endSession",null),s([n.returnsPromise],p.prototype,"commitTransaction",null),s([n.returnsPromise],p.prototype,"abortTransaction",null),s([n.returnsPromise],p.prototype,"withTransaction",null),p=s([n.shellApiClassDefault,(0,n.classPlatforms)(["CLI"])],p),t.default=p},91923:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86901),o=r(86930),l=r(58744),c=r(46177),p=i(r(97699));let u=class extends n.ShellApiWithMongoClass{constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}[o.asPrintable](){return`Shard class connected to ${(0,c.redactURICredentials)(this._database._mongo._uri)} via db ${this._database._name}`}_emitShardApiCall(e,t={}){this._database._mongo._instanceState.emitApiCallWithArgs({method:e,class:"Shard",arguments:t})}async enableSharding(e,t){(0,a.assertArgsDefinedType)([e,t],["string",[void 0,"string"]],"Shard.enableSharding"),this._emitShardApiCall("enableSharding",{database:e,primaryShard:t});const r={enableSharding:e};void 0!==t&&(r.primaryShard=t);try{return await this._database._runAdminCommand(r)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. Are you connected to mongos?`),e}}async commitReshardCollection(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.commitReshardCollection"),this._emitShardApiCall("commitReshardCollection",{namespace:e}),await this._database._runAdminCommand({commitReshardCollection:e})}async abortReshardCollection(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.abortReshardCollection"),this._emitShardApiCall("abortReshardCollection",{namespace:e}),await this._database._runAdminCommand({abortReshardCollection:e})}async shardCollection(e,t,r,s){return await this._runShardCollection("shardCollection",e,t,r,s)}async reshardCollection(e,t,r,s){return await this._runShardCollection("reshardCollection",e,t,r,s)}async _runShardCollection(e,t,r,s,i){(0,a.assertArgsDefinedType)([t,r,s,i],["string","object",[void 0,"boolean","object"],[void 0,"object"]],`Shard.${e}`),this._emitShardApiCall(e,{namespace:t,key:r,unique:s,options:i}),"object"==typeof s&&null!==s&&(i=s,s=void 0);const n={[e]:t,key:r};void 0!==s&&(n.unique=s);try{return await this._database._runAdminCommand({...n,...i})}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. Are you connected to mongos?`),e}}async status(e=!1,t){const r=await(0,a.getPrintableShardStatus)(null!=t?t:await(0,a.getConfigDB)(this._database),e);return new l.CommandResult("StatsResult",r)}async addShard(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.addShard"),await(0,a.getConfigDB)(this._database),this._emitShardApiCall("addShard",{url:e}),this._database._runAdminCommand({addShard:e})}async addShardToZone(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.addShardToZone"),this._emitShardApiCall("addShardToZone",{shard:e,zone:t}),await(0,a.getConfigDB)(this._database),this._database._runAdminCommand({addShardToZone:e,zone:t})}async addShardTag(e,t){(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.addShardTag"),this._emitShardApiCall("addShardTag",{shard:e,tag:t});try{return await this.addShardToZone(e,t)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to addShardToZone which exists only for server versions > 3.4.`),e}}async updateZoneKeyRange(e,t,r,s){return(0,a.assertArgsDefinedType)([e,t,r,s],["string","object","object",!0],"Shard.updateZoneKeyRange"),this._emitShardApiCall("updateZoneKeyRange",{namespace:e,min:t,max:r,zone:s}),await(0,a.getConfigDB)(this._database),await this._database._runAdminCommand({updateZoneKeyRange:e,min:t,max:r,zone:s})}async addTagRange(e,t,r,s){(0,a.assertArgsDefinedType)([e,t,r,s],["string","object","object",!0],"Shard.addTagRange"),this._emitShardApiCall("addTagRange",{namespace:e,min:t,max:r,zone:s});try{return await this.updateZoneKeyRange(e,t,r,s)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to updateZoneKeyRange which exists only for server versions > 3.4.`),e}}async removeRangeFromZone(e,t,r){return(0,a.assertArgsDefinedType)([e,t,r],["string","object","object"],"Shard.removeRangeFromZone"),this._emitShardApiCall("removeRangeFromZone",{ns:e,min:t,max:r}),this.updateZoneKeyRange(e,t,r,null)}async removeTagRange(e,t,r){(0,a.assertArgsDefinedType)([e,t,r],["string","object","object"],"Shard.removeTagRange"),this._emitShardApiCall("removeTagRange",{ns:e,min:t,max:r});try{return await this.updateZoneKeyRange(e,t,r,null)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to updateZoneKeyRange which exists only for server versions > 3.4.`),e}}async removeShardFromZone(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.removeShardFromZone"),this._emitShardApiCall("removeShardFromZone",{shard:e,zone:t}),await(0,a.getConfigDB)(this._database),await this._database._runAdminCommand({removeShardFromZone:e,zone:t})}async removeShardTag(e,t){(0,a.assertArgsDefinedType)([e,t],["string","string"],"Shard.removeShardTag"),this._emitShardApiCall("removeTagRange",{shard:e,tag:t});try{return await this.removeShardFromZone(e,t)}catch(e){throw"CommandNotFound"===(null==e?void 0:e.codeName)&&(e.message=`${e.message}. This method aliases to removeShardFromZone which exists only for server versions > 3.4.`),e}}async enableAutoSplit(){this._instanceState.connectionInfo.buildInfo.version&&p.default.gte(this._instanceState.connectionInfo.buildInfo.version,"6.0.3")&&await this._instanceState.printDeprecationWarning("Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. For details, see Balancing Policy Changes: https://www.mongodb.com/docs/manual/release-notes/6.0/#balancing-policy-changes\n"),this._emitShardApiCall("enableAutoSplit",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"autosplit"},{$set:{enabled:!0}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async disableAutoSplit(){this._instanceState.connectionInfo.buildInfo.version&&p.default.gte(this._instanceState.connectionInfo.buildInfo.version,"6.0.3")&&await this._instanceState.printDeprecationWarning("Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. For details, see Balancing Policy Changes: https://www.mongodb.com/docs/manual/release-notes/6.0/#balancing-policy-changes\n"),this._emitShardApiCall("disableAutoSplit",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"autosplit"},{$set:{enabled:!1}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async splitAt(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","object"],"Shard.splitAt"),this._emitShardApiCall("splitAt",{ns:e,query:t}),this._database._runAdminCommand({split:e,middle:t})}async splitFind(e,t){return(0,a.assertArgsDefinedType)([e,t],["string","object"],"Shard.splitFind"),this._emitShardApiCall("splitFind",{ns:e,query:t}),this._database._runAdminCommand({split:e,find:t})}async moveChunk(e,t,r){return(0,a.assertArgsDefinedType)([e,t,r],["string","object","string"],"Shard.moveChunk"),this._emitShardApiCall("moveChunk",{ns:e,query:t,destination:r}),this._database._runAdminCommand({moveChunk:e,find:t,to:r})}async balancerCollectionStatus(e){return(0,a.assertArgsDefinedType)([e],["string"],"Shard.balancerCollectionStatus"),this._emitShardApiCall("balancerCollectionStatus",{ns:e}),this._database._runAdminCommand({balancerCollectionStatus:e})}async enableBalancing(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.enableBalancing"),this._emitShardApiCall("enableBalancing",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{noBalance:!1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async disableBalancing(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.disableBalancing"),this._emitShardApiCall("disableBalancing",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{noBalance:!0}},{writeConcern:{w:"majority",wtimeout:6e4}})}async getBalancerState(){this._emitShardApiCall("getBalancerState",{});const e=await(0,a.getConfigDB)(this._database),t=await e.getCollection("settings").findOne({_id:"balancer"});return null==t||!t.stopped}async isBalancerRunning(){return this._emitShardApiCall("isBalancerRunning",{}),await(0,a.getConfigDB)(this._database),this._database._runAdminCommand({balancerStatus:1})}async startBalancer(e=6e4){return(0,a.assertArgsDefinedType)([e],["number"],"Shard.startBalancer"),this._emitShardApiCall("startBalancer",{timeout:e}),this._database._runAdminCommand({balancerStart:1,maxTimeMS:e})}async stopBalancer(e=6e4){return(0,a.assertArgsDefinedType)([e],["number"],"Shard.stopBalancer"),this._emitShardApiCall("stopBalancer",{timeout:e}),this._database._runAdminCommand({balancerStop:1,maxTimeMS:e})}async setBalancerState(e){return(0,a.assertArgsDefinedType)([e],["boolean"],"Shard.setBalancerState"),this._emitShardApiCall("setBalancerState",{state:e}),e?this.startBalancer():this.stopBalancer()}async getShardedDataDistribution(e={}){var t;this._emitShardApiCall("getShardedDataDistribution",{});const r=await this._database.getSiblingDB("admin").aggregate([{$shardedDataDistribution:e}]);try{await r.hasNext()}catch(e){throw 40324===(null===(t=e.code)||void 0===t?void 0:t.valueOf())&&(e.message=`sh.getShardedDataDistribution only works on mongos and MongoDB server versions greater than 6.0.3 [Original Error: ${e.message}]`),e}return r}async startAutoMerger(){this._emitShardApiCall("startAutoMerger",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"automerge"},{$set:{enabled:!0}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async stopAutoMerger(){this._emitShardApiCall("stopAutoMerger",{});const e=await(0,a.getConfigDB)(this._database);return await e.getCollection("settings").updateOne({_id:"automerge"},{$set:{enabled:!1}},{upsert:!0,writeConcern:{w:"majority",wtimeout:3e4}})}async isAutoMergerEnabled(){this._emitShardApiCall("isAutoMergerEnabled",{});const e=await(0,a.getConfigDB)(this._database),t=await e.getCollection("settings").findOne({_id:"automerge"});return null==t||t.enabled}async disableAutoMerger(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.disableAutoMerger"),this._emitShardApiCall("disableAutoMerger",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$set:{enableAutoMerge:!1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async enableAutoMerger(e){(0,a.assertArgsDefinedType)([e],["string"],"Shard.enableAutoMerger"),this._emitShardApiCall("enableAutoMerger",{ns:e});const t=await(0,a.getConfigDB)(this._database);return await t.getCollection("collections").updateOne({_id:e},{$unset:{enableAutoMerge:1}},{writeConcern:{w:"majority",wtimeout:6e4}})}async checkMetadataConsistency(e={}){return this._emitShardApiCall("checkMetadataConsistency",{options:e}),this._database._runAdminCursorCommand({checkMetadataConsistency:1})}};s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"enableSharding",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"commitReshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"abortReshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"shardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["5.0.0",o.ServerVersions.latest])],u.prototype,"reshardCollection",null),s([n.returnsPromise,(0,n.apiVersions)([1])],u.prototype,"status",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"addShard",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addShardToZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addShardTag",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"updateZoneKeyRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"addTagRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeRangeFromZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeTagRange",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeShardFromZone",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["3.4.0",o.ServerVersions.latest])],u.prototype,"removeShardTag",null),s([n.returnsPromise,(0,n.apiVersions)([1]),(0,n.serverVersions)(["3.4.0","6.0.2"])],u.prototype,"enableAutoSplit",null),s([n.returnsPromise,(0,n.apiVersions)([1]),(0,n.serverVersions)(["3.4.0","6.0.2"])],u.prototype,"disableAutoSplit",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"splitAt",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"splitFind",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"moveChunk",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["4.4.0",o.ServerVersions.latest])],u.prototype,"balancerCollectionStatus",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"enableBalancing",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"disableBalancing",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"getBalancerState",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"isBalancerRunning",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"startBalancer",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"stopBalancer",null),s([n.returnsPromise,(0,n.apiVersions)([])],u.prototype,"setBalancerState",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["6.0.3",o.ServerVersions.latest]),(0,n.returnType)("AggregationCursor")],u.prototype,"getShardedDataDistribution",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"startAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"stopAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"isAutoMergerEnabled",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"disableAutoMerger",null),s([n.returnsPromise,(0,n.apiVersions)([]),(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"enableAutoMerger",null),s([n.returnsPromise,(0,n.serverVersions)(["7.0.0",o.ServerVersions.latest])],u.prototype,"checkMetadataConsistency",null),u=s([n.shellApiClassDefault],u),t.default=u},15826:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(40191),a=r(86930),o=i(r(69483)),l=r(58744),c=r(86901),p=r(67802),u=r(6534),h=r(9461),d=r(21764),f=r(55315),m=r(63873),y=i(r(2416)),g=Symbol.for("@@mongosh.instanceState"),b=Symbol.for("@@mongosh.loadCallNestingLevel");let x=class extends n.ShellApiClass{constructor(e){super(),this._instanceState=e,this.defaults=Object.freeze(new m.ShellUserConfig)}async set(e,t){var r,s;(0,c.assertArgsDefinedType)([e],["string"],"config.set");const{evaluationListener:i}=this._instanceState,n=(await this._allKeys()).includes(e);if(n){const s=await(null===(r=i.validateConfig)||void 0===r?void 0:r.call(i,e,t));if(s)return`Cannot set option "${e}": ${s}`}return"success"!==(n&&await(null===(s=i.setConfig)||void 0===s?void 0:s.call(i,e,t)))?`Option "${e}" is not available in this environment`:`Setting "${e}" has been changed`}async get(e){var t,r;(0,c.assertArgsDefinedType)([e],["string"],"config.get");const{evaluationListener:s}=this._instanceState;return null!==(r=await(null===(t=s.getConfig)||void 0===t?void 0:t.call(s,e)))&&void 0!==r?r:this.defaults[e]}async reset(e){var t;(0,c.assertArgsDefinedType)([e],["string"],"config.reset");const{evaluationListener:r}=this._instanceState;return"success"!==await(null===(t=r.resetConfig)||void 0===t?void 0:t.call(r,e))?`Option "${e}" cannot be changed in this environment`:`Setting "${e}" has been reset to its default value`}async _allKeys(){var e,t;const{evaluationListener:r}=this._instanceState;return null!==(t=await(null===(e=r.listConfigOptions)||void 0===e?void 0:e.call(r)))&&void 0!==t?t:Object.keys(this.defaults)}async[a.asPrintable](){return new Map(await Promise.all((await this._allKeys()).map((async e=>[e,await this.get(e)]))))}};s([n.returnsPromise],x.prototype,"set",null),s([n.returnsPromise],x.prototype,"get",null),s([n.returnsPromise],x.prototype,"reset",null),x=s([n.shellApiClassDefault],x);let v=class extends n.ShellApiClass{constructor(e){super(),this[g]=e,this[b]=0,this.DBQuery=new h.DBQuery(e),this.config=new x(e)}get _instanceState(){return this[g]}get loadCallNestingLevel(){return this[b]}set loadCallNestingLevel(e){this[b]=e}use(e){return this._instanceState.currentDb._mongo.use(e)}async show(e,t){return await this._instanceState.currentDb._mongo.show(e,t)}async exit(e){var t,r;throw(0,c.assertArgsDefinedType)([e],[[void 0,"number"]],"exit"),(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"the exit/quit commands"),await this._instanceState.close(!0),await(null===(r=(t=this._instanceState.evaluationListener).onExit)||void 0===r?void 0:r.call(t,e)),new u.MongoshInternalError(".onExit listener returned")}async quit(e){return await this.exit(e)}async Mongo(e,t,r){(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"new Mongo connections");const s=new o.default(this._instanceState,e,t,r);return await s.connect(),this._instanceState.mongos.push(s),s}async connect(e,t,r){(0,c.assertArgsDefinedType)([e,t,r],["string",[void 0,"string"],[void 0,"string"]],"connect"),(0,c.assertCLI)(this._instanceState.initialServiceProvider.platform,"new Mongo connections");const s=new o.default(this._instanceState,e);await s.connect(t,r),this._instanceState.mongos.push(s);const i=s._serviceProvider.initialDb||p.DEFAULT_DB;return s.getDB(i)}async it(){return this._instanceState.currentCursor?await this._instanceState.currentCursor._it():new l.CursorIterationResult}version(){return r(57518).i8}async load(e){if((0,c.assertArgsDefinedType)([e],["string"],"load"),!this._instanceState.evaluationListener.onLoad)throw new u.MongoshUnimplementedError("load is not currently implemented for this platform",u.CommonErrors.NotImplemented);this._instanceState.messageBus.emit("mongosh:api-load-file",{nested:this.loadCallNestingLevel>0,filename:e});const{resolvedFilename:t,evaluate:r}=await this._instanceState.evaluationListener.onLoad(e),s=this._instanceState.context,i=s.__filename;s.__filename=t,s.__dirname=(0,f.dirname)(t),this.loadCallNestingLevel++;try{await r()}finally{this.loadCallNestingLevel--,i?(s.__filename=i,s.__dirname=(0,f.dirname)(i)):(delete s.__filename,delete s.__dirname)}return!0}async enableTelemetry(){var e,t;if("success"===await(null===(t=(e=this._instanceState.evaluationListener).setConfig)||void 0===t?void 0:t.call(e,"enableTelemetry",!0)))return y.default.__("cli-repl.cli-repl.enabledTelemetry")}async disableTelemetry(){var e,t;if("success"===await(null===(t=(e=this._instanceState.evaluationListener).setConfig)||void 0===t?void 0:t.call(e,"enableTelemetry",!1)))return y.default.__("cli-repl.cli-repl.disabledTelemetry")}async passwordPrompt(){const{evaluationListener:e}=this._instanceState;if(!e.onPrompt)throw new u.MongoshUnimplementedError("passwordPrompt() is not available in this shell",u.CommonErrors.NotImplemented);return await e.onPrompt("Enter password","password")}async sleep(e){return await(0,d.promisify)(setTimeout)(e)}async _print(e,t){var r;const{evaluationListener:s}=this._instanceState,i=await Promise.all(e.map((e=>(0,n.toShellResult)(e))));await(null===(r=s.onPrint)||void 0===r?void 0:r.call(s,i,t))}async print(...e){await this._print(e,"print")}async printjson(...e){await this._print(e,"printjson")}async convertShardKeyToHashed(e){return this._instanceState.currentDb._mongo.convertShardKeyToHashed(e)}async cls(){var e;const{evaluationListener:t}=this._instanceState;await(null===(e=t.onClearCommand)||void 0===e?void 0:e.call(t))}isInteractive(){return this._instanceState.isInteractive}};s([n.directShellCommand,(0,n.shellCommandCompleter)((async function(e,t){var r;if(!(t.length>2))return await e.getDatabaseCompletions(null!==(r=t[1])&&void 0!==r?r:"")}))],v.prototype,"use",null),s([n.directShellCommand,n.returnsPromise,(0,n.shellCommandCompleter)((async function(e,t){if(!(t.length>2))return"d"===t[1]?["databases"]:["databases","dbs","collections","tables","profile","users","roles","log","logs","startupWarnings","automationNotices","nonGenuineMongoDBCheck"].filter((e=>{var r;return e.startsWith(null!==(r=t[1])&&void 0!==r?r:"")}))}))],v.prototype,"show",null),s([n.directShellCommand,n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"exit",null),s([n.directShellCommand,n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"quit",null),s([n.returnsPromise,(0,n.returnType)("Mongo"),(0,n.platforms)(["CLI"])],v.prototype,"Mongo",null),s([n.returnsPromise,(0,n.returnType)("Database"),(0,n.platforms)(["CLI"])],v.prototype,"connect",null),s([n.directShellCommand,n.returnsPromise],v.prototype,"it",null),s([n.returnsPromise],v.prototype,"load",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"enableTelemetry",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"disableTelemetry",null),s([n.returnsPromise,(0,n.platforms)(["CLI"])],v.prototype,"passwordPrompt",null),s([n.returnsPromise],v.prototype,"sleep",null),s([n.returnsPromise],v.prototype,"print",null),s([n.returnsPromise],v.prototype,"printjson",null),s([n.returnsPromise],v.prototype,"convertShardKeyToHashed",null),s([n.directShellCommand,n.returnsPromise],v.prototype,"cls",null),v=s([n.shellApiClassDefault],v),t.default=v},11731:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(86930),n=s(r(55179)),a=r(67802),o=r(6534),l=r(86901),c=r(84770);function p(e){const t=`shell-api.classes.${e}.help`,r={help:`${t}.description`,example:`${t}.example`,docs:`${t}.link`,attr:[]};return new n.default(r)}t.default=function(e,t){void 0===e&&(e=a.bson);const r={};["Binary","Code","DBRef","Decimal128","Double","Int32","Long","MaxKey","MinKey","ObjectId","Timestamp","BSONSymbol","BSONRegExp"].forEach((t=>{if(!(t in e))throw new o.MongoshInternalError(`${t} does not exist in provided BSON package.`);const s=e[t].prototype;s.serverVersions=i.ALL_SERVER_VERSIONS,s.platforms=i.ALL_PLATFORMS,s.topologies=i.ALL_TOPOLOGIES;const n=p(t);r[t]=n,s.help=()=>n,Object.setPrototypeOf(s.help,n)})),e.BSONSymbol.prototype.serverVersions=[i.ServerVersions.earliest,"1.6.0"],e.BSONSymbol.prototype.deprecated=!0;const s={DBRef:(0,l.assignAll)((function(t,r,s,i){return(0,l.assertArgsDefinedType)([t,r,s],["string",!0,[void 0,"string"],[void 0,"object"]],"DBRef"),new e.DBRef(t,r,s,i)}),(0,l.pickWithExactKeyMatch)(e.DBRef,["prototype"])),bsonsize:function(t){return(0,l.assertArgsDefinedType)([t],["object"],"bsonsize"),e.calculateObjectSize(t)},MaxKey:(0,l.assignAll)((function(){return new e.MaxKey}),(0,l.pickWithExactKeyMatch)(e.MaxKey,["prototype"]),{toBSON:()=>new e.MaxKey}),MinKey:(0,l.assignAll)((function(){return new e.MinKey}),(0,l.pickWithExactKeyMatch)(e.MinKey,["prototype"]),{toBSON:()=>new e.MinKey}),ObjectId:(0,l.assignAll)((function(t){return(0,l.assertArgsDefinedType)([t],[[void 0,"string","number","object"]],"ObjectId"),new e.ObjectId(t)}),(0,l.pickWithExactKeyMatch)(e.ObjectId,["prototype","cacheHexString","generate","createFromTime","createFromHexString","createFromBase64","isValid"])),Timestamp:(0,l.assignAll)((function(t,r){return(0,l.assertArgsDefinedType)([t,r],[["number","object",void 0],[void 0,"number"]],"Timestamp"),"object"==typeof t&&null!==t&&"t"in t&&"i"in t?new e.Timestamp(t):void 0!==r||"number"==typeof t?new e.Timestamp({t,i:null!=r?r:0}):new e.Timestamp(t)}),(0,l.pickWithExactKeyMatch)(e.Timestamp,["prototype","fromInt","fromNumber","fromBits","fromString","MAX_VALUE"])),Code:(0,l.assignAll)((function(t="",r){return(0,l.assertArgsDefinedType)([t,r],[[void 0,"string","function"],[void 0,"object"]],"Code"),new e.Code(t,r)}),(0,l.pickWithExactKeyMatch)(e.Code,["prototype"])),NumberDecimal:(0,l.assignAll)((function(r="0"){return(0,l.assertArgsDefinedType)([r],[["string","number","bson:Long","bson:Int32","bson:Decimal128"]],"NumberDecimal"),"number"==typeof r&&t("NumberDecimal: specifying a number as argument is deprecated and may lead to loss of precision, pass a string instead"),e.Decimal128.fromString(`${r}`)}),{prototype:e.Decimal128.prototype}),NumberInt:(0,l.assignAll)((function(t="0"){return null!=t||(t="0"),(0,l.assertArgsDefinedType)([t],[["string","number","bson:Long","bson:Int32"]],"NumberInt"),new e.Int32(parseInt(`${t}`,10))}),{prototype:e.Int32.prototype}),NumberLong:(0,l.assignAll)((function(r="0"){return null!=r||(r="0"),(0,l.assertArgsDefinedType)([r],[["string","number","bson:Long","bson:Int32"]],"NumberLong"),"number"==typeof r?(t("NumberLong: specifying a number as argument is deprecated and may lead to loss of precision, pass a string instead"),e.Long.fromNumber(r)):e.Long.fromString(`${r}`)}),{prototype:e.Long.prototype}),ISODate:function(e){e||(e=(new Date).toISOString());const t=/^(?<Y>\d{4})-?(?<M>\d{2})-?(?<D>\d{2})([T ](?<h>\d{2})(:?(?<m>\d{2})(:?((?<s>\d{2})(\.(?<ms>\d+))?))?)?(?<tz>Z|([+-])(\d{2}):?(\d{2})?)?)?$/.exec(e);if(null!==t&&void 0!==t.groups){const{Y:e,M:r,D:s,h:i,m:n,s:a,ms:o,tz:l}=t.groups,c=new Date(`${e}-${r}-${s}T${i||"00"}:${n||"00"}:${a||"00"}.${o||"000"}${l||"Z"}`);if(c.getTime()>=-621672192e5&&c.getTime()<=0xe677d21fdbff)return c}throw new o.MongoshInvalidInputError(`${JSON.stringify(e)} is not a valid ISODate`,o.CommonErrors.InvalidArgument)},BinData:(0,l.assignAll)((function(t,r){(0,l.assertArgsDefinedType)([t,r],["number","string"],"BinData");const s=Buffer.from(r,"base64");return new e.Binary(s,t)}),{prototype:e.Binary.prototype}),HexData:(0,l.assignAll)((function(t,r){(0,l.assertArgsDefinedType)([t,r],["number","string"],"HexData");const s=Buffer.from(r,"hex");return new e.Binary(s,t)}),{prototype:e.Binary.prototype}),UUID:(0,l.assignAll)((function(t){if(void 0===t){const e=(0,c.randomBytes)(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128,t=e.toString("hex")}(0,l.assertArgsDefinedType)([t],["string"],"UUID");const r=Buffer.from(t.replace(/-/g,""),"hex");return new e.Binary(r,e.Binary.SUBTYPE_UUID)}),{prototype:e.Binary.prototype}),MD5:(0,l.assignAll)((function(t){(0,l.assertArgsDefinedType)([t],["string"],"MD5");const r=Buffer.from(t,"hex");return new e.Binary(r,e.Binary.SUBTYPE_MD5)}),{prototype:e.Binary.prototype}),Decimal128:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Decimal128),(0,l.pickWithExactKeyMatch)(e.Decimal128,["prototype","fromString"])),BSONSymbol:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.BSONSymbol),(0,l.pickWithExactKeyMatch)(e.BSONSymbol,["prototype"])),Int32:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Int32),(0,l.pickWithExactKeyMatch)(e.Int32,["prototype"])),Long:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Long),(0,l.pickWithExactKeyMatch)(e.Long,["prototype","fromValue","isLong","fromBytesBE","fromBytesLE","fromBytes","fromString","fromBigInt","fromNumber","fromInt","fromBits","MIN_VALUE","MAX_VALUE","NEG_ONE","UONE","ONE","UZERO","ZERO","MAX_UNSIGNED_VALUE","TWO_PWR_24"])),Binary:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Binary),(0,l.pickWithExactKeyMatch)(e.Binary,["prototype","createFromBase64","createFromHexString","BUFFER_SIZE","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_ENCRYPTED","SUBTYPE_COLUMN","SUBTYPE_USER_DEFINED"])),Double:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.Double),(0,l.pickWithExactKeyMatch)(e.Double,["prototype"])),BSONRegExp:(0,l.assignAll)((0,l.functionCtorWithoutProps)(e.BSONRegExp),(0,l.pickWithExactKeyMatch)(e.BSONRegExp,["prototype","parseOptions"])),EJSON:(0,l.pickWithExactKeyMatch)(e.EJSON,["parse","serialize","stringify","deserialize"])};for(const e of Object.keys(s)){const t=r[e]||p(e);s[e].help=()=>t,Object.setPrototypeOf(s[e].help,t)}return s}},75794:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(6534),n=r(67802),a=r(17702),o=s(r(5051)),l=r(40191),c=r(86930),p=r(73041),u=r(46993),h=r(38961),d=r(72292),f=s(r(51238)),m=s(r(11731)),y=r(32261);t.default=class{constructor(e,t=new a.EventEmitter,r={}){if(this.displayBatchSizeFromDBQuery=void 0,this.isInteractive=!1,this.apiCallDepth=0,this.warningsShown=new Set,this.interrupted=new h.InterruptFlag,this.plugins=[new d.TransformMongoErrorPlugin],this.alreadyTransformedErrors=new WeakMap,this.initialServiceProvider=e,this.messageBus=t,this.shellApi=new u.ShellApi(this),this.shellBson=(0,m.default)(e.bsonLibrary,(e=>{this.shellApi.print(`Warning: ${e}`)})),this.mongos=[],this.connectionInfo={buildInfo:{}},r.nodb)this.currentDb=new f.default;else{const t=new u.Mongo(this,void 0,void 0,void 0,e);this.mongos.push(t),this.currentDb=t.getDB(e.initialDb||n.DEFAULT_DB)}this.currentCursor=null,this.context={},this.cliOptions=r,this.evaluationListener={}}async fetchConnectionInfo(){if(!this.cliOptions.nodb){this.connectionInfo=await this.currentServiceProvider.getConnectionInfo();const e=this.apiVersionInfo();this.messageBus.emit("mongosh:connect",{...this.connectionInfo.extraInfo,api_version:null==e?void 0:e.version,api_strict:null==e?void 0:e.strict,api_deprecation_errors:null==e?void 0:e.deprecationErrors,uri:(0,o.default)(this.connectionInfo.extraInfo.uri)})}}async close(e){for(const t of[...this.mongos])await t.close(e)}setDbFunc(e){return this.currentDb=e,this.context.rs=new u.ReplicaSet(this.currentDb),this.context.sh=new u.Shard(this.currentDb),this.context.sp=y.Streams.newInstance(this.currentDb),this.fetchConnectionInfo().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentDb._getCollectionNamesForCompletion().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentDb._mongo._getDatabaseNamesForCompletion().catch((e=>this.messageBus.emit("mongosh:error",e,"shell-api"))),this.currentCursor=null,e}setCtx(e){this.context=e,Object.assign(e,this.shellApi);for(const t of Object.getOwnPropertyNames(u.ShellApi.prototype)){const{shellApi:r}=this;l.toIgnore.concat(["help"]).includes(t)||"function"!=typeof r[t]||(e[t]=function(...e){return r[t](...e)},e[t].help=r[t].help)}e.help=this.shellApi.help,Object.assign(e,this.shellBson),void 0===e.console&&(e.console={});for(const t of["log","warn","info","error"])e.console[t]=(...t)=>e.print(...t);e.console.clear=e.cls,e.rs=new u.ReplicaSet(this.currentDb),e.sh=new u.Shard(this.currentDb),e.sp=y.Streams.newInstance(this.currentDb);"JavaShell"===this.initialServiceProvider.platform?e.db=this.setDbFunc(this.currentDb):Object.defineProperty(e,"db",{configurable:!0,set:e=>{if("Database"!==(0,u.getShellApiType)(e))throw new i.MongoshInvalidInputError("Cannot reassign 'db' to non-Database type",i.CommonErrors.InvalidOperation);return this.setDbFunc(e)},get:()=>this.currentDb}),this.messageBus.emit("mongosh:setCtx",{method:"setCtx",arguments:{}})}get currentServiceProvider(){try{return this.currentDb._mongo._serviceProvider}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected)return this.initialServiceProvider;throw e}}emitApiCallWithArgs(e){this.messageBus.emit("mongosh:api-call-with-arguments",e)}emitApiCall(e){this.messageBus.emit("mongosh:api-call",{...e,callDepth:this.apiCallDepth})}setEvaluationListener(e){this.evaluationListener=e}getAutocompleteParameters(){return{topology:()=>{var e;let t;const r=null===(e=this.currentServiceProvider.getTopology())||void 0===e?void 0:e.description;switch(null==r?void 0:r.type){case"ReplicaSetNoPrimary":case"ReplicaSetWithPrimary":t=c.Topologies.ReplSet;break;case"Sharded":t=c.Topologies.Sharded;break;case"LoadBalanced":t=c.Topologies.LoadBalanced;break;default:if(t=c.Topologies.Standalone,1===r.servers.size){const[e]=r.servers.values();switch(e.type){case"Mongos":t=c.Topologies.Sharded;break;case"PossiblePrimary":case"RSPrimary":case"RSSecondary":case"RSArbiter":case"RSOther":case"RSGhost":t=c.Topologies.ReplSet}}}return t},apiVersionInfo:()=>this.apiVersionInfo(),connectionInfo:()=>this.connectionInfo.extraInfo,getCollectionCompletionsForCurrentDb:async e=>{try{return(await this.currentDb._getCollectionNamesForCompletion()).filter((t=>t.toLowerCase().startsWith(e.toLowerCase())))}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected||"Unauthorized"===(null==e?void 0:e.codeName))return[];throw e}},getDatabaseCompletions:async e=>{try{return(await this.currentDb._mongo._getDatabaseNamesForCompletion()).filter((t=>t.toLowerCase().startsWith(e.toLowerCase())))}catch(e){if((null==e?void 0:e.code)===p.ShellApiErrors.NotConnected||"Unauthorized"===(null==e?void 0:e.codeName))return[];throw e}}}}apiVersionInfo(){var e,t;const{serverApi:r}=null!==(t=null===(e=this.currentServiceProvider.getRawClient())||void 0===e?void 0:e.options)&&void 0!==t?t:{};return(null==r?void 0:r.version)?{strict:!1,deprecationErrors:!1,...r}:void 0}async onInterruptExecution(){return await this.interrupted.set(),this.currentCursor=null,this.resumeMongosAfterInterrupt=await Promise.all(this.mongos.map((async e=>{try{return{mongo:e,resume:await e._suspend()}}catch(t){return{mongo:e,resume:null}}}))),!this.resumeMongosAfterInterrupt.find((e=>null===e.resume))}async onResumeExecution(){var e,t;const r=null!==(t=null===(e=this.resumeMongosAfterInterrupt)||void 0===e?void 0:e.map((async e=>{if(!this.mongos.find((t=>t===e.mongo)))return!0;if(null===e.resume)return!1;try{return await e.resume(),!0}catch(e){return!1}})))&&void 0!==t?t:[];this.resumeMongosAfterInterrupt=void 0;const s=await Promise.all(r);return this.interrupted.reset(),!s.find((e=>!1===e))}async getDefaultPrompt(){var e,t;if(null===(t=null===(e=this.connectionInfo)||void 0===e?void 0:e.extraInfo)||void 0===t?void 0:t.is_stream)return"AtlasStreamProcessing> ";const r=this.getDefaultPromptPrefix(),s=this.getTopologySpecificPrompt();let i="";try{i=this.currentDb.getName()}catch(e){}return`${[r,s,i].filter(Boolean).join(" ")}> `}getDefaultPromptPrefix(){var e,t,r,s;const i=null===(e=this.connectionInfo)||void 0===e?void 0:e.extraInfo;return(null==i?void 0:i.is_data_federation)?"AtlasDataFederation":(null==i?void 0:i.is_local_atlas)?"AtlasLocalDev":(null==i?void 0:i.is_atlas)?"Atlas":(null==i?void 0:i.is_enterprise)||(null===(s=null===(r=null===(t=this.connectionInfo)||void 0===t?void 0:t.buildInfo)||void 0===r?void 0:r.modules)||void 0===s?void 0:s.indexOf("enterprise"))>=0?"Enterprise":""}getTopologySpecificPrompt(){var e,t,r,s;const i=null===(e=this.currentServiceProvider.getTopology())||void 0===e?void 0:e.description;if(!i)return"";let n=i.setName,a="";switch(i.type){case"Single":const e=this.getTopologySinglePrompt(i);n=null!==(t=null==e?void 0:e.replicaSet)&&void 0!==t?t:n,a=(null==e?void 0:e.serverType)?`[direct: ${e.serverType}]`:"";break;case"ReplicaSetNoPrimary":a="[secondary]";break;case"ReplicaSetWithPrimary":a="[primary]";break;case"Sharded":a=(null===(s=null===(r=this.connectionInfo)||void 0===r?void 0:r.extraInfo)||void 0===s?void 0:s.atlas_version)?"":"[mongos]";break;default:return""}return`${n?`${n} `:""}${a}`}getTopologySinglePrompt(e){var t;if(1!==(null===(t=e.servers)||void 0===t?void 0:t.size))return;const[r]=e.servers.values();let s;switch(r.type){case"Mongos":s="mongos";break;case"RSPrimary":s="primary";break;case"RSSecondary":s="secondary";break;case"RSArbiter":s="arbiter";break;case"RSOther":s="other";break;default:s=""}return{replicaSet:r.setName,serverType:s}}registerPlugin(e){this.plugins.push(e)}transformError(e){if("[object Error]"===Object.prototype.toString.call(e)){if(this.alreadyTransformedErrors.has(e))return this.alreadyTransformedErrors.get(e);const t=e;for(const t of this.plugins)t.transformError&&(e=t.transformError(e));this.alreadyTransformedErrors.set(t,e)}return e}async printDeprecationWarning(e){this.warningsShown.has(e)||(this.warningsShown.add(e),this.context.print?await this.context.print.call(this.shellApi,`DeprecationWarning: ${e}`):await this.shellApi.print(`DeprecationWarning: ${e}`))}async printWarning(e){this.warningsShown.has(e)||(this.warningsShown.add(e),this.context.print?await this.context.print.call(this.shellApi,`Warning: ${e}`):await this.shellApi.print(`Warning: ${e}`))}}},53278:function(e,t,r){"use strict";var s=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=r(86930),n=r(40191);let a=class extends n.ShellApiWithMongoClass{constructor(e,t){super(),this._streams=e,this.name=t}get _mongo(){return this._streams._mongo}[i.asPrintable](){return`Atlas Stream Processor: ${this.name}`}async start(){return await this._streams._runStreamCommand({startStreamProcessor:this.name})}async stop(){return await this._streams._runStreamCommand({stopStreamProcessor:this.name})}async drop(){return this._drop()}async _drop(){return await this._streams._runStreamCommand({dropStreamProcessor:this.name})}async stats(e={}){return this._streams._runStreamCommand({getStreamProcessorStats:this.name,...e})}async sample(e={}){const t=await this._streams._runStreamCommand({startSampleStreamProcessor:this.name,...e});return 1!==t.ok?t:this._sampleFrom(t.cursorId)}async _sampleFrom(e){let t=e;for(;"0"!==String(t);){const e=await this._streams._runStreamCommand({getMoreSampleStreamProcessor:this.name,cursorId:t});if(1!==e.ok)return e;t=e.cursorId;for(const t of e.messages)await this._instanceState.shellApi.printjson(t);if(!e.messages.length){const e=this._instanceState.interrupted.asPromise();try{await Promise.race([this._instanceState.shellApi.sleep(1e3),e.promise])}finally{e.destroy()}}}}};s([n.returnsPromise],a.prototype,"start",null),s([n.returnsPromise],a.prototype,"stop",null),s([n.returnsPromise],a.prototype,"drop",null),s([n.returnsPromise],a.prototype,"stats",null),s([n.returnsPromise],a.prototype,"sample",null),a=s([n.shellApiClassDefault],a),t.default=a},32261:function(e,t,r){"use strict";var s,i=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Streams=void 0;const a=r(6534),o=r(40191),l=n(r(53278)),c=r(86930);let p=t.Streams=s=class extends o.ShellApiWithMongoClass{static newInstance(e){return new Proxy(new s(e),{get(e,t){const r=e[t];return void 0!==r?r:"string"!=typeof t||t.startsWith("_")?void 0:e.getProcessor(t)}})}constructor(e){super(),this._database=e}get _mongo(){return this._database._mongo}[c.asPrintable](){return"Atlas Stream Processing"}getProcessor(e){return new l.default(this,e)}async process(e,t){if(!Array.isArray(e)||!e.length)throw new a.MongoshInvalidInputError("Invalid pipeline",a.CommonErrors.InvalidArgument,e);const r=await this._runStreamCommand({processStreamProcessor:e,...t?{options:t}:{}});if(1!==r.ok)return r;const{name:s,cursorId:i}=r,n=this.getProcessor(s);async function o(){try{await n._drop()}catch(e){}}return await this._instanceState.interrupted.withOverrideInterruptBehavior((()=>n._sampleFrom(i)),o),o()}async createStreamProcessor(e,t,r){if("string"!=typeof e||""===e.trim())throw new a.MongoshInvalidInputError(`Invalid processor name: ${e}`,a.CommonErrors.InvalidArgument);if(!Array.isArray(t)||!t.length)throw new a.MongoshInvalidInputError("Invalid pipeline",a.CommonErrors.InvalidArgument,t);const s=await this._runStreamCommand({createStreamProcessor:e,pipeline:t,...r?{options:r}:{}});return 1!==s.ok?s:this.getProcessor(e)}async listStreamProcessors(e){const t=await this._runStreamCommand({listStreamProcessors:1,filter:e});if(1!==t.ok)return t;const r=t.streamProcessors,s=r.map((e=>this.getProcessor(e.name)));return Object.defineProperties(s,{[c.asPrintable]:{value:()=>r},[c.shellApiType]:{value:"StreamsListResult"}})}async listConnections(e){const t=await this._runStreamCommand({listStreamConnections:1,filter:e});return 1!==t.ok?t:Object.defineProperties(t.connections,{[c.shellApiType]:{value:"StreamsListResult"}})}async _runStreamCommand(e,t={}){return this._mongo._serviceProvider.runCommand(c.ADMIN_DB,e,t)}};i([o.returnsPromise],p.prototype,"process",null),i([o.returnsPromise],p.prototype,"createStreamProcessor",null),i([o.returnsPromise],p.prototype,"listStreamProcessors",null),i([o.returnsPromise],p.prototype,"listConnections",null),t.Streams=p=s=i([o.shellApiClassDefault],p)},1136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellEvaluator=void 0;const s=r(60890);Object.defineProperty(t,"ShellEvaluator",{enumerable:!0,get:function(){return s.ShellEvaluator}}),t.default=s.ShellEvaluator},60890:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShellEvaluator=void 0;const shell_api_1=__webpack_require__(46993),async_rewriter2_1=__importDefault(__webpack_require__(671)),history_1=__webpack_require__(46177);class ShellEvaluator{constructor(e,t=shell_api_1.toShellResult){this.hasAppliedAsyncWriterRuntimeSupport=!0,this.instanceState=e,this.resultHandler=t,this.asyncWriter=new async_rewriter2_1.default,this.hasAppliedAsyncWriterRuntimeSupport=!1}async innerEval(originalEval,input,context,filename){var _a,_b,_c,_d,_e;const{shellApi}=this.instanceState,trimmedInput=input.trim(),argv=trimmedInput.replace(/;$/,"").split(/\s+/g),cmd=argv.shift();if((null===(_a=shellApi[cmd])||void 0===_a?void 0:_a.isDirectShellCommand)&&(null===(_b=shellApi[cmd])||void 0===_b?void 0:_b.acceptsRawInput)&&!(null!==(_c=argv[0])&&void 0!==_c?_c:"").startsWith("(")){const e=trimmedInput.replace(/^\S+\s*/,"");return shellApi[cmd](e)}if((null===(_d=shellApi[cmd])||void 0===_d?void 0:_d.isDirectShellCommand)&&!(null!==(_e=argv[0])&&void 0!==_e?_e:"").startsWith("("))return shellApi[cmd](...argv);let rewrittenInput=this.asyncWriter.process(input);const hiddenCommands=RegExp(history_1.HIDDEN_COMMANDS,"g");if(hiddenCommands.test(input)||hiddenCommands.test(rewrittenInput)||this.instanceState.messageBus.emit("mongosh:evaluate-input",{input:(0,history_1.redactSensitiveData)(trimmedInput)}),!this.hasAppliedAsyncWriterRuntimeSupport){this.hasAppliedAsyncWriterRuntimeSupport=!0;const supportCode=this.asyncWriter.runtimeSupportCode();eval(supportCode),rewrittenInput=supportCode+";\n"+rewrittenInput}try{return await originalEval(rewrittenInput,context,filename)}catch(e){throw this.instanceState.transformError(e)}}async customEval(e,t,r,s){const i=await this.innerEval(e,t,r,s);return await this.resultHandler(i)}}exports.ShellEvaluator=ShellEvaluator},63873:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CliUserConfigValidator=t.CliUserConfig=t.SnippetShellUserConfigValidator=t.SnippetShellUserConfig=t.ShellUserConfigValidator=t.ShellUserConfig=void 0;class r{constructor(){this.displayBatchSize=20,this.maxTimeMS=null,this.enableTelemetry=!1,this.editor=null}}t.ShellUserConfig=r;class s{static async validate(e,t){switch(e){case"displayBatchSize":return"number"!=typeof t||t<=0?`${e} must be a positive integer`:null;case"maxTimeMS":return null!==t&&("number"!=typeof t||t<=0)?`${e} must be null or a positive integer`:null;case"enableTelemetry":return"boolean"!=typeof t?`${e} must be a boolean`:null;case"editor":return"string"!=typeof t&&null!==t?`${e} must be a string or null`:null;default:return`${e} is not a known config option`}}}t.ShellUserConfigValidator=s;class i extends r{constructor(){super(...arguments),this.snippetIndexSourceURLs="https://compass.mongodb.com/mongosh/snippets-index.bson.br",this.snippetRegistryURL="https://registry.npmjs.org",this.snippetAutoload=!0}}t.SnippetShellUserConfig=i;class n extends s{static async validate(e,t){switch(e){case"snippetIndexSourceURLs":return"string"!=typeof t||t.split(";").some((e=>e&&!a(e)))?`${e} must be a ;-separated list of valid URLs`:null;case"snippetRegistryURL":return"string"==typeof t&&a(t)?null:`${e} must be a valid URL`;case"snippetAutoload":return"boolean"!=typeof t?`${e} must be a boolean`:null;default:return super.validate(e,t)}}}function a(e){if("function"==typeof URL)try{return new URL(e),!0}catch(e){return!1}return!0}t.SnippetShellUserConfigValidator=n,t.CliUserConfig=class extends i{constructor(){super(...arguments),this.userId="",this.telemetryAnonymousId="",this.disableGreetingMessage=!1,this.forceDisableTelemetry=!1,this.inspectCompact=3,this.inspectDepth=6,this.historyLength=1e3,this.showStackTraces=!1,this.redactHistory="remove",this.oidcRedirectURI=void 0,this.oidcTrustedEndpoints=void 0,this.browser=void 0,this.updateURL="https://downloads.mongodb.com/compass/mongosh.json"}},t.CliUserConfigValidator=class extends n{static async validate(e,t){switch(e){case"userId":case"telemetryAnonymousId":case"disableGreetingMessage":return null;case"inspectCompact":return"boolean"!=typeof t&&("number"!=typeof t||t<0)?`${e} must be a boolean or a positive integer`:null;case"inspectDepth":case"historyLength":return"number"!=typeof t||t<0?`${e} must be a positive integer`:null;case"forceDisableTelemetry":case"showStackTraces":return"boolean"!=typeof t?`${e} must be a boolean`:null;case"redactHistory":return"keep"!==t&&"remove"!==t&&"remove-redact"!==t?`${e} must be one of 'keep', 'remove', or 'remove-redact'`:null;case"oidcRedirectURI":return void 0===t||"string"==typeof t&&a(t)?null:`${e} must be undefined or a valid URL`;case"oidcTrustedEndpoints":return void 0===t||Array.isArray(t)&&!t.some((e=>"string"!=typeof e))?null:`${e} must be undefined or an array of hostnames`;case"browser":return void 0!==t&&!1!==t&&"string"!=typeof t?`${e} must be undefined, false, or a command string`:null;case"updateURL":return"string"!=typeof t||t.trim()&&!a(t)?`${e} must be a valid URL or empty`:null;default:return super.validate(e,t)}}}},97143:(e,t,r)=>{"use strict";var s=r(92048),i=r(55315),n=r(48858);function a(e,r){var a;(r=r||{}).isFileComment&&(e=function(e,r){var n=t.mapFileCommentRegex.exec(e),a=n[1]||n[2],o=i.resolve(r,a);try{return s.readFileSync(o,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+o+"\n"+e)}}(e,r.commentFileDir)),r.hasComment&&(e=function(e){return e.split(",").pop()}(e)),r.isEncoded&&(a=e,e=(n.Buffer.from(a,"base64")||"").toString()),(r.isJSON||r.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}Object.defineProperty(t,"commentRegex",{get:function(){return/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/gm}}),Object.defineProperty(t,"mapFileCommentRegex",{get:function(){return/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm}}),a.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},a.prototype.toBase64=function(){var e=this.toJSON();return(n.Buffer.from(e,"utf8")||"").toString("base64")},a.prototype.toComment=function(e){var t="sourceMappingURL=data:application/json;charset=utf-8;base64,"+this.toBase64();return e&&e.multiline?"/*# "+t+" */":"//# "+t},a.prototype.toObject=function(){return JSON.parse(this.toJSON())},a.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error('property "'+e+'" already exists on the sourcemap, use set property instead');return this.setProperty(e,t)},a.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},a.prototype.getProperty=function(e){return this.sourcemap[e]},t.fromObject=function(e){return new a(e)},t.fromJSON=function(e){return new a(e,{isJSON:!0})},t.fromBase64=function(e){return new a(e,{isEncoded:!0})},t.fromComment=function(e){return new a(e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),{isEncoded:!0,hasComment:!0})},t.fromMapFileComment=function(e,t){return new a(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},t.fromSource=function(e){var r=e.match(t.commentRegex);return r?t.fromComment(r.pop()):null},t.fromMapFileSource=function(e,r){var s=e.match(t.mapFileCommentRegex);return s?t.fromMapFileComment(s.pop(),r):null},t.removeComments=function(e){return e.replace(t.commentRegex,"")},t.removeMapFileComments=function(e){return e.replace(t.mapFileCommentRegex,"")},t.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}},48858:(e,t,r)=>{var s=r(78893),i=s.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=s:(n(s,t),t.Buffer=a),n(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var s=i(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s.SlowBuffer(e)}},25130:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(s++,"%c"===e&&(i=s))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(87123)(t);const{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},87123:(e,t,r)=>{e.exports=function(e){function t(e){let r,i=null;function n(...e){if(!n.enabled)return;const s=n,i=Number(new Date),a=i-(r||i);s.diff=a,s.prev=r,s.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";o++;const n=t.formatters[i];if("function"==typeof n){const t=e[o];r=n.call(s,t),e.splice(o,1),o--}return r})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return n.namespace=e,n.useColors=t.useColors(),n.color=t.selectColor(e),n.extend=s,n.destroy=t.destroy,Object.defineProperty(n,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(n),n}function s(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),i=s.length;for(r=0;r<i;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,s;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(11378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},48102:e=>{"use strict";var t=/[|\\{}()[\]^$+*?.]/g;e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(t,"\\$&")}},43291:e=>{"use strict";const t=Symbol.for("gensync:v1:start"),r=Symbol.for("gensync:v1:suspend"),s="GENSYNC_EXPECTED_START",i="GENSYNC_EXPECTED_SUSPEND",n="GENSYNC_OPTIONS_ERROR",a="GENSYNC_RACE_NONEMPTY";function o(e,t,r,s){if(typeof r===e||s&&void 0===r)return;let i;throw i=s?`Expected opts.${t} to be either a ${e}, or undefined.`:`Expected opts.${t} to be a ${e}.`,l(i,n)}function l(e,t){return Object.assign(new Error(e),{code:t})}function c({name:e,arity:s,sync:i,async:n}){return m(e,s,(function*(...e){const s=yield t;if(!s)return i.call(this,e);let a;try{n.call(this,e,(e=>{a||(a={value:e},s())}),(e=>{a||(a={err:e},s())}))}catch(e){a={err:e},s()}if(yield r,a.hasOwnProperty("err"))throw a.err;return a.value}))}function p(e){let t;for(;!({value:t}=e.next()).done;)h(t,e);return t}function u(e,t,r){!function s(){try{let r;for(;!({value:r}=e.next()).done;){h(r,e);let t=!0,i=!1;const n=e.next((()=>{t?i=!0:s()}));if(t=!1,d(n,e),!i)return}return t(r)}catch(e){return r(e)}}()}function h(e,r){e!==t&&f(r,l(`Got unexpected yielded value in gensync generator: ${JSON.stringify(e)}. Did you perhaps mean to use 'yield*' instead of 'yield'?`,s))}function d({value:e,done:t},s){(t||e!==r)&&f(s,l(t?"Unexpected generator completion. If you get this, it is probably a gensync bug.":`Expected GENSYNC_SUSPEND, got ${JSON.stringify(e)}. If you get this, it is probably a gensync bug.`,i))}function f(e,t){throw e.throw&&e.throw(t),t}function m(e,t,r){if("string"==typeof e){const t=Object.getOwnPropertyDescriptor(r,"name");t&&!t.configurable||Object.defineProperty(r,"name",Object.assign(t||{},{configurable:!0,value:e}))}if("number"==typeof t){const e=Object.getOwnPropertyDescriptor(r,"length");e&&!e.configurable||Object.defineProperty(r,"length",Object.assign(e||{},{configurable:!0,value:t}))}return r}e.exports=Object.assign((function(e){let t=e;return t="function"!=typeof e?function({name:e,arity:t,sync:r,async:s,errback:i}){if(o("string","name",e,!0),o("number","arity",t,!0),o("function","sync",r),o("function","async",s,!0),o("function","errback",i,!0),s&&i)throw l("Expected one of either opts.async or opts.errback, but got _both_.",n);if("string"!=typeof e){let t;i&&i.name&&"errback"!==i.name&&(t=i.name),s&&s.name&&"async"!==s.name&&(t=s.name.replace(/Async$/,"")),r&&r.name&&"sync"!==r.name&&(t=r.name.replace(/Sync$/,"")),"string"==typeof t&&(e=t)}return"number"!=typeof t&&(t=r.length),c({name:e,arity:t,sync:function(e){return r.apply(this,e)},async:function(e,t,n){s?s.apply(this,e).then(t,n):i?i.call(this,...e,((e,r)=>{null==e?t(r):n(e)})):t(r.apply(this,e))}})}(e):function(e){return m(e.name,e.length,(function(...t){return e.apply(this,t)}))}(e),Object.assign(t,function(e){return{sync:function(...t){return p(e.apply(this,t))},async:function(...t){return new Promise(((r,s)=>{u(e.apply(this,t),r,s)}))},errback:function(...t){const r=t.pop();if("function"!=typeof r)throw l("Asynchronous function called without callback","GENSYNC_ERRBACK_NO_CALLBACK");let s;try{s=e.apply(this,t)}catch(e){return void r(e)}u(s,(e=>r(void 0,e)),(e=>r(e)))}}}(t))}),{all:c({name:"all",arity:1,sync:function(e){return Array.from(e[0]).map((e=>p(e)))},async:function(e,t,r){const s=Array.from(e[0]);if(0===s.length)return void Promise.resolve().then((()=>t([])));let i=0;const n=s.map((()=>{}));s.forEach(((e,s)=>{u(e,(e=>{n[s]=e,i+=1,i===n.length&&t(n)}),r)}))}}),race:c({name:"race",arity:1,sync:function(e){const t=Array.from(e[0]);if(0===t.length)throw l("Must race at least 1 item",a);return p(t[0])},async:function(e,t,r){const s=Array.from(e[0]);if(0===s.length)throw l("Must race at least 1 item",a);for(const e of s)u(e,t,r)}})})},84904:(e,t,r)=>{"use strict";e.exports=r(10964)},39520:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:void 0};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},94669:e=>{"use strict";const t={},r=t.hasOwnProperty,s=(e,t)=>{for(const s in e)r.call(e,s)&&t(s,e[s])},i=t.toString,n=Array.isArray,a=Buffer.isBuffer,o={'"':'\\"',"'":"\\'","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},l=/["'\\\b\f\n\r\t]/,c=/[0-9]/,p=/[ !#-&\(-\[\]-_a-~]/,u=(e,t)=>{const r=()=>{v=x,++t.indentLevel,x=t.indent.repeat(t.indentLevel)},h={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",indentLevel:0,__inline1__:!1,__inline2__:!1},d=t&&t.json;var f,m;d&&(h.quotes="double",h.wrap=!0),f=h,t=(m=t)?(s(m,((e,t)=>{f[e]=t})),f):f,"single"!=t.quotes&&"double"!=t.quotes&&"backtick"!=t.quotes&&(t.quotes="single");const y="double"==t.quotes?'"':"backtick"==t.quotes?"`":"'",g=t.compact,b=t.lowercaseHex;let x=t.indent.repeat(t.indentLevel),v="";const E=t.__inline1__,P=t.__inline2__,T=g?"":"\n";let S,A=!0;const w="binary"==t.numbers,C="octal"==t.numbers,I="decimal"==t.numbers,_="hexadecimal"==t.numbers;if(d&&e&&"function"==typeof e.toJSON&&(e=e.toJSON()),"string"!=typeof(k=e)&&"[object String]"!=i.call(k)){if((e=>"[object Map]"==i.call(e))(e))return 0==e.size?"new Map()":(g||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+u(Array.from(e),t)+")");if((e=>"[object Set]"==i.call(e))(e))return 0==e.size?"new Set()":"new Set("+u(Array.from(e),t)+")";if(a(e))return 0==e.length?"Buffer.from([])":"Buffer.from("+u(Array.from(e),t)+")";if(n(e))return S=[],t.wrap=!0,E&&(t.__inline1__=!1,t.__inline2__=!0),P||r(),((e,t)=>{const r=e.length;let s=-1;for(;++s<r;)t(e[s])})(e,(e=>{A=!1,P&&(t.__inline2__=!1),S.push((g||P?"":x)+u(e,t))})),A?"[]":P?"["+S.join(", ")+"]":"["+T+S.join(","+T)+T+(g?"":v)+"]";if(!(e=>"number"==typeof e||"[object Number]"==i.call(e))(e))return(e=>"[object Object]"==i.call(e))(e)?(S=[],t.wrap=!0,r(),s(e,((e,r)=>{A=!1,S.push((g?"":x)+u(e,t)+":"+(g?"":" ")+u(r,t))})),A?"{}":"{"+T+S.join(","+T)+T+(g?"":v)+"}"):d?JSON.stringify(e)||"null":String(e);if(d)return JSON.stringify(e);if(I)return String(e);if(_){let t=e.toString(16);return b||(t=t.toUpperCase()),"0x"+t}if(w)return"0b"+e.toString(2);if(C)return"0o"+e.toString(8)}var k;const N=e;let O=-1;const D=N.length;for(S="";++O<D;){const e=N.charAt(O);if(t.es6){const e=N.charCodeAt(O);if(e>=55296&&e<=56319&&D>O+1){const t=N.charCodeAt(O+1);if(t>=56320&&t<=57343){let r=(1024*(e-55296)+t-56320+65536).toString(16);b||(r=r.toUpperCase()),S+="\\u{"+r+"}",++O;continue}}}if(!t.escapeEverything){if(p.test(e)){S+=e;continue}if('"'==e){S+=y==e?'\\"':e;continue}if("`"==e){S+=y==e?"\\`":e;continue}if("'"==e){S+=y==e?"\\'":e;continue}}if("\0"==e&&!d&&!c.test(N.charAt(O+1))){S+="\\0";continue}if(l.test(e)){S+=o[e];continue}const r=e.charCodeAt(0);if(t.minimal&&8232!=r&&8233!=r){S+=e;continue}let s=r.toString(16);b||(s=s.toUpperCase());const i=s.length>2||d,n="\\"+(i?"u":"x")+("0000"+s).slice(i?-4:-2);S+=n}return t.wrap&&(S=y+S+y),"`"==y&&(S=S.replace(/\$\{/g,"\\${")),t.isScriptContext?S.replace(/<\/(script|style)/gi,"<\\/$1").replace(/<!--/g,d?"\\u003C!--":"\\x3C!--"):S};u.version="2.5.2",e.exports=u},59176:(e,t,r)=>{const{default:s}=r(4680),i=/\.mongodb(-dev|-qa|-stage)?\.net$/i,n=/^atlas-stream-.+/i,a=/^(localhost|127\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])|0\.0\.0\.0|(?:0*\:)*?:?0*1)$/i,o=/\.mongo\.ondigitalocean\.com$/i,l=/\.cosmos\.azure\.com$/i,c=/docdb(-elastic)?\.amazonaws\.com$/i;function p(e){return e.startsWith("[")?e.substring(1).split("]")[0]:e.split(":")[0]}function u(e){if("string"!=typeof e)return"";try{return p(new s(e).hosts[0])}catch(t){return p(e)}}e.exports={getDataLake:function(e){const t={isDataLake:!1,dlVersion:null};return e.dataLake&&(t.isDataLake=!0,t.dlVersion=e.dataLake.version),t},isEnterprise:function(e){return!(!e.gitVersion||!e.gitVersion.match(/enterprise/))||!(!e.modules||-1===e.modules.indexOf("enterprise"))},isAtlas:function(e){return!!u(e).match(i)},isLocalAtlas:function(e){return e("admin","atlascli",{managedClusterType:"atlasCliLocalDevCluster"}).then((e=>e>0)).catch((()=>!1))},isAtlasStream:function(e){const t=u(e);return!(!t.match(i)||!t.match(n))},isLocalhost:function(e){return!!u(e).match(a)},isDigitalOcean:function(e){return!!u(e).match(o)},getGenuineMongoDB:function(e){const t=u(e);return t.match(l)?{isGenuine:!1,serverName:"cosmosdb"}:t.match(c)?{isGenuine:!1,serverName:"documentdb"}:{isGenuine:!0,serverName:"mongodb"}},getBuildEnv:function(e){return{serverOs:e.buildEnvironment?e.buildEnvironment.target_os:null,serverArch:e.buildEnvironment?e.buildEnvironment.target_arch:null}}}},11378:e=>{var t=1e3,r=60*t,s=60*r,i=24*s;function n(e,t,r,s){var i=t>=1.5*r;return Math.round(e/r)+" "+s+(i?"s":"")}e.exports=function(e,a){a=a||{};var o,l,c=typeof e;if("string"===c&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var n=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(n){var a=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*s;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===c&&isFinite(e))return a.long?(o=e,(l=Math.abs(o))>=i?n(o,l,i,"day"):l>=s?n(o,l,s,"hour"):l>=r?n(o,l,r,"minute"):l>=t?n(o,l,t,"second"):o+" ms"):function(e){var n=Math.abs(e);return n>=i?Math.round(e/i)+"d":n>=s?Math.round(e/s)+"h":n>=r?Math.round(e/r)+"m":n>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},16599:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function r(e){return"function"==typeof e}function s(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var n=RegExp.prototype.test;var a=/\S/;function o(e){return!function(e,t){return n.call(e,t)}(a,e)}var l={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};var c=/\s*/,p=/\s+/,u=/\s*=/,h=/\s*\}/,d=/#|\^|\/|>|\{|&|=|!/;function f(e){this.string=e,this.tail=e,this.pos=0}function m(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function y(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}f.prototype.eos=function(){return""===this.tail},f.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r},f.prototype.scanUntil=function(e){var t,r=this.tail.search(e);switch(r){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=t.length,t},m.prototype.push=function(e){return new m(e,this)},m.prototype.lookup=function(e){var t,s,n,a=this.cache;if(a.hasOwnProperty(e))t=a[e];else{for(var o,l,c,p=this,u=!1;p;){if(e.indexOf(".")>0)for(o=p.view,l=e.split("."),c=0;null!=o&&c<l.length;)c===l.length-1&&(u=i(o,l[c])||(s=o,n=l[c],null!=s&&"object"!=typeof s&&s.hasOwnProperty&&s.hasOwnProperty(n))),o=o[l[c++]];else o=p.view[e],u=i(p.view,e);if(u){t=o;break}p=p.parent}a[e]=t}return r(t)&&(t=t.call(this.view)),t},y.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},y.prototype.parse=function(e,r){var i=this.templateCache,n=e+":"+(r||g.tags).join(":"),a=void 0!==i,l=a?i.get(n):void 0;return null==l&&(l=function(e,r){if(!e)return[];var i,n,a,l=!1,m=[],y=[],b=[],x=!1,v=!1,E="",P=0;function T(){if(x&&!v)for(;b.length;)delete y[b.pop()];else b=[];x=!1,v=!1}function S(e){if("string"==typeof e&&(e=e.split(p,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);i=new RegExp(s(e[0])+"\\s*"),n=new RegExp("\\s*"+s(e[1])),a=new RegExp("\\s*"+s("}"+e[1]))}S(r||g.tags);for(var A,w,C,I,_,k,N=new f(e);!N.eos();){if(A=N.pos,C=N.scanUntil(i))for(var O=0,D=C.length;O<D;++O)o(I=C.charAt(O))?(b.push(y.length),E+=I):(v=!0,l=!0,E+=" "),y.push(["text",I,A,A+1]),A+=1,"\n"===I&&(T(),E="",P=0,l=!1);if(!N.scan(i))break;if(x=!0,w=N.scan(d)||"name",N.scan(c),"="===w?(C=N.scanUntil(u),N.scan(u),N.scanUntil(n)):"{"===w?(C=N.scanUntil(a),N.scan(h),N.scanUntil(n),w="&"):C=N.scanUntil(n),!N.scan(n))throw new Error("Unclosed tag at "+N.pos);if(_=">"==w?[w,C,A,N.pos,E,P,l]:[w,C,A,N.pos],P++,y.push(_),"#"===w||"^"===w)m.push(_);else if("/"===w){if(!(k=m.pop()))throw new Error('Unopened section "'+C+'" at '+A);if(k[1]!==C)throw new Error('Unclosed section "'+k[1]+'" at '+A)}else"name"===w||"{"===w||"&"===w?v=!0:"="===w&&S(C)}if(T(),k=m.pop())throw new Error('Unclosed section "'+k[1]+'" at '+N.pos);return function(e){for(var t,r=[],s=r,i=[],n=0,a=e.length;n<a;++n)switch((t=e[n])[0]){case"#":case"^":s.push(t),i.push(t),s=t[4]=[];break;case"/":i.pop()[5]=t[2],s=i.length>0?i[i.length-1][4]:r;break;default:s.push(t)}return r}(function(e){for(var t,r,s=[],i=0,n=e.length;i<n;++i)(t=e[i])&&("text"===t[0]&&r&&"text"===r[0]?(r[1]+=t[1],r[3]=t[3]):(s.push(t),r=t));return s}(y))}(e,r),a&&i.set(n,l)),l},y.prototype.render=function(e,t,r,s){var i=this.getConfigTags(s),n=this.parse(e,i),a=t instanceof m?t:new m(t,void 0);return this.renderTokens(n,a,r,e,s)},y.prototype.renderTokens=function(e,t,r,s,i){for(var n,a,o,l="",c=0,p=e.length;c<p;++c)o=void 0,"#"===(a=(n=e[c])[0])?o=this.renderSection(n,t,r,s,i):"^"===a?o=this.renderInverted(n,t,r,s,i):">"===a?o=this.renderPartial(n,t,r,i):"&"===a?o=this.unescapedValue(n,t):"name"===a?o=this.escapedValue(n,t,i):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(l+=o);return l},y.prototype.renderSection=function(e,s,i,n,a){var o=this,l="",c=s.lookup(e[1]);if(c){if(t(c))for(var p=0,u=c.length;p<u;++p)l+=this.renderTokens(e[4],s.push(c[p]),i,n,a);else if("object"==typeof c||"string"==typeof c||"number"==typeof c)l+=this.renderTokens(e[4],s.push(c),i,n,a);else if(r(c)){if("string"!=typeof n)throw new Error("Cannot use higher-order sections without the original template");null!=(c=c.call(s.view,n.slice(e[3],e[5]),(function(e){return o.render(e,s,i,a)})))&&(l+=c)}else l+=this.renderTokens(e[4],s,i,n,a);return l}},y.prototype.renderInverted=function(e,r,s,i,n){var a=r.lookup(e[1]);if(!a||t(a)&&0===a.length)return this.renderTokens(e[4],r,s,i,n)},y.prototype.indentPartial=function(e,t,r){for(var s=t.replace(/[^ \t]/g,""),i=e.split("\n"),n=0;n<i.length;n++)i[n].length&&(n>0||!r)&&(i[n]=s+i[n]);return i.join("\n")},y.prototype.renderPartial=function(e,t,s,i){if(s){var n=this.getConfigTags(i),a=r(s)?s(e[1]):s[e[1]];if(null!=a){var o=e[6],l=e[5],c=e[4],p=a;0==l&&c&&(p=this.indentPartial(a,c,o));var u=this.parse(p,n);return this.renderTokens(u,t,s,p,i)}}},y.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(null!=r)return r},y.prototype.escapedValue=function(e,t,r){var s=this.getConfigEscape(r)||g.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&s===g.escape?String(i):s(i)},y.prototype.rawValue=function(e){return e[1]},y.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},y.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var g={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){b.templateCache=e},get templateCache(){return b.templateCache}},b=new y;return g.clearCache=function(){return b.clearCache()},g.parse=function(e,t){return b.parse(e,t)},g.render=function(e,r,s,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(n=e)?"array":typeof n)+'" was given as the first argument for mustache#render(template, view, partials)'));var n;return b.render(e,r,s,i)},g.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return l[e]}))},g.Scanner=f,g.Context=m,g.Writer=y,g}()},68262:(e,t,r)=>{"use strict";var s=r(23586);function i(){}function n(){}n.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,n,a){if(a!==s){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:i};return r.PropTypes=r,r}},13980:(e,t,r)=>{e.exports=r(68262)()},23586:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},7847:(e,t,r)=>{const s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=n(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),c("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(e){const t=this.options.loose?a[o.COMPARATORLOOSE]:a[o.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new p(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(c("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new p(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new u(e.value,t).test(this.value):""===e.operator?""===e.value||new u(this.value,t).test(e.semver):!((t=n(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=i;const n=r(71388),{safeRe:a,t:o}=r(94808),l=r(28117),c=r(10952),p=r(52435),u=r(66843)},66843:(e,t,r)=>{class s{constructor(e,t){if(t=n(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!y(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&m))+":"+e,r=i.get(t);if(r)return r;const s=this.options.loose,n=s?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(n,_(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(c[p.TILDETRIM],h),o("tilde trim",e),e=e.replace(c[p.CARETTRIM],d),o("caret trim",e);let l=e.split(" ").map((e=>x(e,this.options))).join(" ").split(/\s+/).map((e=>I(e,this.options)));s&&(l=l.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),o("range list",l);const g=new Map,b=l.map((e=>new a(e,this.options)));for(const e of b){if(y(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const v=[...g.values()];return i.set(t,v),v}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some((r=>b(r,t)&&e.set.some((e=>b(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const i=new(r(77105))({max:1e3}),n=r(71388),a=r(7847),o=r(10952),l=r(52435),{safeRe:c,t:p,comparatorTrimReplace:u,tildeTrimReplace:h,caretTrimReplace:d}=r(94808),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:m}=r(55558),y=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,b=(e,t)=>{let r=!0;const s=e.slice();let i=s.pop();for(;r&&s.length;)r=s.every((e=>i.intersects(e,t))),i=s.pop();return r},x=(e,t)=>(o("comp",e,t),e=T(e,t),o("caret",e),e=E(e,t),o("tildes",e),e=A(e,t),o("xrange",e),e=C(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,E=(e,t)=>e.trim().split(/\s+/).map((e=>P(e,t))).join(" "),P=(e,t)=>{const r=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(r,((t,r,s,i,n)=>{let a;return o("tilde",e,t,r,s,i,n),v(r)?a="":v(s)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:v(i)?a=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:n?(o("replaceTilde pr",n),a=`>=${r}.${s}.${i}-${n} <${r}.${+s+1}.0-0`):a=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,o("tilde return",a),a}))},T=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{o("caret",e,t);const r=t.loose?c[p.CARETLOOSE]:c[p.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,n,a)=>{let l;return o("caret",e,t,r,i,n,a),v(r)?l="":v(i)?l=`>=${r}.0.0${s} <${+r+1}.0.0-0`:v(n)?l="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:a?(o("replaceCaret pr",a),l="0"===r?"0"===i?`>=${r}.${i}.${n}-${a} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n}-${a} <${+r+1}.0.0-0`):(o("no pr"),l="0"===r?"0"===i?`>=${r}.${i}.${n}${s} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n} <${+r+1}.0.0-0`),o("caret return",l),l}))},A=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>w(e,t))).join(" ")),w=(e,t)=>{e=e.trim();const r=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(r,((r,s,i,n,a,l)=>{o("xRange",e,r,s,i,n,a,l);const c=v(i),p=c||v(n),u=p||v(a),h=u;return"="===s&&h&&(s=""),l=t.includePrerelease?"-0":"",c?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&h?(p&&(n=0),a=0,">"===s?(s=">=",p?(i=+i+1,n=0,a=0):(n=+n+1,a=0)):"<="===s&&(s="<",p?i=+i+1:n=+n+1),"<"===s&&(l="-0"),r=`${s+i}.${n}.${a}${l}`):p?r=`>=${i}.0.0${l} <${+i+1}.0.0-0`:u&&(r=`>=${i}.${n}.0${l} <${i}.${+n+1}.0-0`),o("xRange return",r),r}))},C=(e,t)=>(o("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),I=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),_=e=>(t,r,s,i,n,a,o,l,c,p,u,h,d)=>`${r=v(s)?"":v(i)?`>=${s}.0.0${e?"-0":""}`:v(n)?`>=${s}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=v(c)?"":v(p)?`<${+c+1}.0.0-0`:v(u)?`<${c}.${+p+1}.0-0`:h?`<=${c}.${p}.${u}-${h}`:e?`<${c}.${p}.${+u+1}-0`:`<=${l}`}`.trim(),k=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(o(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){const s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},52435:(e,t,r)=>{const s=r(10952),{MAX_LENGTH:i,MAX_SAFE_INTEGER:n}=r(55558),{safeRe:a,t:o}=r(94808),l=r(71388),{compareIdentifiers:c}=r(14935);class p{constructor(e,t){if(t=l(t),e instanceof p){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?a[o.LOOSE]:a[o.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof p)){if("string"==typeof e&&e===this.version)return 0;e=new p(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof p||(e=new p(e,this.options)),c(this.major,e.major)||c(this.minor,e.minor)||c(this.patch,e.patch)}comparePre(e){if(e instanceof p||(e=new p(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],i=e.prerelease[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}compareBuild(e){e instanceof p||(e=new p(e,this.options));let t=0;do{const r=this.build[t],i=e.build[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===c(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=p},36694:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},28117:(e,t,r)=>{const s=r(33276),i=r(77893),n=r(16379),a=r(8463),o=r(21897),l=r(30506);e.exports=(e,t,r,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return i(e,r,c);case">":return n(e,r,c);case">=":return a(e,r,c);case"<":return o(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},98686:(e,t,r)=>{const s=r(52435),i=r(79943),{safeRe:n,t:a}=r(94808);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=n[a.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),n[a.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;n[a.COERCERTL].lastIndex=-1}else r=e.match(n[a.COERCE]);return null===r?null:i(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},65914:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r)=>{const i=new s(e,r),n=new s(t,r);return i.compare(n)||i.compareBuild(n)}},55404:(e,t,r)=>{const s=r(92271);e.exports=(e,t)=>s(e,t,!0)},92271:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},66007:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,null,!0),i=s(t,null,!0),n=r.compare(i);if(0===n)return null;const a=n>0,o=a?r:i,l=a?i:r,c=!!o.prerelease.length;if(l.prerelease.length&&!c)return l.patch||l.minor?o.patch?"patch":o.minor?"minor":"major":"major";const p=c?"pre":"";return r.major!==i.major?p+"major":r.minor!==i.minor?p+"minor":r.patch!==i.patch?p+"patch":"prerelease"}},33276:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>0===s(e,t,r)},16379:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)>0},8463:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)>=0},86360:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,n).version}catch(e){return null}}},21897:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)<0},30506:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(e,t,r)<=0},14551:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).major},469:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).minor},77893:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>0!==s(e,t,r)},79943:(e,t,r)=>{const s=r(52435);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},54250:(e,t,r)=>{const s=r(52435);e.exports=(e,t)=>new s(e,t).patch},58204:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},70733:(e,t,r)=>{const s=r(92271);e.exports=(e,t,r)=>s(t,e,r)},72961:(e,t,r)=>{const s=r(65914);e.exports=(e,t)=>e.sort(((e,r)=>s(r,e,t)))},59844:(e,t,r)=>{const s=r(66843);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},51116:(e,t,r)=>{const s=r(65914);e.exports=(e,t)=>e.sort(((e,r)=>s(e,r,t)))},97230:(e,t,r)=>{const s=r(79943);e.exports=(e,t)=>{const r=s(e,t);return r?r.version:null}},97699:(e,t,r)=>{const s=r(94808),i=r(55558),n=r(52435),a=r(14935),o=r(79943),l=r(97230),c=r(36694),p=r(86360),u=r(66007),h=r(14551),d=r(469),f=r(54250),m=r(58204),y=r(92271),g=r(70733),b=r(55404),x=r(65914),v=r(51116),E=r(72961),P=r(16379),T=r(21897),S=r(33276),A=r(77893),w=r(8463),C=r(30506),I=r(28117),_=r(98686),k=r(7847),N=r(66843),O=r(59844),D=r(48865),M=r(53727),F=r(14338),L=r(21542),R=r(36240),j=r(89106),B=r(90995),U=r(47805),V=r(22013),$=r(81338),K=r(53122);e.exports={parse:o,valid:l,clean:c,inc:p,diff:u,major:h,minor:d,patch:f,prerelease:m,compare:y,rcompare:g,compareLoose:b,compareBuild:x,sort:v,rsort:E,gt:P,lt:T,eq:S,neq:A,gte:w,lte:C,cmp:I,coerce:_,Comparator:k,Range:N,satisfies:O,toComparators:D,maxSatisfying:M,minSatisfying:F,minVersion:L,validRange:R,outside:j,gtr:B,ltr:U,intersects:V,simplifyRange:$,subset:K,SemVer:n,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}},55558:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},10952:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},14935:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const s=t.test(e),i=t.test(r);return s&&i&&(e=+e,r=+r),e===r?0:s&&!i?-1:i&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},71388:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},94808:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=r(55558),a=r(10952),o=(t=e.exports={}).re=[],l=t.safeRe=[],c=t.src=[],p=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const s=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=u++;a(e,i,t),p[e]=i,c[i]=t,o[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(s,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),f("MAINVERSION",`(${c[p.NUMERICIDENTIFIER]})\\.(${c[p.NUMERICIDENTIFIER]})\\.(${c[p.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${c[p.NUMERICIDENTIFIERLOOSE]})\\.(${c[p.NUMERICIDENTIFIERLOOSE]})\\.(${c[p.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${c[p.NUMERICIDENTIFIER]}|${c[p.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${c[p.NUMERICIDENTIFIERLOOSE]}|${c[p.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${c[p.PRERELEASEIDENTIFIER]}(?:\\.${c[p.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${c[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[p.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${h}+`),f("BUILD",`(?:\\+(${c[p.BUILDIDENTIFIER]}(?:\\.${c[p.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${c[p.MAINVERSION]}${c[p.PRERELEASE]}?${c[p.BUILD]}?`),f("FULL",`^${c[p.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${c[p.MAINVERSIONLOOSE]}${c[p.PRERELEASELOOSE]}?${c[p.BUILD]}?`),f("LOOSE",`^${c[p.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${c[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${c[p.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${c[p.XRANGEIDENTIFIER]})(?:\\.(${c[p.XRANGEIDENTIFIER]})(?:\\.(${c[p.XRANGEIDENTIFIER]})(?:${c[p.PRERELEASE]})?${c[p.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${c[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[p.XRANGEIDENTIFIERLOOSE]})(?:${c[p.PRERELEASELOOSE]})?${c[p.BUILD]}?)?)?`),f("XRANGE",`^${c[p.GTLT]}\\s*${c[p.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${c[p.GTLT]}\\s*${c[p.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?(?:$|[^\\d])`),f("COERCERTL",c[p.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${c[p.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${c[p.LONETILDE]}${c[p.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${c[p.LONETILDE]}${c[p.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${c[p.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${c[p.LONECARET]}${c[p.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${c[p.LONECARET]}${c[p.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${c[p.GTLT]}\\s*(${c[p.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${c[p.GTLT]}\\s*(${c[p.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${c[p.GTLT]}\\s*(${c[p.LOOSEPLAIN]}|${c[p.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${c[p.XRANGEPLAIN]})\\s+-\\s+(${c[p.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${c[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[p.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},90995:(e,t,r)=>{const s=r(89106);e.exports=(e,t,r)=>s(e,t,">",r)},22013:(e,t,r)=>{const s=r(66843);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},47805:(e,t,r)=>{const s=r(89106);e.exports=(e,t,r)=>s(e,t,"<",r)},53727:(e,t,r)=>{const s=r(52435),i=r(66843);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&-1!==a.compare(e)||(n=e,a=new s(n,r)))})),n}},14338:(e,t,r)=>{const s=r(52435),i=r(66843);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&1!==a.compare(e)||(n=e,a=new s(n,r)))})),n}},21542:(e,t,r)=>{const s=r(52435),i=r(66843),n=r(16379);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r))return r;if(r=new s("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let a=null;i.forEach((e=>{const t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":a&&!n(t,a)||(a=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!a||r&&!n(r,a)||(r=a)}return r&&e.test(r)?r:null}},89106:(e,t,r)=>{const s=r(52435),i=r(7847),{ANY:n}=i,a=r(66843),o=r(59844),l=r(16379),c=r(21897),p=r(30506),u=r(8463);e.exports=(e,t,r,h)=>{let d,f,m,y,g;switch(e=new s(e,h),t=new a(t,h),r){case">":d=l,f=p,m=c,y=">",g=">=";break;case"<":d=c,f=u,m=l,y="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,h))return!1;for(let r=0;r<t.set.length;++r){const s=t.set[r];let a=null,o=null;if(s.forEach((e=>{e.semver===n&&(e=new i(">=0.0.0")),a=a||e,o=o||e,d(e.semver,a.semver,h)?a=e:m(e.semver,o.semver,h)&&(o=e)})),a.operator===y||a.operator===g)return!1;if((!o.operator||o.operator===y)&&f(e,o.semver))return!1;if(o.operator===g&&m(e,o.semver))return!1}return!0}},81338:(e,t,r)=>{const s=r(59844),i=r(92271);e.exports=(e,t,r)=>{const n=[];let a=null,o=null;const l=e.sort(((e,t)=>i(e,t,r)));for(const e of l)s(e,t,r)?(o=e,a||(a=e)):(o&&n.push([a,o]),o=null,a=null);a&&n.push([a,null]);const c=[];for(const[e,t]of n)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push(`<=${t}`):c.push(`${e} - ${t}`):c.push(`>=${e}`):c.push("*");const p=c.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return p.length<u.length?p:t}},53122:(e,t,r)=>{const s=r(66843),i=r(7847),{ANY:n}=i,a=r(59844),o=r(92271),l=[new i(">=0.0.0-0")],c=[new i(">=0.0.0")],p=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?l:c}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=c}const s=new Set;let i,p,d,f,m,y,g;for(const t of e)">"===t.operator||">="===t.operator?i=u(i,t,r):"<"===t.operator||"<="===t.operator?p=h(p,t,r):s.add(t.semver);if(s.size>1)return null;if(i&&p){if(d=o(i.semver,p.semver,r),d>0)return null;if(0===d&&(">="!==i.operator||"<="!==p.operator))return null}for(const e of s){if(i&&!a(e,String(i),r))return null;if(p&&!a(e,String(p),r))return null;for(const s of t)if(!a(e,String(s),r))return!1;return!0}let b=!(!p||r.includePrerelease||!p.semver.prerelease.length)&&p.semver,x=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;b&&1===b.prerelease.length&&"<"===p.operator&&0===b.prerelease[0]&&(b=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,y=y||"<"===e.operator||"<="===e.operator,i)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),">"===e.operator||">="===e.operator){if(f=u(i,e,r),f===e&&f!==i)return!1}else if(">="===i.operator&&!a(i.semver,String(e),r))return!1;if(p)if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),"<"===e.operator||"<="===e.operator){if(m=h(p,e,r),m===e&&m!==p)return!1}else if("<="===p.operator&&!a(p.semver,String(e),r))return!1;if(!e.operator&&(p||i)&&0!==d)return!1}return!(i&&y&&!p&&0!==d||p&&g&&!i&&0!==d||x||b)},u=(e,t,r)=>{if(!e)return t;const s=o(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},h=(e,t,r)=>{if(!e)return t;const s=o(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(const s of e.set){for(const e of t.set){const t=p(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},48865:(e,t,r)=>{const s=r(66843);e.exports=(e,t)=>new s(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},36240:(e,t,r)=>{const s=r(66843);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},90082:e=>{function t(e){var t=/\.[^.]*$/.exec(e);return t?t.index+1:e.length}function r(e,t,r){if(e.reduce)return e.reduce(t,r);for(var s=0,i=arguments.length>=3?r:e[s++];s<e.length;s++)t(i,e[s],s);return i}function s(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t.call(e,e[r],r)}function i(e,t){if(e.map)return e.map(t);for(var r=[],s=0;s<e.length;s++)r.push(t.call(e,e[s],s));return r}e.exports=function(e,n){n||(n={});var a=void 0===n.hsep?" ":n.hsep,o=n.align||[],l=n.stringLength||function(e){return String(e).length},c=r(e,(function(e,r){return s(r,(function(r,s){var i=t(r);(!e[s]||i>e[s])&&(e[s]=i)})),e}),[]),p=i(e,(function(e){return i(e,(function(e,r){var s=String(e);if("."===o[r]){var i=t(s),n=c[r]+(/\./.test(s)?1:2)-(l(s)-i);return s+Array(n).join(" ")}return s}))})),u=r(p,(function(e,t){return s(t,(function(t,r){var s=l(t);(!e[r]||s>e[r])&&(e[r]=s)})),e}),[]);return i(p,(function(e){return i(e,(function(e,t){var r=u[t]-l(e)||0,s=Array(Math.max(r+1,1)).join(" ");return"r"===o[t]||"."===o[t]?s+e:"c"===o[t]?Array(Math.ceil(r/2+1)).join(" ")+e+Array(Math.floor(r/2+1)).join(" "):e+s})).join(a).replace(/\s+$/,"")})).join("\n")}},49517:e=>{"use strict";let t=null;function r(e){if(null!==t&&(t.property,1)){const e=t;return t=r.prototype=null,e}return t=r.prototype=null==e?Object.create(null):e,new r}r(),e.exports=function(e){return r(e)}},96092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.codeFrameColumns=c,t.default=function(e,t,r,s={}){if(!o){o=!0;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";process.emitWarning?process.emitWarning(e,"DeprecationWarning"):(new Error(e).name="DeprecationWarning",console.warn(new Error(e)))}return c(e,{start:{column:r=Math.max(r,0),line:t}},s)};var s=r(13106),i=function(e,t){if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(true);if(r&&r.has(e))return r.get(e);var s={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(s,a,o):s[a]=e[a]}return s.default=e,r&&r.set(e,s),s}(r(43574));function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}let a,o=!1;const l=/\r\n|[\n\r\u2028\u2029]/;function c(e,t,r={}){const n=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r),o=r.forceColor?(null!=a||(a=new i.default.constructor({enabled:!0,level:1})),a):i.default,c=function(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}(o),p=(e,t)=>n?e(t):t,u=e.split(l),{start:h,end:d,markerLines:f}=function(e,t,r){const s=Object.assign({column:0,line:-1},e.start),i=Object.assign({},s,e.end),{linesAbove:n=2,linesBelow:a=3}=r||{},o=s.line,l=s.column,c=i.line,p=i.column;let u=Math.max(o-(n+1),0),h=Math.min(t.length,c+a);-1===o&&(u=0),-1===c&&(h=t.length);const d=c-o,f={};if(d)for(let e=0;e<=d;e++){const r=e+o;if(l)if(0===e){const e=t[r-1].length;f[r]=[l,e-l+1]}else if(e===d)f[r]=[0,p];else{const s=t[r-e].length;f[r]=[0,s]}else f[r]=!0}else f[o]=l===p?!l||[l,0]:[l,p-l];return{start:u,end:h,markerLines:f}}(t,u,r),m=t.start&&"number"==typeof t.start.column,y=String(d).length;let g=(n?(0,s.default)(e,r):e).split(l,d).slice(h,d).map(((e,t)=>{const s=h+1+t,i=` ${` ${s}`.slice(-y)} |`,n=f[s],a=!f[s+1];if(n){let t="";if(Array.isArray(n)){const s=e.slice(0,Math.max(n[0]-1,0)).replace(/[^\t]/g," "),o=n[1]||1;t=["\n ",p(c.gutter,i.replace(/\d/g," "))," ",s,p(c.marker,"^").repeat(o)].join(""),a&&r.message&&(t+=" "+p(c.message,r.message))}return[p(c.marker,">"),p(c.gutter,i),e.length>0?` ${e}`:"",t].join("")}return` ${p(c.gutter,i)}${e.length>0?` ${e}`:""}`})).join("\n");return r.message&&!m&&(g=`${" ".repeat(y+1)}${r.message}\n${g}`),n?o.reset(g):g}},45884:(e,t,r)=>{e.exports=r(95619)},18052:(e,t,r)=>{e.exports=r(7286)},69417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=class{constructor(e){this._map=null,this._buf="",this._str="",this._appendCount=0,this._last=0,this._queue=[],this._queueCursor=0,this._canMarkIdName=!0,this._position={line:1,column:0},this._sourcePosition={identifierName:void 0,identifierNamePos:void 0,line:void 0,column:void 0,filename:void 0},this._map=e,this._allocQueue()}_allocQueue(){const e=this._queue;for(let t=0;t<16;t++)e.push({char:0,repeat:1,line:void 0,column:void 0,identifierName:void 0,identifierNamePos:void 0,filename:""})}_pushQueue(e,t,r,s,i){const n=this._queueCursor;n===this._queue.length&&this._allocQueue();const a=this._queue[n];a.char=e,a.repeat=t,a.line=r,a.column=s,a.filename=i,this._queueCursor++}_popQueue(){if(0===this._queueCursor)throw new Error("Cannot pop from empty queue");return this._queue[--this._queueCursor]}get(){this._flush();const e=this._map,t={code:(this._buf+this._str).trimRight(),decodedMap:null==e?void 0:e.getDecoded(),get __mergedMap(){return this.map},get map(){const r=e?e.get():null;return t.map=r,r},set map(e){Object.defineProperty(t,"map",{value:e,writable:!0})},get rawMappings(){const r=null==e?void 0:e.getRawMappings();return t.rawMappings=r,r},set rawMappings(e){Object.defineProperty(t,"rawMappings",{value:e,writable:!0})}};return t}append(e,t){this._flush(),this._append(e,this._sourcePosition,t)}appendChar(e){this._flush(),this._appendChar(e,1,this._sourcePosition)}queue(e){if(10===e)for(;0!==this._queueCursor;){const e=this._queue[this._queueCursor-1].char;if(32!==e&&9!==e)break;this._queueCursor--}const t=this._sourcePosition;this._pushQueue(e,1,t.line,t.column,t.filename)}queueIndentation(e,t){this._pushQueue(e,t,void 0,void 0,void 0)}_flush(){const e=this._queueCursor,t=this._queue;for(let r=0;r<e;r++){const e=t[r];this._appendChar(e.char,e.repeat,e)}this._queueCursor=0}_appendChar(e,t,r){this._last=e,this._str+=t>1?String.fromCharCode(e).repeat(t):String.fromCharCode(e),10!==e?(this._mark(r.line,r.column,r.identifierName,r.identifierNamePos,r.filename),this._position.column+=t):(this._position.line++,this._position.column=0),this._canMarkIdName&&(r.identifierName=void 0,r.identifierNamePos=void 0)}_append(e,t,r){const s=e.length,i=this._position;if(this._last=e.charCodeAt(s-1),++this._appendCount>4096?(this._str,this._buf+=this._str,this._str=e,this._appendCount=0):this._str+=e,!r&&!this._map)return void(i.column+=s);const{column:n,identifierName:a,identifierNamePos:o,filename:l}=t;let c=t.line;null==a&&null==o||!this._canMarkIdName||(t.identifierName=void 0,t.identifierNamePos=void 0);let p=e.indexOf("\n"),u=0;for(0!==p&&this._mark(c,n,a,o,l);-1!==p;)i.line++,i.column=0,u=p+1,u<s&&void 0!==c&&this._mark(++c,0,null,null,l),p=e.indexOf("\n",u);i.column+=s-u}_mark(e,t,r,s,i){var n;null==(n=this._map)||n.mark(this._position,e,t,r,s,i)}removeTrailingNewline(){const e=this._queueCursor;0!==e&&10===this._queue[e-1].char&&this._queueCursor--}removeLastSemicolon(){const e=this._queueCursor;0!==e&&59===this._queue[e-1].char&&this._queueCursor--}getLastChar(){const e=this._queueCursor;return 0!==e?this._queue[e-1].char:this._last}getNewlineCount(){const e=this._queueCursor;let t=0;if(0===e)return 10===this._last?1:0;for(let r=e-1;r>=0&&10===this._queue[r].char;r--)t++;return t===e&&10===this._last?t+1:t}endsWithCharAndNewline(){const e=this._queue,t=this._queueCursor;if(0!==t){if(10!==e[t-1].char)return;return t>1?e[t-2].char:this._last}}hasContent(){return 0!==this._queueCursor||!!this._last}exactSource(e,t){if(!this._map)return void t();this.source("start",e);const r=e.identifierName,s=this._sourcePosition;r&&(this._canMarkIdName=!1,s.identifierName=r),t(),r&&(this._canMarkIdName=!0,s.identifierName=void 0,s.identifierNamePos=void 0),this.source("end",e)}source(e,t){this._map&&this._normalizePosition(e,t,0)}sourceWithOffset(e,t,r){this._map&&this._normalizePosition(e,t,r)}withSource(e,t,r){this._map&&this.source(e,t),r()}_normalizePosition(e,t,r){const s=t[e],i=this._sourcePosition;s&&(i.line=s.line,i.column=Math.max(s.column+r,0),i.filename=t.filename)}getCurrentColumn(){const e=this._queue,t=this._queueCursor;let r=-1,s=0;for(let i=0;i<t;i++){const t=e[i];10===t.char&&(r=s),s+=t.repeat}return-1===r?this._position.column+s:s-1-r}getCurrentLine(){let e=0;const t=this._queue;for(let r=0;r<this._queueCursor;r++)10===t[r].char&&e++;return this._position.line+e}}},45406:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockStatement=function(e){var t;this.tokenChar(123);const r=null==(t=e.directives)?void 0:t.length;if(r){var s;const t=e.body.length?2:1;this.printSequence(e.directives,e,{indent:!0,trailingCommentsLineOffset:t}),null!=(s=e.directives[r-1].trailingComments)&&s.length||this.newline(t)}this.printSequence(e.body,e,{indent:!0}),this.rightBrace(e)},t.Directive=function(e){this.print(e.value,e),this.semicolon()},t.DirectiveLiteral=function(e){const t=this.getPossibleRaw(e);if(!this.format.minified&&void 0!==t)return void this.token(t);const{value:i}=e;if(s.test(i)){if(r.test(i))throw new Error("Malformed AST: it is not possible to print a directive containing both unescaped single and double quotes.");this.token(`'${i}'`)}else this.token(`"${i}"`)},t.File=function(e){e.program&&this.print(e.program.interpreter,e),this.print(e.program,e)},t.InterpreterDirective=function(e){this.token(`#!${e.value}`),this.newline(1,!0)},t.Placeholder=function(e){this.token("%%"),this.print(e.name),this.token("%%"),"Statement"===e.expectedNode&&this.semicolon()},t.Program=function(e){var t;this.noIndentInnerCommentsHere(),this.printInnerComments();const r=null==(t=e.directives)?void 0:t.length;if(r){var s;const t=e.body.length?2:1;this.printSequence(e.directives,e,{trailingCommentsLineOffset:t}),null!=(s=e.directives[r-1].trailingComments)&&s.length||this.newline(t)}this.printSequence(e.body,e)};const r=/(?:^|[^\\])(?:\\\\)*'/,s=/(?:^|[^\\])(?:\\\\)*"/},60315:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClassAccessorProperty=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),this.word("accessor",!0),this.space(),e.computed?(this.tokenChar(91),this.print(e.key,e),this.tokenChar(93)):(this._variance(e),this.print(e.key,e)),e.optional&&this.tokenChar(63),e.definite&&this.tokenChar(33),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.ClassBody=function(e){this.tokenChar(123),0===e.body.length?this.tokenChar(125):(this.newline(),this.printSequence(e.body,e,{indent:!0}),this.endsWith(10)||this.newline(),this.rightBrace(e))},t.ClassExpression=t.ClassDeclaration=function(e,t){(i(t)||n(t))&&this._shouldPrintDecoratorsBeforeExport(t)||this.printJoin(e.decorators,e),e.declare&&(this.word("declare"),this.space()),e.abstract&&(this.word("abstract"),this.space()),this.word("class"),e.id&&(this.space(),this.print(e.id,e)),this.print(e.typeParameters,e),e.superClass&&(this.space(),this.word("extends"),this.space(),this.print(e.superClass,e),this.print(e.superTypeParameters,e)),e.implements&&(this.space(),this.word("implements"),this.space(),this.printList(e.implements,e)),this.space(),this.print(e.body,e)},t.ClassMethod=function(e){this._classMethodHead(e),this.space(),this.print(e.body,e)},t.ClassPrivateMethod=function(e){this._classMethodHead(e),this.space(),this.print(e.body,e)},t.ClassPrivateProperty=function(e){this.printJoin(e.decorators,e),e.static&&(this.word("static"),this.space()),this.print(e.key,e),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.ClassProperty=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),e.computed?(this.tokenChar(91),this.print(e.key,e),this.tokenChar(93)):(this._variance(e),this.print(e.key,e)),e.optional&&this.tokenChar(63),e.definite&&this.tokenChar(33),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.tokenChar(61),this.space(),this.print(e.value,e)),this.semicolon()},t.StaticBlock=function(e){this.word("static"),this.space(),this.tokenChar(123),0===e.body.length?this.tokenChar(125):(this.newline(),this.printSequence(e.body,e,{indent:!0}),this.rightBrace(e))},t._classMethodHead=function(e){var t;this.printJoin(e.decorators,e);const r=null==(t=e.key.loc)||null==(t=t.end)?void 0:t.line;r&&this.catchUp(r),this.tsPrintClassMemberModifiers(e),this._methodHead(e)};var s=r(81483);const{isExportDefaultDeclaration:i,isExportNamedDeclaration:n}=s},59853:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogicalExpression=t.BinaryExpression=t.AssignmentExpression=function(e,t){const r=this.inForStatementInitCounter&&"in"===e.operator&&!i.needsParens(e,t);r&&this.tokenChar(40),this.print(e.left,e),this.space(),"in"===e.operator||"instanceof"===e.operator?this.word(e.operator):this.token(e.operator),this.space(),this.print(e.right,e),r&&this.tokenChar(41)},t.AssignmentPattern=function(e){this.print(e.left,e),e.left.optional&&this.tokenChar(63),this.print(e.left.typeAnnotation,e),this.space(),this.tokenChar(61),this.space(),this.print(e.right,e)},t.AwaitExpression=function(e){this.word("await"),e.argument&&(this.space(),this.printTerminatorless(e.argument,e,!1))},t.BindExpression=function(e){this.print(e.object,e),this.token("::"),this.print(e.callee,e)},t.CallExpression=function(e){this.print(e.callee,e),this.print(e.typeArguments,e),this.print(e.typeParameters,e),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e)},t.ConditionalExpression=function(e){this.print(e.test,e),this.space(),this.tokenChar(63),this.space(),this.print(e.consequent,e),this.space(),this.tokenChar(58),this.space(),this.print(e.alternate,e)},t.Decorator=function(e){this.tokenChar(64);const{expression:t}=e;!function(e){return"ParenthesizedExpression"!==e.type&&!c("CallExpression"===e.type?e.callee:e)}(t)?this.print(t,e):(this.tokenChar(40),this.print(t,e),this.tokenChar(41)),this.newline()},t.DoExpression=function(e){e.async&&(this.word("async",!0),this.space()),this.word("do"),this.space(),this.print(e.body,e)},t.EmptyStatement=function(){this.semicolon(!0)},t.ExpressionStatement=function(e){this.print(e.expression,e),this.semicolon()},t.Import=function(){this.word("import")},t.MemberExpression=function(e){if(this.print(e.object,e),!e.computed&&o(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");let t=e.computed;a(e.property)&&"number"==typeof e.property.value&&(t=!0),t?(this.tokenChar(91),this.print(e.property,e),this.tokenChar(93)):(this.tokenChar(46),this.print(e.property,e))},t.MetaProperty=function(e){this.print(e.meta,e),this.tokenChar(46),this.print(e.property,e)},t.ModuleExpression=function(e){this.word("module",!0),this.space(),this.tokenChar(123),this.indent();const{body:t}=e;(t.body.length||t.directives.length)&&this.newline(),this.print(t,e),this.dedent(),this.rightBrace(e)},t.NewExpression=function(e,t){this.word("new"),this.space(),this.print(e.callee,e),(!this.format.minified||0!==e.arguments.length||e.optional||n(t,{callee:e})||o(t)||l(t))&&(this.print(e.typeArguments,e),this.print(e.typeParameters,e),e.optional&&this.token("?."),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e))},t.OptionalCallExpression=function(e){this.print(e.callee,e),this.print(e.typeParameters,e),e.optional&&this.token("?."),this.print(e.typeArguments,e),this.tokenChar(40),this.printList(e.arguments,e),this.rightParens(e)},t.OptionalMemberExpression=function(e){let{computed:t}=e;const{optional:r,property:s}=e;if(this.print(e.object,e),!t&&o(s))throw new TypeError("Got a MemberExpression for MemberExpression property");a(s)&&"number"==typeof s.value&&(t=!0),r&&this.token("?."),t?(this.tokenChar(91),this.print(s,e),this.tokenChar(93)):(r||this.tokenChar(46),this.print(s,e))},t.ParenthesizedExpression=function(e){this.tokenChar(40),this.print(e.expression,e),this.rightParens(e)},t.PrivateName=function(e){this.tokenChar(35),this.print(e.id,e)},t.SequenceExpression=function(e){this.printList(e.expressions,e)},t.Super=function(){this.word("super")},t.ThisExpression=function(){this.word("this")},t.UnaryExpression=function(e){const{operator:t}=e;"void"===t||"delete"===t||"typeof"===t||"throw"===t?(this.word(t),this.space()):this.token(t),this.print(e.argument,e)},t.UpdateExpression=function(e){e.prefix?(this.token(e.operator),this.print(e.argument,e)):(this.printTerminatorless(e.argument,e,!0),this.token(e.operator))},t.V8IntrinsicIdentifier=function(e){this.tokenChar(37),this.word(e.name)},t.YieldExpression=function(e){this.word("yield",!0),e.delegate?(this.tokenChar(42),e.argument&&(this.space(),this.print(e.argument,e))):e.argument&&(this.space(),this.printTerminatorless(e.argument,e,!1))},t._shouldPrintDecoratorsBeforeExport=function(e){return"boolean"==typeof this.format.decoratorsBeforeExport?this.format.decoratorsBeforeExport:"number"==typeof e.start&&e.start===e.declaration.start};var s=r(81483),i=r(92505);const{isCallExpression:n,isLiteral:a,isMemberExpression:o,isNewExpression:l}=s;function c(e){switch(e.type){case"Identifier":return!0;case"MemberExpression":return!e.computed&&"Identifier"===e.property.type&&c(e.object);default:return!1}}},97900:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnyTypeAnnotation=function(){this.word("any")},t.ArrayTypeAnnotation=function(e){this.print(e.elementType,e,!0),this.tokenChar(91),this.tokenChar(93)},t.BooleanLiteralTypeAnnotation=function(e){this.word(e.value?"true":"false")},t.BooleanTypeAnnotation=function(){this.word("boolean")},t.DeclareClass=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("class"),this.space(),this._interfaceish(e)},t.DeclareExportAllDeclaration=function(e){this.word("declare"),this.space(),i.ExportAllDeclaration.call(this,e)},t.DeclareExportDeclaration=function(e){this.word("declare"),this.space(),this.word("export"),this.space(),e.default&&(this.word("default"),this.space()),u.call(this,e)},t.DeclareFunction=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("function"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation.typeAnnotation,e),e.predicate&&(this.space(),this.print(e.predicate,e)),this.semicolon()},t.DeclareInterface=function(e){this.word("declare"),this.space(),this.InterfaceDeclaration(e)},t.DeclareModule=function(e){this.word("declare"),this.space(),this.word("module"),this.space(),this.print(e.id,e),this.space(),this.print(e.body,e)},t.DeclareModuleExports=function(e){this.word("declare"),this.space(),this.word("module"),this.tokenChar(46),this.word("exports"),this.print(e.typeAnnotation,e)},t.DeclareOpaqueType=function(e,t){a(t)||(this.word("declare"),this.space()),this.OpaqueType(e)},t.DeclareTypeAlias=function(e){this.word("declare"),this.space(),this.TypeAlias(e)},t.DeclareVariable=function(e,t){a(t)||(this.word("declare"),this.space()),this.word("var"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation,e),this.semicolon()},t.DeclaredPredicate=function(e){this.tokenChar(37),this.word("checks"),this.tokenChar(40),this.print(e.value,e),this.tokenChar(41)},t.EmptyTypeAnnotation=function(){this.word("empty")},t.EnumBooleanBody=function(e){const{explicitType:t}=e;l(this,"boolean",t),c(this,e)},t.EnumBooleanMember=function(e){p(this,e)},t.EnumDeclaration=function(e){const{id:t,body:r}=e;this.word("enum"),this.space(),this.print(t,e),this.print(r,e)},t.EnumDefaultedMember=function(e){const{id:t}=e;this.print(t,e),this.tokenChar(44)},t.EnumNumberBody=function(e){const{explicitType:t}=e;l(this,"number",t),c(this,e)},t.EnumNumberMember=function(e){p(this,e)},t.EnumStringBody=function(e){const{explicitType:t}=e;l(this,"string",t),c(this,e)},t.EnumStringMember=function(e){p(this,e)},t.EnumSymbolBody=function(e){l(this,"symbol",!0),c(this,e)},t.ExistsTypeAnnotation=function(){this.tokenChar(42)},t.FunctionTypeAnnotation=function(e,t){this.print(e.typeParameters,e),this.tokenChar(40),e.this&&(this.word("this"),this.tokenChar(58),this.space(),this.print(e.this.typeAnnotation,e),(e.params.length||e.rest)&&(this.tokenChar(44),this.space())),this.printList(e.params,e),e.rest&&(e.params.length&&(this.tokenChar(44),this.space()),this.token("..."),this.print(e.rest,e)),this.tokenChar(41);const r=null==t?void 0:t.type;null!=r&&("ObjectTypeCallProperty"===r||"ObjectTypeInternalSlot"===r||"DeclareFunction"===r||"ObjectTypeProperty"===r&&t.method)?this.tokenChar(58):(this.space(),this.token("=>")),this.space(),this.print(e.returnType,e)},t.FunctionTypeParam=function(e){this.print(e.name,e),e.optional&&this.tokenChar(63),e.name&&(this.tokenChar(58),this.space()),this.print(e.typeAnnotation,e)},t.IndexedAccessType=function(e){this.print(e.objectType,e,!0),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.InferredPredicate=function(){this.tokenChar(37),this.word("checks")},t.InterfaceDeclaration=function(e){this.word("interface"),this.space(),this._interfaceish(e)},t.GenericTypeAnnotation=t.ClassImplements=t.InterfaceExtends=function(e){this.print(e.id,e),this.print(e.typeParameters,e,!0)},t.InterfaceTypeAnnotation=function(e){var t;this.word("interface"),null!=(t=e.extends)&&t.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),this.space(),this.print(e.body,e)},t.IntersectionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:h})},t.MixedTypeAnnotation=function(){this.word("mixed")},t.NullLiteralTypeAnnotation=function(){this.word("null")},t.NullableTypeAnnotation=function(e){this.tokenChar(63),this.print(e.typeAnnotation,e)},Object.defineProperty(t,"NumberLiteralTypeAnnotation",{enumerable:!0,get:function(){return n.NumericLiteral}}),t.NumberTypeAnnotation=function(){this.word("number")},t.ObjectTypeAnnotation=function(e){e.exact?this.token("{|"):this.tokenChar(123);const t=[...e.properties,...e.callProperties||[],...e.indexers||[],...e.internalSlots||[]];t.length&&(this.newline(),this.space(),this.printJoin(t,e,{addNewlines(e){if(e&&!t[0])return 1},indent:!0,statement:!0,iterator:()=>{(1!==t.length||e.inexact)&&(this.tokenChar(44),this.space())}}),this.space()),e.inexact&&(this.indent(),this.token("..."),t.length&&this.newline(),this.dedent()),e.exact?this.token("|}"):this.tokenChar(125)},t.ObjectTypeCallProperty=function(e){e.static&&(this.word("static"),this.space()),this.print(e.value,e)},t.ObjectTypeIndexer=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.tokenChar(91),e.id&&(this.print(e.id,e),this.tokenChar(58),this.space()),this.print(e.key,e),this.tokenChar(93),this.tokenChar(58),this.space(),this.print(e.value,e)},t.ObjectTypeInternalSlot=function(e){e.static&&(this.word("static"),this.space()),this.tokenChar(91),this.tokenChar(91),this.print(e.id,e),this.tokenChar(93),this.tokenChar(93),e.optional&&this.tokenChar(63),e.method||(this.tokenChar(58),this.space()),this.print(e.value,e)},t.ObjectTypeProperty=function(e){e.proto&&(this.word("proto"),this.space()),e.static&&(this.word("static"),this.space()),"get"!==e.kind&&"set"!==e.kind||(this.word(e.kind),this.space()),this._variance(e),this.print(e.key,e),e.optional&&this.tokenChar(63),e.method||(this.tokenChar(58),this.space()),this.print(e.value,e)},t.ObjectTypeSpreadProperty=function(e){this.token("..."),this.print(e.argument,e)},t.OpaqueType=function(e){this.word("opaque"),this.space(),this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),e.supertype&&(this.tokenChar(58),this.space(),this.print(e.supertype,e)),e.impltype&&(this.space(),this.tokenChar(61),this.space(),this.print(e.impltype,e)),this.semicolon()},t.OptionalIndexedAccessType=function(e){this.print(e.objectType,e),e.optional&&this.token("?."),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.QualifiedTypeIdentifier=function(e){this.print(e.qualification,e),this.tokenChar(46),this.print(e.id,e)},Object.defineProperty(t,"StringLiteralTypeAnnotation",{enumerable:!0,get:function(){return n.StringLiteral}}),t.StringTypeAnnotation=function(){this.word("string")},t.SymbolTypeAnnotation=function(){this.word("symbol")},t.ThisTypeAnnotation=function(){this.word("this")},t.TupleTypeAnnotation=function(e){this.tokenChar(91),this.printList(e.types,e),this.tokenChar(93)},t.TypeAlias=function(e){this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),this.space(),this.tokenChar(61),this.space(),this.print(e.right,e),this.semicolon()},t.TypeAnnotation=function(e){this.tokenChar(58),this.space(),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t.TypeCastExpression=function(e){this.tokenChar(40),this.print(e.expression,e),this.print(e.typeAnnotation,e),this.tokenChar(41)},t.TypeParameter=function(e){this._variance(e),this.word(e.name),e.bound&&this.print(e.bound,e),e.default&&(this.space(),this.tokenChar(61),this.space(),this.print(e.default,e))},t.TypeParameterDeclaration=t.TypeParameterInstantiation=function(e){this.tokenChar(60),this.printList(e.params,e,{}),this.tokenChar(62)},t.TypeofTypeAnnotation=function(e){this.word("typeof"),this.space(),this.print(e.argument,e)},t.UnionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:d})},t.Variance=function(e){"plus"===e.kind?this.tokenChar(43):this.tokenChar(45)},t.VoidTypeAnnotation=function(){this.word("void")},t._interfaceish=function(e){var t,r,s;(this.print(e.id,e),this.print(e.typeParameters,e),null!=(t=e.extends)&&t.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),"DeclareClass"===e.type)&&(null!=(r=e.mixins)&&r.length&&(this.space(),this.word("mixins"),this.space(),this.printList(e.mixins,e)),null!=(s=e.implements)&&s.length&&(this.space(),this.word("implements"),this.space(),this.printList(e.implements,e)));this.space(),this.print(e.body,e)},t._variance=function(e){var t;const r=null==(t=e.variance)?void 0:t.kind;null!=r&&("plus"===r?this.tokenChar(43):"minus"===r&&this.tokenChar(45))};var s=r(81483),i=r(86019),n=r(40062);const{isDeclareExportDeclaration:a,isStatement:o}=s;function l(e,t,r){r&&(e.space(),e.word("of"),e.space(),e.word(t)),e.space()}function c(e,t){const{members:r}=t;e.token("{"),e.indent(),e.newline();for(const s of r)e.print(s,t),e.newline();t.hasUnknownMembers&&(e.token("..."),e.newline()),e.dedent(),e.token("}")}function p(e,t){const{id:r,init:s}=t;e.print(r,t),e.space(),e.token("="),e.space(),e.print(s,t),e.token(",")}function u(e){if(e.declaration){const t=e.declaration;this.print(t,e),o(t)||this.semicolon()}else this.tokenChar(123),e.specifiers.length&&(this.space(),this.printList(e.specifiers,e),this.space()),this.tokenChar(125),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}function h(){this.space(),this.tokenChar(38),this.space()}function d(){this.space(),this.tokenChar(124),this.space()}},87817:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=r(36644);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var i=r(59853);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));var n=r(14679);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===n[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}}))}));var a=r(60315);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=r(58588);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var l=r(86019);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===l[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}}))}));var c=r(40062);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===c[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}}))}));var p=r(97900);Object.keys(p).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===p[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}}))}));var u=r(45406);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}));var h=r(68136);Object.keys(h).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===h[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return h[e]}}))}));var d=r(6704);Object.keys(d).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===d[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}}))}))},68136:(e,t)=>{"use strict";function r(){this.space()}Object.defineProperty(t,"__esModule",{value:!0}),t.JSXAttribute=function(e){this.print(e.name,e),e.value&&(this.tokenChar(61),this.print(e.value,e))},t.JSXClosingElement=function(e){this.token("</"),this.print(e.name,e),this.tokenChar(62)},t.JSXClosingFragment=function(){this.token("</"),this.tokenChar(62)},t.JSXElement=function(e){const t=e.openingElement;if(this.print(t,e),!t.selfClosing){this.indent();for(const t of e.children)this.print(t,e);this.dedent(),this.print(e.closingElement,e)}},t.JSXEmptyExpression=function(){this.printInnerComments()},t.JSXExpressionContainer=function(e){this.tokenChar(123),this.print(e.expression,e),this.tokenChar(125)},t.JSXFragment=function(e){this.print(e.openingFragment,e),this.indent();for(const t of e.children)this.print(t,e);this.dedent(),this.print(e.closingFragment,e)},t.JSXIdentifier=function(e){this.word(e.name)},t.JSXMemberExpression=function(e){this.print(e.object,e),this.tokenChar(46),this.print(e.property,e)},t.JSXNamespacedName=function(e){this.print(e.namespace,e),this.tokenChar(58),this.print(e.name,e)},t.JSXOpeningElement=function(e){this.tokenChar(60),this.print(e.name,e),this.print(e.typeParameters,e),e.attributes.length>0&&(this.space(),this.printJoin(e.attributes,e,{separator:r})),e.selfClosing?(this.space(),this.token("/>")):this.tokenChar(62)},t.JSXOpeningFragment=function(){this.tokenChar(60),this.tokenChar(62)},t.JSXSpreadAttribute=function(e){this.tokenChar(123),this.token("..."),this.print(e.argument,e),this.tokenChar(125)},t.JSXSpreadChild=function(e){this.tokenChar(123),this.token("..."),this.print(e.expression,e),this.tokenChar(125)},t.JSXText=function(e){const t=this.getPossibleRaw(e);void 0!==t?this.token(t,!0):this.token(e.value,!0)}},58588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowFunctionExpression=function(e,t){let r;e.async&&(this.word("async",!0),this.space()),this.format.retainLines||1!==e.params.length||!i(r=e.params[0])||function(e,t){var r,s;return!!(e.typeParameters||e.returnType||e.predicate||t.typeAnnotation||t.optional||null!=(r=t.leadingComments)&&r.length||null!=(s=t.trailingComments)&&s.length)}(e,r)?this._params(e,void 0,t):this.print(r,e,!0),this._predicate(e,!0),this.space(),this.printInnerComments(),this.token("=>"),this.space(),this.print(e.body,e)},t.FunctionDeclaration=t.FunctionExpression=function(e,t){this._functionHead(e,t),this.space(),this.print(e.body,e)},t._functionHead=function(e,t){e.async&&(this.word("async"),this._endsWithInnerRaw=!1,this.space()),this.word("function"),e.generator&&(this._endsWithInnerRaw=!1,this.tokenChar(42)),this.space(),e.id&&this.print(e.id,e),this._params(e,e.id,t),"TSDeclareFunction"!==e.type&&this._predicate(e)},t._methodHead=function(e){const t=e.kind,r=e.key;"get"!==t&&"set"!==t||(this.word(t),this.space()),e.async&&(this.word("async",!0),this.space()),"method"!==t&&"init"!==t||e.generator&&this.tokenChar(42),e.computed?(this.tokenChar(91),this.print(r,e),this.tokenChar(93)):this.print(r,e),e.optional&&this.tokenChar(63),this._params(e,e.computed&&"StringLiteral"!==e.key.type?void 0:e.key,void 0)},t._param=function(e,t){this.printJoin(e.decorators,e),this.print(e,t),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t._parameters=function(e,t){const r=e.length;for(let s=0;s<r;s++)this._param(e[s],t),s<e.length-1&&(this.tokenChar(44),this.space())},t._params=function(e,t,r){this.print(e.typeParameters,e);const s=n.call(this,t,r);s&&this.sourceIdentifierName(s.name,s.pos),this.tokenChar(40),this._parameters(e.params,e),this.tokenChar(41);const i="ArrowFunctionExpression"===e.type;this.print(e.returnType,e,i),this._noLineTerminator=i},t._predicate=function(e,t){e.predicate&&(e.returnType||this.tokenChar(58),this.space(),this.print(e.predicate,e,t))};var s=r(81483);const{isIdentifier:i}=s;function n(e,t){let r,s=e;if(!s&&t){const e=t.type;"VariableDeclarator"===e?s=t.id:"AssignmentExpression"===e||"AssignmentPattern"===e?s=t.left:"ObjectProperty"===e||"ClassProperty"===e?t.computed&&"StringLiteral"!==t.key.type||(s=t.key):"ClassPrivateProperty"!==e&&"ClassAccessorProperty"!==e||(s=t.key)}if(s){var i,n;if("Identifier"===s.type)r={pos:null==(i=s.loc)?void 0:i.start,name:(null==(n=s.loc)?void 0:n.identifierName)||s.name};else if("PrivateName"===s.type){var a;r={pos:null==(a=s.loc)?void 0:a.start,name:"#"+s.id.name}}else if("StringLiteral"===s.type){var o;r={pos:null==(o=s.loc)?void 0:o.start,name:s.value}}return r}}},86019:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExportAllDeclaration=function(e){var t,r;this.word("export"),this.space(),"type"===e.exportKind&&(this.word("type"),this.space()),this.tokenChar(42),this.space(),this.word("from"),this.space(),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e),this.semicolon()},t.ExportDefaultDeclaration=function(e){u(this,e),this.word("export"),this.noIndentInnerCommentsHere(),this.space(),this.word("default"),this.space();const t=e.declaration;this.print(t,e),c(t)||this.semicolon()},t.ExportDefaultSpecifier=function(e){this.print(e.exported,e)},t.ExportNamedDeclaration=function(e){if(u(this,e),this.word("export"),this.space(),e.declaration){const t=e.declaration;this.print(t,e),c(t)||this.semicolon()}else{"type"===e.exportKind&&(this.word("type"),this.space());const s=e.specifiers.slice(0);let i=!1;for(;;){const t=s[0];if(!n(t)&&!a(t))break;i=!0,this.print(s.shift(),e),s.length&&(this.tokenChar(44),this.space())}var t,r;(s.length||!s.length&&!i)&&(this.tokenChar(123),s.length&&(this.space(),this.printList(s,e),this.space()),this.tokenChar(125)),e.source&&(this.space(),this.word("from"),this.space(),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e)),this.semicolon()}},t.ExportNamespaceSpecifier=function(e){this.tokenChar(42),this.space(),this.word("as"),this.space(),this.print(e.exported,e)},t.ExportSpecifier=function(e){"type"===e.exportKind&&(this.word("type"),this.space()),this.print(e.local,e),e.exported&&e.local.name!==e.exported.name&&(this.space(),this.word("as"),this.space(),this.print(e.exported,e))},t.ImportAttribute=function(e){this.print(e.key),this.tokenChar(58),this.space(),this.print(e.value)},t.ImportDeclaration=function(e){var t,r;this.word("import"),this.space();const s="type"===e.importKind||"typeof"===e.importKind;s?(this.noIndentInnerCommentsHere(),this.word(e.importKind),this.space()):e.module&&(this.noIndentInnerCommentsHere(),this.word("module"),this.space());const i=e.specifiers.slice(0),n=!!i.length;for(;n;){const t=i[0];if(!o(t)&&!l(t))break;this.print(i.shift(),e),i.length&&(this.tokenChar(44),this.space())}i.length?(this.tokenChar(123),this.space(),this.printList(i,e),this.space(),this.tokenChar(125)):s&&!n&&(this.tokenChar(123),this.tokenChar(125)),(n||s)&&(this.space(),this.word("from"),this.space()),null!=(t=e.attributes)&&t.length||null!=(r=e.assertions)&&r.length?(this.print(e.source,e,!0),this.space(),this._printAttributes(e)):this.print(e.source,e),this.semicolon()},t.ImportDefaultSpecifier=function(e){this.print(e.local,e)},t.ImportNamespaceSpecifier=function(e){this.tokenChar(42),this.space(),this.word("as"),this.space(),this.print(e.local,e)},t.ImportSpecifier=function(e){"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space()),this.print(e.imported,e),e.local&&e.local.name!==e.imported.name&&(this.space(),this.word("as"),this.space(),this.print(e.local,e))},t._printAttributes=function(e){const{importAttributesKeyword:t}=this.format,{attributes:r,assertions:s}=e;!r||t||p||(p=!0,console.warn('You are using import attributes, without specifying the desired output syntax.\nPlease specify the "importAttributesKeyword" generator option, whose value can be one of:\n - "with" : `import { a } from "b" with { type: "json" };`\n - "assert" : `import { a } from "b" assert { type: "json" };`\n - "with-legacy" : `import { a } from "b" with type: "json";`\n'));const i="assert"===t||!t&&s;this.word(i?"assert":"with"),this.space(),i||"with"===t?(this.tokenChar(123),this.space(),this.printList(r||s,e),this.space(),this.tokenChar(125)):this.printList(r||s,e)};var s=r(81483);const{isClassDeclaration:i,isExportDefaultSpecifier:n,isExportNamespaceSpecifier:a,isImportDefaultSpecifier:o,isImportNamespaceSpecifier:l,isStatement:c}=s;let p=!1;function u(e,t){i(t.declaration)&&e._shouldPrintDecoratorsBeforeExport(t)&&e.printJoin(t.declaration.decorators,t)}},14679:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BreakStatement=function(e){this.word("break"),h(this,e.label,e,!0)},t.CatchClause=function(e){this.word("catch"),this.space(),e.param&&(this.tokenChar(40),this.print(e.param,e),this.print(e.param.typeAnnotation,e),this.tokenChar(41),this.space()),this.print(e.body,e)},t.ContinueStatement=function(e){this.word("continue"),h(this,e.label,e,!0)},t.DebuggerStatement=function(){this.word("debugger"),this.semicolon()},t.DoWhileStatement=function(e){this.word("do"),this.space(),this.print(e.body,e),this.space(),this.word("while"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.semicolon()},t.ForOfStatement=t.ForInStatement=void 0,t.ForStatement=function(e){this.word("for"),this.space(),this.tokenChar(40),this.inForStatementInitCounter++,this.print(e.init,e),this.inForStatementInitCounter--,this.tokenChar(59),e.test&&(this.space(),this.print(e.test,e)),this.tokenChar(59),e.update&&(this.space(),this.print(e.update,e)),this.tokenChar(41),this.printBlock(e)},t.IfStatement=function(e){this.word("if"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.space();const t=e.alternate&&a(l(e.consequent));t&&(this.tokenChar(123),this.newline(),this.indent()),this.printAndIndentOnComments(e.consequent,e),t&&(this.dedent(),this.newline(),this.tokenChar(125)),e.alternate&&(this.endsWith(125)&&this.space(),this.word("else"),this.space(),this.printAndIndentOnComments(e.alternate,e))},t.LabeledStatement=function(e){this.print(e.label,e),this.tokenChar(58),this.space(),this.print(e.body,e)},t.ReturnStatement=function(e){this.word("return"),h(this,e.argument,e,!1)},t.SwitchCase=function(e){e.test?(this.word("case"),this.space(),this.print(e.test,e),this.tokenChar(58)):(this.word("default"),this.tokenChar(58)),e.consequent.length&&(this.newline(),this.printSequence(e.consequent,e,{indent:!0}))},t.SwitchStatement=function(e){this.word("switch"),this.space(),this.tokenChar(40),this.print(e.discriminant,e),this.tokenChar(41),this.space(),this.tokenChar(123),this.printSequence(e.cases,e,{indent:!0,addNewlines(t,r){if(!t&&e.cases[e.cases.length-1]===r)return-1}}),this.rightBrace(e)},t.ThrowStatement=function(e){this.word("throw"),h(this,e.argument,e,!1)},t.TryStatement=function(e){this.word("try"),this.space(),this.print(e.block,e),this.space(),e.handlers?this.print(e.handlers[0],e):this.print(e.handler,e),e.finalizer&&(this.space(),this.word("finally"),this.space(),this.print(e.finalizer,e))},t.VariableDeclaration=function(e,t){e.declare&&(this.word("declare"),this.space());const{kind:r}=e;this.word(r,"using"===r||"await using"===r),this.space();let s=!1;if(!i(t))for(const t of e.declarations)t.init&&(s=!0);if(this.printList(e.declarations,e,{separator:s?function(){this.tokenChar(44),this.newline()}:void 0,indent:e.declarations.length>1}),i(t))if(n(t)){if(t.init===e)return}else if(t.left===e)return;this.semicolon()},t.VariableDeclarator=function(e){this.print(e.id,e),e.definite&&this.tokenChar(33),this.print(e.id.typeAnnotation,e),e.init&&(this.space(),this.tokenChar(61),this.space(),this.print(e.init,e))},t.WhileStatement=function(e){this.word("while"),this.space(),this.tokenChar(40),this.print(e.test,e),this.tokenChar(41),this.printBlock(e)},t.WithStatement=function(e){this.word("with"),this.space(),this.tokenChar(40),this.print(e.object,e),this.tokenChar(41),this.printBlock(e)};var s=r(81483);const{isFor:i,isForStatement:n,isIfStatement:a,isStatement:o}=s;function l(e){const{body:t}=e;return!1===o(t)?e:l(t)}function c(e){this.word("for"),this.space();const t="ForOfStatement"===e.type;t&&e.await&&(this.word("await"),this.space()),this.noIndentInnerCommentsHere(),this.tokenChar(40),this.print(e.left,e),this.space(),this.word(t?"of":"in"),this.space(),this.print(e.right,e),this.tokenChar(41),this.printBlock(e)}const p=c;t.ForInStatement=p;const u=c;function h(e,t,r,s){t&&(e.space(),e.printTerminatorless(t,r,s)),e.semicolon()}t.ForOfStatement=u},36644:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaggedTemplateExpression=function(e){this.print(e.tag,e),this.print(e.typeParameters,e),this.print(e.quasi,e)},t.TemplateElement=function(e,t){const r=t.quasis[0]===e,s=t.quasis[t.quasis.length-1]===e,i=(r?"`":"}")+e.value.raw+(s?"`":"${");this.token(i,!0)},t.TemplateLiteral=function(e){const t=e.quasis;for(let r=0;r<t.length;r++)this.print(t[r],e),r+1<t.length&&this.print(e.expressions[r],e)}},40062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentPlaceholder=function(){this.tokenChar(63)},t.ArrayPattern=t.ArrayExpression=function(e){const t=e.elements,r=t.length;this.tokenChar(91);for(let s=0;s<t.length;s++){const i=t[s];i?(s>0&&this.space(),this.print(i,e),s<r-1&&this.tokenChar(44)):this.tokenChar(44)}this.tokenChar(93)},t.BigIntLiteral=function(e){const t=this.getPossibleRaw(e);this.format.minified||void 0===t?this.word(e.value+"n"):this.word(t)},t.BooleanLiteral=function(e){this.word(e.value?"true":"false")},t.DecimalLiteral=function(e){const t=this.getPossibleRaw(e);this.format.minified||void 0===t?this.word(e.value+"m"):this.word(t)},t.Identifier=function(e){var t;this.sourceIdentifierName((null==(t=e.loc)?void 0:t.identifierName)||e.name),this.word(e.name)},t.NullLiteral=function(){this.word("null")},t.NumericLiteral=function(e){const t=this.getPossibleRaw(e),r=this.format.jsescOption,s=e.value+"";r.numbers?this.number(i(e.value,r)):null==t?this.number(s):this.format.minified?this.number(t.length<s.length?t:s):this.number(t)},t.ObjectPattern=t.ObjectExpression=function(e){const t=e.properties;this.tokenChar(123),t.length&&(this.space(),this.printList(t,e,{indent:!0,statement:!0}),this.space()),this.sourceWithOffset("end",e.loc,-1),this.tokenChar(125)},t.ObjectMethod=function(e){this.printJoin(e.decorators,e),this._methodHead(e),this.space(),this.print(e.body,e)},t.ObjectProperty=function(e){if(this.printJoin(e.decorators,e),e.computed)this.tokenChar(91),this.print(e.key,e),this.tokenChar(93);else{if(n(e.value)&&a(e.key)&&e.key.name===e.value.left.name)return void this.print(e.value,e);if(this.print(e.key,e),e.shorthand&&a(e.key)&&a(e.value)&&e.key.name===e.value.name)return}this.tokenChar(58),this.space(),this.print(e.value,e)},t.PipelineBareFunction=function(e){this.print(e.callee,e)},t.PipelinePrimaryTopicReference=function(){this.tokenChar(35)},t.PipelineTopicExpression=function(e){this.print(e.expression,e)},t.RecordExpression=function(e){const t=e.properties;let r,s;if("bar"===this.format.recordAndTupleSyntaxType)r="{|",s="|}";else{if("hash"!==this.format.recordAndTupleSyntaxType&&null!=this.format.recordAndTupleSyntaxType)throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);r="#{",s="}"}this.token(r),t.length&&(this.space(),this.printList(t,e,{indent:!0,statement:!0}),this.space()),this.token(s)},t.RegExpLiteral=function(e){this.word(`/${e.pattern}/${e.flags}`)},t.SpreadElement=t.RestElement=function(e){this.token("..."),this.print(e.argument,e)},t.StringLiteral=function(e){const t=this.getPossibleRaw(e);if(!this.format.minified&&void 0!==t)return void this.token(t);const r=i(e.value,this.format.jsescOption);this.token(r)},t.TopicReference=function(){const{topicToken:e}=this.format;if(!o.has(e)){const t=JSON.stringify(e),r=Array.from(o,(e=>JSON.stringify(e)));throw new Error(`The "topicToken" generator option must be one of ${r.join(", ")} (${t} received instead).`)}this.token(e)},t.TupleExpression=function(e){const t=e.elements,r=t.length;let s,i;if("bar"===this.format.recordAndTupleSyntaxType)s="[|",i="|]";else{if("hash"!==this.format.recordAndTupleSyntaxType)throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);s="#[",i="]"}this.token(s);for(let s=0;s<t.length;s++){const i=t[s];i&&(s>0&&this.space(),this.print(i,e),s<r-1&&this.tokenChar(44))}this.token(i)};var s=r(81483),i=r(94669);const{isAssignmentPattern:n,isIdentifier:a}=s,o=new Set(["^^","@@","^","%","#"])},6704:(e,t)=>{"use strict";function r(e,t,r){if(e.token("{"),t.length){e.indent(),e.newline();for(const s of t)e.print(s,r),e.newline();e.dedent()}e.rightBrace(r)}function s(e,t,r){e.printJoin(t.types,t,{separator(){this.space(),this.token(r),this.space()}})}function i(e,t){!0!==t&&e.token(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TSAnyKeyword=function(){this.word("any")},t.TSArrayType=function(e){this.print(e.elementType,e,!0),this.token("[]")},t.TSSatisfiesExpression=t.TSAsExpression=function(e){var t;const{type:r,expression:s,typeAnnotation:i}=e,n=!(null==(t=s.trailingComments)||!t.length);this.print(s,e,!0,void 0,n),this.space(),this.word("TSAsExpression"===r?"as":"satisfies"),this.space(),this.print(i,e)},t.TSBigIntKeyword=function(){this.word("bigint")},t.TSBooleanKeyword=function(){this.word("boolean")},t.TSCallSignatureDeclaration=function(e){this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSConditionalType=function(e){this.print(e.checkType),this.space(),this.word("extends"),this.space(),this.print(e.extendsType),this.space(),this.tokenChar(63),this.space(),this.print(e.trueType),this.space(),this.tokenChar(58),this.space(),this.print(e.falseType)},t.TSConstructSignatureDeclaration=function(e){this.word("new"),this.space(),this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSConstructorType=function(e){e.abstract&&(this.word("abstract"),this.space()),this.word("new"),this.space(),this.tsPrintFunctionOrConstructorType(e)},t.TSDeclareFunction=function(e,t){e.declare&&(this.word("declare"),this.space()),this._functionHead(e,t),this.tokenChar(59)},t.TSDeclareMethod=function(e){this._classMethodHead(e),this.tokenChar(59)},t.TSEnumDeclaration=function(e){const{declare:t,const:s,id:i,members:n}=e;t&&(this.word("declare"),this.space()),s&&(this.word("const"),this.space()),this.word("enum"),this.space(),this.print(i,e),this.space(),r(this,n,e)},t.TSEnumMember=function(e){const{id:t,initializer:r}=e;this.print(t,e),r&&(this.space(),this.tokenChar(61),this.space(),this.print(r,e)),this.tokenChar(44)},t.TSExportAssignment=function(e){this.word("export"),this.space(),this.tokenChar(61),this.space(),this.print(e.expression,e),this.tokenChar(59)},t.TSExpressionWithTypeArguments=function(e){this.print(e.expression,e),this.print(e.typeParameters,e)},t.TSExternalModuleReference=function(e){this.token("require("),this.print(e.expression,e),this.tokenChar(41)},t.TSFunctionType=function(e){this.tsPrintFunctionOrConstructorType(e)},t.TSImportEqualsDeclaration=function(e){const{isExport:t,id:r,moduleReference:s}=e;t&&(this.word("export"),this.space()),this.word("import"),this.space(),this.print(r,e),this.space(),this.tokenChar(61),this.space(),this.print(s,e),this.tokenChar(59)},t.TSImportType=function(e){const{argument:t,qualifier:r,typeParameters:s}=e;this.word("import"),this.tokenChar(40),this.print(t,e),this.tokenChar(41),r&&(this.tokenChar(46),this.print(r,e)),s&&this.print(s,e)},t.TSIndexSignature=function(e){const{readonly:t,static:r}=e;r&&(this.word("static"),this.space()),t&&(this.word("readonly"),this.space()),this.tokenChar(91),this._parameters(e.parameters,e),this.tokenChar(93),this.print(e.typeAnnotation,e),this.tokenChar(59)},t.TSIndexedAccessType=function(e){this.print(e.objectType,e,!0),this.tokenChar(91),this.print(e.indexType,e),this.tokenChar(93)},t.TSInferType=function(e){this.token("infer"),this.space(),this.print(e.typeParameter)},t.TSInstantiationExpression=function(e){this.print(e.expression,e),this.print(e.typeParameters,e)},t.TSInterfaceBody=function(e){this.tsPrintTypeLiteralOrInterfaceBody(e.body,e)},t.TSInterfaceDeclaration=function(e){const{declare:t,id:r,typeParameters:s,extends:i,body:n}=e;t&&(this.word("declare"),this.space()),this.word("interface"),this.space(),this.print(r,e),this.print(s,e),null!=i&&i.length&&(this.space(),this.word("extends"),this.space(),this.printList(i,e)),this.space(),this.print(n,e)},t.TSIntersectionType=function(e){s(this,e,"&")},t.TSIntrinsicKeyword=function(){this.word("intrinsic")},t.TSLiteralType=function(e){this.print(e.literal,e)},t.TSMappedType=function(e){const{nameType:t,optional:r,readonly:s,typeParameter:n}=e;this.tokenChar(123),this.space(),s&&(i(this,s),this.word("readonly"),this.space()),this.tokenChar(91),this.word(n.name),this.space(),this.word("in"),this.space(),this.print(n.constraint,n),t&&(this.space(),this.word("as"),this.space(),this.print(t,e)),this.tokenChar(93),r&&(i(this,r),this.tokenChar(63)),this.tokenChar(58),this.space(),this.print(e.typeAnnotation,e),this.space(),this.tokenChar(125)},t.TSMethodSignature=function(e){const{kind:t}=e;"set"!==t&&"get"!==t||(this.word(t),this.space()),this.tsPrintPropertyOrMethodName(e),this.tsPrintSignatureDeclarationBase(e),this.tokenChar(59)},t.TSModuleBlock=function(e){r(this,e.body,e)},t.TSModuleDeclaration=function(e){const{declare:t,id:r}=e;if(t&&(this.word("declare"),this.space()),e.global||(this.word("Identifier"===r.type?"namespace":"module"),this.space()),this.print(r,e),!e.body)return void this.tokenChar(59);let s=e.body;for(;"TSModuleDeclaration"===s.type;)this.tokenChar(46),this.print(s.id,s),s=s.body;this.space(),this.print(s,e)},t.TSNamedTupleMember=function(e){this.print(e.label,e),e.optional&&this.tokenChar(63),this.tokenChar(58),this.space(),this.print(e.elementType,e)},t.TSNamespaceExportDeclaration=function(e){this.word("export"),this.space(),this.word("as"),this.space(),this.word("namespace"),this.space(),this.print(e.id,e)},t.TSNeverKeyword=function(){this.word("never")},t.TSNonNullExpression=function(e){this.print(e.expression,e),this.tokenChar(33)},t.TSNullKeyword=function(){this.word("null")},t.TSNumberKeyword=function(){this.word("number")},t.TSObjectKeyword=function(){this.word("object")},t.TSOptionalType=function(e){this.print(e.typeAnnotation,e),this.tokenChar(63)},t.TSParameterProperty=function(e){e.accessibility&&(this.word(e.accessibility),this.space()),e.readonly&&(this.word("readonly"),this.space()),this._param(e.parameter)},t.TSParenthesizedType=function(e){this.tokenChar(40),this.print(e.typeAnnotation,e),this.tokenChar(41)},t.TSPropertySignature=function(e){const{readonly:t,initializer:r}=e;t&&(this.word("readonly"),this.space()),this.tsPrintPropertyOrMethodName(e),this.print(e.typeAnnotation,e),r&&(this.space(),this.tokenChar(61),this.space(),this.print(r,e)),this.tokenChar(59)},t.TSQualifiedName=function(e){this.print(e.left,e),this.tokenChar(46),this.print(e.right,e)},t.TSRestType=function(e){this.token("..."),this.print(e.typeAnnotation,e)},t.TSStringKeyword=function(){this.word("string")},t.TSSymbolKeyword=function(){this.word("symbol")},t.TSThisType=function(){this.word("this")},t.TSTupleType=function(e){this.tokenChar(91),this.printList(e.elementTypes,e),this.tokenChar(93)},t.TSTypeAliasDeclaration=function(e){const{declare:t,id:r,typeParameters:s,typeAnnotation:i}=e;t&&(this.word("declare"),this.space()),this.word("type"),this.space(),this.print(r,e),this.print(s,e),this.space(),this.tokenChar(61),this.space(),this.print(i,e),this.tokenChar(59)},t.TSTypeAnnotation=function(e){this.tokenChar(58),this.space(),e.optional&&this.tokenChar(63),this.print(e.typeAnnotation,e)},t.TSTypeAssertion=function(e){const{typeAnnotation:t,expression:r}=e;this.tokenChar(60),this.print(t,e),this.tokenChar(62),this.space(),this.print(r,e)},t.TSTypeLiteral=function(e){this.tsPrintTypeLiteralOrInterfaceBody(e.members,e)},t.TSTypeOperator=function(e){this.word(e.operator),this.space(),this.print(e.typeAnnotation,e)},t.TSTypeParameter=function(e){e.in&&(this.word("in"),this.space()),e.out&&(this.word("out"),this.space()),this.word(e.name),e.constraint&&(this.space(),this.word("extends"),this.space(),this.print(e.constraint,e)),e.default&&(this.space(),this.tokenChar(61),this.space(),this.print(e.default,e))},t.TSTypeParameterDeclaration=t.TSTypeParameterInstantiation=function(e,t){this.tokenChar(60),this.printList(e.params,e,{}),"ArrowFunctionExpression"===t.type&&1===e.params.length&&this.tokenChar(44),this.tokenChar(62)},t.TSTypePredicate=function(e){e.asserts&&(this.word("asserts"),this.space()),this.print(e.parameterName),e.typeAnnotation&&(this.space(),this.word("is"),this.space(),this.print(e.typeAnnotation.typeAnnotation))},t.TSTypeQuery=function(e){this.word("typeof"),this.space(),this.print(e.exprName),e.typeParameters&&this.print(e.typeParameters,e)},t.TSTypeReference=function(e){this.print(e.typeName,e,!0),this.print(e.typeParameters,e,!0)},t.TSUndefinedKeyword=function(){this.word("undefined")},t.TSUnionType=function(e){s(this,e,"|")},t.TSUnknownKeyword=function(){this.word("unknown")},t.TSVoidKeyword=function(){this.word("void")},t.tsPrintClassMemberModifiers=function(e){const t="ClassAccessorProperty"===e.type||"ClassProperty"===e.type;t&&e.declare&&(this.word("declare"),this.space()),e.accessibility&&(this.word(e.accessibility),this.space()),e.static&&(this.word("static"),this.space()),e.override&&(this.word("override"),this.space()),e.abstract&&(this.word("abstract"),this.space()),t&&e.readonly&&(this.word("readonly"),this.space())},t.tsPrintFunctionOrConstructorType=function(e){const{typeParameters:t}=e,r=e.parameters;this.print(t,e),this.tokenChar(40),this._parameters(r,e),this.tokenChar(41),this.space(),this.token("=>"),this.space();const s=e.typeAnnotation;this.print(s.typeAnnotation,e)},t.tsPrintPropertyOrMethodName=function(e){e.computed&&this.tokenChar(91),this.print(e.key,e),e.computed&&this.tokenChar(93),e.optional&&this.tokenChar(63)},t.tsPrintSignatureDeclarationBase=function(e){const{typeParameters:t}=e,r=e.parameters;this.print(t,e),this.tokenChar(40),this._parameters(r,e),this.tokenChar(41);const s=e.typeAnnotation;this.print(s,e)},t.tsPrintTypeLiteralOrInterfaceBody=function(e,t){r(this,e,t)}},63692:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGenerator=void 0,t.default=function(e,t,r){return new n(e,t,r).generate()};var s=r(11693),i=r(60271);class n extends i.default{constructor(e,t={},r){const i=function(e,t){var r;const s={auxiliaryCommentBefore:t.auxiliaryCommentBefore,auxiliaryCommentAfter:t.auxiliaryCommentAfter,shouldPrintComment:t.shouldPrintComment,retainLines:t.retainLines,retainFunctionParens:t.retainFunctionParens,comments:null==t.comments||t.comments,compact:t.compact,minified:t.minified,concise:t.concise,indent:{adjustMultilineComment:!0,style:" "},jsescOption:Object.assign({quotes:"double",wrap:!0,minimal:!1},t.jsescOption),recordAndTupleSyntaxType:null!=(r=t.recordAndTupleSyntaxType)?r:"hash",topicToken:t.topicToken,importAttributesKeyword:t.importAttributesKeyword};s.decoratorsBeforeExport=t.decoratorsBeforeExport,s.jsescOption.json=t.jsonCompatibleStrings,s.minified?(s.compact=!0,s.shouldPrintComment=s.shouldPrintComment||(()=>s.comments)):s.shouldPrintComment=s.shouldPrintComment||(e=>s.comments||e.includes("@license")||e.includes("@preserve")),"auto"===s.compact&&(s.compact="string"==typeof e&&e.length>5e5,s.compact&&console.error(`[BABEL] Note: The code generator has deoptimised the styling of ${t.filename} as it exceeds the max of 500KB.`)),s.compact&&(s.indent.adjustMultilineComment=!1);const{auxiliaryCommentBefore:i,auxiliaryCommentAfter:n,shouldPrintComment:a}=s;return i&&!a(i)&&(s.auxiliaryCommentBefore=void 0),n&&!a(n)&&(s.auxiliaryCommentAfter=void 0),s}(r,t);super(i,t.sourceMaps?new s.default(t,r):null),this.ast=void 0,this.ast=e}generate(){return super.generate(this.ast)}}t.CodeGenerator=class{constructor(e,t,r){this._generator=void 0,this._generator=new n(e,t,r)}generate(){return this._generator.generate()}}},92505:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.needsParens=function(e,t,r){return!!t&&(!(!p(t)||t.callee!==e||!m(e))||f(h,e,t,r))},t.needsWhitespace=y,t.needsWhitespaceAfter=function(e,t){return y(e,t,2)},t.needsWhitespaceBefore=function(e,t){return y(e,t,1)};var s=r(65327),i=r(43161),n=r(81483);const{FLIPPED_ALIAS_KEYS:a,isCallExpression:o,isExpressionStatement:l,isMemberExpression:c,isNewExpression:p}=n;function u(e){const t={};function r(e,r){const s=t[e];t[e]=s?function(e,t,i){const n=s(e,t,i);return null==n?r(e,t,i):n}:r}for(const t of Object.keys(e)){const s=a[t];if(s)for(const i of s)r(i,e[t]);else r(t,e[t])}return t}const h=u(i),d=u(s.nodes);function f(e,t,r,s){const i=e[t.type];return i?i(t,r,s):null}function m(e){return!!o(e)||c(e)&&m(e.object)}function y(e,t,r){if(!e)return!1;l(e)&&(e=e.expression);const s=f(d,e,t);return"number"==typeof s&&0!=(s&r)}},43161:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowFunctionExpression=function(e,t){return y(t)||ae(e,t)},t.AssignmentExpression=function(e,t){return!!N(e.left)||ae(e,t)},t.Binary=function(e,t){if("**"===e.operator&&c(t,{operator:"**"}))return t.left===e;if(se(e,t))return!0;if(ie(e,t)||X(t)||o(t))return!0;if(l(t)){const r=t.operator,s=te[r],i=e.operator,n=te[i];if(s===n&&t.right===e&&!C(t)||s>n)return!0}},t.BinaryExpression=function(e,t){return"in"===e.operator&&(Y(t)||x(t))},t.ClassExpression=function(e,t,r){return oe(r,5)},t.ConditionalExpression=ae,t.DoExpression=function(e,t,r){return!e.async&&oe(r,1)},t.FunctionExpression=function(e,t,r){return oe(r,5)},t.FunctionTypeAnnotation=function(e,t,r){if(!(r.length<3))return J(t)||w(t)||i(t)||G(t)&&n(r[r.length-3])},t.Identifier=function(e,t,r){var s;return!(null==(s=e.extra)||!s.parenthesized||!a(t,{left:e})||!T(t.right)&&!d(t.right)||null!=t.right.id)||("let"===e.name?oe(r,I(t,{object:e,computed:!0})||D(t,{object:e,computed:!0,optional:!1})?57:32):"async"===e.name&&E(t)&&e===t.left)},t.LogicalExpression=function(e,t){if(re(t))return!0;switch(e.operator){case"||":return!!C(t)&&("??"===t.operator||"&&"===t.operator);case"&&":return C(t,{operator:"??"});case"??":return C(t)&&"??"!==t.operator}},t.NullableTypeAnnotation=function(e,t){return i(t)},t.ObjectExpression=function(e,t,r){return oe(r,3)},t.OptionalIndexedAccessType=function(e,t){return A(t,{objectType:e})},t.OptionalCallExpression=t.OptionalMemberExpression=function(e,t){return u(t,{callee:e})||I(t,{object:e})},t.SequenceExpression=function(e,t){return!(P(t)||z(t)||M(t)||S(t)&&t.test===e||Q(t)&&t.test===e||v(t)&&t.right===e||L(t)&&t.discriminant===e||b(t)&&t.expression===e)},t.TSTypeAssertion=t.TSSatisfiesExpression=t.TSAsExpression=function(){return!0},t.TSInferType=function(e,t){return R(t)||$(t)},t.TSInstantiationExpression=function(e,t){return(u(t)||O(t)||_(t)||B(t))&&!!t.typeParameters},t.TSIntersectionType=t.TSUnionType=function(e,t){return R(t)||$(t)||U(t)||W(t)||K(t)},t.UnaryLike=ne,t.IntersectionTypeAnnotation=t.UnionTypeAnnotation=function(e,t){return i(t)||k(t)||w(t)||J(t)},t.UpdateExpression=function(e,t){return ie(e,t)||se(e,t)},t.AwaitExpression=t.YieldExpression=function(e,t){return l(t)||X(t)||ie(e,t)||o(t)&&Z(e)||m(t)&&e===t.test||se(e,t)};var s=r(81483);const{isArrayTypeAnnotation:i,isArrowFunctionExpression:n,isAssignmentExpression:a,isAwaitExpression:o,isBinary:l,isBinaryExpression:c,isUpdateExpression:p,isCallExpression:u,isClass:h,isClassExpression:d,isConditional:f,isConditionalExpression:m,isExportDeclaration:y,isExportDefaultDeclaration:g,isExpressionStatement:b,isFor:x,isForInStatement:v,isForOfStatement:E,isForStatement:P,isFunctionExpression:T,isIfStatement:S,isIndexedAccessType:A,isIntersectionTypeAnnotation:w,isLogicalExpression:C,isMemberExpression:I,isNewExpression:_,isNullableTypeAnnotation:k,isObjectPattern:N,isOptionalCallExpression:O,isOptionalMemberExpression:D,isReturnStatement:M,isSequenceExpression:F,isSwitchStatement:L,isTSArrayType:R,isTSAsExpression:j,isTSInstantiationExpression:B,isTSIntersectionType:U,isTSNonNullExpression:V,isTSOptionalType:$,isTSRestType:K,isTSTypeAssertion:H,isTSUnionType:W,isTaggedTemplateExpression:q,isThrowStatement:z,isTypeAnnotation:G,isUnaryLike:X,isUnionTypeAnnotation:J,isVariableDeclarator:Y,isWhileStatement:Q,isYieldExpression:Z,isTSSatisfiesExpression:ee}=s,te={"||":0,"??":0,"|>":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,in:6,instanceof:6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};function re(e){return j(e)||ee(e)||H(e)}const se=(e,t)=>h(t,{superClass:e}),ie=(e,t)=>(I(t)||D(t))&&t.object===e||(u(t)||O(t)||_(t))&&t.callee===e||q(t)&&t.tag===e||V(t);function ne(e,t){return ie(e,t)||c(t,{operator:"**",left:e})||se(e,t)}function ae(e,t){return!!(X(t)||l(t)||m(t,{test:e})||o(t)||re(t))||ne(e,t)}function oe(e,t){const r=1&t,s=2&t,i=4&t,o=8&t,c=16&t,u=32&t;let h=e.length-1;if(h<=0)return;let d=e[h];h--;let m=e[h];for(;h>=0;){if(r&&b(m,{expression:d})||i&&g(m,{declaration:d})||s&&n(m,{body:d})||o&&P(m,{init:d})||c&&v(m,{left:d})||u&&E(m,{left:d}))return!0;if(!(h>0&&(ie(d,m)&&!_(m)||F(m)&&m.expressions[0]===d||p(m)&&!m.prefix||f(m,{test:d})||l(m,{left:d})||a(m,{left:d}))))return!1;d=m,h--,m=e[h]}return!1}},65327:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nodes=void 0;var s=r(81483);const{FLIPPED_ALIAS_KEYS:i,isArrayExpression:n,isAssignmentExpression:a,isBinary:o,isBlockStatement:l,isCallExpression:c,isFunction:p,isIdentifier:u,isLiteral:h,isMemberExpression:d,isObjectExpression:f,isOptionalCallExpression:m,isOptionalMemberExpression:y,isStringLiteral:g}=s;function b(e,t){return e?(d(e)||y(e)?(b(e.object,t),e.computed&&b(e.property,t)):o(e)||a(e)?(b(e.left,t),b(e.right,t)):c(e)||m(e)?(t.hasCall=!0,b(e.callee,t)):p(e)?t.hasFunction=!0:u(e)&&(t.hasHelper=t.hasHelper||e.callee&&v(e.callee)),t):t}function x(e){return b(e,{hasCall:!1,hasFunction:!1,hasHelper:!1})}function v(e){return!!e&&(d(e)?v(e.object)||v(e.property):u(e)?"require"===e.name||95===e.name.charCodeAt(0):c(e)?v(e.callee):!(!o(e)&&!a(e))&&(u(e.left)&&v(e.left)||v(e.right)))}function E(e){return h(e)||f(e)||n(e)||u(e)||d(e)}const P={AssignmentExpression(e){const t=x(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return t.hasFunction?3:2},SwitchCase:(e,t)=>(e.consequent.length||t.cases[0]===e?1:0)|(e.consequent.length||t.cases[t.cases.length-1]!==e?0:2),LogicalExpression(e){if(p(e.left)||p(e.right))return 2},Literal(e){if(g(e)&&"use strict"===e.value)return 2},CallExpression(e){if(p(e.callee)||v(e))return 3},OptionalCallExpression(e){if(p(e.callee))return 3},VariableDeclaration(e){for(let t=0;t<e.declarations.length;t++){const r=e.declarations[t];let s=v(r.id)&&!E(r.init);if(!s&&r.init){const e=x(r.init);s=v(r.init)&&e.hasCall||e.hasFunction}if(s)return 3}},IfStatement(e){if(l(e.consequent))return 3}};t.nodes=P,P.ObjectProperty=P.ObjectTypeProperty=P.ObjectMethod=function(e,t){if(t.properties[0]===e)return 1},P.ObjectTypeCallProperty=function(e,t){var r;if(t.callProperties[0]===e&&(null==(r=t.properties)||!r.length))return 1},P.ObjectTypeIndexer=function(e,t){var r,s;if(!(t.indexers[0]!==e||null!=(r=t.properties)&&r.length||null!=(s=t.callProperties)&&s.length))return 1},P.ObjectTypeInternalSlot=function(e,t){var r,s,i;if(!(t.internalSlots[0]!==e||null!=(r=t.properties)&&r.length||null!=(s=t.callProperties)&&s.length||null!=(i=t.indexers)&&i.length))return 1},[["Function",!0],["Class",!0],["Loop",!0],["LabeledStatement",!0],["SwitchStatement",!0],["TryStatement",!0]].forEach((function([e,t]){[e].concat(i[e]||[]).forEach((function(e){const r=t?3:0;P[e]=()=>r}))}))},60271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(69417),i=r(92505),n=r(81483),a=r(87817);const{isFunction:o,isStatement:l,isClassBody:c,isTSInterfaceBody:p,isTSEnumDeclaration:u}=n,h=/e/i,d=/\.0+$/,f=/^0[box]/,m=/^\s*[@#]__PURE__\s*$/,y=/[\n\r\u2028\u2029]/,g=/\*\//,{needsParens:b}=i;class x{constructor(e,t){this.inForStatementInitCounter=0,this._printStack=[],this._indent=0,this._indentChar=0,this._indentRepeat=0,this._insideAux=!1,this._parenPushNewlineState=null,this._noLineTerminator=!1,this._printAuxAfterOnNextUserNode=!1,this._printedComments=new Set,this._endsWithInteger=!1,this._endsWithWord=!1,this._lastCommentLine=0,this._endsWithInnerRaw=!1,this._indentInnerComments=!0,this.format=e,this._buf=new s.default(t),this._indentChar=e.indent.style.charCodeAt(0),this._indentRepeat=e.indent.style.length,this._inputMap=null==t?void 0:t._inputMap}generate(e){return this.print(e),this._maybeAddAuxComment(),this._buf.get()}indent(){this.format.compact||this.format.concise||this._indent++}dedent(){this.format.compact||this.format.concise||this._indent--}semicolon(e=!1){this._maybeAddAuxComment(),e?this._appendChar(59):this._queue(59),this._noLineTerminator=!1}rightBrace(e){this.format.minified&&this._buf.removeLastSemicolon(),this.sourceWithOffset("end",e.loc,-1),this.tokenChar(125)}rightParens(e){this.sourceWithOffset("end",e.loc,-1),this.tokenChar(41)}space(e=!1){if(!this.format.compact)if(e)this._space();else if(this._buf.hasContent()){const e=this.getLastChar();32!==e&&10!==e&&this._space()}}word(e,t=!1){this._maybePrintInnerComments(),(this._endsWithWord||47===e.charCodeAt(0)&&this.endsWith(47))&&this._space(),this._maybeAddAuxComment(),this._append(e,!1),this._endsWithWord=!0,this._noLineTerminator=t}number(e){this.word(e),this._endsWithInteger=Number.isInteger(+e)&&!f.test(e)&&!h.test(e)&&!d.test(e)&&46!==e.charCodeAt(e.length-1)}token(e,t=!1){this._maybePrintInnerComments();const r=this.getLastChar(),s=e.charCodeAt(0);(33===r&&("--"===e||61===s)||43===s&&43===r||45===s&&45===r||46===s&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._append(e,t),this._noLineTerminator=!1}tokenChar(e){this._maybePrintInnerComments();const t=this.getLastChar();(43===e&&43===t||45===e&&45===t||46===e&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._appendChar(e),this._noLineTerminator=!1}newline(e=1,t){if(!(e<=0)){if(!t){if(this.format.retainLines||this.format.compact)return;if(this.format.concise)return void this.space()}e>2&&(e=2),e-=this._buf.getNewlineCount();for(let t=0;t<e;t++)this._newline()}}endsWith(e){return this.getLastChar()===e}getLastChar(){return this._buf.getLastChar()}endsWithCharAndNewline(){return this._buf.endsWithCharAndNewline()}removeTrailingNewline(){this._buf.removeTrailingNewline()}exactSource(e,t){e?(this._catchUp("start",e),this._buf.exactSource(e,t)):t()}source(e,t){t&&(this._catchUp(e,t),this._buf.source(e,t))}sourceWithOffset(e,t,r){t&&(this._catchUp(e,t),this._buf.sourceWithOffset(e,t,r))}withSource(e,t,r){t?(this._catchUp(e,t),this._buf.withSource(e,t,r)):r()}sourceIdentifierName(e,t){if(!this._buf._canMarkIdName)return;const r=this._buf._sourcePosition;r.identifierNamePos=t,r.identifierName=e}_space(){this._queue(32)}_newline(){this._queue(10)}_append(e,t){this._maybeAddParen(e),this._maybeIndent(e.charCodeAt(0)),this._buf.append(e,t),this._endsWithWord=!1,this._endsWithInteger=!1}_appendChar(e){this._maybeAddParenChar(e),this._maybeIndent(e),this._buf.appendChar(e),this._endsWithWord=!1,this._endsWithInteger=!1}_queue(e){this._maybeAddParenChar(e),this._maybeIndent(e),this._buf.queue(e),this._endsWithWord=!1,this._endsWithInteger=!1}_maybeIndent(e){this._indent&&10!==e&&this.endsWith(10)&&this._buf.queueIndentation(this._indentChar,this._getIndent())}_shouldIndent(e){if(this._indent&&10!==e&&this.endsWith(10))return!0}_maybeAddParenChar(e){const t=this._parenPushNewlineState;t&&32!==e&&(10===e?(this.tokenChar(40),this.indent(),t.printed=!0):this._parenPushNewlineState=null)}_maybeAddParen(e){const t=this._parenPushNewlineState;if(!t)return;const r=e.length;let s;for(s=0;s<r&&32===e.charCodeAt(s);s++)continue;if(s===r)return;const i=e.charCodeAt(s);if(10!==i){if(47!==i||s+1===r)return void(this._parenPushNewlineState=null);const t=e.charCodeAt(s+1);if(42===t){if(m.test(e.slice(s+2,r-2)))return}else if(47!==t)return void(this._parenPushNewlineState=null)}this.tokenChar(40),this.indent(),t.printed=!0}catchUp(e){if(!this.format.retainLines)return;const t=e-this._buf.getCurrentLine();for(let e=0;e<t;e++)this._newline()}_catchUp(e,t){var r;if(!this.format.retainLines)return;const s=null==t||null==(r=t[e])?void 0:r.line;if(null!=s){const e=s-this._buf.getCurrentLine();for(let t=0;t<e;t++)this._newline()}}_getIndent(){return this._indentRepeat*this._indent}printTerminatorless(e,t,r){if(r)this._noLineTerminator=!0,this.print(e,t);else{const r={printed:!1};this._parenPushNewlineState=r,this.print(e,t),r.printed&&(this.dedent(),this.newline(),this.tokenChar(41))}}print(e,t,r,s,i){var n;if(!e)return;this._endsWithInnerRaw=!1;const a=e.type,o=this.format,l=o.concise;e._compact&&(o.concise=!0);const c=this[a];if(void 0===c)throw new ReferenceError(`unknown node of type ${JSON.stringify(a)} with constructor ${JSON.stringify(e.constructor.name)}`);this._printStack.push(e);const p=this._insideAux;this._insideAux=null==e.loc,this._maybeAddAuxComment(this._insideAux&&!p);const u=i||o.retainFunctionParens&&"FunctionExpression"===a&&(null==(n=e.extra)?void 0:n.parenthesized)||b(e,t,this._printStack);u&&(this.tokenChar(40),this._endsWithInnerRaw=!1),this._lastCommentLine=0,this._printLeadingComments(e,t);const h="Program"===a||"File"===a?null:e.loc;this.exactSource(h,c.bind(this,e,t)),u?(this._printTrailingComments(e,t),this.tokenChar(41),this._noLineTerminator=r):r&&!this._noLineTerminator?(this._noLineTerminator=!0,this._printTrailingComments(e,t)):this._printTrailingComments(e,t,s),this._printStack.pop(),o.concise=l,this._insideAux=p,this._endsWithInnerRaw=!1}_maybeAddAuxComment(e){e&&this._printAuxBeforeComment(),this._insideAux||this._printAuxAfterComment()}_printAuxBeforeComment(){if(this._printAuxAfterOnNextUserNode)return;this._printAuxAfterOnNextUserNode=!0;const e=this.format.auxiliaryCommentBefore;e&&this._printComment({type:"CommentBlock",value:e},0)}_printAuxAfterComment(){if(!this._printAuxAfterOnNextUserNode)return;this._printAuxAfterOnNextUserNode=!1;const e=this.format.auxiliaryCommentAfter;e&&this._printComment({type:"CommentBlock",value:e},0)}getPossibleRaw(e){const t=e.extra;if(null!=(null==t?void 0:t.raw)&&null!=t.rawValue&&e.value===t.rawValue)return t.raw}printJoin(e,t,r={}){if(null==e||!e.length)return;let{indent:s}=r;if(null==s&&this.format.retainLines){var i;const t=null==(i=e[0].loc)?void 0:i.start.line;null!=t&&t!==this._buf.getCurrentLine()&&(s=!0)}s&&this.indent();const n={addNewlines:r.addNewlines,nextNodeStartLine:0},a=r.separator?r.separator.bind(this):null,o=e.length;for(let s=0;s<o;s++){const i=e[s];if(i&&(r.statement&&this._printNewline(0===s,n),this.print(i,t,void 0,r.trailingCommentsLineOffset||0),null==r.iterator||r.iterator(i,s),s<o-1&&(null==a||a()),r.statement))if(s+1===o)this.newline(1);else{var l;const t=e[s+1];n.nextNodeStartLine=(null==(l=t.loc)?void 0:l.start.line)||0,this._printNewline(!0,n)}}s&&this.dedent()}printAndIndentOnComments(e,t){const r=e.leadingComments&&e.leadingComments.length>0;r&&this.indent(),this.print(e,t),r&&this.dedent()}printBlock(e){const t=e.body;"EmptyStatement"!==t.type&&this.space(),this.print(t,e)}_printTrailingComments(e,t,r){const{innerComments:s,trailingComments:i}=e;null!=s&&s.length&&this._printComments(2,s,e,t,r),null!=i&&i.length&&this._printComments(2,i,e,t,r)}_printLeadingComments(e,t){const r=e.leadingComments;null!=r&&r.length&&this._printComments(0,r,e,t)}_maybePrintInnerComments(){this._endsWithInnerRaw&&this.printInnerComments(),this._endsWithInnerRaw=!0,this._indentInnerComments=!0}printInnerComments(){const e=this._printStack[this._printStack.length-1],t=e.innerComments;if(null==t||!t.length)return;const r=this.endsWith(32),s=this._indentInnerComments,i=this._printedComments.size;s&&this.indent(),this._printComments(1,t,e),r&&i!==this._printedComments.size&&this.space(),s&&this.dedent()}noIndentInnerCommentsHere(){this._indentInnerComments=!1}printSequence(e,t,r={}){r.statement=!0,null!=r.indent||(r.indent=!1),this.printJoin(e,t,r)}printList(e,t,r={}){null==r.separator&&(r.separator=E),this.printJoin(e,t,r)}_printNewline(e,t){const r=this.format;if(r.retainLines||r.compact)return;if(r.concise)return void this.space();if(!e)return;const s=t.nextNodeStartLine,i=this._lastCommentLine;if(s>0&&i>0){const e=s-i;if(e>=0)return void this.newline(e||1)}this._buf.hasContent()&&this.newline(1)}_shouldPrintComment(e){return e.ignore||this._printedComments.has(e)?0:this._noLineTerminator&&(y.test(e.value)||g.test(e.value))?2:(this._printedComments.add(e),this.format.shouldPrintComment(e.value)?1:0)}_printComment(e,t){const r=this._noLineTerminator,s="CommentBlock"===e.type,i=s&&1!==t&&!this._noLineTerminator;i&&this._buf.hasContent()&&2!==t&&this.newline(1);const n=this.getLastChar();let a;if(91!==n&&123!==n&&this.space(),s){if(a=`/*${e.value}*/`,this.format.indent.adjustMultilineComment){var o;const t=null==(o=e.loc)?void 0:o.start.column;if(t){const e=new RegExp("\\n\\s{1,"+t+"}","g");a=a.replace(e,"\n")}let r=this.format.retainLines?0:this._buf.getCurrentColumn();(this._shouldIndent(47)||this.format.retainLines)&&(r+=this._getIndent()),a=a.replace(/\n(?!$)/g,`\n${" ".repeat(r)}`)}}else a=r?`/*${e.value}*/`:`//${e.value}`;this.endsWith(47)&&this._space(),this.source("start",e.loc),this._append(a,s),s||r||this.newline(1,!0),i&&3!==t&&this.newline(1)}_printComments(e,t,r,s,i=0){const n=r.loc,a=t.length;let h=!!n;const d=h?n.start.line:0,f=h?n.end.line:0;let m=0,g=0;const b=this._noLineTerminator?function(){}:this.newline.bind(this);for(let n=0;n<a;n++){const x=t[n],v=this._shouldPrintComment(x);if(2===v){h=!1;break}if(h&&x.loc&&1===v){const t=x.loc.start.line,r=x.loc.end.line;if(0===e){let e=0;0===n?!this._buf.hasContent()||"CommentLine"!==x.type&&t==r||(e=g=1):e=t-m,m=r,b(e),this._printComment(x,1),n+1===a&&(b(Math.max(d-m,g)),m=d)}else if(1===e){const e=t-(0===n?d:m);m=r,b(e),this._printComment(x,1),n+1===a&&(b(Math.min(1,f-m)),m=f)}else{const e=t-(0===n?f-i:m);m=r,b(e),this._printComment(x,1)}}else{if(h=!1,1!==v)continue;if(1===a){const t=x.loc?x.loc.start.line===x.loc.end.line:!y.test(x.value),i=t&&!l(r)&&!c(s)&&!p(s)&&!u(s);0===e?this._printComment(x,i&&"ObjectExpression"!==r.type||t&&o(s,{body:r})?1:0):i&&2===e?this._printComment(x,1):this._printComment(x,0)}else 1!==e||"ObjectExpression"===r.type&&r.properties.length>1||"ClassBody"===r.type||"TSInterfaceBody"===r.type?this._printComment(x,0):this._printComment(x,0===n?2:n===a-1?3:0)}}2===e&&h&&m&&(this._lastCommentLine=m)}}Object.assign(x.prototype,a),x.prototype.Noop=function(){};var v=x;function E(){this.tokenChar(44),this.space()}t.default=v},11693:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(65939),i=r(21076);t.default=class{constructor(e,t){var r;this._map=void 0,this._rawMappings=void 0,this._sourceFileName=void 0,this._lastGenLine=0,this._lastSourceLine=0,this._lastSourceColumn=0,this._inputMap=void 0;const n=this._map=new s.GenMapping({sourceRoot:e.sourceRoot});if(this._sourceFileName=null==(r=e.sourceFileName)?void 0:r.replace(/\\/g,"/"),this._rawMappings=void 0,e.inputSourceMap){this._inputMap=new i.TraceMap(e.inputSourceMap);const t=this._inputMap.resolvedSources;if(t.length)for(let e=0;e<t.length;e++){var a;(0,s.setSourceContent)(n,t[e],null==(a=this._inputMap.sourcesContent)?void 0:a[e])}}if("string"!=typeof t||e.inputSourceMap){if("object"==typeof t)for(const e of Object.keys(t))(0,s.setSourceContent)(n,e.replace(/\\/g,"/"),t[e])}else(0,s.setSourceContent)(n,this._sourceFileName,t)}get(){return(0,s.toEncodedMap)(this._map)}getDecoded(){return(0,s.toDecodedMap)(this._map)}getRawMappings(){return this._rawMappings||(this._rawMappings=(0,s.allMappings)(this._map))}mark(e,t,r,n,a,o){var l;let c;if(this._rawMappings=void 0,null!=t)if(this._inputMap){if(c=(0,i.originalPositionFor)(this._inputMap,{line:t,column:r}),!c.name&&a){const e=(0,i.originalPositionFor)(this._inputMap,a);e.name&&(n=e.name)}}else c={source:(null==o?void 0:o.replace(/\\/g,"/"))||this._sourceFileName,line:t,column:r};(0,s.maybeAddMapping)(this._map,{name:n,generated:e,source:null==(l=c)?void 0:l.source,original:c})}}},72773:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getInclusionReasons=function(e,t,r){const a=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const o=(0,n.getLowestImplementedVersion)(a,r),l=t[r];if(o){const t=(0,n.isUnreleasedVersion)(o,r);(0,n.isUnreleasedVersion)(l,r)||!t&&!s.lt(l.toString(),(0,n.semverify)(o))||(e[r]=(0,i.prettifyVersion)(l))}else e[r]=(0,i.prettifyVersion)(l);return e}),{})};var s=r(30266),i=r(50497),n=r(358)},44839:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,s,i,n,a){const l=new Set,c={compatData:e,includes:t,excludes:r};for(const t in e)if(o(t,s,c))l.add(t);else if(a){const e=a.get(t);e&&l.add(e)}return null==i||i.forEach((e=>!r.has(e)&&l.add(e))),null==n||n.forEach((e=>!t.has(e)&&l.delete(e))),l},t.isRequired=o,t.targetsSupported=a;var s=r(30266),i=r(18052),n=r(358);function a(e,t){const r=Object.keys(e);return 0!==r.length&&0===r.filter((r=>{const i=(0,n.getLowestImplementedVersion)(t,r);if(!i)return!0;const a=e[r];if((0,n.isUnreleasedVersion)(a,r))return!1;if((0,n.isUnreleasedVersion)(i,r))return!0;if(!s.valid(a.toString()))throw new Error(`Invalid version passed for target "${r}": "${a}". Versions must be in semver format (major.minor.patch)`);return s.gt((0,n.semverify)(i),a.toString())})).length}function o(e,t,{compatData:r=i,includes:s,excludes:n}={}){return!(null!=n&&n.has(e)||(null==s||!s.has(e))&&a(t,r[e]))}},49160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TargetNames",{enumerable:!0,get:function(){return c.TargetNames}}),t.default=function(e={},t={}){var r,n;let{browsers:a,esmodules:p}=e;const{configPath:u="."}=t;!function(e){f.invariant(void 0===e||m(e),`'${String(e)}' is not a valid browserslist query`)}(a);let h=function(e){const t=Object.keys(c.TargetNames);for(const r of Object.keys(e))if(!(r in c.TargetNames))throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,i.findSuggestion)(r,t)}'?`));return e}(function(e){const t=Object.assign({},e);return delete t.esmodules,delete t.browsers,t}(e));const y=!!a||Object.keys(h).length>0,v=!t.ignoreBrowserslistConfig&&!y;if(!a&&v&&(a=s.loadConfig({config:t.configFile,path:u,env:t.browserslistEnv}),null==a&&(a=[])),!p||"intersect"===p&&null!=(r=a)&&r.length||(a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", "),p=!1),null!=(n=a)&&n.length){const e=function(e,t){const r="string"==typeof e?e:e.join()+t;let i=x.get(r);return i||(i=function(e,t){return function(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" "),i=l.browserNameMap[r];if(!i)return e;try{const t=s.split("-")[0].toLowerCase(),r=(0,o.isUnreleasedVersion)(t,i);if(!e[i])return e[i]=r?t:(0,o.semverify)(t),e;const n=e[i],a=(0,o.isUnreleasedVersion)(n,i);if(a&&r)e[i]=(0,o.getLowestUnreleased)(n,t,i);else if(a)e[i]=(0,o.semverify)(t);else if(!a&&!r){const r=(0,o.semverify)(t);e[i]=(0,o.semverMin)(n,r)}}catch(e){}return e}),{})}(s(e,{mobileToDesktop:!0,env:t}))}(e,t),x.set(r,i)),Object.assign({},i)}(a,t.browserslistEnv);if("intersect"===p)for(const t of Object.keys(e))if("deno"!==t&&"ie"!==t){const r=d["opera_mobile"===t?"op_mob":t];if(r){const s=e[t];e[t]=(0,o.getHighestUnreleased)(s,(0,o.semverify)(r),t)}else delete e[t]}else delete e[t];h=Object.assign(e,h)}const E={},P=[];for(const e of Object.keys(h).sort()){const t=h[e];"number"==typeof t&&t%1!=0&&P.push({target:e,value:t});const[r,s]="node"===e?g(t):b(e,t);s&&(E[r]=s)}return(T=P).length&&(console.warn("Warning, the following targets are using a decimal version:\n"),T.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`))),console.warn("\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n")),E;var T},Object.defineProperty(t,"filterItems",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"getInclusionReasons",{enumerable:!0,get:function(){return u.getInclusionReasons}}),t.isBrowsersQueryValid=m,Object.defineProperty(t,"isRequired",{enumerable:!0,get:function(){return h.isRequired}}),Object.defineProperty(t,"prettifyTargets",{enumerable:!0,get:function(){return p.prettifyTargets}}),Object.defineProperty(t,"unreleasedLabels",{enumerable:!0,get:function(){return l.unreleasedLabels}});var s=r(70648),i=r(77515),n=r(45884),a=r(78722),o=r(358),l=r(83335),c=r(84124),p=r(50497),u=r(72773),h=r(44839);const d=n["es6.module"],f=new i.OptionValidator("@babel/helper-compilation-targets");function m(e){return"string"==typeof e||Array.isArray(e)&&e.every((e=>"string"==typeof e))}function y(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}function g(e){return["node",!0===e||"current"===e?process.versions.node:y("node",e)]}function b(e,t){return[e,(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():y(e,t)]}const x=new a({max:64})},84124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TargetNames=void 0,t.TargetNames={node:"node",deno:"deno",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino",opera_mobile:"opera_mobile"}},50497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prettifyTargets=function(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const a=i.unreleasedLabels[r];return"string"==typeof s&&a!==s&&(s=n(s)),t[r]=s,t}),{})},t.prettifyVersion=n;var s=r(30266),i=r(83335);function n(e){if("string"!=typeof e)return e;const{major:t,minor:r,patch:i}=s.parse(e),n=[t];return(r||i)&&n.push(r),i&&n.push(i),n.join(".")}},83335:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unreleasedLabels=t.browserNameMap=void 0,t.unreleasedLabels={safari:"tp"},t.browserNameMap={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",deno:"deno",op_mob:"opera_mobile",opera:"opera",safari:"safari",samsung:"samsung"}},358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHighestUnreleased=function(e,t,r){return c(e,t,r)===e?t:e},t.getLowestImplementedVersion=function(e,t){const r=e[t];return r||"android"!==t?r:e.chrome},t.getLowestUnreleased=c,t.isUnreleasedVersion=function(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()},t.semverMin=l,t.semverify=function(e){if("string"==typeof e&&s.valid(e))return e;o.invariant("number"==typeof e||"string"==typeof e&&a.test(e),`'${e}' is not a valid version`),e=e.toString();let t=0,r=0;for(;(t=e.indexOf(".",t+1))>0;)r++;return e+".0".repeat(2-r)};var s=r(30266),i=r(77515),n=r(83335);const a=/^(\d+|\d+.\d+)$/,o=new i.OptionValidator("@babel/helper-compilation-targets");function l(e,t){return e&&s.lt(e,t)?e:t}function c(e,t,r){const s=n.unreleasedLabels[r];return e===s?t:t===s?e:l(e,t)}},55740:(e,t)=>{"use strict";function r(e){const{context:t,node:r}=e;if(r.computed&&t.maybeQueue(e.get("key")),r.decorators)for(const r of e.get("decorators"))t.maybeQueue(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.requeueComputedKeyAndDecorators=r,t.skipAllButComputedKey=function(e){e.skip(),e.node.computed&&e.context.maybeQueue(e.get("key"))};var s={FunctionParent(e){e.isArrowFunctionExpression()||(e.skip(),e.isMethod()&&r(e))},Property(e){e.isObjectProperty()||(e.skip(),r(e))}};t.default=s},69434:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({node:e,parent:t,scope:r,id:s},i=!1,S=!1){if(e.id)return;if(!m(t)&&!f(t,{kind:"method"})||t.computed&&!h(t.key)){if(x(t)){if(s=t.id,u(s)&&!i){const t=r.parent.getBinding(s.name);if(t&&t.constant&&r.getBinding(s.name)===t)return e.id=a(s),void(e.id[n]=!0)}}else if(l(t,{operator:"="}))s=t.left;else if(!s)return}else s=t.key;let A;if(s&&h(s)?A=function(e){return d(e)?"null":y(e)?`_${e.pattern}_${e.flags}`:b(e)?e.quasis.map((e=>e.value.raw)).join(""):void 0!==e.value?e.value+"":""}(s):s&&u(s)&&(A=s.name),void 0===A)return;if(!S&&p(e)&&/[\uD800-\uDFFF]/.test(A))return;A=v(A);const w=o(A);return w[n]=!0,function(e,t,r,s){if(e.selfReference){if(!s.hasBinding(r.name)||s.hasGlobal(r.name)){if(!p(t))return;let e=E;t.generator&&(e=P);const i=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:s.generateUidIdentifier(r.name)}).expression,n=i.callee.body.body[0].params;for(let e=0,r=function(e){const t=e.params.findIndex((e=>c(e)||g(e)));return-1===t?e.params.length:t}(t);e<r;e++)n.push(s.generateUidIdentifier("x"));return i}s.rename(r.name)}t.id=r,s.getProgramParent().references[r.name]=!0}(function(e,t,r){const s={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(s.selfReference=!0):(s.outerDeclar||r.hasGlobal(t))&&r.traverse(e,T,s),s}(e,A,r),e,w,r)||e};var s=r(40589),i=r(81483);const{NOT_LOCAL_BINDING:n,cloneNode:a,identifier:o,isAssignmentExpression:l,isAssignmentPattern:c,isFunction:p,isIdentifier:u,isLiteral:h,isNullLiteral:d,isObjectMethod:f,isObjectProperty:m,isRegExpLiteral:y,isRestElement:g,isTemplateLiteral:b,isVariableDeclarator:x,toBindingIdentifierName:v}=i,E=s.default.statement("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),P=s.default.statement("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),T={"ReferencedIdentifier|BindingIdentifier"(e,t){e.node.name===t.name&&e.scope.getBindingIdentifier(t.name)===t.outerDeclar&&(t.selfReference=!0,e.stop())}}},61763:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r="var"){e.traverse(o,{kind:r,emit:t})};var s=r(81483);const{assignmentExpression:i,expressionStatement:n,identifier:a}=s,o={Scope(e,t){"let"===t.kind&&e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[],s=e.get("declarations");let o;for(const e of s){o=e.node.id,e.node.init&&r.push(n(i("=",e.node.id,e.node.init)));for(const r of Object.keys(e.getBindingIdentifiers()))t.emit(a(r),r,null!==e.node.init)}e.parentPath.isFor({left:e.node})?e.replaceWith(o):e.replaceWithMultiple(r)}}},14419:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(27790),i=r(81483);const{callExpression:n,cloneNode:a,expressionStatement:o,identifier:l,importDeclaration:c,importDefaultSpecifier:p,importNamespaceSpecifier:u,importSpecifier:h,memberExpression:d,stringLiteral:f,variableDeclaration:m,variableDeclarator:y}=i;t.default=class{constructor(e,t,r){this._statements=[],this._resultName=null,this._importedSource=void 0,this._scope=t,this._hub=r,this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){return this._statements.push(c([],f(this._importedSource))),this}require(){return this._statements.push(o(n(l("require"),[f(this._importedSource)]))),this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e),r=this._statements[this._statements.length-1];return s("ImportDeclaration"===r.type),s(0===r.specifiers.length),r.specifiers=[u(t)],this._resultName=a(t),this}default(e){const t=this._scope.generateUidIdentifier(e),r=this._statements[this._statements.length-1];return s("ImportDeclaration"===r.type),s(0===r.specifiers.length),r.specifiers=[p(t)],this._resultName=a(t),this}named(e,t){if("default"===t)return this.default(e);const r=this._scope.generateUidIdentifier(e),i=this._statements[this._statements.length-1];return s("ImportDeclaration"===i.type),s(0===i.specifiers.length),i.specifiers=[h(r,l(t))],this._resultName=a(r),this}var(e){const t=this._scope.generateUidIdentifier(e);let r=this._statements[this._statements.length-1];return"ExpressionStatement"!==r.type&&(s(this._resultName),r=o(this._resultName),this._statements.push(r)),this._statements[this._statements.length-1]=m("var",[y(t,r.expression)]),this._resultName=a(t),this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];return"ExpressionStatement"===t.type?t.expression=n(e,[t.expression]):"VariableDeclaration"===t.type?(s(1===t.declarations.length),t.declarations[0].init=n(e,[t.declarations[0].init])):s.fail("Unexpected type."),this}prop(e){const t=this._statements[this._statements.length-1];return"ExpressionStatement"===t.type?t.expression=d(t.expression,l(e)):"VariableDeclaration"===t.type?(s(1===t.declarations.length),t.declarations[0].init=d(t.declarations[0].init,l(e))):s.fail("Unexpected type:"+t.type),this}read(e){this._resultName=d(this._resultName,l(e))}}},14064:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(27790),i=r(81483),n=r(14419),a=r(95392);const{numericLiteral:o,sequenceExpression:l}=i;t.default=class{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:!1,ensureNoContext:!1,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s,this._programScope=s.scope,this._hub=s.hub,this._defaultOpts=this._applyDefaults(t,r,!0)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){return s("string"==typeof e),this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),void 0)}_applyDefaults(e,t,r=!1){let i;return"string"==typeof e?i=Object.assign({},this._defaultOpts,{importedSource:e},t):(s(!t,"Unexpected secondary arguments."),i=Object.assign({},this._defaultOpts,e)),!r&&t&&(void 0!==t.nameHint&&(i.nameHint=t.nameHint),void 0!==t.blockHoist&&(i.blockHoist=t.blockHoist)),i}_generateImport(e,t){const r="default"===t,s=!!t&&!r,i=null===t,{importedSource:c,importedType:p,importedInterop:u,importingInterop:h,ensureLiveReference:d,ensureNoContext:f,nameHint:m,importPosition:y,blockHoist:g}=e;let b=m||t;const x=(0,a.default)(this._programPath),v=x&&"node"===h,E=x&&"babel"===h;if("after"===y&&!x)throw new Error('"importPosition": "after" is only supported in modules');const P=new n.default(c,this._programScope,this._hub);if("es6"===p){if(!v&&!E)throw new Error("Cannot import an ES6 module from CommonJS");P.import(),i?P.namespace(m||c):(r||s)&&P.named(b,t)}else{if("commonjs"!==p)throw new Error(`Unexpected interopType "${p}"`);if("babel"===u)if(v){b="default"!==b?b:c;const e=`${c}$es6Default`;P.import(),i?P.default(e).var(b||c).wildcardInterop():r?d?P.default(e).var(b||c).defaultInterop().read("default"):P.default(e).var(b).defaultInterop().prop(t):s&&P.default(e).read(t)}else E?(P.import(),i?P.namespace(b||c):(r||s)&&P.named(b,t)):(P.require(),i?P.var(b||c).wildcardInterop():(r||s)&&d?r?(b="default"!==b?b:c,P.var(b).read(t),P.defaultInterop()):P.var(c).read(t):r?P.var(b).defaultInterop().prop(t):s&&P.var(b).prop(t));else if("compiled"===u)v?(P.import(),i?P.default(b||c):(r||s)&&P.default(c).read(b)):E?(P.import(),i?P.namespace(b||c):(r||s)&&P.named(b,t)):(P.require(),i?P.var(b||c):(r||s)&&(d?P.var(c).read(b):P.prop(t).var(b)));else{if("uncompiled"!==u)throw new Error(`Unknown importedInterop "${u}".`);if(r&&d)throw new Error("No live reference for commonjs default");v?(P.import(),i?P.default(b||c):r?P.default(b):s&&P.default(c).read(b)):E?(P.import(),i?P.default(b||c):r?P.default(b):s&&P.named(b,t)):(P.require(),i?P.var(b||c):r?P.var(b):s&&(d?P.var(c).read(b):P.var(b).prop(t)))}}const{statements:T,resultName:S}=P.done();return this._insertStatements(T,y,g),(r||s)&&f&&"Identifier"!==S.type?l([o(0),S]):S}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if("after"===t){for(let t=s.length-1;t>=0;t--)if(s[t].isImportDeclaration())return void s[t].insertAfter(e)}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t)return void t.insertBefore(e)}this._programPath.unshiftContainer("body",e)}}},5598:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImportInjector",{enumerable:!0,get:function(){return s.default}}),t.addDefault=function(e,t,r){return new s.default(e).addDefault(t,r)},t.addNamed=function(e,t,r,i){return new s.default(e).addNamed(t,r,i)},t.addNamespace=function(e,t,r){return new s.default(e).addNamespace(t,r)},t.addSideEffect=function(e,t,r){return new s.default(e).addSideEffect(t,r)},Object.defineProperty(t,"isModule",{enumerable:!0,get:function(){return i.default}});var s=r(14064),i=r(95392)},95392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"module"===e.node.sourceType}},28476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildDynamicImport=function(e,t,r,i){const[n]=e.arguments;if(s.types.isStringLiteral(n)||s.types.isTemplateLiteral(n)&&0===n.quasis.length)return t?s.template.expression.ast`
|
|
23
23
|
Promise.resolve().then(() => ${i(n)})
|
|
24
24
|
`:i(n);const a=s.types.isTemplateLiteral(n)?s.types.identifier("specifier"):s.types.templateLiteral([s.types.templateElement({raw:""}),s.types.templateElement({raw:""})],[s.types.identifier("specifier")]);return t?s.template.expression.ast`
|
|
25
25
|
(specifier =>
|