@alipay/faas-web-sdk 1.1.16-alpha.2 → 1.1.16-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).cloud={})}(this,(function(t){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},e(t,n)};var r=function(){return r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function o(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))}function i(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var u,c,a,s,p,f,l=(u=function(t,n){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},u(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}u(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),y=function(t){function n(e,r){var o=t.call(this,r)||this;return o.name="FaasError",o.error=e,o.errorMessage=r,Object.setPrototypeOf(o,n.prototype),o}return l(n,t),Object.defineProperty(n.prototype,"errCode",{get:function(){return this.error},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"errMsg",{get:function(){return this.message},enumerable:!1,configurable:!0}),n.INVALID_PARAM_ERR=function(t,e){return new n(60001,"无效入参,参数 ".concat(t," ").concat(e))},n.NOT_FOUND_ERR=function(t){return new n(60001,t)},n.SERVER_ERR=function(t,e,r,o){var i=new n(t,e);return i.requestID=r,i.httpStatus=o,i},n.STORAGE_ERR=function(t,e,r){var o=new n(t,e);return o.requestID=r,o},n.NETWORK_ERR=function(t,e){var r=new n(-1,t.toString());return r.requestID=e,r},n}(Error),h=function(t,n){return void 0===n&&(n=void 0),function(e){if(!((null==e?void 0:e.complete)||(null==e?void 0:e.success)||(null==e?void 0:e.fail)))return t.call(n,e);var r=e.complete,o=e.success,i=e.fail,u=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}(e,["complete","success","fail"]);t.call(n,u).then((function(t){return null==o||o(t),t}),(function(t){return null==i||i(t),t})).then((function(t){null==r||r(t)}))}},d=function(){function t(){}return t.handleResponse=function(t){if(200!==t.status){var n=t.data||{code:-1,message:"未知异常"},e=n.code,r=n.message;throw y.SERVER_ERR(e,r,t.requestID,t.status)}return t.data.data},t}(),w=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},v=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},_=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},b=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},g=(c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},c(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}c(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),m=function(){},O=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return g(n,t),n}(m),j=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return g(n,t),n}(O),P=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return g(n,t),n}(m),A=function(t){function n(n,e){var r=t.call(this)||this;return r.name="$"+n,r.value=e,r}return g(n,t),n.prototype.stringify=function(){var t;return(t={})[this.name]=this.value,t},n}(m),x=(a=function(t,n){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},a(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}a(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),S=function(t){function n(n){return t.call(this,"add",n)||this}return x(n,t),n}(A),C=(s=function(t,n){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},s(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}s(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),E=function(t){function n(n){return t.call(this,"addToSet",n)||this}return C(n,t),n}(A),R=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}();(f=p||(p={})).INVALID_PARAM="INVALID_PARAM",f.INVALID_COMMAND="INVALID_COMMAND";var T,I,N,q,D,k,$=function(t){function n(e){var r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return R(n,t),n.create=function(t,e){var r=new n(e);return r.code=t,r},n.invalidParam=function(t,e){return n.create(p.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(e))},n.invalidCommand=function(t){return n.create(p.INVALID_COMMAND,t)},n}(Error),F=function(){function t(t,n){void 0===n&&(n=""),this.data=t,this.prefix=n}return t.prototype.stringify=function(){var e=this;if(this.data instanceof m){if(!(this.data instanceof A))throw $.invalidCommand("Command 不是聚合操作");return this.data.stringify()}if(null===this.data)return this.data;if(Array.isArray(this.data))return this.data.map((function(n,r){return new t(n,"".concat(e.prefix,".$.").concat(r)).stringify()}));switch(n(this.data)){case"number":case"boolean":case"string":case"bigint":return this.data;case"function":throw $.invalidParam(this.prefix,"不支持函数");case"symbol":throw $.invalidParam(this.prefix,"不支持 symbol");case"undefined":throw $.invalidParam(this.prefix,"不支持 undefined");default:var r={};for(var o in this.data){var i=this.prefix?"".concat(this.prefix,".").concat(o):o,u=new t(this.data[o],i);r[o]=u.stringify()}return r}},t.prototype.toJSON=function(){return this.stringify()},t}(),L=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),M=function(t){function n(n){var e=n.map((function(t){return new F(t).toJSON()}));return t.call(this,"and",e)||this}return L(n,t),n.prototype.pushCommand=function(t){this.value.push(new F(t).toJSON())},n}(A),B=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),U=function(t){function n(n){return t.call(this,"arrayElemAt",n)||this}return B(n,t),n}(A),H=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),J=function(t){function n(n){return t.call(this,"avg",new F(n).toJSON())||this}return H(n,t),n}(A),V=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),z=function(t){function n(n){return t.call(this,"cmp",n)||this}return V(n,t),n}(A),G=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),W=function(t){function n(n){return t.call(this,"concat",n)||this}return G(n,t),n}(A),K=(T=function(t,n){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},T(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}T(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),Y=function(t){function n(n){var e=Array.isArray(n)?{if:n[0],then:n[1],else:n[2]}:n;return t.call(this,"cond",new F(e).toJSON())||this}return K(n,t),n}(A),Q=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),X=function(t){function n(){return t.call(this,"count",{})||this}return Q(n,t),n}(A),Z=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),tt=function(t){function n(n){return t.call(this,"dateToString",n)||this}return Z(n,t),n}(A),nt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),et=function(t){function n(n){return t.call(this,"eq",n)||this}return nt(n,t),n}(A),rt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ot=function(t){function n(n){return t.call(this,"first",n)||this}return rt(n,t),n}(A),it=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ut=function(t){function n(n){return t.call(this,"ifNull",n)||this}return it(n,t),n}(A),ct=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),at=function(t){function n(n){return t.call(this,"in",n)||this}return ct(n,t),n}(A),st=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),pt=function(t){function n(n){return t.call(this,"indexOfArray",n)||this}return st(n,t),n}(A),ft=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),lt=function(t){function n(n){return t.call(this,"isArray",n)||this}return ft(n,t),n}(A),yt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ht=function(t){function n(n){return t.call(this,"last",n)||this}return yt(n,t),n}(A),dt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),wt=function(t){function n(n){return t.call(this,"let",{vars:new F(n.vars).toJSON(),in:new F(n.in).toJSON()})||this}return dt(n,t),n}(A),vt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),_t=function(t){function n(n){return t.call(this,"multiply",n)||this}return vt(n,t),n}(A),bt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),gt=function(t){function n(n){return t.call(this,"not",[new F(n).toJSON()])||this}return bt(n,t),n}(A),mt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ot=function(t){function n(n){return t.call(this,"push",n)||this}return mt(n,t),n}(A),jt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Pt=function(t){function n(n){return t.call(this,"size",n)||this}return jt(n,t),n}(A),At=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),xt=function(t){function n(n){return t.call(this,"slice",n)||this}return At(n,t),n}(A),St=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ct=function(t){function n(n){return t.call(this,"split",n)||this}return St(n,t),n}(A),Et=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Rt=function(t){function n(n){return t.call(this,"substr",n)||this}return Et(n,t),n}(A),Tt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),It=function(t){function n(n){return t.call(this,"substrBytes",n)||this}return Tt(n,t),n}(A),Nt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),qt=function(t){function n(n){var e=n.branches.map((function(t){return Array.isArray(t)?{case:new F(t[0]).toJSON(),then:t[1]}:{case:new F(t.case).toJSON(),then:t.then}}));return t.call(this,"switch",{branches:e,default:n.default})||this}return Nt(n,t),n}(A),Dt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),kt=function(t){function n(n){return t.call(this,"toLower",n)||this}return Dt(n,t),n}(A),$t=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ft=function(t){function n(n){return t.call(this,"toUpper",n)||this}return $t(n,t),n}(A);!function(t){t.DESC="desc",t.ASC="asc"}(I||(I={})),function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(N||(N={})),function(t){t.update="update",t.findOneAndUpdate="findOneAndUpdate",t.replace="replace",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create",t.batchCreate="batchCreate",t.count="count",t.aggregate="aggregate"}(q||(q={})),function(t){t.collection="collection",t.document="document"}(D||(D={})),function(t){t.addFields="$addFields",t.count="$count",t.match="$match",t.group="$group",t.project="$project",t.replaceRoot="$replaceRoot",t.sample="$sample",t.lookup="$lookup",t.sort="$sort",t.limit="$limit",t.skip="$skip",t.unwind="$unwind"}(k||(k={}));var Lt,Mt=function(){function t(t){this.regexp=t.regexp,this.options=t.options||""}return t.prototype.stringify=function(){return{$regexp:this.regexp,$options:this.options}},t}(),Bt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ut=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(vn.stringify),e}return Bt(n,t),n.prototype.pushCommand=function(t){this.commands.push(vn.stringify(t))},n.prototype.stringify=function(){return{$and:this.commands}},n}(P),Ht=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Jt=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(vn.stringify),e}return Ht(n,t),n.prototype.pushCommand=function(t){this.commands.push(vn.stringify(t))},n.prototype.stringify=function(){return{$or:this.commands}},n}(P),Vt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),zt=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Vt(n,t),n.prototype.stringify=function(){return{$eq:this.val}},n}(P),Gt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Wt=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Gt(n,t),n.prototype.stringify=function(){return{$ne:this.val}},n}(P),Kt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Yt=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Kt(n,t),n.prototype.stringify=function(){return{$lt:this.val}},n}(P),Qt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Xt=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Qt(n,t),n.prototype.stringify=function(){return{$lte:this.val}},n}(P),Zt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),tn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Zt(n,t),n.prototype.stringify=function(){return{$gt:this.val}},n}(P),nn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),en=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return nn(n,t),n.prototype.stringify=function(){return{$gte:this.val}},n}(P),rn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),on=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return rn(n,t),n.prototype.stringify=function(){return{$in:this.val}},n}(P),un=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),cn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return un(n,t),n.prototype.stringify=function(){return{$nin:this.val}},n}(P),an=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),sn=function(t){function n(n){var e=t.call(this)||this;return e.exists=n,e}return an(n,t),n.prototype.stringify=function(){return{$exists:this.exists}},n}(P),pn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),fn=function(t){function n(n,e){var r=t.call(this)||this;return r.divisor=n,r.remainder=e,r}return pn(n,t),n.prototype.stringify=function(){return{$mod:[this.divisor,this.remainder]}},n}(P),ln=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),yn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return ln(n,t),n.prototype.stringify=function(){return{$all:this.val}},n}(P),hn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),dn=function(t){function n(n){var e=t.call(this)||this;return e.val=vn.stringify(n),e}return hn(n,t),n.prototype.stringify=function(){return{$elemMatch:this.val}},n}(P),wn=function(){function t(t){this.lastCmd=t}return t.prototype.appendCommand=function(t){return t=vn.unchain(t),this.lastCmd instanceof Ut?this.lastCmd.pushCommand(t):this.lastCmd=new Ut([this.lastCmd,t]),this},t.prototype.and=function(t){return this.appendCommand(t)},t.prototype.or=function(t){return t=vn.unchain(t),this.lastCmd instanceof Jt?this.lastCmd.pushCommand(t):this.lastCmd=new Jt([this.lastCmd,t]),this},t.prototype.not=function(t){return this.appendCommand(t)},t.prototype.nor=function(t){return this.appendCommand(t)},t.prototype.eq=function(t){return this.appendCommand(new zt(t))},t.prototype.neq=function(t){return this.appendCommand(new Wt(t))},t.prototype.lt=function(t){return this.appendCommand(new Yt(t))},t.prototype.lte=function(t){return this.appendCommand(new Xt(t))},t.prototype.gt=function(t){return this.appendCommand(new tn(t))},t.prototype.gte=function(t){return this.appendCommand(new en(t))},t.prototype.in=function(t){return this.appendCommand(new on(t))},t.prototype.nin=function(t){return this.appendCommand(new cn(t))},t.prototype.exists=function(t){return this.appendCommand(new sn(t))},t.prototype.mod=function(t,n){return this.appendCommand(new fn(t,n))},t.prototype.all=function(t){return this.appendCommand(new yn(t))},t.prototype.elemMatch=function(t){return this.appendCommand(new dn(vn.unchain(t)))},t.prototype.size=function(t){return this.appendCommand(t)},t}(),vn=function(){function t(){}return t.stringify=function(n){return(n=t.unchain(n))instanceof P?n.stringify():new _n(n).toJSON()},t.unchain=function(t){return t instanceof wn?t.lastCmd:t},t}(),_n=function(){function t(t,n){void 0===n&&(n=""),this.query=t,this.prefix=n}return t.prototype.stringify=function(){var e=this,r={},o=vn.unchain(this.query),i=n(o);if(o instanceof P)return o.stringify();if(o instanceof Mt)return o.stringify();if(Array.isArray(o))return o.map((function(n,r){return new t(n,"".concat(e.prefix,".$.").concat(r)).stringify()}));if("number"===i)return o;if("boolean"===i)return o;if("string"===i)return o;if("bigint"===i)return o;if("function"===i)throw $.invalidParam(this.prefix,"不支持函数");if("symbol"===i)throw $.invalidParam(this.prefix,"不支持 symbol");if("undefined"===i)throw $.invalidParam(this.prefix,"不支持 undefined");if(null===o)return o;for(var u in o){var c=this.prefix?"".concat(this.prefix,".").concat(u):u,a=new t(o[u],c);r[u]=a.stringify()}return r},t.prototype.toJSON=function(){return this.stringify()},t}(),bn=function(){function t(){this.pipeline=[]}return t.prototype.addFields=function(t){return this.pushStage(k.addFields,t),this},t.prototype.count=function(t){return this.pushStage(k.count,t),this},t.prototype.match=function(t){return this.pushStage(k.match,t),this},t.prototype.group=function(t){return this.pushStage(k.group,t),this},t.prototype.project=function(t){return this.pushStage(k.project,t),this},t.prototype.replaceRoot=function(t){return this.pushStage(k.replaceRoot,t),this},t.prototype.sample=function(t){return this.pushStage(k.sample,t),this},t.prototype.lookup=function(t){return this.pushStage(k.lookup,t),this},t.prototype.sort=function(t){return this.pushStage(k.sort,t),this},t.prototype.limit=function(t){return this.pushStage(k.limit,t),this},t.prototype.skip=function(t){return this.pushStage(k.skip,t),this},t.prototype.unwind=function(t){return this.pushStage(k.unwind,t),this},t.prototype.done=function(){return this.pipeline.map((function(t){var n,e;switch(t.name){case k.match:return{$match:new _n(t.param).toJSON()};case k.count:case k.sample:case k.lookup:case k.limit:case k.skip:case k.unwind:return(n={})[t.name]=t.param,n;case k.addFields:case k.group:case k.project:case k.replaceRoot:return(e={})[t.name]=new F(t.param).toJSON(),e;case k.sort:return{$sort:Object.keys(t.param).reduce((function(n,e){var r;switch(t.param[e]){case I.DESC:r=-1;break;case I.ASC:case 1:r=1;break;case-1:r=-1;break;default:r=1}return n[e]=r,n}),{})};default:var r=t.name;throw $.invalidParam(r,"不支持的 aggregate 操作")}}))},t.prototype.pushStage=function(t,n){this.pipeline.push({name:t,param:n})},t}(),gn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),mn=function(t){function n(n){var e=t.call(this)||this;return e.commands=new F(n).toJSON(),e}return gn(n,t),n.prototype.stringify=function(){return{$expr:this.commands}},n}(P),On=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),jn=function(t){function n(n){return t.call(this,"gt",n)||this}return On(n,t),n}(A),Pn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),An=function(t){function n(n){return t.call(this,"gte",n)||this}return Pn(n,t),n}(A),xn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Sn=function(t){function n(n){return t.call(this,"lt",n)||this}return xn(n,t),n}(A),Cn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),En=function(t){function n(n){return t.call(this,"lte",n)||this}return Cn(n,t),n}(A),Rn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Tn=function(t){function n(n){return t.call(this,"max",new F(n).toJSON())||this}return Rn(n,t),n}(A),In=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Nn=function(t){function n(n){return t.call(this,"min",new F(n).toJSON())||this}return In(n,t),n}(A),qn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Dn=function(t){function n(n){return t.call(this,"ne",n)||this}return qn(n,t),n}(A),kn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),$n=function(t){function n(n){var e=n.map((function(t){return new F(t).toJSON()}));return t.call(this,"or",e)||this}return kn(n,t),n.prototype.pushCommand=function(t){this.value.push(new F(t).toJSON())},n}(A),Fn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ln=function(t){function n(n){var e=Array.isArray(n)?n.map((function(t){return new F(t).toJSON()})):new F(n).toJSON();return t.call(this,"sum",e)||this}return Fn(n,t),n}(A),Mn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Bn=function(t){function e(n){var e=t.call(this)||this;return e.value=n,e}return Mn(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$addToSet"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return Array.isArray(this.value)?{$each:this.value}:"object"===n(this.value)&&this.value.hasOwnProperty("each")?{$each:this.value.each}:this.value},e}(j),Un=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Hn=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return Un(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$max"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(O),Jn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Vn=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return Jn(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$min"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(O),zn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Gn=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return zn(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$mul"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(O),Wn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Kn=function(t){function n(n){var e=t.call(this)||this;return e.value=n,e}return Wn(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pop"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.value||1},n}(j),Yn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Qn=function(t){function n(n){var e=t.call(this)||this;return e.value=n,e}return Yn(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pull"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return new _n(this.value).toJSON()},n}(j),Xn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Zn=function(t){function n(n){var e=t.call(this)||this;return e.values=n,e}return Xn(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pullAll"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.values},n}(j),te=(Lt=function(t,n){return Lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},Lt(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}Lt(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),ne=function(){return ne=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},ne.apply(this,arguments)},ee=function(t){function e(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];var i=t.call(this)||this;return"object"===n(i.value)&&i.value.hasOwnProperty("each")?i.value=e:(null==r?void 0:r.length)>0?i.value=[].concat.apply([],function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}([e],r,!1)):i.value=e,i}return te(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$push"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){if(Array.isArray(this.value))return{$each:this.value};if("object"===n(this.value)&&this.value.hasOwnProperty("each")){var t=this.value,e={$each:t.each};return void 0!==t.position&&(e.$position=t.position),void 0!==t.slice&&(e.$slice=t.slice),void 0!==t.sort&&("string"==typeof t.sort?e.$sort=t.sort===I.DESC?-1:1:e.$sort=t.sort),e}return"object"===n(this.value)&&"string"==typeof this.value.$sort?ne(ne({},this.value),{$sort:this.value.$sort===I.DESC?-1:1}):this.value},e}(j),re=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),oe=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return re(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$unset"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return""},n}(O),ie=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ue=function(t){function n(n){var e=t.call(this)||this;return e.name=n,e}return ie(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$rename"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.name},n}(O),ce=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ae=function(t){function n(n){var e=t.call(this)||this;return e.data=n,e}return ce(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$set"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.data},n}(O),se=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),pe=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return se(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$inc"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(O),fe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),le=function(t){function n(n){var e=t.call(this)||this;return e.command=vn.stringify(n),e}return fe(n,t),n.prototype.stringify=function(){return{$not:this.command.stringify()}},n}(P),ye=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),he=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(vn.stringify),e}return ye(n,t),n.prototype.pushCommand=function(t){this.commands.push(vn.stringify(t))},n.prototype.stringify=function(){return{$nor:this.commands}},n}(P),de=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),we=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return de(n,t),n.prototype.stringify=function(){return{$size:this.val}},n}(P),ve=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},_e=function(){function t(){}return t.prototype.pipeline=function(){return new bn},t.prototype.avg=function(t){return new J(t)},t.prototype.count=function(){return new X},t.prototype.max=function(t){return new Tn(t)},t.prototype.min=function(t){return new Nn(t)},t.prototype.sum=function(t){return new Ln(t)},t.prototype.and=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t=Array.isArray(t[0])?t[0]:t,new M(t)},t.prototype.or=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t=Array.isArray(t[0])?t[0]:t,new $n(t)},t.prototype.not=function(t){return new gt(t)},t.prototype.cmp=function(t,n){var e=Array.isArray(t)?t:[t,n];return new z(e)},t.prototype.eq=function(t,n){var e=Array.isArray(t)?t:[t,n];return new et(e)},t.prototype.neq=function(t,n){var e=Array.isArray(t)?t:[t,n];return new Dn(e)},t.prototype.lt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new Sn(e)},t.prototype.lte=function(t,n){var e=Array.isArray(t)?t:[t,n];return new En(e)},t.prototype.gt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new jn(e)},t.prototype.gte=function(t,n){var e=Array.isArray(t)?t:[t,n];return new An(e)},t.prototype.addToSet=function(t){return new E(t)},t.prototype.arrayElemAt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new U(e)},t.prototype.indexOfArray=function(t,n,e,r){var o=Array.isArray(t)?t:[t,n,e,r].filter((function(t){return void 0!==t}));return new pt(o)},t.prototype.isArray=function(t){return new lt(t)},t.prototype.size=function(t){return new Pt(t)},t.prototype.in=function(t,n){var e=Array.isArray(t)?t:[t,n];return new at(e)},t.prototype.slice=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e].filter((function(t){return void 0!==t}));return new xt(r)},t.prototype.ifNull=function(t,n){var e=Array.isArray(t)?t:[t,n];return new ut(e)},t.prototype.cond=function(t){return new Y(t)},t.prototype.switch=function(t){return new qt(t)},t.prototype.concat=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var r=Array.isArray(t)?t:ve([t],n,!0);return new W(r)},t.prototype.dateToString=function(t){return new tt(t)},t.prototype.toLower=function(t){return new kt(t)},t.prototype.toUpper=function(t){return new Ft(t)},t.prototype.split=function(t,n){var e=Array.isArray(t)?t:[t,n];return new Ct(e)},t.prototype.substr=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e];return new Rt(r)},t.prototype.substrBytes=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e];return new It(r)},t.prototype.first=function(t){return new ot(t)},t.prototype.last=function(t){return new ht(t)},t.prototype.push=function(t){return new Ot(t)},t.prototype.let=function(t){return new wt(t)},t.prototype.add=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new S(e)},t.prototype.multiply=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new _t(e)},t}(),be=function(){function t(){this.aggregate=new _e,this.Sort=I}return t.prototype.addToSet=function(t){return new Bn(t)},t.prototype.inc=function(t){return new pe(t)},t.prototype.max=function(t){return new Hn(t)},t.prototype.min=function(t){return new Vn(t)},t.prototype.mul=function(t){return new Gn(t)},t.prototype.pop=function(t){return new Kn(t)},t.prototype.pull=function(t){return new Qn(t)},t.prototype.pullAll=function(t){return new Zn(t)},t.prototype.push=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return new(ee.bind.apply(ee,ve([void 0,t],n,!1)))},t.prototype.remove=function(){return new oe},t.prototype.rename=function(t){return new ue(t)},t.prototype.set=function(t){return new ae(t)},t.prototype.expr=function(t){return new mn(t)},t.prototype.and=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new Ut(t.map(vn.unchain));return new wn(e)},t.prototype.or=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new Jt(t.map(vn.unchain));return new wn(e)},t.prototype.not=function(t){var n=new le(vn.unchain(t));return new wn(n)},t.prototype.nor=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new he(t.map(vn.unchain));return new wn(e)},t.prototype.eq=function(t){return new wn(new zt(t))},t.prototype.neq=function(t){return new wn(new Wt(t))},t.prototype.lt=function(t){return new wn(new Yt(t))},t.prototype.lte=function(t){return new wn(new Xt(t))},t.prototype.gt=function(t){return new wn(new tn(t))},t.prototype.gte=function(t){return new wn(new en(t))},t.prototype.in=function(t){return new wn(new on(t))},t.prototype.nin=function(t){return new wn(new cn(t))},t.prototype.exists=function(t){return new wn(new sn(t))},t.prototype.mod=function(t,n){return new wn(new fn(t,n))},t.prototype.all=function(t){return new wn(new yn(t))},t.prototype.elemMatch=function(t){return new wn(new dn(vn.unchain(t)))},t.prototype.size=function(t){return new wn(new we(t))},t}(),ge=function(){function t(){}return t.buildCollectionAction=function(t,n){return{target:D.collection,action:t,collectionName:n}},t.buildCollectionListQueryAction=function(t){return{target:D.collection,action:N.queryList,options:t}},t.buildDocumentAction=function(t,n,e){return{target:D.document,action:t,collectionName:n,options:e}},t}(),me=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Oe=function(t){function n(n){var e=t.call(this)||this;return e.collectionName=n,e}return me(n,t),n.prototype.end=function(){var t={$aggregate:this.done()};return ge.buildDocumentAction(q.aggregate,this.collectionName,t)},n}(bn),je=function(){function t(){this.res={}}return t.prototype.set=function(t,n){this.res.$set=this.res.$set||{},this.res.$set[t]=n},t.prototype.applyOperator=function(t,n,e){this.res[t]=this.res[t]||{},this.res[t][n]=e},t.prototype.emit=function(){return this.res},t}(),Pe=function(){function t(t,n){void 0===n&&(n=""),this.data=t,this.prefix=n}return t.prototype.stringify=function(e){for(var r in e=e||new je,this.data){var o=this.prefix?"".concat(this.prefix,".").concat(r):r,i=this.data[r],u=n(i);if(i instanceof m){if(!(i instanceof O))throw $.invalidCommand("Command 不是更新操作");e.applyOperator(i.operator,o,i.stringify())}else if("number"===u)e.set(o,i);else if("boolean"===u)e.set(o,i);else if("string"===u)e.set(o,i);else if("bigint"===u)e.set(o,i);else{if("function"===u)throw $.invalidParam(o,"不支持函数");if("symbol"===u)throw $.invalidParam(o,"不支持 symbol");if("undefined"===u)throw $.invalidParam(o,"不支持 undefined");if(null===i)e.set(o,i);else if(Array.isArray(i))e.set(o,i);else{new t(i,o).stringify(e)}}}return e},t.prototype.toJSON=function(){return this.stringify().emit()},t}(),Ae=function(){return Ae=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},Ae.apply(this,arguments)},xe=function(){function t(t){this.collectionName=t,this.criteria={sort:[]}}return t.prototype.limit=function(t){return this.criteria.limit=t,this},t.prototype.skip=function(t){return this.criteria.skip=t,this},t.prototype.where=function(t){return this.criteria.match=t,this},t.prototype.projection=function(t){for(var e in t)t[e]?"object"!==n(t[e])&&(t[e]=1):t[e]=0;return this.criteria.projection=t,this},t.prototype.orderBy=function(t,n){return this.criteria.sort.push({field:t,sort:n}),this},t.prototype.update=function(t){return this.build(q.update,Ae(Ae({},this.baseOptions()),{$update:new Pe(t.data).toJSON()}))},t.prototype.updateAndReturn=function(t){var n=this.findOptions();return this.build(q.findOneAndUpdate,{$match:n.$match,$update:new Pe(t.data).toJSON(),$options:{$sort:n.$sort,$returnDocument:"after",$upsert:!1}})},t.prototype.set=function(t){return this.build(q.replace,Ae(Ae({},this.baseOptions()),{$replace:t.data}))},t.prototype.remove=function(){return this.build(q.delete,this.baseOptions())},t.prototype.get=function(){return this.build(q.queryList,Ae({$limit:100},this.findOptions()))},t.prototype.count=function(){return this.build(q.count,this.baseOptions())},t.prototype.baseOptions=function(){var t={};if(void 0!==this.criteria.match){var n=new _n(this.criteria.match);t.$match=n.toJSON()}return void 0!==this.criteria.limit&&(t.$limit=this.criteria.limit),t},t.prototype.findOptions=function(){var t=this.baseOptions();if(void 0!==this.criteria.projection&&(t.$project=this.criteria.projection),void 0!==this.criteria.sort){t.$sort={};for(var n=0,e=this.criteria.sort;n<e.length;n++){var r=e[n];t.$sort[r.field]=r.sort===I.DESC?-1:1}}return void 0!==this.criteria.skip&&(t.$skip=this.criteria.skip),t},t.prototype.build=function(t,n){return ge.buildDocumentAction(t,this.collectionName,n)},t}(),Se=function(){function t(t,n){this.collectionName=t,this.id=n}return t.prototype.update=function(t){return new xe(this.collectionName).where({_id:String(this.id)}).limit(1).update(t)},t.prototype.set=function(t){return new xe(this.collectionName).where({_id:String(this.id)}).limit(1).set(t)},t.prototype.remove=function(){return new xe(this.collectionName).where({_id:String(this.id)}).limit(1).remove()},t.prototype.get=function(){var t=new xe(this.collectionName).where({_id:String(this.id)}).limit(1).get();return t.action=q.query,t},t}(),Ce=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){if(!(null==t?void 0:t.data))throw $.invalidParam("data","不能为空");return Array.isArray(t.data)?this.batchAdd(t):ge.buildDocumentAction(q.create,this.collectionName,t.data)},t.prototype.batchAdd=function(t){if(t.data.length<=0)throw $.invalidParam("data","不能为空数组");if(t.data.length>200)throw $.invalidParam("data","最大长度 200");var n={$create:t.data};return"boolean"==typeof t.ordered&&(n.$ordered=t.ordered),ge.buildDocumentAction(q.batchCreate,this.collectionName,n)},t.prototype.doc=function(t){return new Se(this.collectionName,t)},t.prototype.limit=function(t){return new xe(this.collectionName).limit(t)},t.prototype.skip=function(t){return new xe(this.collectionName).skip(t)},t.prototype.where=function(t){return new xe(this.collectionName).where(t)},t.prototype.projection=function(t){return new xe(this.collectionName).projection(t)},t.prototype.orderBy=function(t,n){return new xe(this.collectionName).orderBy(t,n)},t.prototype.aggregate=function(){return new Oe(this.collectionName)},t.prototype.get=function(){return new xe(this.collectionName).get()},t.prototype.count=function(){return new xe(this.collectionName).count()},t}(),Ee=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},Re=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};function Te(){return function(t,n,e){var r=e.value;e.value=function(t){return Ee(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,h(r,this)(t)]}))}))}}}var Ie,Ne=function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qe=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},De=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},ke=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new Oe(t)}return t.prototype.addFields=function(t){return this.builder.addFields(t),this},t.prototype.count=function(t){return this.builder.count(t),this},t.prototype.match=function(t){return this.builder.match(t),this},t.prototype.group=function(t){return this.builder.group(t),this},t.prototype.sample=function(t){return this.builder.sample(t),this},t.prototype.lookup=function(t){return this.builder.lookup(t),this},t.prototype.project=function(t){return this.builder.project(t),this},t.prototype.replaceRoot=function(t){return this.builder.replaceRoot(t),this},t.prototype.sort=function(t){return this.builder.sort(t),this},t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.unwind=function(t){return this.builder.unwind(t),this},t.prototype.end=function(){return qe(this,void 0,void 0,(function(){var t,n,e;return De(this,(function(r){switch(r.label){case 0:return t=this.builder.end().options,"POST",n="".concat(this.getCollectionPath(),"?aggregate"),[4,this.options.httpclient.request({method:"POST",path:n,data:t})];case 1:return e=r.sent(),[2,d.handleResponse(e)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},function(t,e,r,o){var i,u=arguments.length,c=u<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(c=(u<3?i(c):u>3?i(e,r,c):i(e,r))||c);u>3&&c&&Object.defineProperty(e,r,c)}([Te(),Ne("design:type",Function),Ne("design:paramtypes",[]),Ne("design:returntype",Promise)],t.prototype,"end",null),t}(),$e=function(t,e,r,o){var i,u=arguments.length,c=u<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(c=(u<3?i(c):u>3?i(e,r,c):i(e,r))||c);return u>3&&c&&Object.defineProperty(e,r,c),c},Fe=function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Le=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},Me=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},Be=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new xe(t)}return t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.where=function(t){return this.builder.where(t),this},t.prototype.projection=function(t){return this.builder.projection(t),this},t.prototype.field=function(t){return this.builder.projection(t),this},t.prototype.orderBy=function(t,n){return this.builder.orderBy(t,n),this},t.prototype.updateAndReturn=function(t){return Le(this,void 0,void 0,(function(){var n,e,r,o;return Me(this,(function(i){switch(i.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?findOneAndUpdate"),e=this.builder.updateAndReturn(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=i.sent(),[2,{updated:(o=d.handleResponse(r))?1:0,doc:o}]}}))}))},t.prototype.update=function(t){return Le(this,void 0,void 0,(function(){var n,e,r;return Me(this,(function(o){switch(o.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?update"),e=this.builder.update(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,d.handleResponse(r)]}}))}))},t.prototype.set=function(t){return Le(this,void 0,void 0,(function(){var n,e,r;return Me(this,(function(o){switch(o.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?replace"),e=this.builder.set(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,d.handleResponse(r)]}}))}))},t.prototype.remove=function(){return Le(this,void 0,void 0,(function(){var t,n,e;return Me(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?delete"),n=this.builder.remove().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,d.handleResponse(e)]}}))}))},t.prototype.get=function(){return Le(this,void 0,void 0,(function(){var t,n,e;return Me(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?query"),n=this.builder.get().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,d.handleResponse(e)]}}))}))},t.prototype.count=function(){return Le(this,void 0,void 0,(function(){var t,n,e;return Me(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?count"),n=this.builder.count().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,{total:d.handleResponse(e).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[Object]),Fe("design:returntype",Promise)],t.prototype,"updateAndReturn",null),$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[Object]),Fe("design:returntype",Promise)],t.prototype,"update",null),$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[Object]),Fe("design:returntype",Promise)],t.prototype,"set",null),$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",Promise)],t.prototype,"remove",null),$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",Promise)],t.prototype,"get",null),$e([Te(),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",Promise)],t.prototype,"count",null),t}(),Ue=function(t,e,r,o){var i,u=arguments.length,c=u<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(c=(u<3?i(c):u>3?i(e,r,c):i(e,r))||c);return u>3&&c&&Object.defineProperty(e,r,c),c},He=function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Je=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},Ve=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},ze=function(){function t(t,n,e){this.collectionName=t,this.id=n,this.options=e}return t.prototype.projection=function(t){return this.query.projection(t),this},t.prototype.field=function(t){return this.query.field(t),this},t.prototype.update=function(t){return Je(this,void 0,void 0,(function(){return Ve(this,(function(n){switch(n.label){case 0:return[4,this.query.update(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateAndReturn=function(t){return Je(this,void 0,void 0,(function(){return Ve(this,(function(n){switch(n.label){case 0:return[4,this.query.updateAndReturn(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.set=function(t){return Je(this,void 0,void 0,(function(){return Ve(this,(function(n){switch(n.label){case 0:return[4,this.query.set(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.remove=function(){return Je(this,void 0,void 0,(function(){return Ve(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return Je(this,void 0,void 0,(function(){var t,n;return Ve(this,(function(e){switch(e.label){case 0:return[4,this.query.get()];case 1:if(t=e.sent(),!(n=t[0])){if(this.options.throwOnNotFound)throw y.NOT_FOUND_ERR("不存在_id 为 ".concat(this.id," 的文档"));return[2,null]}return[2,n]}}))}))},Object.defineProperty(t.prototype,"query",{get:function(){return this._query||(this._query=new Be(this.collectionName,this.options).where({_id:String(this.id)}).limit(1)),this._query},enumerable:!1,configurable:!0}),Ue([Te(),He("design:type",Function),He("design:paramtypes",[Object]),He("design:returntype",Promise)],t.prototype,"update",null),Ue([Te(),He("design:type",Function),He("design:paramtypes",[Object]),He("design:returntype",Promise)],t.prototype,"updateAndReturn",null),Ue([Te(),He("design:type",Function),He("design:paramtypes",[Object]),He("design:returntype",Promise)],t.prototype,"set",null),Ue([Te(),He("design:type",Function),He("design:paramtypes",[]),He("design:returntype",Promise)],t.prototype,"remove",null),Ue([Te(),He("design:type",Function),He("design:paramtypes",[]),He("design:returntype",Promise)],t.prototype,"get",null),t}(),Ge=function(t,e,r,o){var i,u=arguments.length,c=u<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(c=(u<3?i(c):u>3?i(e,r,c):i(e,r))||c);return u>3&&c&&Object.defineProperty(e,r,c),c},We=function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ke=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},Ye=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},Qe=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new Ce(t)}return t.prototype.add=function(t){return Ke(this,void 0,void 0,(function(){var n,e,r;return Ye(this,(function(o){switch(o.label){case 0:return n=this.builder.add(t).options,"POST",e=this.getDocumentPath(t.data._id),[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,d.handleResponse(r)]}}))}))},t.prototype.doc=function(t){return new ze(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new Be(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new Be(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new Be(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new Be(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new Be(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,n){return new Be(this.collectionName,this.options).orderBy(t,n)},t.prototype.aggregate=function(){return new ke(this.collectionName,this.options)},t.prototype.update=function(t){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(n){switch(n.label){case 0:return[4,new Be(this.collectionName,this.options).update(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateAndReturn=function(t){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(n){switch(n.label){case 0:return[4,new Be(this.collectionName,this.options).updateAndReturn(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.set=function(t){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(n){switch(n.label){case 0:return[4,new Be(this.collectionName,this.options).set(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.remove=function(){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(t){switch(t.label){case 0:return[4,new Be(this.collectionName,this.options).remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(t){switch(t.label){case 0:return[4,new Be(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return Ke(this,void 0,void 0,(function(){return Ye(this,(function(t){switch(t.label){case 0:return[4,new Be(this.collectionName,this.options).count()];case 1:return[2,t.sent()]}}))}))},t.prototype.getDocumentPath=function(t){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName,"?_id=").concat(t||"")},Ge([Te(),We("design:type",Function),We("design:paramtypes",[Object]),We("design:returntype",Promise)],t.prototype,"add",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[Object]),We("design:returntype",Promise)],t.prototype,"update",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[Object]),We("design:returntype",Promise)],t.prototype,"updateAndReturn",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[Object]),We("design:returntype",Promise)],t.prototype,"set",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[]),We("design:returntype",Promise)],t.prototype,"remove",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[]),We("design:returntype",Promise)],t.prototype,"get",null),Ge([Te(),We("design:type",Function),We("design:paramtypes",[]),We("design:returntype",Promise)],t.prototype,"count",null),t}(),Xe=function(){return Xe=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},Xe.apply(this,arguments)},Ze=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},tr=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},nr=function(){function t(t){this.httpclient=t}return t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,o=t.headers;return Ze(this,void 0,void 0,(function(){return tr(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:n,path:e,data:r,headers:Xe({"x-alipay-cloud-mode":"mongo","x-data-api-type":"mongo","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),er=function(){function t(t){this.command=new be,this.options=Xe(Xe({},t),{httpclient:new nr(t.httpclient)})}return t.prototype.collection=function(t){if(!t)throw y.INVALID_PARAM_ERR("collectionName","不能为空");return new Qe(t,this.options)},t}(),rr=function(){return rr=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},rr.apply(this,arguments)},or=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}a((r=r.apply(t,n||[])).next())}))},ir=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},ur=function(){function t(t){this.options=t}return t.prototype.getUploadPath=function(t){return"/".concat(t,"?upload_url")},t.prototype.getDownloadPath=function(t){return"/".concat(t,"?download_url&expire=3600")},t.prototype.getBatchDeletePath=function(){return"/?delete"},t.prototype.getBatchDownloadPath=function(){return"/?download_url"},t.prototype.checkCloudPath=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?t.startsWith("/")?"不能以 / 开头":t.includes("//")?"不能包含连续的 /":t.length>850?"长度不能超过 850 字节":void 0:"不能为空字符串"},t.prototype.checkFileID=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?void 0:"不能为空字符串"},t.prototype.formatFileID=function(t){return"cloud://".concat(this.options.toEnvId,"/").concat(t.replace(/^\/+/,""))},t.prototype.getCloudPathFromFileID=function(t){var n=t.trim().replace(/^cloud:\/\//,""),e=n.indexOf("/");if(e<=0)throw y.INVALID_PARAM_ERR("fileID","不合法");var r=n.substring(0,e),o=n.substring(e+1);return r!==this.options.toEnvId&&console.warn("file ".concat(t," does not belong to env ").concat(this.options.toEnvId)),o},t.prototype.uploadFile=function(t){return or(this,void 0,void 0,(function(){var n,e,r,o,i,u;return ir(this,(function(c){switch(c.label){case 0:if(n=this.checkCloudPath(t.cloudPath))throw y.INVALID_PARAM_ERR("cloudPath",n);return e=this.getUploadPath(t.cloudPath.trim()),[4,this.request({method:"GET",path:e})];case 1:return r=c.sent(),o=d.handleResponse(r),i=this.formatFileID(o.file_id),[4,this.options.fileUploader.upload({fileID:i,uploadURL:o.upload_url,fileContent:t.fileContent})];case 2:if(200!==(u=c.sent()).statusCode)throw y.STORAGE_ERR(-1,"上传文件 ".concat(o.upload_url," 失败"),r.requestID);return[2,{fileID:i,statusCode:u.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return or(this,void 0,void 0,(function(){var n,e,r,o,i,u;return ir(this,(function(c){switch(c.label){case 0:if(n=this.checkFileID(t.fileID))throw y.INVALID_PARAM_ERR("fileID",n);return e=this.getCloudPathFromFileID(t.fileID),r=this.getDownloadPath(e),[4,this.request({method:"GET",path:r})];case 1:return o=c.sent(),i=d.handleResponse(o),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:i.download_url})];case 2:if(200!==(u=c.sent()).statusCode)throw y.STORAGE_ERR(-1,"下载文件 ".concat(i.download_url," 失败"),o.requestID);return[2,u]}}))}))},t.prototype.deleteFile=function(t){return or(this,void 0,void 0,(function(){var n,e,r,o,i,u,c,a,s,p=this;return ir(this,(function(f){switch(f.label){case 0:if(n=Array.isArray(t)?t:t.fileList,!Array.isArray(n)||0===n.length)throw y.INVALID_PARAM_ERR("fileList","不能为空数组");for(e=[],r=0,o=n;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw y.INVALID_PARAM_ERR("fileID",u);c=this.getCloudPathFromFileID(i),e.push(c)}return a=this.getBatchDeletePath(),[4,this.request({method:"POST",path:a,data:{file_list:e}})];case 1:return s=f.sent(),[2,{fileList:d.handleResponse(s).file_list.map((function(t){return{fileID:p.formatFileID(t.file_id),status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.getTempFileURL=function(t){return or(this,void 0,void 0,(function(){var n,e,r,o,i,u,c,a,s,p=this;return ir(this,(function(f){switch(f.label){case 0:if(n=Array.isArray(t)?t:t.fileList,!Array.isArray(n)||0===n.length)throw y.INVALID_PARAM_ERR("fileList","不能为空数组");if(n.length>50)throw y.INVALID_PARAM_ERR("fileList","最大长度 50");for(e=[],r=0,o=n;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw y.INVALID_PARAM_ERR("fileID",u);c=this.getCloudPathFromFileID(i),e.push({file_id:c,expire:600})}return a=this.getBatchDownloadPath(),[4,this.request({method:"POST",path:a,data:{file_list:e}})];case 1:return s=f.sent(),[2,{fileList:d.handleResponse(s).file_list.map((function(t){return{fileID:p.formatFileID(t.file_id),tempFileURL:t.download_url,status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,o=t.headers;return or(this,void 0,void 0,(function(){return ir(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:n,path:e,data:r,headers:rr({"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),cr=function(){function t(){}return t.createCallFunction=function(t){return function(t){var n=t.httpclient;return h((function(t){return _(void 0,void 0,void 0,(function(){var e,r,o,i,u;return b(this,(function(c){switch(c.label){case 0:if(!t.name)throw y.INVALID_PARAM_ERR("name","缺失");return e={"x-to-function-name":t.name,"x-alipay-cloud-mode":"function"},[4,n.request({method:"POST",path:"/functions/invokeFunction",data:t.data,headers:e})];case 1:if(200!==(r=c.sent()).status)throw o=-1,i="",(u=r.data)&&(o=u.errCode,i=u.errMsg,u.errDetail&&(i+=",详情:".concat(u.errDetail))),y.SERVER_ERR(o,i,r.requestID,r.status);return[2,{requestID:r.requestID,result:r.data}]}}))}))}))}(t)},t.createCallContainer=function(t){return function(t){return h((function(n){return w(void 0,void 0,void 0,(function(){return v(this,(function(e){throw new Error("not implemented in "+t.type+" with "+n)}))}))}))}(t)},t.createDatabase=function(t){return new er(t)},t.createStorage=function(t){return new ur(t)},t}();!function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}(Ie||(Ie={}));var ar="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function sr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pr={exports:{}};var fr,lr={exports:{}};function yr(){return fr||(fr=1,function(t,n){var e;t.exports=(e=e||function(t,n){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),"undefined"!=typeof self&&self.crypto&&(e=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(e=globalThis.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&void 0!==ar&&ar.crypto&&(e=ar.crypto),!e)try{e=require("crypto")}catch(t){}var r=function(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(n){var e;return t.prototype=n,e=new t,t.prototype=null,e}}(),i={},u=i.lib={},c=u.Base={extend:function(t){var n=o(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=u.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=e!=n?e:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var n=this.words,e=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var u=e[i>>>2]>>>24-i%4*8&255;n[r+i>>>2]|=u<<24-(r+i)%4*8}else for(var c=0;c<o;c+=4)n[r+c>>>2]=e[c>>>2];return this.sigBytes+=o,this},clamp:function(){var n=this.words,e=this.sigBytes;n[e>>>2]&=4294967295<<32-e%4*8,n.length=t.ceil(e/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],e=0;e<t;e+=4)n.push(r());return new a.init(n,t)}}),s=i.enc={},p=s.Hex={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],o=0;o<e;o++){var i=n[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r+=2)e[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new a.init(e,n/2)}},f=s.Latin1={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],o=0;o<e;o++){var i=n[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r++)e[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new a.init(e,n)}},l=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},y=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var e,r=this._data,o=r.words,i=r.sigBytes,u=this.blockSize,c=i/(4*u),s=(c=n?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*u,p=t.min(4*s,i);if(s){for(var f=0;f<s;f+=u)this._doProcessBlock(o,f);e=o.splice(0,s),r.sigBytes-=p}return new a.init(e,p)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});u.Hasher=y.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,e){return new t.init(e).finalize(n)}},_createHmacHelper:function(t){return function(n,e){return new h.HMAC.init(t,e).finalize(n)}}});var h=i.algo={};return i}(Math),e)}(lr)),lr.exports}!function(t,n){t.exports=yr().enc.Hex}(pr);var hr=sr(pr.exports),dr={exports:{}},wr={exports:{}};!function(t,n){var e;t.exports=(e=yr(),function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,u=n.algo,c=[],a=[];!function(){function n(n){for(var e=t.sqrt(n),r=2;r<=e;r++)if(!(n%r))return!1;return!0}function e(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)n(r)&&(o<8&&(c[o]=e(t.pow(r,.5))),a[o]=e(t.pow(r,1/3)),o++),r++}();var s=[],p=u.SHA256=i.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(t,n){for(var e=this._hash.words,r=e[0],o=e[1],i=e[2],u=e[3],c=e[4],p=e[5],f=e[6],l=e[7],y=0;y<64;y++){if(y<16)s[y]=0|t[n+y];else{var h=s[y-15],d=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,w=s[y-2],v=(w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10;s[y]=d+s[y-7]+v+s[y-16]}var _=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),g=l+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&p^~c&f)+a[y]+s[y];l=f,f=p,p=c,c=u+g|0,u=i,i=o,o=r,r=g+(b+_)|0}e[0]=e[0]+r|0,e[1]=e[1]+o|0,e[2]=e[2]+i|0,e[3]=e[3]+u|0,e[4]=e[4]+c|0,e[5]=e[5]+p|0,e[6]=e[6]+f|0,e[7]=e[7]+l|0},_doFinalize:function(){var n=this._data,e=n.words,r=8*this._nDataBytes,o=8*n.sigBytes;return e[o>>>5]|=128<<24-o%32,e[14+(o+64>>>9<<4)]=t.floor(r/4294967296),e[15+(o+64>>>9<<4)]=r,n.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(p),n.HmacSHA256=i._createHmacHelper(p)}(Math),e.SHA256)}(wr);var vr,_r=wr.exports,br=sr(_r),gr={exports:{}};!function(t,n){var e;t.exports=(e=yr(),vr||(vr=1,function(t,n){var e,r,o;t.exports=(r=(e=yr()).lib.Base,o=e.enc.Utf8,void(e.algo.HMAC=r.extend({init:function(t,n){t=this._hasher=new t.init,"string"==typeof n&&(n=o.parse(n));var e=t.blockSize,r=4*e;n.sigBytes>r&&(n=t.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),u=this._iKey=n.clone(),c=i.words,a=u.words,s=0;s<e;s++)c[s]^=1549556828,a[s]^=909522486;i.sigBytes=u.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var n=this._hasher,e=n.finalize(t);return n.reset(),n.finalize(this._oKey.clone().concat(e))}})))}(gr)),e.HmacSHA256)}(dr);var mr=sr(dr.exports),Or=function(){function t(){}return t.sign=function(n){for(var e=n.signedHeaders.join(";"),r="",o=0,i=n.signedHeaders;o<i.length;o++){var u=i[o],c=n.headers[u];r+="".concat(u,":").concat(c,"\n")}var a=t.createHash(n.body||""),s=n.method.toUpperCase()+"\n"+n.path+"\n"+n.query+"\n"+r+"\n"+e+"\n"+a+"\n",p="HMAC-SHA256",f=t.createHash(s),l="".concat(p,"\n").concat(n.timestamp,"\n").concat(f,"\n"),y=t.createSha256(l,n.secretKey);return"".concat(p," Credential=").concat(n.secretId,", SignedHeaders=").concat(e,", Signature=").concat(y)},t.createSha256=function(t,n){return void 0===n&&(n=""),mr(t,n).toString(hr)},t.createHash=function(t){return br(t).toString(hr)},t}(),jr=function(){function t(){}return t.detectRuntime=function(){return window||void 0===("undefined"==typeof my?"undefined":n(my))?window||void 0===("undefined"==typeof wx?"undefined":n(wx))?Ie.WEB:Ie.WEICHAT_MINI:Ie.ALIPAY_MINI},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)}))},t.parseUrl=function(t,n){if(n===Ie.WEB)return new URL(t);var e=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=e[1],o=e[2],i=e[3],u=e[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:u||""}},t}();var Pr=function(){function t(t,n){this.req=t,this.config=n}return Object.defineProperty(t.prototype,"requestId",{get:function(){return this.req.requestOptions.headers["x-trace-id"]},enumerable:!1,configurable:!0}),t}(),Ar=function(){function t(){}return t.prototype.request=function(t,n){return o(this,void 0,void 0,(function(){var e,o,u;return i(this,(function(i){switch(i.label){case 0:return[4,fetch(t,r({mode:"cors"},n))];case 1:return e=i.sent(),o={},e.headers.forEach((function(t,n){o[n]=t})),u={status:e.status},[4,e.json()];case 2:return[2,(u.data=i.sent(),u.headers=o,u)]}}))}))},t}(),xr=function(){function t(){}return t.prototype.request=function(t,n){return o(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,my.request({url:t,method:(null==n?void 0:n.method)||"GET",data:null==n?void 0:n.body,headers:null==n?void 0:n.headers,dataType:"json"})];case 1:return[2,r.sent()];case 2:throw e=r.sent(),console.error(e),new Error("error: ".concat(e.error,", message: ").concat(e.errorMessage));case 3:return[2]}}))}))},t}(),Sr=function(){function t(){}return t.prototype.request=function(t,n){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new Promise((function(e,r){wx.request({url:t,method:(null==n?void 0:n.method)||"GET",data:null==n?void 0:n.body,header:null==n?void 0:n.headers,dataType:"json",success:function(t){e({status:t.statusCode,data:t.data,headers:t.header})},reject:function(t){r(new Error("error: ".concat(t.errno,", message: ").concat(t.errMsg)))}})}))]}))}))},t}(),Cr=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case Ie.ALIPAY_MINI:this.singleton=new xr;break;case Ie.WEB:this.singleton=new Ar;break;case Ie.WEICHAT_MINI:this.singleton=new Sr;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function Er(t,n){return o(this,void 0,void 0,(function(){var e,r;return i(this,(function(o){switch(o.label){case 0:return[4,n()];case 1:return o.sent(),e=t.config.fetch||Cr.default(t.config.runtime),r=t,[4,e.request(t.req.url,t.req.requestOptions)];case 2:return r.res=o.sent(),t.result={status:t.res.status,requestID:t.requestId,headers:t.res.headers,data:t.res.data},[2]}}))}))}function Rr(t,n){return o(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,n()];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),y.NETWORK_ERR(e,t.requestId);case 3:return[2]}}))}))}function Tr(t){return function(n,e){return o(this,void 0,void 0,(function(){var o,u,c,a,s;return i(this,(function(i){switch(i.label){case 0:return o=Date.now(),u=jr.parseUrl(n.req.url,n.config.runtime),c={authorization:"","x-from-app-id":n.config.appId,"x-from-env-id":n.config.envId,"x-to-env-id":n.config.envId,"x-from-instance-id":"".concat(o),"x-from-function-name":n.config.functionName,"x-client-timestamp":"".concat(o)},t.length>0&&t.forEach((function(t){var e,r=null===(e=n.req.requestOptions.headers)||void 0===e?void 0:e[t];r&&(c[t]=r)})),a=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}(["x-from-app-id","x-from-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp","x-to-env-id"],t,!0).sort(),s={path:u.pathname,query:u.search.substring(1),secretId:n.config.secretId,secretKey:n.config.secretKey,method:n.req.requestOptions.method,headers:c,body:n.req.requestOptions.body,timestamp:o,signedHeaders:a},c.authorization=Or.sign(s),n.req.requestOptions.headers=r(r({},c),n.req.requestOptions.headers),[4,e()];case 1:return i.sent(),[2]}}))}))}}var Ir=function(){function t(t,n){var e;this.config=t,this.handler=(e=n,function(t,n){var r=-1;return function o(i){if(i<=r)return Promise.reject(new Error("next() called multiple times"));r=i;var u=e[i];if(i===e.length&&(u=n),!u)return Promise.resolve();try{return Promise.resolve(u(t,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)})}return t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,u=t.headers;return o(this,void 0,void 0,(function(){var t,o,c,a;return i(this,(function(i){switch(i.label){case 0:return t=this.config.endpoint+e,o=r?JSON.stringify(r):r,c=jr.generateUUID(),u=Object.assign({"x-alipay-callid":c,"x-request-id":c,"x-alipay-source":"web,web-sdk","content-type":"application/json"},u),a=new Pr({url:t,requestOptions:{method:n,body:o,headers:u}},this.config),[4,this.handler(a)];case 1:return i.sent(),[2,a.result]}}))}))},t.createFunctionHttpclient=function(n){return new t(n,[Rr,Tr(["x-to-function-name"]),Er])},t.createDatabaseHttpclient=function(n){return new t(n,[Rr,Tr(["x-data-api-type","x-expire-timestamp"]),Er])},t.createStorageHttpclient=function(n){return new t(n,[Rr,Tr(["x-data-api-type","x-expire-timestamp"]),Er])},t}(),Nr=function(){function t(){}return t.prototype.upload=function(t){return o(this,void 0,void 0,(function(){var n,e;return i(this,(function(r){switch(r.label){case 0:return n=t.uploadURL,e=t.fileContent,[4,fetch(n,{method:"PUT",mode:"cors",body:e})];case 1:return[2,{statusCode:r.sent().status}]}}))}))},t.prototype.download=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,{fileContent:t.downloadURL,statusCode:200}]}))}))},t.create=function(){return t.instance||(t.instance=new t),t.instance},t}(),qr=function(t){function n(e){var r=Ir.createStorageHttpclient(e),o=n.getFileUploader(e);return t.call(this,{httpclient:r,fileUploader:o,type:"web",toEnvId:e.envId})||this}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n.getFileUploader=function(t){if(t.fileUploader)return t.fileUploader;if(t.runtime===Ie.WEB)return Nr.create();throw y.INVALID_PARAM_ERR("fileUploader","未指定文件上传/下载实现")},n}(ur),Dr=function(){function t(t){var n=t.resourceEnv||t.envId,e=t.resourceAppid||t.appId;this.config={endpoint:t.endpoint||"https://".concat(n,".api-hz.cloudbasefunction.cn"),secretId:t.secretId,secretKey:t.secretKey,appId:e,envId:n,fetch:t.fetch,fileUploader:t.fileUploader,runtime:t.runtime||jr.detectRuntime(),functionName:""}}return t.prototype.init=function(){},t.prototype.callFunction=function(t){var n;return o(this,void 0,void 0,(function(){var e,o;return i(this,(function(i){switch(i.label){case 0:return e=r(r({},this.config),{envId:(null===(n=t.config)||void 0===n?void 0:n.env)||this.config.envId,functionName:t.name}),o=Ir.createFunctionHttpclient(e),[4,cr.createCallFunction({type:"web",httpclient:o})(t)];case 1:return[2,i.sent()]}}))}))},t.prototype.getStorage=function(){return this.storage||(this.storage=new qr(this.config)),this.storage},t.prototype.uploadFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().uploadFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.downloadFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().downloadFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().deleteFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTempFileURL=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().getTempFileURL(t)];case 1:return[2,n.sent()]}}))}))},t.RUNTIME=Ie,t}();t.Cloud=Dr}));
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("buffer")):"function"==typeof define&&define.amd?define(["exports","buffer"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).cloud={},t.buffer)}(this,(function(t,n){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},r(t,n)};var o=function(){return o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},o.apply(this,arguments)};function i(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}s((r=r.apply(t,n||[])).next())}))}function u(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}"function"==typeof SuppressedError&&SuppressedError;var c,s,a,f,p=(c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},c(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}c(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),l=function(t){function n(e,r){var o=t.call(this,r)||this;return o.name="FaasError",o.error=e,o.errorMessage=r,Object.setPrototypeOf(o,n.prototype),o}return p(n,t),Object.defineProperty(n.prototype,"errCode",{get:function(){return this.error},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"errMsg",{get:function(){return this.message},enumerable:!1,configurable:!0}),n.INVALID_PARAM_ERR=function(t,e){return new n(60001,"无效入参,参数 ".concat(t," ").concat(e))},n.NOT_FOUND_ERR=function(t){return new n(60001,t)},n.SERVER_ERR=function(t,e,r,o){var i=new n(t,e);return i.requestID=r,i.httpStatus=o,i},n.STORAGE_ERR=function(t,e,r){var o=new n(t,e);return o.requestID=r,o},n.NETWORK_ERR=function(t,e){var r=new n(-1,t.toString());return r.requestID=e,r},n}(Error),h=function(t,n){return void 0===n&&(n=void 0),function(e){if(!((null==e?void 0:e.complete)||(null==e?void 0:e.success)||(null==e?void 0:e.fail)))return t.call(n,e);var r=e.complete,o=e.success,i=e.fail,u=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}(e,["complete","success","fail"]);t.call(n,u).then((function(t){return null==o||o(t),t}),(function(t){return null==i||i(t),t})).then((function(t){null==r||r(t)}))}},y=function(){function t(){}return t.handleResponse=function(t){if(200!==t.status){var n=t.data||{code:-1,message:"未知异常"},e=n.code,r=n.message;throw l.SERVER_ERR(e,r,t.requestID,t.status)}return t.data.data},t}(),d=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},g=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},w=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},v=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},b=(s=function(t,n){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},s(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}s(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),_=function(){},m=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return b(n,t),n}(_),O=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return b(n,t),n}(m),x=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return b(n,t),n}(_),j=function(t){function n(n,e){var r=t.call(this)||this;return r.name="$"+n,r.value=e,r}return b(n,t),n.prototype.stringify=function(){var t;return(t={})[this.name]=this.value,t},n}(_),S=(a=function(t,n){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},a(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}a(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)});!function(t){t.INVALID_PARAM="INVALID_PARAM",t.INVALID_COMMAND="INVALID_COMMAND"}(f||(f={}));var P,A,E,N,I,T,R,C=function(t){function n(e){var r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return S(n,t),n.create=function(t,e){var r=new n(e);return r.code=t,r},n.invalidParam=function(t,e){return n.create(f.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(e))},n.invalidCommand=function(t){return n.create(f.INVALID_COMMAND,t)},n}(Error),B=function(){function t(t,n){void 0===n&&(n=""),this.data=t,this.prefix=n}return t.prototype.stringify=function(){var n=this;if(this.data instanceof _){if(!(this.data instanceof j))throw C.invalidCommand("Command 不是聚合操作");return this.data.stringify()}if(null===this.data||this.data instanceof Date)return this.data;if(Array.isArray(this.data))return this.data.map((function(e,r){return new t(e,"".concat(n.prefix,".$.").concat(r)).stringify()}));switch(e(this.data)){case"number":case"boolean":case"string":case"bigint":case"undefined":return this.data;case"function":throw C.invalidParam(this.prefix,"不支持函数");case"symbol":throw C.invalidParam(this.prefix,"不支持 symbol");default:var r={};for(var o in this.data){var i=this.prefix?"".concat(this.prefix,".").concat(o):o,u=new t(this.data[o],i).stringify();void 0!==u&&(r[o]=u)}return r}},t.prototype.toJSON=function(){var t=this.stringify();if(void 0===t)throw C.invalidParam(this.prefix,"不支持 undefined");return t},t}(),$=(P=function(t,n){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},P(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}P(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),D=function(t){function n(n){return t.call(this,"abs",new B(n).toJSON())||this}return $(n,t),n}(j),U=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),q=function(t){function n(n){return t.call(this,"add",new B(n).toJSON())||this}return U(n,t),n}(j),L=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),k=function(t){function n(n){return t.call(this,"addToSet",n)||this}return L(n,t),n}(j),M=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),J=function(t){function n(n){var e=n.map((function(t){return new B(t).toJSON()}));return t.call(this,"and",e)||this}return M(n,t),n.prototype.pushCommand=function(t){this.value.push(new B(t).toJSON())},n}(j),F=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),H=function(t){function n(n){return t.call(this,"arrayElemAt",n)||this}return F(n,t),n}(j),V=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),z=function(t){function n(n){return t.call(this,"avg",new B(n).toJSON())||this}return V(n,t),n}(j),Z=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),W=function(t){function n(n){return t.call(this,"ceil",new B(n).toJSON())||this}return Z(n,t),n}(j),K=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),G=function(t){function n(n){return t.call(this,"cmp",n)||this}return K(n,t),n}(j),Y=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),X=function(t){function n(n){return t.call(this,"concat",n)||this}return Y(n,t),n}(j),Q=(A=function(t,n){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},A(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}A(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),tt=function(t){function n(n){var e=Array.isArray(n)?{if:n[0],then:n[1],else:n[2]}:n;return t.call(this,"cond",new B(e).toJSON())||this}return Q(n,t),n}(j),nt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),et=function(t){function n(){return t.call(this,"count",{})||this}return nt(n,t),n.prototype.stringify=function(){return{$sum:1}},n}(j),rt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ot=function(t){function n(n){return t.call(this,"dateToString",n)||this}return rt(n,t),n}(j),it=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ut=function(t){function n(n){return t.call(this,"divide",new B(n).toJSON())||this}return it(n,t),n}(j),ct=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),st=function(t){function n(n){return t.call(this,"eq",n)||this}return ct(n,t),n}(j),at=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ft=function(t){function n(n){return t.call(this,"exp",new B(n).toJSON())||this}return at(n,t),n}(j),pt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),lt=function(t){function n(n){return t.call(this,"first",n)||this}return pt(n,t),n}(j),ht=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),yt=function(t){function n(n){return t.call(this,"floor",new B(n).toJSON())||this}return ht(n,t),n}(j),dt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),gt=function(t){function n(n){return t.call(this,"ifNull",n)||this}return dt(n,t),n}(j),wt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),vt=function(t){function n(n){return t.call(this,"in",n)||this}return wt(n,t),n}(j),bt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),_t=function(t){function n(n){return t.call(this,"indexOfArray",n)||this}return bt(n,t),n}(j),mt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ot=function(t){function n(n){return t.call(this,"isArray",n)||this}return mt(n,t),n}(j),xt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),jt=function(t){function n(n){return t.call(this,"isoWeek",n)||this}return xt(n,t),n}(j),St=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Pt=function(t){function n(n){return t.call(this,"last",n)||this}return St(n,t),n}(j),At=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Et=function(t){function n(n){return t.call(this,"let",{vars:new B(n.vars).toJSON(),in:new B(n.in).toJSON()})||this}return At(n,t),n}(j),Nt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),It=function(t){function n(n){return t.call(this,"ln",new B(n).toJSON())||this}return Nt(n,t),n}(j),Tt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Rt=function(t){function n(n){return t.call(this,"log",new B(n).toJSON())||this}return Tt(n,t),n}(j),Ct=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Bt=function(t){function n(n){return t.call(this,"log10",new B(n).toJSON())||this}return Ct(n,t),n}(j),$t=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Dt=function(t){function n(n){return t.call(this,"map",new B(n).toJSON())||this}return $t(n,t),n}(j),Ut=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),qt=function(t){function n(n){return t.call(this,"mergeObjects",new B(n).toJSON())||this}return Ut(n,t),n}(j),Lt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),kt=function(t){function n(n){return t.call(this,"mod",new B(n).toJSON())||this}return Lt(n,t),n}(j),Mt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Jt=function(t){function n(n){return t.call(this,"month",n)||this}return Mt(n,t),n}(j),Ft=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ht=function(t){function n(n){return t.call(this,"multiply",new B(n).toJSON())||this}return Ft(n,t),n}(j),Vt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),zt=function(t){function n(n){return t.call(this,"not",[new B(n).toJSON()])||this}return Vt(n,t),n}(j),Zt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Wt=function(t){function n(n){return t.call(this,"pow",new B(n).toJSON())||this}return Zt(n,t),n}(j),Kt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Gt=function(t){function n(n){return t.call(this,"push",n)||this}return Kt(n,t),n}(j),Yt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Xt=function(t){function n(n){return t.call(this,"size",n)||this}return Yt(n,t),n}(j),Qt=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),tn=function(t){function n(n){return t.call(this,"slice",n)||this}return Qt(n,t),n}(j),nn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),en=function(t){function n(n){return t.call(this,"split",n)||this}return nn(n,t),n}(j),rn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),on=function(t){function n(n){return t.call(this,"sqrt",new B(n).toJSON())||this}return rn(n,t),n}(j),un=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),cn=function(t){function n(n){return t.call(this,"substr",n)||this}return un(n,t),n}(j),sn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),an=function(t){function n(n){return t.call(this,"substrBytes",n)||this}return sn(n,t),n}(j),fn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),pn=function(t){function n(n){return t.call(this,"subtract",n.map((function(t){return new B(t).toJSON()})))||this}return fn(n,t),n}(j),ln=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),hn=function(t){function n(n){var e=n.branches.map((function(t){return Array.isArray(t)?{case:new B(t[0]).toJSON(),then:t[1]}:{case:new B(t.case).toJSON(),then:t.then}}));return t.call(this,"switch",{branches:e,default:n.default})||this}return ln(n,t),n}(j),yn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),dn=function(t){function n(n){return t.call(this,"toLower",n)||this}return yn(n,t),n}(j),gn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),wn=function(t){function n(n){return t.call(this,"toUpper",n)||this}return gn(n,t),n}(j),vn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),bn=function(t){function n(n){return t.call(this,"trunc",new B(n).toJSON())||this}return vn(n,t),n}(j);!function(t){t.DESC="desc",t.ASC="asc"}(E||(E={})),function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(N||(N={})),function(t){t.update="update",t.findOneAndUpdate="findOneAndUpdate",t.replace="replace",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create",t.batchCreate="batchCreate",t.count="count",t.aggregate="aggregate"}(I||(I={})),function(t){t.collection="collection",t.document="document"}(T||(T={})),function(t){t.addFields="$addFields",t.count="$count",t.match="$match",t.group="$group",t.project="$project",t.replaceRoot="$replaceRoot",t.sample="$sample",t.lookup="$lookup",t.sort="$sort",t.limit="$limit",t.skip="$skip",t.unwind="$unwind"}(R||(R={}));var _n,mn=function(){function t(t){this.regexp=t.regexp,this.options=t.options||""}return t.prototype.stringify=function(){return{$regex:this.regexp,$options:this.options}},t}(),On=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),xn=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(Yn.stringify),e}return On(n,t),n.prototype.pushCommand=function(t){this.commands.push(Yn.stringify(t))},n.prototype.stringify=function(){return{$and:this.commands}},n}(x),jn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Sn=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(Yn.stringify),e}return jn(n,t),n.prototype.pushCommand=function(t){this.commands.push(Yn.stringify(t))},n.prototype.stringify=function(){return{$or:this.commands}},n}(x),Pn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),An=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Pn(n,t),n.prototype.stringify=function(){return{$eq:this.val}},n}(x),En=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Nn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return En(n,t),n.prototype.stringify=function(){return{$ne:this.val}},n}(x),In=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Tn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return In(n,t),n.prototype.stringify=function(){return{$lt:this.val}},n}(x),Rn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Cn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Rn(n,t),n.prototype.stringify=function(){return{$lte:this.val}},n}(x),Bn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),$n=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Bn(n,t),n.prototype.stringify=function(){return{$gt:this.val}},n}(x),Dn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Un=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Dn(n,t),n.prototype.stringify=function(){return{$gte:this.val}},n}(x),qn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ln=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return qn(n,t),n.prototype.stringify=function(){return{$in:this.val}},n}(x),kn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Mn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return kn(n,t),n.prototype.stringify=function(){return{$nin:this.val}},n}(x),Jn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Fn=function(t){function n(n){var e=t.call(this)||this;return e.exists=n,e}return Jn(n,t),n.prototype.stringify=function(){return{$exists:this.exists}},n}(x),Hn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Vn=function(t){function n(n,e){var r=t.call(this)||this;return r.divisor=n,r.remainder=e,r}return Hn(n,t),n.prototype.stringify=function(){return{$mod:[this.divisor,this.remainder]}},n}(x),zn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Zn=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return zn(n,t),n.prototype.stringify=function(){return{$all:this.val}},n}(x),Wn=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Kn=function(t){function n(n){var e=t.call(this)||this;return e.val=Yn.stringify(n),e}return Wn(n,t),n.prototype.stringify=function(){return{$elemMatch:this.val}},n}(x),Gn=function(){function t(t){this.lastCmd=t}return t.prototype.appendCommand=function(t){return t=Yn.unchain(t),this.lastCmd instanceof xn?this.lastCmd.pushCommand(t):this.lastCmd=new xn([this.lastCmd,t]),this},t.prototype.and=function(t){return this.appendCommand(t)},t.prototype.or=function(t){return t=Yn.unchain(t),this.lastCmd instanceof Sn?this.lastCmd.pushCommand(t):this.lastCmd=new Sn([this.lastCmd,t]),this},t.prototype.not=function(t){return this.appendCommand(t)},t.prototype.nor=function(t){return this.appendCommand(t)},t.prototype.eq=function(t){return this.appendCommand(new An(t))},t.prototype.neq=function(t){return this.appendCommand(new Nn(t))},t.prototype.lt=function(t){return this.appendCommand(new Tn(t))},t.prototype.lte=function(t){return this.appendCommand(new Cn(t))},t.prototype.gt=function(t){return this.appendCommand(new $n(t))},t.prototype.gte=function(t){return this.appendCommand(new Un(t))},t.prototype.in=function(t){return this.appendCommand(new Ln(t))},t.prototype.nin=function(t){return this.appendCommand(new Mn(t))},t.prototype.exists=function(t){return this.appendCommand(new Fn(t))},t.prototype.mod=function(t,n){return this.appendCommand(new Vn(t,n))},t.prototype.all=function(t){return this.appendCommand(new Zn(t))},t.prototype.elemMatch=function(t){return this.appendCommand(new Kn(Yn.unchain(t)))},t.prototype.size=function(t){return this.appendCommand(t)},t}(),Yn=function(){function t(){}return t.stringify=function(n){return(n=t.unchain(n))instanceof x?n.stringify():new Xn(n).toJSON()},t.unchain=function(t){return t instanceof Gn?t.lastCmd:t},t}(),Xn=function(){function t(t,n){void 0===n&&(n=""),this.query=t,this.prefix=n}return t.prototype.stringify=function(){var n=this,r={},o=Yn.unchain(this.query),i=e(o);if(o instanceof x)return o.stringify();if(o instanceof mn)return o.stringify();if(o instanceof Date)return o;if(Array.isArray(o))return o.map((function(e,r){return new t(e,"".concat(n.prefix,".$.").concat(r)).stringify()}));if("number"===i)return o;if("boolean"===i)return o;if("string"===i)return o;if("bigint"===i)return o;if("function"===i)throw C.invalidParam(this.prefix,"不支持函数");if("symbol"===i)throw C.invalidParam(this.prefix,"不支持 symbol");if("undefined"!==i){if(null===o)return o;for(var u in o){var c=this.prefix?"".concat(this.prefix,".").concat(u):u,s=new t(o[u],c).stringify();void 0!==s&&(r[u]=s)}return r}},t.prototype.toJSON=function(){var t=this.stringify();if(void 0===t)throw C.invalidParam(this.prefix,"不支持 undefined");return t},t}(),Qn=function(){function t(){this.pipeline=[]}return t.prototype.addFields=function(t){return this.pushStage(R.addFields,t),this},t.prototype.count=function(t){return this.pushStage(R.count,t),this},t.prototype.match=function(t){return this.pushStage(R.match,t),this},t.prototype.group=function(t){return this.pushStage(R.group,t),this},t.prototype.project=function(t){return this.pushStage(R.project,t),this},t.prototype.replaceRoot=function(t){return this.pushStage(R.replaceRoot,t),this},t.prototype.sample=function(t){return this.pushStage(R.sample,t),this},t.prototype.lookup=function(t){return this.pushStage(R.lookup,t),this},t.prototype.sort=function(t){return this.pushStage(R.sort,t),this},t.prototype.limit=function(t){return this.pushStage(R.limit,t),this},t.prototype.skip=function(t){return this.pushStage(R.skip,t),this},t.prototype.unwind=function(t){return this.pushStage(R.unwind,t),this},t.prototype.done=function(){return this.pipeline.map((function(t){var n,e;switch(t.name){case R.match:return{$match:new Xn(t.param).toJSON()};case R.count:case R.sample:case R.lookup:case R.limit:case R.skip:case R.unwind:return(n={})[t.name]=t.param,n;case R.addFields:case R.group:case R.project:case R.replaceRoot:return(e={})[t.name]=new B(t.param).toJSON(),e;case R.sort:return{$sort:Object.keys(t.param).reduce((function(n,e){var r;switch(t.param[e]){case E.DESC:r=-1;break;case E.ASC:case 1:r=1;break;case-1:r=-1;break;default:r=1}return n[e]=r,n}),{})};default:var r=t.name;throw C.invalidParam(r,"不支持的 aggregate 操作")}}))},t.prototype.pushStage=function(t,n){this.pipeline.push({name:t,param:n})},t}(),te=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ne=function(t){function n(n){var e=t.call(this)||this;return e.commands=new B(n).toJSON(),e}return te(n,t),n.prototype.stringify=function(){return{$expr:this.commands}},n}(x),ee=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),re=function(t){function n(n){return t.call(this,"gt",n)||this}return ee(n,t),n}(j),oe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ie=function(t){function n(n){return t.call(this,"gte",n)||this}return oe(n,t),n}(j),ue=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ce=function(t){function n(n){return t.call(this,"lt",n)||this}return ue(n,t),n}(j),se=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ae=function(t){function n(n){return t.call(this,"lte",n)||this}return se(n,t),n}(j),fe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),pe=function(t){function n(n){return t.call(this,"max",new B(n).toJSON())||this}return fe(n,t),n}(j),le=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),he=function(t){function n(n){return t.call(this,"min",new B(n).toJSON())||this}return le(n,t),n}(j),ye=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),de=function(t){function n(n){return t.call(this,"ne",n)||this}return ye(n,t),n}(j),ge=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),we=function(t){function n(n){var e=n.map((function(t){return new B(t).toJSON()}));return t.call(this,"or",e)||this}return ge(n,t),n.prototype.pushCommand=function(t){this.value.push(new B(t).toJSON())},n}(j),ve=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),be=function(t){function n(n){var e=Array.isArray(n)?n.map((function(t){return new B(t).toJSON()})):new B(n).toJSON();return t.call(this,"sum",e)||this}return ve(n,t),n}(j),_e=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),me=function(t){function n(n){var e=t.call(this)||this;return e.value=n,e}return _e(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$addToSet"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return Array.isArray(this.value)?{$each:this.value}:"object"===e(this.value)&&this.value.hasOwnProperty("each")?{$each:this.value.each}:this.value},n}(O),Oe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),xe=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return Oe(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$max"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(m),je=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Se=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return je(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$min"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(m),Pe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ae=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return Pe(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$mul"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(m),Ee=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ne=function(t){function n(n){var e=t.call(this)||this;return e.value=n,e}return Ee(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pop"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.value||1},n}(O),Ie=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Te=function(t){function n(n){var e=t.call(this)||this;return e.value=n,e}return Ie(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pull"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return new Xn(this.value).toJSON()},n}(O),Re=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ce=function(t){function n(n){var e=t.call(this)||this;return e.values=n,e}return Re(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$pullAll"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.values},n}(O),Be=(_n=function(t,n){return _n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},_n(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}_n(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),$e=function(){return $e=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},$e.apply(this,arguments)},De=function(t){function n(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];var i=t.call(this)||this;return"object"===e(i.value)&&i.value.hasOwnProperty("each")?i.value=n:(null==r?void 0:r.length)>0?i.value=[].concat.apply([],function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}([n],r,!1)):i.value=n,i}return Be(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$push"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){if(Array.isArray(this.value))return{$each:this.value};if("object"===e(this.value)&&this.value.hasOwnProperty("each")){var t=this.value,n={$each:t.each};return void 0!==t.position&&(n.$position=t.position),void 0!==t.slice&&(n.$slice=t.slice),void 0!==t.sort&&("string"==typeof t.sort?n.$sort=t.sort===E.DESC?-1:1:n.$sort=t.sort),n}return"object"===e(this.value)&&"string"==typeof this.value.$sort?$e($e({},this.value),{$sort:this.value.$sort===E.DESC?-1:1}):this.value},n}(O),Ue=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),qe=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return Ue(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$unset"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return""},n}(m),Le=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ke=function(t){function n(n){var e=t.call(this)||this;return e.name=n,e}return Le(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$rename"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.name},n}(m),Me=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Je=function(t){function n(n){var e=t.call(this)||this;return e.data=n,e}return Me(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$set"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.data},n}(m),Fe=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),He=function(t){function n(n){var e=t.call(this)||this;return e.num=n,e}return Fe(n,t),Object.defineProperty(n.prototype,"operator",{get:function(){return"$inc"},enumerable:!1,configurable:!0}),n.prototype.stringify=function(){return this.num},n}(m),Ve=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),ze=function(t){function n(n){var e=t.call(this)||this;return e.command=Yn.stringify(n),e}return Ve(n,t),n.prototype.stringify=function(){return{$not:this.command.stringify()}},n}(x),Ze=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),We=function(t){function n(n){var e=t.call(this)||this;return e.commands=n.map(Yn.stringify),e}return Ze(n,t),n.prototype.pushCommand=function(t){this.commands.push(Yn.stringify(t))},n.prototype.stringify=function(){return{$nor:this.commands}},n}(x),Ke=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ge=function(t){function n(n){var e=t.call(this)||this;return e.val=n,e}return Ke(n,t),n.prototype.stringify=function(){return{$size:this.val}},n}(x),Ye=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},Xe=function(){function t(){}return t.prototype.pipeline=function(){return new Qn},t.prototype.avg=function(t){return new z(t)},t.prototype.count=function(){return new et},t.prototype.max=function(t){return new pe(t)},t.prototype.min=function(t){return new he(t)},t.prototype.sum=function(t){return new be(t)},t.prototype.and=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t=Array.isArray(t[0])?t[0]:t,new J(t)},t.prototype.or=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t=Array.isArray(t[0])?t[0]:t,new we(t)},t.prototype.not=function(t){return new zt(t)},t.prototype.cmp=function(t,n){var e=Array.isArray(t)?t:[t,n];return new G(e)},t.prototype.eq=function(t,n){var e=Array.isArray(t)?t:[t,n];return new st(e)},t.prototype.neq=function(t,n){var e=Array.isArray(t)?t:[t,n];return new de(e)},t.prototype.lt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new ce(e)},t.prototype.lte=function(t,n){var e=Array.isArray(t)?t:[t,n];return new ae(e)},t.prototype.gt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new re(e)},t.prototype.gte=function(t,n){var e=Array.isArray(t)?t:[t,n];return new ie(e)},t.prototype.addToSet=function(t){return new k(t)},t.prototype.arrayElemAt=function(t,n){var e=Array.isArray(t)?t:[t,n];return new H(e)},t.prototype.indexOfArray=function(t,n,e,r){var o=Array.isArray(t)?t:[t,n,e,r].filter((function(t){return void 0!==t}));return new _t(o)},t.prototype.isArray=function(t){return new Ot(t)},t.prototype.size=function(t){return new Xt(t)},t.prototype.in=function(t,n){var e=Array.isArray(t)?t:[t,n];return new vt(e)},t.prototype.slice=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e].filter((function(t){return void 0!==t}));return new tn(r)},t.prototype.map=function(t){return new Dt(t)},t.prototype.ifNull=function(t,n){var e=Array.isArray(t)?t:[t,n];return new gt(e)},t.prototype.cond=function(t){return new tt(t)},t.prototype.switch=function(t){return new hn(t)},t.prototype.concat=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var r=Array.isArray(t)?t:Ye([t],n,!0);return new X(r)},t.prototype.dateToString=function(t){return new ot(t)},t.prototype.toLower=function(t){return new dn(t)},t.prototype.toUpper=function(t){return new wn(t)},t.prototype.split=function(t,n){var e=Array.isArray(t)?t:[t,n];return new en(e)},t.prototype.substr=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e];return new cn(r)},t.prototype.substrBytes=function(t,n,e){var r=Array.isArray(t)?t:[t,n,e];return new an(r)},t.prototype.first=function(t){return new lt(t)},t.prototype.last=function(t){return new Pt(t)},t.prototype.push=function(t){return new Gt(t)},t.prototype.let=function(t){return new Et(t)},t.prototype.add=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new q(e)},t.prototype.subtract=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new pn(e)},t.prototype.multiply=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new Ht(e)},t.prototype.divide=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new ut(e)},t.prototype.abs=function(t){return new D(t)},t.prototype.ceil=function(t){return new W(t)},t.prototype.exp=function(t){return new ft(t)},t.prototype.floor=function(t){return new yt(t)},t.prototype.ln=function(t){return new It(t)},t.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new Rt(e)},t.prototype.log10=function(t){return new Bt(t)},t.prototype.mod=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new kt(e)},t.prototype.pow=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=Array.isArray(t[0])?t[0]:t;return new Wt(e)},t.prototype.sqrt=function(t){return new on(t)},t.prototype.trunc=function(t){return new bn(t)},t.prototype.mergeObjects=function(t){return new qt(t)},t.prototype.month=function(t){return new Jt(t)},t.prototype.isoWeek=function(t){return new jt(t)},t}(),Qe=function(){function t(){this.aggregate=new Xe,this.Sort=E}return t.prototype.addToSet=function(t){return new me(t)},t.prototype.inc=function(t){return new He(t)},t.prototype.max=function(t){return new xe(t)},t.prototype.min=function(t){return new Se(t)},t.prototype.mul=function(t){return new Ae(t)},t.prototype.pop=function(t){return new Ne(t)},t.prototype.pull=function(t){return new Te(t)},t.prototype.pullAll=function(t){return new Ce(t)},t.prototype.push=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return new(De.bind.apply(De,Ye([void 0,t],n,!1)))},t.prototype.remove=function(){return new qe},t.prototype.rename=function(t){return new ke(t)},t.prototype.set=function(t){return new Je(t)},t.prototype.expr=function(t){return new ne(t)},t.prototype.and=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new xn(t.map(Yn.unchain));return new Gn(e)},t.prototype.or=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new Sn(t.map(Yn.unchain));return new Gn(e)},t.prototype.not=function(t){var n=new ze(Yn.unchain(t));return new Gn(n)},t.prototype.nor=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t=Array.isArray(t[0])?t[0]:t;var e=new We(t.map(Yn.unchain));return new Gn(e)},t.prototype.eq=function(t){return new Gn(new An(t))},t.prototype.neq=function(t){return new Gn(new Nn(t))},t.prototype.lt=function(t){return new Gn(new Tn(t))},t.prototype.lte=function(t){return new Gn(new Cn(t))},t.prototype.gt=function(t){return new Gn(new $n(t))},t.prototype.gte=function(t){return new Gn(new Un(t))},t.prototype.in=function(t){return new Gn(new Ln(t))},t.prototype.nin=function(t){return new Gn(new Mn(t))},t.prototype.exists=function(t){return new Gn(new Fn(t))},t.prototype.mod=function(t,n){return new Gn(new Vn(t,n))},t.prototype.all=function(t){return new Gn(new Zn(t))},t.prototype.elemMatch=function(t){return new Gn(new Kn(Yn.unchain(t)))},t.prototype.size=function(t){return new Gn(new Ge(t))},t}(),tr=function(t,n){return tr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])},tr(t,n)};function nr(t,n){function e(){this.constructor=t}tr(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var er=function(t){function n(e){var r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return nr(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),n}(Error),rr=function(t){function n(e){var r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return nr(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),n}(TypeError);function or(t){return t&&t.Math==Math&&t}function ir(){return or("object"===("undefined"==typeof globalThis?"undefined":e(globalThis))&&globalThis)||or("object"===("undefined"==typeof window?"undefined":e(window))&&window)||or("object"===("undefined"==typeof self?"undefined":e(self))&&self)||or("object"===("undefined"==typeof global?"undefined":e(global))&&global)||Function("return this")()}var ur=function(t){var r=function(){var t=ir();return"object"===e(t.navigator)&&"ReactNative"===t.navigator.product}()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var o=n.Buffer.alloc(t),i=0;i<t;++i)o[i]=Math.floor(256*Math.random());return o},cr=function(){var t=void 0;try{t=require("crypto").randomBytes}catch(t){}return t||ur}();function sr(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function ar(t){return"object"===e(t)&&null!==t}function fr(t,n){var e=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return e||(console.warn(n),e=!0),t.apply(this,r)}}function pr(t){if(ArrayBuffer.isView(t))return n.Buffer.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return n.Buffer.from(t);var e;throw new rr("Must use either Buffer or TypedArray")}var lr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,hr=function(t){return"string"==typeof t&&lr.test(t)},yr=function(t){if(!hr(t))throw new rr('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return n.Buffer.from(e,"hex")},dr=function(t,n){return void 0===n&&(n=!0),n?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},gr=Math.pow(2,53),wr=-Math.pow(2,53),vr=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new rr("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=n.Buffer.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=n.Buffer.from(e,"binary"):Array.isArray(e)?this.buffer=n.Buffer.from(e):this.buffer=pr(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new rr("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new rr("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||r>255)throw new rr("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var o=n.Buffer.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o,this.buffer[this.position++]=r}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=n.Buffer.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(pr(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,n){return n=n&&n>0?n:this.position,this.buffer.slice(t,t+n)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var n=this.buffer.toString("base64"),e=Number(this.sub_type).toString(16);return t.legacy?{$binary:n,$type:1===e.length?"0"+e:e}:{$binary:{base64:n,subType:1===e.length?"0"+e:e}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new br(this.buffer.slice(0,this.position));throw new er('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){var o,i;if(r=r||{},"$binary"in e?r.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,o=n.Buffer.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,o=n.Buffer.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,o=yr(e.$uuid)),!o)throw new rr("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 4===i?new br(o):new t(o,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(vr.prototype,"_bsontype",{value:"Binary"});var br=function(t){function e(r){var o,i,u=this;if(null==r)o=e.generate();else if(r instanceof e)o=n.Buffer.from(r.buffer),i=r.__id;else if(ArrayBuffer.isView(r)&&16===r.byteLength)o=pr(r);else{if("string"!=typeof r)throw new rr("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");o=yr(r)}return(u=t.call(this,o,4)||this).__id=i,u}return nr(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=dr(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=dr(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new vr(this.id,vr.SUBTYPE_UUID)},e.generate=function(){var t=cr(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,n.Buffer.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?hr(t):!!sr(t)&&(16===t.length&&(64==(240&t[6])&&128==(128&t[8])))))},e.createFromHexString=function(t){return new e(yr(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(vr),_r=function(){function t(n,e){if(!(this instanceof t))return new t(n,e);this.code=n,this.scope=e}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(n){return new t(n.$code,n.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();Object.defineProperty(_r.prototype,"_bsontype",{value:"Code"});var mr=function(){function t(n,e,r,o){if(!(this instanceof t))return new t(n,e,r,o);var i=n.split(".");2===i.length&&(r=i.shift(),n=i.shift()),this.collection=n,this.oid=e,this.db=r,this.fields=o||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var n={$ref:this.collection,$id:this.oid};return t.legacy?n:(this.db&&(n.$db=this.db),n=Object.assign(n,this.fields))},t.fromExtendedJSON=function(n){var e=Object.assign({},n);return delete e.$ref,delete e.$id,delete e.$db,new t(n.$ref,n.$id,n.$db,e)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(mr.prototype,"_bsontype",{value:"DBRef"});var Or=void 0;try{Or=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(_n){}var xr=4294967296,jr=0x10000000000000000,Sr=jr/2,Pr={},Ar={},Er=function(){function t(n,e,r){if(void 0===n&&(n=0),!(this instanceof t))return new t(n,e,r);"bigint"==typeof n?Object.assign(this,t.fromBigInt(n,!!e)):"string"==typeof n?Object.assign(this,t.fromString(n,!!e)):(this.low=0|n,this.high=0|e,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(n,e,r){return new t(n,e,r)},t.fromInt=function(n,e){var r,o,i;return e?(i=0<=(n>>>=0)&&n<256)&&(o=Ar[n])?o:(r=t.fromBits(n,(0|n)<0?-1:0,!0),i&&(Ar[n]=r),r):(i=-128<=(n|=0)&&n<128)&&(o=Pr[n])?o:(r=t.fromBits(n,n<0?-1:0,!1),i&&(Pr[n]=r),r)},t.fromNumber=function(n,e){if(isNaN(n))return e?t.UZERO:t.ZERO;if(e){if(n<0)return t.UZERO;if(n>=jr)return t.MAX_UNSIGNED_VALUE}else{if(n<=-Sr)return t.MIN_VALUE;if(n+1>=Sr)return t.MAX_VALUE}return n<0?t.fromNumber(-n,e).neg():t.fromBits(n%xr|0,n/xr|0,e)},t.fromBigInt=function(n,e){return t.fromString(n.toString(),e)},t.fromString=function(n,e,r){if(0===n.length)throw Error("empty string");if("NaN"===n||"Infinity"===n||"+Infinity"===n||"-Infinity"===n)return t.ZERO;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");var o;if((o=n.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return t.fromString(n.substring(1),e,r).neg();for(var i=t.fromNumber(Math.pow(r,8)),u=t.ZERO,c=0;c<n.length;c+=8){var s=Math.min(8,n.length-c),a=parseInt(n.substring(c,c+s),r);if(s<8){var f=t.fromNumber(Math.pow(r,s));u=u.mul(f).add(t.fromNumber(a))}else u=(u=u.mul(i)).add(t.fromNumber(a))}return u.unsigned=e,u},t.fromBytes=function(n,e,r){return r?t.fromBytesLE(n,e):t.fromBytesBE(n,e)},t.fromBytesLE=function(n,e){return new t(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,e)},t.fromBytesBE=function(n,e){return new t(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],e)},t.isLong=function(t){return ar(t)&&!0===t.__isLong__},t.fromValue=function(n,e){return"number"==typeof n?t.fromNumber(n,e):"string"==typeof n?t.fromString(n,e):t.fromBits(n.low,n.high,"boolean"==typeof e?e:n.unsigned)},t.prototype.add=function(n){t.isLong(n)||(n=t.fromValue(n));var e=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,u=n.high>>>16,c=65535&n.high,s=n.low>>>16,a=0,f=0,p=0,l=0;return p+=(l+=i+(65535&n.low))>>>16,l&=65535,f+=(p+=o+s)>>>16,p&=65535,a+=(f+=r+c)>>>16,f&=65535,a+=e+u,a&=65535,t.fromBits(p<<16|l,a<<16|f,this.unsigned)},t.prototype.and=function(n){return t.isLong(n)||(n=t.fromValue(n)),t.fromBits(this.low&n.low,this.high&n.high,this.unsigned)},t.prototype.compare=function(n){if(t.isLong(n)||(n=t.fromValue(n)),this.eq(n))return 0;var e=this.isNegative(),r=n.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(n){if(t.isLong(n)||(n=t.fromValue(n)),n.isZero())throw Error("division by zero");if(Or){if(!this.unsigned&&-2147483648===this.high&&-1===n.low&&-1===n.high)return this;var e=(this.unsigned?Or.div_u:Or.div_s)(this.low,this.high,n.low,n.high);return t.fromBits(e,Or.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,o,i;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return t.UZERO;if(n.gt(this.shru(1)))return t.UONE;i=t.UZERO}else{if(this.eq(t.MIN_VALUE))return n.eq(t.ONE)||n.eq(t.NEG_ONE)?t.MIN_VALUE:n.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(n).shl(1)).eq(t.ZERO)?n.isNegative()?t.ONE:t.NEG_ONE:(o=this.sub(n.mul(r)),i=r.add(o.div(n)));if(n.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();i=t.ZERO}for(o=this;o.gte(n);){r=Math.max(1,Math.floor(o.toNumber()/n.toNumber()));for(var u=Math.ceil(Math.log(r)/Math.LN2),c=u<=48?1:Math.pow(2,u-48),s=t.fromNumber(r),a=s.mul(n);a.isNegative()||a.gt(o);)r-=c,a=(s=t.fromNumber(r,this.unsigned)).mul(n);s.isZero()&&(s=t.ONE),i=i.add(s),o=o.sub(a)}return i},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(n){return t.isLong(n)||(n=t.fromValue(n)),(this.unsigned===n.unsigned||this.high>>>31!=1||n.high>>>31!=1)&&(this.high===n.high&&this.low===n.low)},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var n,e=0!==this.high?this.high:this.low;for(n=31;n>0&&0==(e&1<<n);n--);return 0!==this.high?n+33:n+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(n){if(t.isLong(n)||(n=t.fromValue(n)),Or){var e=(this.unsigned?Or.rem_u:Or.rem_s)(this.low,this.high,n.low,n.high);return t.fromBits(e,Or.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(n){if(this.isZero())return t.ZERO;if(t.isLong(n)||(n=t.fromValue(n)),Or){var e=Or.mul(this.low,this.high,n.low,n.high);return t.fromBits(e,Or.get_high(),this.unsigned)}if(n.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return n.isOdd()?t.MIN_VALUE:t.ZERO;if(n.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(t.TWO_PWR_24)&&n.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*n.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,u=65535&this.low,c=n.high>>>16,s=65535&n.high,a=n.low>>>16,f=65535&n.low,p=0,l=0,h=0,y=0;return h+=(y+=u*f)>>>16,y&=65535,l+=(h+=i*f)>>>16,h&=65535,l+=(h+=u*a)>>>16,h&=65535,p+=(l+=o*f)>>>16,l&=65535,p+=(l+=i*a)>>>16,l&=65535,p+=(l+=u*s)>>>16,l&=65535,p+=r*f+o*a+i*s+u*c,p&=65535,t.fromBits(h<<16|y,p<<16|l,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(n){return t.isLong(n)||(n=t.fromValue(n)),t.fromBits(this.low|n.low,this.high|n.high,this.unsigned)},t.prototype.shiftLeft=function(n){return t.isLong(n)&&(n=n.toInt()),0==(n&=63)?this:n<32?t.fromBits(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):t.fromBits(0,this.low<<n-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(n){return t.isLong(n)&&(n=n.toInt()),0==(n&=63)?this:n<32?t.fromBits(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):t.fromBits(this.high>>n-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(n){if(t.isLong(n)&&(n=n.toInt()),0===(n&=63))return this;var e=this.high;if(n<32){var r=this.low;return t.fromBits(r>>>n|e<<32-n,e>>>n,this.unsigned)}return 32===n?t.fromBits(e,0,this.unsigned):t.fromBits(e>>>n-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(n){return t.isLong(n)||(n=t.fromValue(n)),this.add(n.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*xr+(this.low>>>0):this.high*xr+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,n=this.low;return[255&n,n>>>8&255,n>>>16&255,n>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,n>>>24,n>>>16&255,n>>>8&255,255&n]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(n){if((n=n||10)<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var e=t.fromNumber(n),r=this.div(e),o=r.mul(e).sub(this);return r.toString(n)+o.toInt().toString(n)}return"-"+this.neg().toString(n)}for(var i=t.fromNumber(Math.pow(n,6),this.unsigned),u=this,c="";;){var s=u.div(i),a=(u.sub(s.mul(i)).toInt()>>>0).toString(n);if((u=s).isZero())return a+c;for(;a.length<6;)a="0"+a;c=""+a+c}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(n){return t.isLong(n)||(n=t.fromValue(n)),t.fromBits(this.low^n.low,this.high^n.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(n,e){var r=t.fromString(n.$numberLong);return e&&e.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Er.prototype,"__isLong__",{value:!0}),Object.defineProperty(Er.prototype,"_bsontype",{value:"Long"});var Nr=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ir=/^(\+|-)?(Infinity|inf)$/i,Tr=/^(\+|-)?NaN$/i,Rr=6111,Cr=-6176,Br=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),$r=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Dr=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ur=/^([-+])?(\d+)?$/;function qr(t){return!isNaN(parseInt(t,10))}function Lr(t){var n=Er.fromNumber(1e9),e=Er.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:e};for(var r=0;r<=3;r++)e=(e=e.shiftLeft(32)).add(new Er(t.parts[r],0)),t.parts[r]=e.div(n).low,e=e.modulo(n);return{quotient:t,rem:e}}function kr(t,n){throw new rr('"'.concat(t,'" is not a valid Decimal128 string - ').concat(n))}var Mr=function(){function t(n){if(!(this instanceof t))return new t(n);if("string"==typeof n)this.bytes=t.fromString(n).bytes;else{if(!sr(n))throw new rr("Decimal128 must take a Buffer or string");if(16!==n.byteLength)throw new rr("Decimal128 must take a Buffer of 16 bytes");this.bytes=n}}return t.fromString=function(e){var r,o=!1,i=!1,u=!1,c=0,s=0,a=0,f=0,p=0,l=[0],h=0,y=0,d=0,g=0,w=0,v=0,b=new Er(0,0),_=new Er(0,0),m=0;if(e.length>=7e3)throw new rr(e+" not a valid Decimal128 string");var O=e.match(Nr),x=e.match(Ir),j=e.match(Tr);if(!O&&!x&&!j||0===e.length)throw new rr(e+" not a valid Decimal128 string");if(O){var S=O[2],P=O[4],A=O[5],E=O[6];P&&void 0===E&&kr(e,"missing exponent power"),P&&void 0===S&&kr(e,"missing exponent base"),void 0===P&&(A||E)&&kr(e,"missing e before exponent")}if("+"!==e[m]&&"-"!==e[m]||(o="-"===e[m++]),!qr(e[m])&&"."!==e[m]){if("i"===e[m]||"I"===e[m])return new t(n.Buffer.from(o?$r:Dr));if("N"===e[m])return new t(n.Buffer.from(Br))}for(;qr(e[m])||"."===e[m];)"."!==e[m]?(h<34&&("0"!==e[m]||u)&&(u||(p=s),u=!0,l[y++]=parseInt(e[m],10),h+=1),u&&(a+=1),i&&(f+=1),s+=1,m+=1):(i&&kr(e,"contains multiple periods"),i=!0,m+=1);if(i&&!s)throw new rr(e+" not a valid Decimal128 string");if("e"===e[m]||"E"===e[m]){var N=e.substr(++m).match(Ur);if(!N||!N[2])return new t(n.Buffer.from(Br));w=parseInt(N[0],10),m+=N[0].length}if(e[m])return new t(n.Buffer.from(Br));if(d=0,h){if(g=h-1,1!==(c=a))for(;0===l[p+c-1];)c-=1}else d=0,g=0,l[0]=0,a=1,h=1,c=0;for(w<=f&&f-w>16384?w=Cr:w-=f;w>Rr;){if((g+=1)-d>34){if(l.join("").match(/^0+$/)){w=Rr;break}kr(e,"overflow")}w-=1}for(;w<Cr||h<a;){if(0===g&&c<h){w=Cr,c=0;break}if(h<a?a-=1:g-=1,w<Rr)w+=1;else{if(l.join("").match(/^0+$/)){w=Rr;break}kr(e,"overflow")}}if(g-d+1<c){var I=s;i&&(p+=1,I+=1),o&&(p+=1,I+=1);var T=parseInt(e[p+g+1],10),R=0;if(T>=5&&(R=1,5===T))for(R=l[g]%2==1?1:0,v=p+g+2;v<I;v++)if(parseInt(e[v],10)){R=1;break}if(R)for(var C=g;C>=0;C--)if(++l[C]>9&&(l[C]=0,0===C)){if(!(w<Rr))return new t(n.Buffer.from(o?$r:Dr));w+=1,l[C]=1}}if(b=Er.fromNumber(0),_=Er.fromNumber(0),0===c)b=Er.fromNumber(0),_=Er.fromNumber(0);else if(g-d<17){C=d;for(_=Er.fromNumber(l[C++]),b=new Er(0,0);C<=g;C++)_=(_=_.multiply(Er.fromNumber(10))).add(Er.fromNumber(l[C]))}else{C=d;for(b=Er.fromNumber(l[C++]);C<=g-17;C++)b=(b=b.multiply(Er.fromNumber(10))).add(Er.fromNumber(l[C]));for(_=Er.fromNumber(l[C++]);C<=g;C++)_=(_=_.multiply(Er.fromNumber(10))).add(Er.fromNumber(l[C]))}var B,$,D,U,q=function(t,n){if(!t&&!n)return{high:Er.fromNumber(0),low:Er.fromNumber(0)};var e=t.shiftRightUnsigned(32),r=new Er(t.getLowBits(),0),o=n.shiftRightUnsigned(32),i=new Er(n.getLowBits(),0),u=e.multiply(o),c=e.multiply(i),s=r.multiply(o),a=r.multiply(i);return u=u.add(c.shiftRightUnsigned(32)),c=new Er(c.getLowBits(),0).add(s).add(a.shiftRightUnsigned(32)),{high:u=u.add(c.shiftRightUnsigned(32)),low:a=c.shiftLeft(32).add(new Er(a.getLowBits(),0))}}(b,Er.fromString("100000000000000000"));q.low=q.low.add(_),B=q.low,$=_,D=B.high>>>0,U=$.high>>>0,(D<U||D===U&&B.low>>>0<$.low>>>0)&&(q.high=q.high.add(Er.fromNumber(1))),r=w+6176;var L={low:Er.fromNumber(0),high:Er.fromNumber(0)};q.high.shiftRightUnsigned(49).and(Er.fromNumber(1)).equals(Er.fromNumber(1))?(L.high=L.high.or(Er.fromNumber(3).shiftLeft(61)),L.high=L.high.or(Er.fromNumber(r).and(Er.fromNumber(16383).shiftLeft(47))),L.high=L.high.or(q.high.and(Er.fromNumber(0x7fffffffffff)))):(L.high=L.high.or(Er.fromNumber(16383&r).shiftLeft(49)),L.high=L.high.or(q.high.and(Er.fromNumber(562949953421311)))),L.low=q.low,o&&(L.high=L.high.or(Er.fromString("9223372036854775808")));var k=n.Buffer.alloc(16);return m=0,k[m++]=255&L.low.low,k[m++]=L.low.low>>8&255,k[m++]=L.low.low>>16&255,k[m++]=L.low.low>>24&255,k[m++]=255&L.low.high,k[m++]=L.low.high>>8&255,k[m++]=L.low.high>>16&255,k[m++]=L.low.high>>24&255,k[m++]=255&L.high.low,k[m++]=L.high.low>>8&255,k[m++]=L.high.low>>16&255,k[m++]=L.high.low>>24&255,k[m++]=255&L.high.high,k[m++]=L.high.high>>8&255,k[m++]=L.high.high>>16&255,k[m++]=L.high.high>>24&255,new t(k)},t.prototype.toString=function(){for(var t,n=0,e=new Array(36),r=0;r<e.length;r++)e[r]=0;var o,i,u,c=0,s=!1,a={parts:[0,0,0,0]},f=[];c=0;var p=this.bytes,l=p[c++]|p[c++]<<8|p[c++]<<16|p[c++]<<24,h=p[c++]|p[c++]<<8|p[c++]<<16|p[c++]<<24,y=p[c++]|p[c++]<<8|p[c++]<<16|p[c++]<<24,d=p[c++]|p[c++]<<8|p[c++]<<16|p[c++]<<24;c=0,{low:new Er(l,h),high:new Er(y,d)}.high.lessThan(Er.ZERO)&&f.push("-");var g=d>>26&31;if(g>>3==3){if(30===g)return f.join("")+"Infinity";if(31===g)return"NaN";t=d>>15&16383,o=8+(d>>14&1)}else o=d>>14&7,t=d>>17&16383;var w=t-6176;if(a.parts[0]=(16383&d)+((15&o)<<14),a.parts[1]=y,a.parts[2]=h,a.parts[3]=l,0===a.parts[0]&&0===a.parts[1]&&0===a.parts[2]&&0===a.parts[3])s=!0;else for(u=3;u>=0;u--){var v=0,b=Lr(a);if(a=b.quotient,v=b.rem.low)for(i=8;i>=0;i--)e[9*u+i]=v%10,v=Math.floor(v/10)}if(s)n=1,e[c]=0;else for(n=36;!e[c];)n-=1,c+=1;var _=n-1+w;if(_>=34||_<=-7||w>0){if(n>34)return f.push("".concat(0)),w>0?f.push("E+".concat(w)):w<0&&f.push("E".concat(w)),f.join("");f.push("".concat(e[c++])),(n-=1)&&f.push(".");for(r=0;r<n;r++)f.push("".concat(e[c++]));f.push("E"),_>0?f.push("+".concat(_)):f.push("".concat(_))}else if(w>=0)for(r=0;r<n;r++)f.push("".concat(e[c++]));else{var m=n+w;if(m>0)for(r=0;r<m;r++)f.push("".concat(e[c++]));else f.push("0");for(f.push(".");m++<0;)f.push("0");for(r=0;r<n-Math.max(m-1,0);r++)f.push("".concat(e[c++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(n){return t.fromString(n.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Mr.prototype,"_bsontype",{value:"Decimal128"});var Jr=function(){function t(n){if(!(this instanceof t))return new t(n);n instanceof Number&&(n=n.valueOf()),this.value=+n}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(n,e){var r=parseFloat(n.$numberDouble);return e&&e.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(Jr.prototype,"_bsontype",{value:"Double"});var Fr=function(){function t(n){if(!(this instanceof t))return new t(n);n instanceof Number&&(n=n.valueOf()),this.value=0|+n}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(n,e){return e&&e.relaxed?parseInt(n.$numberInt,10):new t(n.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Fr.prototype,"_bsontype",{value:"Int32"});var Hr=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Hr.prototype,"_bsontype",{value:"MaxKey"});var Vr=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Vr.prototype,"_bsontype",{value:"MinKey"});var zr=new RegExp("^[0-9a-fA-F]{24}$"),Zr=null,Wr=Symbol("id"),Kr=function(){function t(r){if(!(this instanceof t))return new t(r);var o;if("object"===e(r)&&r&&"id"in r){if("string"!=typeof r.id&&!ArrayBuffer.isView(r.id))throw new rr("Argument passed in must have an id that is of type string or Buffer");o="toHexString"in r&&"function"==typeof r.toHexString?n.Buffer.from(r.toHexString(),"hex"):r.id}else o=r;if(null==o||"number"==typeof o)this[Wr]=t.generate("number"==typeof o?o:void 0);else if(ArrayBuffer.isView(o)&&12===o.byteLength)this[Wr]=o instanceof n.Buffer?o:pr(o);else{if("string"!=typeof o)throw new rr("Argument passed in does not match the accepted types");if(12===o.length){var i=n.Buffer.from(o);if(12!==i.byteLength)throw new rr("Argument passed in must be a string of 12 bytes");this[Wr]=i}else{if(24!==o.length||!zr.test(o))throw new rr("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Wr]=n.Buffer.from(o,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Wr]},set:function(n){this[Wr]=n,t.cacheHexString&&(this.__id=n.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var n=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=n),n},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),o=n.Buffer.alloc(12);return o.writeUInt32BE(e,0),null===Zr&&(Zr=cr(5)),o[4]=Zr[0],o[5]=Zr[1],o[6]=Zr[2],o[7]=Zr[3],o[8]=Zr[4],o[11]=255&r,o[10]=r>>8&255,o[9]=r>>16&255,o},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(r){if(null==r)return!1;if(r instanceof t)return this[Wr][11]===r[Wr][11]&&this[Wr].equals(r[Wr]);if("string"==typeof r&&t.isValid(r)&&12===r.length&&sr(this.id))return r===n.Buffer.prototype.toString.call(this.id,"latin1");if("string"==typeof r&&t.isValid(r)&&24===r.length)return r.toLowerCase()===this.toHexString();if("string"==typeof r&&t.isValid(r)&&12===r.length)return n.Buffer.from(r).equals(this.id);if("object"===e(r)&&"toHexString"in r&&"function"==typeof r.toHexString){var o=r.toHexString(),i=this.toHexString().toLowerCase();return"string"==typeof o&&o.toLowerCase()===i}return!1},t.prototype.getTimestamp=function(){var t=new Date,n=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(n)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var r=n.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new rr("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(n.Buffer.from(e,"hex"))},t.isValid=function(n){if(null==n)return!1;try{return new t(n),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(n){return new t(n.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(Kr.prototype,"generate",{value:fr((function(t){return Kr.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Kr.prototype,"getInc",{value:fr((function(){return Kr.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Kr.prototype,"get_inc",{value:fr((function(){return Kr.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Kr,"get_inc",{value:fr((function(){return Kr.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Kr.prototype,"_bsontype",{value:"ObjectID"});var Gr=function(){function t(n,e){if(!(this instanceof t))return new t(n,e);if(this.pattern=n,this.options=(null!=e?e:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new er("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new er("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new er("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(n){if("$regex"in n){if("string"==typeof n.$regex)return new t(n.$regex,t.parseOptions(n.$options));if("BSONRegExp"===n.$regex._bsontype)return n}if("$regularExpression"in n)return new t(n.$regularExpression.pattern,t.parseOptions(n.$regularExpression.options));throw new rr("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(n)))},t}();Object.defineProperty(Gr.prototype,"_bsontype",{value:"BSONRegExp"});var Yr=function(){function t(n){if(!(this instanceof t))return new t(n);this.value=n}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(n){return new t(n.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(Yr.prototype,"_bsontype",{value:"Symbol"});var Xr=function(t){function n(e,r){var o=this;return o instanceof n?(o=Er.isLong(e)?t.call(this,e.low,e.high,!0)||this:ar(e)&&void 0!==e.t&&void 0!==e.i?t.call(this,e.i,e.t,!0)||this:t.call(this,e,r,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new n(e,r)}return nr(n,t),n.prototype.toJSON=function(){return{$timestamp:this.toString()}},n.fromInt=function(t){return new n(Er.fromInt(t,!0))},n.fromNumber=function(t){return new n(Er.fromNumber(t,!0))},n.fromBits=function(t,e){return new n(t,e)},n.fromString=function(t,e){return new n(Er.fromString(t,!0,e))},n.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},n.fromExtendedJSON=function(t){return new n(t.$timestamp)},n.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},n.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},n.MAX_VALUE=Er.MAX_UNSIGNED_VALUE,n}(Er);var Qr=2147483647,to=-2147483648,no=0x8000000000000000,eo=-0x8000000000000000,ro={$oid:Kr,$binary:vr,$uuid:vr,$symbol:Yr,$numberInt:Fr,$numberDecimal:Mr,$numberDouble:Jr,$numberLong:Er,$minKey:Vr,$maxKey:Hr,$regex:Gr,$regularExpression:Gr,$timestamp:Xr};function oo(t,n){if(void 0===n&&(n={}),"number"==typeof t){if(n.relaxed||n.legacy)return t;if(Math.floor(t)===t){if(t>=to&&t<=Qr)return new Fr(t);if(t>=eo&&t<=no)return Er.fromNumber(t)}return new Jr(t)}if(null==t||"object"!==e(t))return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter((function(n){return n.startsWith("$")&&null!=t[n]})),o=0;o<r.length;o++){var i=ro[r[o]];if(i)return i.fromExtendedJSON(t,n)}if(null!=t.$date){var u=t.$date,c=new Date;return n.legacy?"number"==typeof u?c.setTime(u):"string"==typeof u&&c.setTime(Date.parse(u)):"string"==typeof u?c.setTime(Date.parse(u)):Er.isLong(u)?c.setTime(u.toNumber()):"number"==typeof u&&n.relaxed&&c.setTime(u),c}if(null!=t.$code){var s=Object.assign({},t);return t.$scope&&(s.$scope=oo(t.$scope)),_r.fromExtendedJSON(t)}if(function(t){return ar(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var a=t.$ref?t:t.$dbPointer;if(a instanceof mr)return a;var f=Object.keys(a).filter((function(t){return t.startsWith("$")})),p=!0;if(f.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(p=!1)})),p)return mr.fromExtendedJSON(a)}return t}function io(t){var n=t.toISOString();return 0!==t.getUTCMilliseconds()?n:n.slice(0,-5)+"Z"}function uo(t,n){if(("object"===e(t)||"function"==typeof t)&&null!==t){var r=n.seenObjects.findIndex((function(n){return n.obj===t}));if(-1!==r){var o=n.seenObjects.map((function(t){return t.propertyName})),i=o.slice(0,r).map((function(t){return"".concat(t," -> ")})).join(""),u=o[r],c=" -> "+o.slice(r+1,o.length-1).map((function(t){return"".concat(t," -> ")})).join(""),s=o[o.length-1],a=" ".repeat(i.length+u.length/2),f="-".repeat(c.length+(u.length+s.length)/2-1);throw new rr("Converting circular structure to EJSON:\n"+" ".concat(i).concat(u).concat(c).concat(s,"\n")+" ".concat(a,"\\").concat(f,"/"))}n.seenObjects[n.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,n){return t.map((function(t,e){n.seenObjects.push({propertyName:"index ".concat(e),obj:null});try{return uo(t,n)}finally{n.seenObjects.pop()}}))}(t,n);if(void 0===t)return null;if(t instanceof Date||function(t){return ar(t)&&"[object Date]"===Object.prototype.toString.call(t)}(t)){var p=t.getTime(),l=p>-1&&p<2534023188e5;return n.legacy?n.relaxed&&l?{$date:t.getTime()}:{$date:io(t)}:n.relaxed&&l?{$date:io(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||n.relaxed&&isFinite(t))){if(Math.floor(t)===t){var h=t>=eo&&t<=no;if(t>=to&&t<=Qr)return{$numberInt:t.toString()};if(h)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(t)){var y=t.flags;if(void 0===y){var d=t.toString().match(/[gimuy]*$/);d&&(y=d[0])}return new Gr(t.source,y).toExtendedJSON(n)}return null!=t&&"object"===e(t)?function(t,n){if(null==t||"object"!==e(t))throw new er("not an object instance");var r=t._bsontype;if(void 0===r){var o={};for(var i in t){n.seenObjects.push({propertyName:i,obj:null});try{var u=uo(t[i],n);"__proto__"===i?Object.defineProperty(o,i,{value:u,writable:!0,enumerable:!0,configurable:!0}):o[i]=u}finally{n.seenObjects.pop()}}return o}if(function(t){return ar(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var c=t;if("function"!=typeof c.toExtendedJSON){var s=so[t._bsontype];if(!s)throw new rr("Unrecognized or invalid _bsontype: "+t._bsontype);c=s(c)}return"Code"===r&&c.scope?c=new _r(c.code,uo(c.scope,n)):"DBRef"===r&&c.oid&&(c=new mr(uo(c.collection,n),uo(c.oid,n),uo(c.db,n),uo(c.fields,n))),c.toExtendedJSON(n)}throw new er("_bsontype must be a string, but was: "+e(r))}(t,n):t}var co,so={Binary:function(t){return new vr(t.value(),t.sub_type)},Code:function(t){return new _r(t.code,t.scope)},DBRef:function(t){return new mr(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Mr(t.bytes)},Double:function(t){return new Jr(t.value)},Int32:function(t){return new Fr(t.value)},Long:function(t){return Er.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new Hr},MinKey:function(){return new Vr},ObjectID:function(t){return new Kr(t)},ObjectId:function(t){return new Kr(t)},BSONRegExp:function(t){return new Gr(t.pattern,t.options)},Symbol:function(t){return new Yr(t.value)},Timestamp:function(t){return Xr.fromBits(t.low,t.high)}};!function(t){function n(t,n){var e=Object.assign({},{relaxed:!0,legacy:!1},n);return"boolean"==typeof e.relaxed&&(e.strict=!e.relaxed),"boolean"==typeof e.strict&&(e.relaxed=!e.strict),JSON.parse(t,(function(t,n){if(-1!==t.indexOf("\0"))throw new er("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return oo(n,e)}))}function r(t,n,r,o){null!=r&&"object"===e(r)&&(o=r,r=0),null==n||"object"!==e(n)||Array.isArray(n)||(o=n,n=void 0,r=0);var i=uo(t,Object.assign({relaxed:!0,legacy:!1},o,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,n,r)}t.parse=n,t.stringify=r,t.serialize=function(t,n){return n=n||{},JSON.parse(r(t,n))},t.deserialize=function(t,e){return e=e||{},n(JSON.stringify(t),e)}}(co||(co={}));var ao=ir();ao.Map?ao.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var n=0;n<t.length;n++)if(null!=t[n]){var e=t[n],r=e[0],o=e[1];this._keys.push(r),this._values[r]={v:o,i:this._keys.length-1}}}t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var n=this._values[t];return null!=n&&(delete this._values[t],this._keys.splice(n.i,1),!0)},t.prototype.entries=function(){var t=this,n=0;return{next:function(){var e=t._keys[n++];return{value:void 0!==e?[e,t._values[e].v]:void 0,done:void 0===e}}}},t.prototype.forEach=function(t,n){n=n||this;for(var e=0;e<this._keys.length;e++){var r=this._keys[e];t.call(n,this._values[r].v,r,n)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,n=0;return{next:function(){var e=t._keys[n++];return{value:void 0!==e?e:void 0,done:void 0===e}}}},t.prototype.set=function(t,n){return this._values[t]?(this._values[t].v=n,this):(this._keys.push(t),this._values[t]={v:n,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,n=0;return{next:function(){var e=t._keys[n++];return{value:void 0!==e?t._values[e].v:void 0,done:void 0===e}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),Er.fromNumber(gr),Er.fromNumber(wr);var fo=new Uint8Array(8);new DataView(fo.buffer,fo.byteOffset,fo.byteLength);n.Buffer.alloc(17825792);var po=function(){function t(){}return t.serialize=function(n){return t.filterUndefinedKey(n,[n]),co.serialize(n)},t.deserialize=function(t){return co.deserialize(t)},t.filterUndefinedKey=function(n,r){if(!r.includes(n)){if(r.push(n),!n||"object"!==e(n))return n;for(var o in n)void 0===n[o]?delete n[o]:t.filterUndefinedKey(n[o],r)}},t}(),lo=function(){function t(){}return t.buildCollectionAction=function(t,n){return{target:T.collection,action:t,collectionName:n}},t.buildCollectionListQueryAction=function(t){return{target:T.collection,action:N.queryList,options:po.serialize(t)}},t.buildDocumentAction=function(t,n,e){return{target:T.document,action:t,collectionName:n,options:po.serialize(e)}},t}(),ho=function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),yo=function(t){function n(n){var e=t.call(this)||this;return e.collectionName=n,e}return ho(n,t),n.prototype.end=function(){var t={$aggregate:this.done()};return lo.buildDocumentAction(I.aggregate,this.collectionName,t)},n}(Qn),go=function(){function t(){this.res={}}return t.prototype.set=function(t,n){this.res.$set=this.res.$set||{},this.res.$set[t]=n},t.prototype.applyOperator=function(t,n,e){this.res[t]=this.res[t]||{},this.res[t][n]=e},t.prototype.emit=function(){return this.res},t}(),wo=function(){function t(t,n){void 0===n&&(n=""),this.data=t,this.prefix=n}return t.prototype.stringify=function(n){for(var r in n=n||new go,this.data){var o=this.prefix?"".concat(this.prefix,".").concat(r):r,i=this.data[r],u=e(i);if(i instanceof _){if(!(i instanceof m))throw C.invalidCommand("Command 不是更新操作");n.applyOperator(i.operator,o,i.stringify())}else if(i instanceof Date)n.set(o,i);else if("number"===u)n.set(o,i);else if("boolean"===u)n.set(o,i);else if("string"===u)n.set(o,i);else if("bigint"===u)n.set(o,i);else{if("function"===u)throw C.invalidParam(o,"不支持函数");if("symbol"===u)throw C.invalidParam(o,"不支持 symbol");if("undefined"===u);else if(null===i)n.set(o,i);else if(Array.isArray(i))n.set(o,i);else{new t(i,o).stringify(n)}}}return n},t.prototype.toJSON=function(){return this.stringify().emit()},t}(),vo=function(){return vo=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},vo.apply(this,arguments)},bo=function(){function t(t){this.collectionName=t,this.criteria={sort:[]}}return t.prototype.limit=function(t){return this.criteria.limit=t,this},t.prototype.skip=function(t){return this.criteria.skip=t,this},t.prototype.where=function(t){return this.criteria.match=t,this},t.prototype.projection=function(t){for(var n in t)t[n]?"object"!==e(t[n])&&(t[n]=1):t[n]=0;return this.criteria.projection=t,this},t.prototype.orderBy=function(t,n){return this.criteria.sort.push({field:t,sort:n}),this},t.prototype.update=function(t){return this.build(I.update,vo(vo({},this.baseOptions()),{$update:new wo(t.data).toJSON()}))},t.prototype.updateAndReturn=function(t){var n=this.findOptions();return this.build(I.findOneAndUpdate,{$match:n.$match,$update:new wo(t.data).toJSON(),$options:{$sort:n.$sort,$returnDocument:"after",$upsert:!1}})},t.prototype.set=function(t){return this.build(I.replace,vo(vo({},this.baseOptions()),{$replace:t.data,$upsert:!0}))},t.prototype.remove=function(){return this.build(I.delete,this.baseOptions())},t.prototype.get=function(){return this.build(I.queryList,vo({$limit:100},this.findOptions()))},t.prototype.count=function(){return this.build(I.count,this.baseOptions())},t.prototype.baseOptions=function(){var t={};if(void 0!==this.criteria.match){var n=new Xn(this.criteria.match);t.$match=n.toJSON()}return void 0!==this.criteria.limit&&(t.$limit=this.criteria.limit),t},t.prototype.findOptions=function(){var t=this.baseOptions();if(void 0!==this.criteria.projection&&(t.$project=this.criteria.projection),void 0!==this.criteria.sort){t.$sort={};for(var n=0,e=this.criteria.sort;n<e.length;n++){var r=e[n];t.$sort[r.field]=r.sort===E.DESC?-1:1}}return void 0!==this.criteria.skip&&(t.$skip=this.criteria.skip),t},t.prototype.build=function(t,n){return lo.buildDocumentAction(t,this.collectionName,n)},t}(),_o=function(){function t(t,n){this.collectionName=t,this.id=n}return t.prototype.update=function(t){return new bo(this.collectionName).where({_id:String(this.id)}).limit(1).update(t)},t.prototype.set=function(t){return new bo(this.collectionName).where({_id:String(this.id)}).limit(1).set(t)},t.prototype.remove=function(){return new bo(this.collectionName).where({_id:String(this.id)}).limit(1).remove()},t.prototype.get=function(){var t=new bo(this.collectionName).where({_id:String(this.id)}).limit(1).get();return t.action=I.query,t},t}(),mo=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){if(!(null==t?void 0:t.data))throw C.invalidParam("data","不能为空");return Array.isArray(t.data)?this.batchAdd(t):lo.buildDocumentAction(I.create,this.collectionName,t.data)},t.prototype.batchAdd=function(t){if(t.data.length<=0)throw C.invalidParam("data","不能为空数组");if(t.data.length>200)throw C.invalidParam("data","最大长度 200");var n={$create:t.data};return"boolean"==typeof t.ordered&&(n.$ordered=t.ordered),lo.buildDocumentAction(I.batchCreate,this.collectionName,n)},t.prototype.doc=function(t){return new _o(this.collectionName,t)},t.prototype.limit=function(t){return new bo(this.collectionName).limit(t)},t.prototype.skip=function(t){return new bo(this.collectionName).skip(t)},t.prototype.where=function(t){return new bo(this.collectionName).where(t)},t.prototype.projection=function(t){return new bo(this.collectionName).projection(t)},t.prototype.orderBy=function(t,n){return new bo(this.collectionName).orderBy(t,n)},t.prototype.aggregate=function(){return new yo(this.collectionName)},t.prototype.get=function(){return new bo(this.collectionName).get()},t.prototype.count=function(){return new bo(this.collectionName).count()},t}(),Oo=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},xo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}};function jo(){return function(t,n,e){var r=e.value;e.value=function(t){return Oo(this,void 0,void 0,(function(){return xo(this,(function(n){return[2,h(r,this)(t)]}))}))}}}var So,Po=function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Ao=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},Eo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},No=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new yo(t)}return t.prototype.addFields=function(t){return this.builder.addFields(t),this},t.prototype.count=function(t){return this.builder.count(t),this},t.prototype.match=function(t){return this.builder.match(t),this},t.prototype.group=function(t){return this.builder.group(t),this},t.prototype.sample=function(t){return this.builder.sample(t),this},t.prototype.lookup=function(t){return this.builder.lookup(t),this},t.prototype.project=function(t){return this.builder.project(t),this},t.prototype.replaceRoot=function(t){return this.builder.replaceRoot(t),this},t.prototype.sort=function(t){return this.builder.sort(t),this},t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.unwind=function(t){return this.builder.unwind(t),this},t.prototype.end=function(){return Ao(this,void 0,void 0,(function(){var t,n,e;return Eo(this,(function(r){switch(r.label){case 0:return t=this.builder.end().options,"POST",n="".concat(this.getCollectionPath(),"?aggregate"),[4,this.options.httpclient.request({method:"POST",path:n,data:t})];case 1:return e=r.sent(),[2,y.handleResponse(e)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},function(t,n,r,o){var i,u=arguments.length,c=u<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,n,r,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(c=(u<3?i(c):u>3?i(n,r,c):i(n,r))||c);u>3&&c&&Object.defineProperty(n,r,c)}([jo(),Po("design:type",Function),Po("design:paramtypes",[]),Po("design:returntype",Promise)],t.prototype,"end",null),t}(),Io=function(t,n,r,o){var i,u=arguments.length,c=u<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,n,r,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(c=(u<3?i(c):u>3?i(n,r,c):i(n,r))||c);return u>3&&c&&Object.defineProperty(n,r,c),c},To=function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Ro=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},Co=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Bo=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new bo(t)}return t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.where=function(t){return this.builder.where(t),this},t.prototype.projection=function(t){return this.builder.projection(t),this},t.prototype.field=function(t){return this.builder.projection(t),this},t.prototype.orderBy=function(t,n){return this.builder.orderBy(t,n),this},t.prototype.updateAndReturn=function(t){return Ro(this,void 0,void 0,(function(){var n,e,r,o;return Co(this,(function(i){switch(i.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?findOneAndUpdate"),e=this.builder.updateAndReturn(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=i.sent(),[2,{updated:(o=y.handleResponse(r))?1:0,doc:o}]}}))}))},t.prototype.update=function(t){return Ro(this,void 0,void 0,(function(){var n,e,r;return Co(this,(function(o){switch(o.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?update"),e=this.builder.update(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,y.handleResponse(r)]}}))}))},t.prototype.set=function(t){return Ro(this,void 0,void 0,(function(){var n,e,r;return Co(this,(function(o){switch(o.label){case 0:return"POST",n="".concat(this.getCollectionPath(),"?replace"),e=this.builder.set(t).options,[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,y.handleResponse(r)]}}))}))},t.prototype.remove=function(){return Ro(this,void 0,void 0,(function(){var t,n,e;return Co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?delete"),n=this.builder.remove().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,y.handleResponse(e)]}}))}))},t.prototype.get=function(){return Ro(this,void 0,void 0,(function(){var t,n,e;return Co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?query"),n=this.builder.get().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,y.handleResponse(e)]}}))}))},t.prototype.count=function(){return Ro(this,void 0,void 0,(function(){var t,n,e;return Co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?count"),n=this.builder.count().options,[4,this.options.httpclient.request({method:"POST",path:t,data:n})];case 1:return e=r.sent(),[2,{total:y.handleResponse(e).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},Io([jo(),To("design:type",Function),To("design:paramtypes",[Object]),To("design:returntype",Promise)],t.prototype,"updateAndReturn",null),Io([jo(),To("design:type",Function),To("design:paramtypes",[Object]),To("design:returntype",Promise)],t.prototype,"update",null),Io([jo(),To("design:type",Function),To("design:paramtypes",[Object]),To("design:returntype",Promise)],t.prototype,"set",null),Io([jo(),To("design:type",Function),To("design:paramtypes",[]),To("design:returntype",Promise)],t.prototype,"remove",null),Io([jo(),To("design:type",Function),To("design:paramtypes",[]),To("design:returntype",Promise)],t.prototype,"get",null),Io([jo(),To("design:type",Function),To("design:paramtypes",[]),To("design:returntype",Promise)],t.prototype,"count",null),t}(),$o=function(t,n,r,o){var i,u=arguments.length,c=u<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,n,r,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(c=(u<3?i(c):u>3?i(n,r,c):i(n,r))||c);return u>3&&c&&Object.defineProperty(n,r,c),c},Do=function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Uo=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},qo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Lo=function(){function t(t,n,e){this.collectionName=t,this.id=n,this.options=e}return t.prototype.projection=function(t){return this.query.projection(t),this},t.prototype.field=function(t){return this.query.field(t),this},t.prototype.update=function(t){return Uo(this,void 0,void 0,(function(){return qo(this,(function(n){switch(n.label){case 0:return[4,this.query.update(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateAndReturn=function(t){return Uo(this,void 0,void 0,(function(){return qo(this,(function(n){switch(n.label){case 0:return[4,this.query.updateAndReturn(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.set=function(t){return Uo(this,void 0,void 0,(function(){return qo(this,(function(n){switch(n.label){case 0:return[4,this.query.set(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.remove=function(){return Uo(this,void 0,void 0,(function(){return qo(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return Uo(this,void 0,void 0,(function(){var t,n;return qo(this,(function(e){switch(e.label){case 0:return[4,this.query.get()];case 1:if(t=e.sent(),!(n=t[0])){if(this.options.throwOnNotFound)throw l.NOT_FOUND_ERR("不存在_id 为 ".concat(this.id," 的文档"));return[2,null]}return[2,n]}}))}))},Object.defineProperty(t.prototype,"query",{get:function(){return this._query||(this._query=new Bo(this.collectionName,this.options).where({_id:String(this.id)}).limit(1)),this._query},enumerable:!1,configurable:!0}),$o([jo(),Do("design:type",Function),Do("design:paramtypes",[Object]),Do("design:returntype",Promise)],t.prototype,"update",null),$o([jo(),Do("design:type",Function),Do("design:paramtypes",[Object]),Do("design:returntype",Promise)],t.prototype,"updateAndReturn",null),$o([jo(),Do("design:type",Function),Do("design:paramtypes",[Object]),Do("design:returntype",Promise)],t.prototype,"set",null),$o([jo(),Do("design:type",Function),Do("design:paramtypes",[]),Do("design:returntype",Promise)],t.prototype,"remove",null),$o([jo(),Do("design:type",Function),Do("design:paramtypes",[]),Do("design:returntype",Promise)],t.prototype,"get",null),t}(),ko=function(t,n,r,o){var i,u=arguments.length,c=u<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,n,r,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(c=(u<3?i(c):u>3?i(n,r,c):i(n,r))||c);return u>3&&c&&Object.defineProperty(n,r,c),c},Mo=function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Jo=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},Fo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Ho=function(){function t(t,n){this.collectionName=t,this.options=n,this.builder=new mo(t)}return t.prototype.add=function(t){return Jo(this,void 0,void 0,(function(){var n,e,r;return Fo(this,(function(o){switch(o.label){case 0:return n=this.builder.add(t).options,"POST",e=this.getDocumentPath(t.data._id),[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,y.handleResponse(r)]}}))}))},t.prototype.doc=function(t){return new Lo(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new Bo(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new Bo(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new Bo(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new Bo(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new Bo(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,n){return new Bo(this.collectionName,this.options).orderBy(t,n)},t.prototype.aggregate=function(){return new No(this.collectionName,this.options)},t.prototype.update=function(t){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(n){switch(n.label){case 0:return[4,new Bo(this.collectionName,this.options).update(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateAndReturn=function(t){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(n){switch(n.label){case 0:return[4,new Bo(this.collectionName,this.options).updateAndReturn(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.set=function(t){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(n){switch(n.label){case 0:return[4,new Bo(this.collectionName,this.options).set(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.remove=function(){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(t){switch(t.label){case 0:return[4,new Bo(this.collectionName,this.options).remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(t){switch(t.label){case 0:return[4,new Bo(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return Jo(this,void 0,void 0,(function(){return Fo(this,(function(t){switch(t.label){case 0:return[4,new Bo(this.collectionName,this.options).count()];case 1:return[2,t.sent()]}}))}))},t.prototype.getDocumentPath=function(t){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName,"?_id=").concat(t||"")},ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[Object]),Mo("design:returntype",Promise)],t.prototype,"add",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[Object]),Mo("design:returntype",Promise)],t.prototype,"update",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[Object]),Mo("design:returntype",Promise)],t.prototype,"updateAndReturn",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[Object]),Mo("design:returntype",Promise)],t.prototype,"set",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[]),Mo("design:returntype",Promise)],t.prototype,"remove",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[]),Mo("design:returntype",Promise)],t.prototype,"get",null),ko([jo(),Mo("design:type",Function),Mo("design:paramtypes",[]),Mo("design:returntype",Promise)],t.prototype,"count",null),t}(),Vo=function(){return Vo=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},Vo.apply(this,arguments)},zo=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},Zo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Wo=function(){function t(t){this.httpclient=t}return t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,o=t.headers;return zo(this,void 0,void 0,(function(){return Zo(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:n,path:e,data:r,headers:Vo({"x-alipay-cloud-mode":"mongo","x-data-api-type":"mongo","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),Ko=function(){function t(t){this.command=new Qe,this.options=Vo(Vo({},t),{httpclient:new Wo(t.httpclient)})}return t.prototype.collection=function(t){if(!t)throw l.INVALID_PARAM_ERR("collectionName","不能为空");return new Ho(t,this.options)},t}(),Go=function(){return Go=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},Go.apply(this,arguments)},Yo=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):function(t){return t instanceof e?t:new e((function(n){n(t)}))}(t.value).then(u,c)}s((r=r.apply(t,n||[])).next())}))},Xo=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Qo=function(){function t(t){this.options=t}return t.prototype.getUploadPath=function(t){return"/".concat(t,"?upload_url")},t.prototype.getDownloadPath=function(t){return"/".concat(t,"?download_url&expire=3600")},t.prototype.getBatchDeletePath=function(){return"/?delete"},t.prototype.getBatchDownloadPath=function(){return"/?download_url"},t.prototype.checkCloudPath=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?t.startsWith("/")?"不能以 / 开头":t.includes("//")?"不能包含连续的 /":t.length>850?"长度不能超过 850 字节":void 0:"不能为空字符串"},t.prototype.checkFileID=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?void 0:"不能为空字符串"},t.prototype.formatFileID=function(t){return"cloud://".concat(this.options.toEnvId,"/").concat(t.replace(/^\/+/,""))},t.prototype.getCloudPathFromFileID=function(t){var n=t.trim().replace(/^cloud:\/\//,""),e=n.indexOf("/");if(e<=0)throw l.INVALID_PARAM_ERR("fileID","不合法");var r=n.substring(0,e),o=n.substring(e+1);return r!==this.options.toEnvId&&console.warn("file ".concat(t," does not belong to env ").concat(this.options.toEnvId)),o},t.prototype.uploadFile=function(t){return Yo(this,void 0,void 0,(function(){var n,e,r,o,i,u;return Xo(this,(function(c){switch(c.label){case 0:if(n=this.checkCloudPath(t.cloudPath))throw l.INVALID_PARAM_ERR("cloudPath",n);return e=this.getUploadPath(t.cloudPath.trim()),[4,this.request({method:"GET",path:e})];case 1:return r=c.sent(),o=y.handleResponse(r),i=this.formatFileID(o.file_id),[4,this.options.fileUploader.upload({fileID:i,uploadURL:o.upload_url,fileContent:t.fileContent})];case 2:if(200!==(u=c.sent()).statusCode)throw l.STORAGE_ERR(-1,"上传文件 ".concat(o.upload_url," 失败"),r.requestID);return[2,{fileID:i,statusCode:u.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return Yo(this,void 0,void 0,(function(){var n,e,r,o,i,u;return Xo(this,(function(c){switch(c.label){case 0:if(n=this.checkFileID(t.fileID))throw l.INVALID_PARAM_ERR("fileID",n);return e=this.getCloudPathFromFileID(t.fileID),r=this.getDownloadPath(e),[4,this.request({method:"GET",path:r})];case 1:return o=c.sent(),i=y.handleResponse(o),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:i.download_url})];case 2:if(200!==(u=c.sent()).statusCode)throw l.STORAGE_ERR(-1,"下载文件 ".concat(i.download_url," 失败"),o.requestID);return[2,u]}}))}))},t.prototype.deleteFile=function(t){return Yo(this,void 0,void 0,(function(){var n,e,r,o,i,u,c,s,a,f=this;return Xo(this,(function(p){switch(p.label){case 0:if(n=Array.isArray(t)?t:t.fileList,!Array.isArray(n)||0===n.length)throw l.INVALID_PARAM_ERR("fileList","不能为空数组");for(e=[],r=0,o=n;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw l.INVALID_PARAM_ERR("fileID",u);c=this.getCloudPathFromFileID(i),e.push(c)}return s=this.getBatchDeletePath(),[4,this.request({method:"POST",path:s,data:{file_list:e}})];case 1:return a=p.sent(),[2,{fileList:y.handleResponse(a).file_list.map((function(t){return{fileID:f.formatFileID(t.file_id),status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.getTempFileURL=function(t){return Yo(this,void 0,void 0,(function(){var n,e,r,o,i,u,c,s,a,f=this;return Xo(this,(function(p){switch(p.label){case 0:if(n=Array.isArray(t)?t:t.fileList,!Array.isArray(n)||0===n.length)throw l.INVALID_PARAM_ERR("fileList","不能为空数组");if(n.length>50)throw l.INVALID_PARAM_ERR("fileList","最大长度 50");for(e=[],r=0,o=n;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw l.INVALID_PARAM_ERR("fileID",u);c=this.getCloudPathFromFileID(i),e.push({file_id:c,expire:600})}return s=this.getBatchDownloadPath(),[4,this.request({method:"POST",path:s,data:{file_list:e}})];case 1:return a=p.sent(),[2,{fileList:y.handleResponse(a).file_list.map((function(t){return{fileID:f.formatFileID(t.file_id),tempFileURL:t.download_url,status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,o=t.headers;return Yo(this,void 0,void 0,(function(){return Xo(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:n,path:e,data:r,headers:Go({"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),ti=function(){function t(){}return t.createCallFunction=function(t){return function(t){var n=t.httpclient;return h((function(t){return w(void 0,void 0,void 0,(function(){var e,r,o,i,u;return v(this,(function(c){switch(c.label){case 0:if(!t.name)throw l.INVALID_PARAM_ERR("name","缺失");return e={"x-to-function-name":t.name,"x-alipay-cloud-mode":"function"},[4,n.request({method:"POST",path:"/functions/invokeFunction",data:t.data,headers:e})];case 1:if(200!==(r=c.sent()).status)throw o=-1,i="",(u=r.data)&&(o=u.errCode,i=u.errMsg,u.errDetail&&(i+=",详情:".concat(u.errDetail))),l.SERVER_ERR(o,i,r.requestID,r.status);return[2,{requestID:r.requestID,result:r.data}]}}))}))}))}(t)},t.createCallContainer=function(t){return function(t){return h((function(n){return d(void 0,void 0,void 0,(function(){return g(this,(function(e){throw new Error("not implemented in "+t.type+" with "+n)}))}))}))}(t)},t.createDatabase=function(t){return new Ko(t)},t.createStorage=function(t){return new Qo(t)},t}();!function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}(So||(So={}));var ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ei(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ri={exports:{}};var oi,ii={exports:{}};function ui(){return oi||(oi=1,function(t,n){var e;t.exports=(e=e||function(t,n){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),"undefined"!=typeof self&&self.crypto&&(e=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(e=globalThis.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&void 0!==ni&&ni.crypto&&(e=ni.crypto),!e)try{e=require("crypto")}catch(t){}var r=function(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(n){var e;return t.prototype=n,e=new t,t.prototype=null,e}}(),i={},u=i.lib={},c=u.Base={extend:function(t){var n=o(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=u.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=e!=n?e:4*t.length},toString:function(t){return(t||f).stringify(this)},concat:function(t){var n=this.words,e=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var u=e[i>>>2]>>>24-i%4*8&255;n[r+i>>>2]|=u<<24-(r+i)%4*8}else for(var c=0;c<o;c+=4)n[r+c>>>2]=e[c>>>2];return this.sigBytes+=o,this},clamp:function(){var n=this.words,e=this.sigBytes;n[e>>>2]&=4294967295<<32-e%4*8,n.length=t.ceil(e/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],e=0;e<t;e+=4)n.push(r());return new s.init(n,t)}}),a=i.enc={},f=a.Hex={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],o=0;o<e;o++){var i=n[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r+=2)e[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(e,n/2)}},p=a.Latin1={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],o=0;o<e;o++){var i=n[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r++)e[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(e,n)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},h=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var e,r=this._data,o=r.words,i=r.sigBytes,u=this.blockSize,c=i/(4*u),a=(c=n?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*u,f=t.min(4*a,i);if(a){for(var p=0;p<a;p+=u)this._doProcessBlock(o,p);e=o.splice(0,a),r.sigBytes-=f}return new s.init(e,f)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});u.Hasher=h.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,e){return new t.init(e).finalize(n)}},_createHmacHelper:function(t){return function(n,e){return new y.HMAC.init(t,e).finalize(n)}}});var y=i.algo={};return i}(Math),e)}(ii)),ii.exports}!function(t,n){t.exports=ui().enc.Hex}(ri);var ci=ei(ri.exports),si={exports:{}},ai={exports:{}};!function(t,n){var e;t.exports=(e=ui(),function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,u=n.algo,c=[],s=[];!function(){function n(n){for(var e=t.sqrt(n),r=2;r<=e;r++)if(!(n%r))return!1;return!0}function e(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)n(r)&&(o<8&&(c[o]=e(t.pow(r,.5))),s[o]=e(t.pow(r,1/3)),o++),r++}();var a=[],f=u.SHA256=i.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(t,n){for(var e=this._hash.words,r=e[0],o=e[1],i=e[2],u=e[3],c=e[4],f=e[5],p=e[6],l=e[7],h=0;h<64;h++){if(h<16)a[h]=0|t[n+h];else{var y=a[h-15],d=(y<<25|y>>>7)^(y<<14|y>>>18)^y>>>3,g=a[h-2],w=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;a[h]=d+a[h-7]+w+a[h-16]}var v=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),_=l+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&f^~c&p)+s[h]+a[h];l=p,p=f,f=c,c=u+_|0,u=i,i=o,o=r,r=_+(b+v)|0}e[0]=e[0]+r|0,e[1]=e[1]+o|0,e[2]=e[2]+i|0,e[3]=e[3]+u|0,e[4]=e[4]+c|0,e[5]=e[5]+f|0,e[6]=e[6]+p|0,e[7]=e[7]+l|0},_doFinalize:function(){var n=this._data,e=n.words,r=8*this._nDataBytes,o=8*n.sigBytes;return e[o>>>5]|=128<<24-o%32,e[14+(o+64>>>9<<4)]=t.floor(r/4294967296),e[15+(o+64>>>9<<4)]=r,n.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(f),n.HmacSHA256=i._createHmacHelper(f)}(Math),e.SHA256)}(ai);var fi,pi=ai.exports,li=ei(pi),hi={exports:{}};!function(t,n){var e;t.exports=(e=ui(),fi||(fi=1,function(t,n){var e,r,o;t.exports=(r=(e=ui()).lib.Base,o=e.enc.Utf8,void(e.algo.HMAC=r.extend({init:function(t,n){t=this._hasher=new t.init,"string"==typeof n&&(n=o.parse(n));var e=t.blockSize,r=4*e;n.sigBytes>r&&(n=t.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),u=this._iKey=n.clone(),c=i.words,s=u.words,a=0;a<e;a++)c[a]^=1549556828,s[a]^=909522486;i.sigBytes=u.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var n=this._hasher,e=n.finalize(t);return n.reset(),n.finalize(this._oKey.clone().concat(e))}})))}(hi)),e.HmacSHA256)}(si);var yi=ei(si.exports),di=function(){function t(){}return t.sign=function(n){for(var e=n.signedHeaders.join(";"),r="",o=0,i=n.signedHeaders;o<i.length;o++){var u=i[o],c=n.headers[u];r+="".concat(u,":").concat(c,"\n")}var s=t.createHash(n.body||""),a=n.method.toUpperCase()+"\n"+n.path+"\n"+n.query+"\n"+r+"\n"+e+"\n"+s+"\n",f="HMAC-SHA256",p=t.createHash(a),l="".concat(f,"\n").concat(n.timestamp,"\n").concat(p,"\n"),h=t.createSha256(l,n.secretKey);return"".concat(f," Credential=").concat(n.secretId,", SignedHeaders=").concat(e,", Signature=").concat(h)},t.createSha256=function(t,n){return void 0===n&&(n=""),yi(t,n).toString(ci)},t.createHash=function(t){return li(t).toString(ci)},t}(),gi=function(){function t(){}return t.detectRuntime=function(){return window||void 0===("undefined"==typeof my?"undefined":e(my))?window||void 0===("undefined"==typeof wx?"undefined":e(wx))?So.WEB:So.WEICHAT_MINI:So.ALIPAY_MINI},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)}))},t.parseUrl=function(t,n){if(n===So.WEB)return new URL(t);var e=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=e[1],o=e[2],i=e[3],u=e[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:u||""}},t}();var wi=function(){function t(t,n){this.req=t,this.config=n}return Object.defineProperty(t.prototype,"requestId",{get:function(){return this.req.requestOptions.headers["x-trace-id"]},enumerable:!1,configurable:!0}),t}(),vi=function(){function t(){}return t.prototype.request=function(t,n){return i(this,void 0,void 0,(function(){var e,r,i;return u(this,(function(u){switch(u.label){case 0:return[4,fetch(t,o({mode:"cors"},n))];case 1:return e=u.sent(),r={},e.headers.forEach((function(t,n){r[n]=t})),i={status:e.status},[4,e.json()];case 2:return[2,(i.data=u.sent(),i.headers=r,i)]}}))}))},t}(),bi=function(){function t(){}return t.prototype.request=function(t,n){return i(this,void 0,void 0,(function(){var e;return u(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,my.request({url:t,method:(null==n?void 0:n.method)||"GET",data:null==n?void 0:n.body,headers:null==n?void 0:n.headers,dataType:"json"})];case 1:return[2,r.sent()];case 2:throw e=r.sent(),console.error(e),new Error("error: ".concat(e.error,", message: ").concat(e.errorMessage));case 3:return[2]}}))}))},t}(),_i=function(){function t(){}return t.prototype.request=function(t,n){return i(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new Promise((function(e,r){wx.request({url:t,method:(null==n?void 0:n.method)||"GET",data:null==n?void 0:n.body,header:null==n?void 0:n.headers,dataType:"json",success:function(t){e({status:t.statusCode,data:t.data,headers:t.header})},reject:function(t){r(new Error("error: ".concat(t.errno,", message: ").concat(t.errMsg)))}})}))]}))}))},t}(),mi=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case So.ALIPAY_MINI:this.singleton=new bi;break;case So.WEB:this.singleton=new vi;break;case So.WEICHAT_MINI:this.singleton=new _i;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function Oi(t,n){return i(this,void 0,void 0,(function(){var e,r;return u(this,(function(o){switch(o.label){case 0:return[4,n()];case 1:return o.sent(),e=t.config.fetch||mi.default(t.config.runtime),r=t,[4,e.request(t.req.url,t.req.requestOptions)];case 2:return r.res=o.sent(),t.result={status:t.res.status,requestID:t.requestId,headers:t.res.headers,data:t.res.data},[2]}}))}))}function xi(t,n){return i(this,void 0,void 0,(function(){var e;return u(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,n()];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),l.NETWORK_ERR(e,t.requestId);case 3:return[2]}}))}))}function ji(t){return function(n,e){return i(this,void 0,void 0,(function(){var r,i,c,s,a;return u(this,(function(u){switch(u.label){case 0:return r=Date.now(),i=gi.parseUrl(n.req.url,n.config.runtime),c={authorization:"","x-from-app-id":n.config.appId,"x-from-env-id":n.config.envId,"x-to-env-id":n.config.envId,"x-from-instance-id":"".concat(r),"x-from-function-name":n.config.functionName,"x-client-timestamp":"".concat(r)},t.length>0&&t.forEach((function(t){var e,r=null===(e=n.req.requestOptions.headers)||void 0===e?void 0:e[t];r&&(c[t]=r)})),s=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}(["x-from-app-id","x-from-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp","x-to-env-id"],t,!0).sort(),a={path:i.pathname,query:i.search.substring(1),secretId:n.config.secretId,secretKey:n.config.secretKey,method:n.req.requestOptions.method,headers:c,body:n.req.requestOptions.body,timestamp:r,signedHeaders:s},c.authorization=di.sign(a),n.req.requestOptions.headers=o(o({},c),n.req.requestOptions.headers),[4,e()];case 1:return u.sent(),[2]}}))}))}}var Si=function(){function t(t,n){var e;this.config=t,this.handler=(e=n,function(t,n){var r=-1;return function o(i){if(i<=r)return Promise.reject(new Error("next() called multiple times"));r=i;var u=e[i];if(i===e.length&&(u=n),!u)return Promise.resolve();try{return Promise.resolve(u(t,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)})}return t.prototype.request=function(t){var n=t.method,e=t.path,r=t.data,o=t.headers;return i(this,void 0,void 0,(function(){var t,i,c,s;return u(this,(function(u){switch(u.label){case 0:return t=this.config.endpoint+e,i=r?JSON.stringify(r):r,c=gi.generateUUID(),o=Object.assign({"x-alipay-callid":c,"x-request-id":c,"x-alipay-source":"web,web-sdk","content-type":"application/json"},o),s=new wi({url:t,requestOptions:{method:n,body:i,headers:o}},this.config),[4,this.handler(s)];case 1:return u.sent(),[2,s.result]}}))}))},t.createFunctionHttpclient=function(n){return new t(n,[xi,ji(["x-to-function-name"]),Oi])},t.createDatabaseHttpclient=function(n){return new t(n,[xi,ji(["x-data-api-type","x-expire-timestamp"]),Oi])},t.createStorageHttpclient=function(n){return new t(n,[xi,ji(["x-data-api-type","x-expire-timestamp"]),Oi])},t}(),Pi=function(){function t(){}return t.prototype.upload=function(t){return i(this,void 0,void 0,(function(){var n,e;return u(this,(function(r){switch(r.label){case 0:return n=t.uploadURL,e=t.fileContent,[4,fetch(n,{method:"PUT",mode:"cors",body:e})];case 1:return[2,{statusCode:r.sent().status}]}}))}))},t.prototype.download=function(t){return i(this,void 0,void 0,(function(){return u(this,(function(n){return[2,{fileContent:t.downloadURL,statusCode:200}]}))}))},t.create=function(){return t.instance||(t.instance=new t),t.instance},t}(),Ai=function(t){function n(e){var r=Si.createStorageHttpclient(e),o=n.getFileUploader(e);return t.call(this,{httpclient:r,fileUploader:o,type:"web",toEnvId:e.envId})||this}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.getFileUploader=function(t){if(t.fileUploader)return t.fileUploader;if(t.runtime===So.WEB)return Pi.create();throw l.INVALID_PARAM_ERR("fileUploader","未指定文件上传/下载实现")},n}(Qo),Ei=function(){function t(t){var n=t.resourceEnv||t.envId,e=t.resourceAppid||t.appId;this.config={endpoint:t.endpoint||"https://".concat(n,".api-hz.cloudbasefunction.cn"),secretId:t.secretId,secretKey:t.secretKey,appId:e,envId:n,fetch:t.fetch,fileUploader:t.fileUploader,runtime:t.runtime||gi.detectRuntime(),functionName:""}}return t.prototype.init=function(){},t.prototype.callFunction=function(t){var n;return i(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){switch(i.label){case 0:return e=o(o({},this.config),{envId:(null===(n=t.config)||void 0===n?void 0:n.env)||this.config.envId,functionName:t.name}),r=Si.createFunctionHttpclient(e),[4,ti.createCallFunction({type:"web",httpclient:r})(t)];case 1:return[2,i.sent()]}}))}))},t.prototype.getStorage=function(){return this.storage||(this.storage=new Ai(this.config)),this.storage},t.prototype.uploadFile=function(t){return i(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().uploadFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.downloadFile=function(t){return i(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().downloadFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteFile=function(t){return i(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().deleteFile(t)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTempFileURL=function(t){return i(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,this.getStorage().getTempFileURL(t)];case 1:return[2,n.sent()]}}))}))},t.RUNTIME=So,t}();t.Cloud=Ei}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/faas-web-sdk",
3
- "version": "1.1.16-alpha.2",
3
+ "version": "1.1.16-alpha.4",
4
4
  "description": "云函数服务 web SDK",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@alipay/faas-common-sdk": "^1.1.16-alpha.2",
21
+ "@alipay/faas-common-sdk": "^1.1.16-alpha.4",
22
22
  "crypto-js": "^4.1.1"
23
23
  },
24
24
  "devDependencies": {