w-orm-mongodb 1.1.27 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js CHANGED
@@ -1,24 +1,24 @@
1
1
  module.exports = {
2
- "env": {
3
- "browser": true,
4
- "es6": true,
5
- "mocha": true
2
+ 'env': {
3
+ 'browser': true,
4
+ 'es6': true,
5
+ 'mocha': true
6
6
  },
7
- "extends": ["plugin:vue/base", "plugin:vue/essential", "standard"],
8
- "plugins": [
9
- "vue"
7
+ 'extends': ['plugin:vue/base', 'plugin:vue/essential', 'standard'],
8
+ 'plugins': [
9
+ 'vue'
10
10
  ],
11
- "globals": {
12
- "Atomics": "readonly",
13
- "SharedArrayBuffer": "readonly"
11
+ 'globals': {
12
+ 'Atomics': 'readonly',
13
+ 'SharedArrayBuffer': 'readonly'
14
14
  },
15
- "parser": "vue-eslint-parser",
16
- "parserOptions": {
17
- "parser": "babel-eslint",
18
- "ecmaVersion": 2019,
19
- "sourceType": "module",
15
+ 'parser': 'vue-eslint-parser',
16
+ 'parserOptions': {
17
+ 'parser': '@babel/eslint-parser',
18
+ 'ecmaVersion': 2019,
19
+ 'sourceType': 'module',
20
20
  },
21
- rules: {
21
+ 'rules': {
22
22
  'generator-star-spacing': 'off',
23
23
  'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
24
24
  'indent': ['error', 4],
@@ -51,4 +51,4 @@ module.exports = {
51
51
  'array-callback-return': 'off',
52
52
  'no-unreachable-loop': 'off',
53
53
  }
54
- };
54
+ }
package/babel.config.js CHANGED
@@ -7,6 +7,7 @@ module.exports = {
7
7
  ],
8
8
  'plugins': [
9
9
  '@babel/plugin-transform-runtime',
10
+ '@babel/plugin-syntax-import-assertions',
10
11
  '@babel/plugin-proposal-export-default-from',
11
12
  '@babel/plugin-proposal-nullish-coalescing-operator',
12
13
  '@babel/plugin-proposal-optional-chaining'
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * w-orm-mongodb v1.1.27
2
+ * w-orm-mongodb v1.1.28
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
6
- !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("events"),require("mongodb"),require("stream")):"function"==typeof define&&define.amd?define(["events","mongodb","stream"],r):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-orm-mongodb"]=r(t.events,t.mongodb,t.stream)}(this,(function(t,r,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=n(t),u=n(r),a=n(e);function i(t,r,e,n,o,u,a){try{var i=t[u](a),c=i.value}catch(t){return void e(t)}i.done?r(c):Promise.resolve(c).then(n,o)}function c(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var u=t.apply(r,e);function a(t){i(u,n,o,a,c,"next",t)}function c(t){i(u,n,o,a,c,"throw",t)}a(void 0)}))}}function f(t){return f="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},f(t)}var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t){var r={exports:{}};return t(r,r.exports),r.exports}var v=s((function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",i=o.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,u=Object.create(o.prototype),a=new L(n||[]);return u._invoke=function(t,r,e){var n=v;return function(o,u){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw u;return z()}for(e.method=o,e.arg=u;;){var a=e.delegate;if(a){var i=k(a,e);if(i){if(i===y)continue;return i}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===v)throw n=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var c=s(t,r,e);if("normal"===c.type){if(n=e.done?d:p,c.arg===y)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n=d,e.method="throw",e.arg=c.arg)}}}(t,e,a),u}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var v="suspendedStart",p="suspendedYield",h="executing",d="completed",y={};function b(){}function g(){}function j(){}var w={};c(w,u,(function(){return this}));var m=Object.getPrototypeOf,_=m&&m(m(P([])));_&&_!==e&&n.call(_,u)&&(w=_);var O=j.prototype=b.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function A(t,r){function e(o,u,a,i){var c=s(t[o],t,u);if("throw"!==c.type){var l=c.arg,v=l.value;return v&&"object"===f(v)&&n.call(v,"__await")?r.resolve(v.__await).then((function(t){e("next",t,a,i)}),(function(t){e("throw",t,a,i)})):r.resolve(v).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,i)}))}i(c.arg)}var o;this._invoke=function(t,n){function u(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(u,u):u()}}function k(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,k(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var u=o.arg;return u?u.done?(e[t.resultName]=u.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):u:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function P(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:z}}function z(){return{value:r,done:!0}}return g.prototype=j,c(O,"constructor",j),c(j,"constructor",g),g.displayName=c(j,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,c(t,i,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,a,(function(){return this})),t.AsyncIterator=A,t.async=function(r,e,n,o,u){void 0===u&&(u=Promise);var a=new A(l(r,e,n,o),u);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(O),c(O,i,"Generator"),c(O,u,(function(){return this})),c(O,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return i.type="throw",i.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var u=this.tryEntries.length-1;u>=0;--u){var a=this.tryEntries[u],i=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var u=o;break}}u&&("break"===t||"continue"===t)&&u.tryLoc<=r&&r<=u.finallyLoc&&(u=null);var a=u?u.completion:{};return a.type=t,a.arg=r,u?(this.method="next",this.next=u.finallyLoc,y):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),y},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"===("undefined"==typeof globalThis?"undefined":f(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}})),p=v;var h=function(){this.__data__=[],this.size=0};var d=function(t,r){return t===r||t!=t&&r!=r};var y=function(t,r){for(var e=t.length;e--;)if(d(t[e][0],r))return e;return-1},b=Array.prototype.splice;var g=function(t){var r=this.__data__,e=y(r,t);return!(e<0)&&(e==r.length-1?r.pop():b.call(r,e,1),--this.size,!0)};var j=function(t){var r=this.__data__,e=y(r,t);return e<0?void 0:r[e][1]};var w=function(t){return y(this.__data__,t)>-1};var m=function(t,r){var e=this.__data__,n=y(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};function _(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}_.prototype.clear=h,_.prototype.delete=g,_.prototype.get=j,_.prototype.has=w,_.prototype.set=m;var O=_;var x=function(){this.__data__=new O,this.size=0};var A=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e};var k=function(t){return this.__data__.get(t)};var S=function(t){return this.__data__.has(t)},E="object"==f(l)&&l&&l.Object===Object&&l,L="object"==("undefined"==typeof self?"undefined":f(self))&&self&&self.Object===Object&&self,P=E||L||Function("return this")(),z=P.Symbol,F=Object.prototype,N=F.hasOwnProperty,B=F.toString,T=z?z.toStringTag:void 0;var I=function(t){var r=N.call(t,T),e=t[T];try{t[T]=void 0;var n=!0}catch(t){}var o=B.call(t);return n&&(r?t[T]=e:delete t[T]),o},G=Object.prototype.toString;var M=function(t){return G.call(t)},U=z?z.toStringTag:void 0;var C=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":U&&U in Object(t)?I(t):M(t)};var D=function(t){var r=f(t);return null!=t&&("object"==r||"function"==r)};var $,R=function(t){if(!D(t))return!1;var r=C(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r},V=P["__core-js_shared__"],q=($=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var W=function(t){return!!q&&q in t},Y=Function.prototype.toString;var H=function(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""},J=/^\[object .+?Constructor\]$/,K=Function.prototype,Q=Object.prototype,X=K.toString,Z=Q.hasOwnProperty,tt=RegExp("^"+X.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var rt=function(t){return!(!D(t)||W(t))&&(R(t)?tt:J).test(H(t))};var et=function(t,r){return null==t?void 0:t[r]};var nt=function(t,r){var e=et(t,r);return rt(e)?e:void 0},ot=nt(P,"Map"),ut=nt(Object,"create");var at=function(){this.__data__=ut?ut(null):{},this.size=0};var it=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},ct=Object.prototype.hasOwnProperty;var ft=function(t){var r=this.__data__;if(ut){var e=r[t];return"__lodash_hash_undefined__"===e?void 0:e}return ct.call(r,t)?r[t]:void 0},lt=Object.prototype.hasOwnProperty;var st=function(t){var r=this.__data__;return ut?void 0!==r[t]:lt.call(r,t)};var vt=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=ut&&void 0===r?"__lodash_hash_undefined__":r,this};function pt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}pt.prototype.clear=at,pt.prototype.delete=it,pt.prototype.get=ft,pt.prototype.has=st,pt.prototype.set=vt;var ht=pt;var dt=function(){this.size=0,this.__data__={hash:new ht,map:new(ot||O),string:new ht}};var yt=function(t){var r=f(t);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t};var bt=function(t,r){var e=t.__data__;return yt(r)?e["string"==typeof r?"string":"hash"]:e.map};var gt=function(t){var r=bt(this,t).delete(t);return this.size-=r?1:0,r};var jt=function(t){return bt(this,t).get(t)};var wt=function(t){return bt(this,t).has(t)};var mt=function(t,r){var e=bt(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};function _t(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}_t.prototype.clear=dt,_t.prototype.delete=gt,_t.prototype.get=jt,_t.prototype.has=wt,_t.prototype.set=mt;var Ot=_t;var xt=function(t,r){var e=this.__data__;if(e instanceof O){var n=e.__data__;if(!ot||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Ot(n)}return e.set(t,r),this.size=e.size,this};function At(t){var r=this.__data__=new O(t);this.size=r.size}At.prototype.clear=x,At.prototype.delete=A,At.prototype.get=k,At.prototype.has=S,At.prototype.set=xt;var kt=At;var St=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n&&!1!==r(t[e],e,t););return t},Et=function(){try{var t=nt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Lt=function(t,r,e){"__proto__"==r&&Et?Et(t,r,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[r]=e},Pt=Object.prototype.hasOwnProperty;var zt=function(t,r,e){var n=t[r];Pt.call(t,r)&&d(n,e)&&(void 0!==e||r in t)||Lt(t,r,e)};var Ft=function(t,r,e,n){var o=!e;e||(e={});for(var u=-1,a=r.length;++u<a;){var i=r[u],c=n?n(e[i],t[i],i,e,t):void 0;void 0===c&&(c=t[i]),o?Lt(e,i,c):zt(e,i,c)}return e};var Nt=function(t,r){for(var e=-1,n=Array(t);++e<t;)n[e]=r(e);return n};var Bt=function(t){return null!=t&&"object"==f(t)};var Tt=function(t){return Bt(t)&&"[object Arguments]"==C(t)},It=Object.prototype,Gt=It.hasOwnProperty,Mt=It.propertyIsEnumerable,Ut=Tt(function(){return arguments}())?Tt:function(t){return Bt(t)&&Gt.call(t,"callee")&&!Mt.call(t,"callee")},Ct=Ut,Dt=Array.isArray;var $t=function(){return!1},Rt=s((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e?P.Buffer:void 0,u=(o?o.isBuffer:void 0)||$t;t.exports=u})),Vt=/^(?:0|[1-9]\d*)$/;var qt=function(t,r){var e=f(t);return!!(r=null==r?9007199254740991:r)&&("number"==e||"symbol"!=e&&Vt.test(t))&&t>-1&&t%1==0&&t<r};var Wt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Yt={};Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object Boolean]"]=Yt["[object DataView]"]=Yt["[object Date]"]=Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object WeakMap]"]=!1;var Ht=function(t){return Bt(t)&&Wt(t.length)&&!!Yt[C(t)]};var Jt=function(t){return function(r){return t(r)}},Kt=s((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e&&E.process,u=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=u})),Qt=Kt&&Kt.isTypedArray,Xt=Qt?Jt(Qt):Ht,Zt=Object.prototype.hasOwnProperty;var tr=function(t,r){var e=Dt(t),n=!e&&Ct(t),o=!e&&!n&&Rt(t),u=!e&&!n&&!o&&Xt(t),a=e||n||o||u,i=a?Nt(t.length,String):[],c=i.length;for(var f in t)!r&&!Zt.call(t,f)||a&&("length"==f||o&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||qt(f,c))||i.push(f);return i},rr=Object.prototype;var er=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||rr)};var nr=function(t,r){return function(e){return t(r(e))}},or=nr(Object.keys,Object),ur=Object.prototype.hasOwnProperty;var ar=function(t){if(!er(t))return or(t);var r=[];for(var e in Object(t))ur.call(t,e)&&"constructor"!=e&&r.push(e);return r};var ir=function(t){return null!=t&&Wt(t.length)&&!R(t)};var cr=function(t){return ir(t)?tr(t):ar(t)};var fr=function(t,r){return t&&Ft(r,cr(r),t)};var lr=function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r},sr=Object.prototype.hasOwnProperty;var vr=function(t){if(!D(t))return lr(t);var r=er(t),e=[];for(var n in t)("constructor"!=n||!r&&sr.call(t,n))&&e.push(n);return e};var pr=function(t){return ir(t)?tr(t,!0):vr(t)};var hr=function(t,r){return t&&Ft(r,pr(r),t)},dr=s((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e?P.Buffer:void 0,u=o?o.allocUnsafe:void 0;t.exports=function(t,r){if(r)return t.slice();var e=t.length,n=u?u(e):new t.constructor(e);return t.copy(n),n}}));var yr=function(t,r){var e=-1,n=t.length;for(r||(r=Array(n));++e<n;)r[e]=t[e];return r};var br=function(t,r){for(var e=-1,n=null==t?0:t.length,o=0,u=[];++e<n;){var a=t[e];r(a,e,t)&&(u[o++]=a)}return u};var gr=function(){return[]},jr=Object.prototype.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,mr=wr?function(t){return null==t?[]:(t=Object(t),br(wr(t),(function(r){return jr.call(t,r)})))}:gr;var _r=function(t,r){return Ft(t,mr(t),r)};var Or=function(t,r){for(var e=-1,n=r.length,o=t.length;++e<n;)t[o+e]=r[e];return t},xr=nr(Object.getPrototypeOf,Object),Ar=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)Or(r,mr(t)),t=xr(t);return r}:gr;var kr=function(t,r){return Ft(t,Ar(t),r)};var Sr=function(t,r,e){var n=r(t);return Dt(t)?n:Or(n,e(t))};var Er=function(t){return Sr(t,cr,mr)};var Lr=function(t){return Sr(t,pr,Ar)},Pr=nt(P,"DataView"),zr=nt(P,"Promise"),Fr=nt(P,"Set"),Nr=nt(P,"WeakMap"),Br="[object Map]",Tr="[object Promise]",Ir="[object Set]",Gr="[object WeakMap]",Mr="[object DataView]",Ur=H(Pr),Cr=H(ot),Dr=H(zr),$r=H(Fr),Rr=H(Nr),Vr=C;(Pr&&Vr(new Pr(new ArrayBuffer(1)))!=Mr||ot&&Vr(new ot)!=Br||zr&&Vr(zr.resolve())!=Tr||Fr&&Vr(new Fr)!=Ir||Nr&&Vr(new Nr)!=Gr)&&(Vr=function(t){var r=C(t),e="[object Object]"==r?t.constructor:void 0,n=e?H(e):"";if(n)switch(n){case Ur:return Mr;case Cr:return Br;case Dr:return Tr;case $r:return Ir;case Rr:return Gr}return r});var qr=Vr,Wr=Object.prototype.hasOwnProperty;var Yr=function(t){var r=t.length,e=new t.constructor(r);return r&&"string"==typeof t[0]&&Wr.call(t,"index")&&(e.index=t.index,e.input=t.input),e},Hr=P.Uint8Array;var Jr=function(t){var r=new t.constructor(t.byteLength);return new Hr(r).set(new Hr(t)),r};var Kr=function(t,r){var e=r?Jr(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)},Qr=/\w*$/;var Xr=function(t){var r=new t.constructor(t.source,Qr.exec(t));return r.lastIndex=t.lastIndex,r},Zr=z?z.prototype:void 0,te=Zr?Zr.valueOf:void 0;var re=function(t){return te?Object(te.call(t)):{}};var ee=function(t,r){var e=r?Jr(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)};var ne=function(t,r,e){var n=t.constructor;switch(r){case"[object ArrayBuffer]":return Jr(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return Kr(t,e);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ee(t,e);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return Xr(t);case"[object Symbol]":return re(t)}},oe=Object.create,ue=function(){function t(){}return function(r){if(!D(r))return{};if(oe)return oe(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();var ae=function(t){return"function"!=typeof t.constructor||er(t)?{}:ue(xr(t))};var ie=function(t){return Bt(t)&&"[object Map]"==qr(t)},ce=Kt&&Kt.isMap,fe=ce?Jt(ce):ie;var le=function(t){return Bt(t)&&"[object Set]"==qr(t)},se=Kt&&Kt.isSet,ve=se?Jt(se):le,pe="[object Arguments]",he="[object Function]",de="[object Object]",ye={};ye[pe]=ye["[object Array]"]=ye["[object ArrayBuffer]"]=ye["[object DataView]"]=ye["[object Boolean]"]=ye["[object Date]"]=ye["[object Float32Array]"]=ye["[object Float64Array]"]=ye["[object Int8Array]"]=ye["[object Int16Array]"]=ye["[object Int32Array]"]=ye["[object Map]"]=ye["[object Number]"]=ye[de]=ye["[object RegExp]"]=ye["[object Set]"]=ye["[object String]"]=ye["[object Symbol]"]=ye["[object Uint8Array]"]=ye["[object Uint8ClampedArray]"]=ye["[object Uint16Array]"]=ye["[object Uint32Array]"]=!0,ye["[object Error]"]=ye[he]=ye["[object WeakMap]"]=!1;var be=function t(r,e,n,o,u,a){var i,c=1&e,f=2&e,l=4&e;if(n&&(i=u?n(r,o,u,a):n(r)),void 0!==i)return i;if(!D(r))return r;var s=Dt(r);if(s){if(i=Yr(r),!c)return yr(r,i)}else{var v=qr(r),p=v==he||"[object GeneratorFunction]"==v;if(Rt(r))return dr(r,c);if(v==de||v==pe||p&&!u){if(i=f||p?{}:ae(r),!c)return f?kr(r,hr(i,r)):_r(r,fr(i,r))}else{if(!ye[v])return u?r:{};i=ne(r,v,c)}}a||(a=new kt);var h=a.get(r);if(h)return h;a.set(r,i),ve(r)?r.forEach((function(o){i.add(t(o,e,n,o,r,a))})):fe(r)&&r.forEach((function(o,u){i.set(u,t(o,e,n,u,r,a))}));var d=s?void 0:(l?f?Lr:Er:f?pr:cr)(r);return St(d||r,(function(o,u){d&&(o=r[u=o]),zt(i,u,t(o,e,n,u,r,a))})),i};var ge=function(t){return be(t,5)};var je=function(t){return"symbol"==f(t)||Bt(t)&&"[object Symbol]"==C(t)},we=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,me=/^\w*$/;var _e=function(t,r){if(Dt(t))return!1;var e=f(t);return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!je(t))||(me.test(t)||!we.test(t)||null!=r&&t in Object(r))};function Oe(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var e=function e(){var n=arguments,o=r?r.apply(this,n):n[0],u=e.cache;if(u.has(o))return u.get(o);var a=t.apply(this,n);return e.cache=u.set(o,a)||u,a};return e.cache=new(Oe.Cache||Ot),e}Oe.Cache=Ot;var xe=Oe;var Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ke=/\\(\\)?/g,Se=function(t){var r=xe(t,(function(t){return 500===e.size&&e.clear(),t})),e=r.cache;return r}((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(Ae,(function(t,e,n,o){r.push(n?o.replace(ke,"$1"):e||t)})),r}));var Ee=function(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e<n;)o[e]=r(t[e],e,t);return o},Le=z?z.prototype:void 0,Pe=Le?Le.toString:void 0;var ze=function t(r){if("string"==typeof r)return r;if(Dt(r))return Ee(r,t)+"";if(je(r))return Pe?Pe.call(r):"";var e=r+"";return"0"==e&&1/r==-Infinity?"-0":e};var Fe=function(t){return null==t?"":ze(t)};var Ne=function(t,r){return Dt(t)?t:_e(t,r)?[t]:Se(Fe(t))};var Be=function(t){if("string"==typeof t||je(t))return t;var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var Te=function(t,r){for(var e=0,n=(r=Ne(r,t)).length;null!=t&&e<n;)t=t[Be(r[e++])];return e&&e==n?t:void 0};var Ie=function(t,r,e){var n=null==t?void 0:Te(t,r);return void 0===n?e:n};var Ge=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Me=function(t){return this.__data__.has(t)};function Ue(t){var r=-1,e=null==t?0:t.length;for(this.__data__=new Ot;++r<e;)this.add(t[r])}Ue.prototype.add=Ue.prototype.push=Ge,Ue.prototype.has=Me;var Ce=Ue;var De=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n;)if(r(t[e],e,t))return!0;return!1};var $e=function(t,r){return t.has(r)};var Re=function(t,r,e,n,o,u){var a=1&e,i=t.length,c=r.length;if(i!=c&&!(a&&c>i))return!1;var f=u.get(t),l=u.get(r);if(f&&l)return f==r&&l==t;var s=-1,v=!0,p=2&e?new Ce:void 0;for(u.set(t,r),u.set(r,t);++s<i;){var h=t[s],d=r[s];if(n)var y=a?n(d,h,s,r,t,u):n(h,d,s,t,r,u);if(void 0!==y){if(y)continue;v=!1;break}if(p){if(!De(r,(function(t,r){if(!$e(p,r)&&(h===t||o(h,t,e,n,u)))return p.push(r)}))){v=!1;break}}else if(h!==d&&!o(h,d,e,n,u)){v=!1;break}}return u.delete(t),u.delete(r),v};var Ve=function(t){var r=-1,e=Array(t.size);return t.forEach((function(t,n){e[++r]=[n,t]})),e};var qe=function(t){var r=-1,e=Array(t.size);return t.forEach((function(t){e[++r]=t})),e},We=z?z.prototype:void 0,Ye=We?We.valueOf:void 0;var He=function(t,r,e,n,o,u,a){switch(e){case"[object DataView]":if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)return!1;t=t.buffer,r=r.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=r.byteLength||!u(new Hr(t),new Hr(r)));case"[object Boolean]":case"[object Date]":case"[object Number]":return d(+t,+r);case"[object Error]":return t.name==r.name&&t.message==r.message;case"[object RegExp]":case"[object String]":return t==r+"";case"[object Map]":var i=Ve;case"[object Set]":var c=1&n;if(i||(i=qe),t.size!=r.size&&!c)return!1;var f=a.get(t);if(f)return f==r;n|=2,a.set(t,r);var l=Re(i(t),i(r),n,o,u,a);return a.delete(t),l;case"[object Symbol]":if(Ye)return Ye.call(t)==Ye.call(r)}return!1},Je=Object.prototype.hasOwnProperty;var Ke=function(t,r,e,n,o,u){var a=1&e,i=Er(t),c=i.length;if(c!=Er(r).length&&!a)return!1;for(var f=c;f--;){var l=i[f];if(!(a?l in r:Je.call(r,l)))return!1}var s=u.get(t),v=u.get(r);if(s&&v)return s==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var h=a;++f<c;){var d=t[l=i[f]],y=r[l];if(n)var b=a?n(y,d,l,r,t,u):n(d,y,l,t,r,u);if(!(void 0===b?d===y||o(d,y,e,n,u):b)){p=!1;break}h||(h="constructor"==l)}if(p&&!h){var g=t.constructor,j=r.constructor;g==j||!("constructor"in t)||!("constructor"in r)||"function"==typeof g&&g instanceof g&&"function"==typeof j&&j instanceof j||(p=!1)}return u.delete(t),u.delete(r),p},Qe="[object Arguments]",Xe="[object Array]",Ze="[object Object]",tn=Object.prototype.hasOwnProperty;var rn=function(t,r,e,n,o,u){var a=Dt(t),i=Dt(r),c=a?Xe:qr(t),f=i?Xe:qr(r),l=(c=c==Qe?Ze:c)==Ze,s=(f=f==Qe?Ze:f)==Ze,v=c==f;if(v&&Rt(t)){if(!Rt(r))return!1;a=!0,l=!1}if(v&&!l)return u||(u=new kt),a||Xt(t)?Re(t,r,e,n,o,u):He(t,r,c,e,n,o,u);if(!(1&e)){var p=l&&tn.call(t,"__wrapped__"),h=s&&tn.call(r,"__wrapped__");if(p||h){var d=p?t.value():t,y=h?r.value():r;return u||(u=new kt),o(d,y,e,n,u)}}return!!v&&(u||(u=new kt),Ke(t,r,e,n,o,u))};var en=function t(r,e,n,o,u){return r===e||(null==r||null==e||!Bt(r)&&!Bt(e)?r!=r&&e!=e:rn(r,e,n,o,t,u))};var nn=function(t,r,e,n){var o=e.length,u=o,a=!n;if(null==t)return!u;for(t=Object(t);o--;){var i=e[o];if(a&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++o<u;){var c=(i=e[o])[0],f=t[c],l=i[1];if(a&&i[2]){if(void 0===f&&!(c in t))return!1}else{var s=new kt;if(n)var v=n(f,l,c,t,r,s);if(!(void 0===v?en(l,f,3,n,s):v))return!1}}return!0};var on=function(t){return t==t&&!D(t)};var un=function(t){for(var r=cr(t),e=r.length;e--;){var n=r[e],o=t[n];r[e]=[n,o,on(o)]}return r};var an=function(t,r){return function(e){return null!=e&&(e[t]===r&&(void 0!==r||t in Object(e)))}};var cn=function(t){var r=un(t);return 1==r.length&&r[0][2]?an(r[0][0],r[0][1]):function(e){return e===t||nn(e,t,r)}};var fn=function(t,r){return null!=t&&r in Object(t)};var ln=function(t,r,e){for(var n=-1,o=(r=Ne(r,t)).length,u=!1;++n<o;){var a=Be(r[n]);if(!(u=null!=t&&e(t,a)))break;t=t[a]}return u||++n!=o?u:!!(o=null==t?0:t.length)&&Wt(o)&&qt(a,o)&&(Dt(t)||Ct(t))};var sn=function(t,r){return null!=t&&ln(t,r,fn)};var vn=function(t,r){return _e(t)&&on(r)?an(Be(t),r):function(e){var n=Ie(e,t);return void 0===n&&n===r?sn(e,t):en(r,n,3)}};var pn=function(t){return t};var hn=function(t){return function(r){return null==r?void 0:r[t]}};var dn=function(t){return function(r){return Te(r,t)}};var yn=function(t){return _e(t)?hn(Be(t)):dn(t)};var bn=function(t){return"function"==typeof t?t:null==t?pn:"object"==f(t)?Dt(t)?vn(t[0],t[1]):cn(t):yn(t)};var gn=function(t){return function(r,e,n){for(var o=-1,u=Object(r),a=n(r),i=a.length;i--;){var c=a[t?i:++o];if(!1===e(u[c],c,u))break}return r}}();var jn=function(t,r){return function(e,n){if(null==e)return e;if(!ir(e))return t(e,n);for(var o=e.length,u=r?o:-1,a=Object(e);(r?u--:++u<o)&&!1!==n(a[u],u,a););return e}}((function(t,r){return t&&gn(t,r,cr)}));var wn=function(t,r){var e=-1,n=ir(t)?Array(t.length):[];return jn(t,(function(t,o,u){n[++e]=r(t,o,u)})),n};var mn=function(t,r){return(Dt(t)?Ee:wn)(t,bn(r))};var _n=function(t){var r=null==t?0:t.length;return r?t[r-1]:void 0};var On=function(t,r,e){var n=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(e=e>o?o:e)<0&&(e+=o),o=r>e?0:e-r>>>0,r>>>=0;for(var u=Array(o);++n<o;)u[n]=t[n+r];return u};var xn=function(t,r){return r.length<2?t:Te(t,On(r,0,-1))};var An=function(t,r){return r=Ne(r,t),null==(t=xn(t,r))||delete t[Be(_n(r))]},kn=Function.prototype,Sn=Object.prototype,En=kn.toString,Ln=Sn.hasOwnProperty,Pn=En.call(Object);var zn=function(t){if(!Bt(t)||"[object Object]"!=C(t))return!1;var r=xr(t);if(null===r)return!0;var e=Ln.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&En.call(e)==Pn};var Fn=function(t){return zn(t)?void 0:t},Nn=z?z.isConcatSpreadable:void 0;var Bn=function(t){return Dt(t)||Ct(t)||!!(Nn&&t&&t[Nn])};var Tn=function t(r,e,n,o,u){var a=-1,i=r.length;for(n||(n=Bn),u||(u=[]);++a<i;){var c=r[a];e>0&&n(c)?e>1?t(c,e-1,n,o,u):Or(u,c):o||(u[u.length]=c)}return u};var In=function(t){return(null==t?0:t.length)?Tn(t,1):[]};var Gn=function(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)},Mn=Math.max;var Un=function(t,r,e){return r=Mn(void 0===r?t.length-1:r,0),function(){for(var n=arguments,o=-1,u=Mn(n.length-r,0),a=Array(u);++o<u;)a[o]=n[r+o];o=-1;for(var i=Array(r+1);++o<r;)i[o]=n[o];return i[r]=e(a),Gn(t,this,i)}};var Cn=function(t){return function(){return t}},Dn=Et?function(t,r){return Et(t,"toString",{configurable:!0,enumerable:!1,value:Cn(r),writable:!0})}:pn,$n=Date.now;var Rn=function(t){var r=0,e=0;return function(){var n=$n(),o=16-(n-e);if(e=n,o>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}},Vn=Rn(Dn);var qn=function(t){return Vn(Un(t,void 0,In),t+"")}((function(t,r){var e={};if(null==t)return e;var n=!1;r=Ee(r,(function(r){return r=Ne(r,t),n||(n=r.length>1),r})),Ft(t,Lr(t),e),n&&(e=be(e,7,Fn));for(var o=r.length;o--;)An(e,r[o]);return e}));var Wn=function(t){return"string"==typeof t||!Dt(t)&&Bt(t)&&"[object String]"==C(t)},Yn=hn("length"),Hn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Jn=function(t){return Hn.test(t)},Kn="\\ud800-\\udfff",Qn="["+Kn+"]",Xn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Zn="\\ud83c[\\udffb-\\udfff]",to="[^"+Kn+"]",ro="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",no="(?:"+Xn+"|"+Zn+")"+"?",oo="[\\ufe0e\\ufe0f]?",uo=oo+no+("(?:\\u200d(?:"+[to,ro,eo].join("|")+")"+oo+no+")*"),ao="(?:"+[to+Xn+"?",Xn,ro,eo,Qn].join("|")+")",io=RegExp(Zn+"(?="+Zn+")|"+ao+uo,"g");var co=function(t){for(var r=io.lastIndex=0;io.test(t);)++r;return r};var fo=function(t){return Jn(t)?co(t):Yn(t)};var lo=function(t){if(null==t)return 0;if(ir(t))return Wn(t)?fo(t):t.length;var r=qr(t);return"[object Map]"==r||"[object Set]"==r?t.size:ar(t).length};function so(){var t,r,e=new Promise((function(){t=arguments[0],r=arguments[1]}));return e.resolve=t,e.reject=r,e}var vo=/\s/;var po=function(t){for(var r=t.length;r--&&vo.test(t.charAt(r)););return r},ho=/^\s+/;var yo=function(t){return t?t.slice(0,po(t)+1).replace(ho,""):t},bo=/^[-+]0x[0-9a-f]+$/i,go=/^0b[01]+$/i,jo=/^0o[0-7]+$/i,wo=parseInt;var mo=function(t){if("number"==typeof t)return t;if(je(t))return NaN;if(D(t)){var r="function"==typeof t.valueOf?t.valueOf():t;t=D(r)?r+"":r}if("string"!=typeof t)return 0===t?t:+t;t=yo(t);var e=go.test(t);return e||jo.test(t)?wo(t.slice(2),e?2:8):bo.test(t)?NaN:+t},_o=1/0;var Oo=function(t){return t?(t=mo(t))===_o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var xo=function(t){var r=Oo(t),e=r%1;return r==r?e?r-e:r:0};var Ao=function(t){return"number"==typeof t&&t==xo(t)};function ko(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function So(t){var r=!1;return ko(t)?r=!isNaN(Number(t)):function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)&&(r=!0),r}function Eo(t){return So(t)?Oo(t):0}var Lo=P.isFinite,Po=Math.min;var zo=function(t){var r=Math[t];return function(t,e){if(t=mo(t),(e=null==e?0:Po(xo(e),292))&&Lo(t)){var n=(Fe(t)+"e").split("e"),o=r(n[0]+"e"+(+n[1]+e));return+((n=(Fe(o)+"e").split("e"))[0]+"e"+(+n[1]-e))}return r(t)}}("round");function Fo(t){if(!So(t))return 0;t=Eo(t);var r=zo(t);return"0"===String(r)?0:r}function No(t){return!!function(t){return!!So(t)&&(t=Eo(t),Ao(t))}(t)&&Fo(t)>0}var Bo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),To=Bo.length;function Io(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,r=[];t=No(t)?Fo(t):32;for(var e=0;e<t;e++)r[e]=Bo[0|Math.random()*To];var n=r.join("");return n}function Go(t){return"[object Array]"===Object.prototype.toString.call(t)}var Mo=function(t,r,e){var n=null==t?0:t.length;return n?(r=e||void 0===r?1:xo(r),On(t,r<0?0:r,n)):[]};var Uo=function(t){return"function"==typeof t?t:pn};var Co=function(t,r){return(Dt(t)?St:jn)(t,Uo(r))};function Do(t){return"[object Object]"===Object.prototype.toString.call(t)}function $o(t){var r=Object.prototype.toString.call(t);return"[object Function]"===r||"[object AsyncFunction]"===r}function Ro(t,r){var e=so();if(!Go(t)&&!Do(t))return e.reject("rs is not an array or object"),e;var n=!1;if(Do(t)){n=!0;var o=[];Co(t,(function(t,r){o.push({k:r,v:t})})),t=o}$o(r)||(r=function(t){return t});var u=-1,a=[];return t.reduce((function(t,e){return t.then((function(t){a.push(t);var o=u+=1,i=e;return n&&(o=e.k,i=e.v),$o(r)?r(i,o):i}))}),Promise.resolve()).then((function(t){a.push(t),a=Mo(a),e.resolve(a)})).catch((function(t){e.reject(t)})),e}var Vo={useNewUrlParser:!0,useUnifiedTopology:!0};return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.url||(t.url="mongodb://127.0.0.1:27017"),t.db||(t.db="worm"),t.cl||(t.cl="test");var r=new o.default.EventEmitter,e=u.default.MongoClient;function n(){return i.apply(this,arguments)}function i(){return i=c(p.mark((function r(){var n,o,u,a,i=arguments;return p.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=i.length>0&&void 0!==i[0]?i[0]:{},o=so(),r.next=4,e.connect(t.url,Vo);case 4:return u=r.sent,a=u.db(t.db),a.collection(t.cl).find(n).toArray((function(t,r){t?o.reject(t):(r=mn(r,(function(t){return t=qn(t,"_id")})),o.resolve(r)),u.close()})),r.abrupt("return",o);case 9:case"end":return r.stop()}}),r)}))),i.apply(this,arguments)}function f(t){return l.apply(this,arguments)}function l(){return(l=c(p.mark((function n(o){var u,a,i,c;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=ge(o),u=so(),n.next=4,e.connect(t.url,Vo);case 4:return a=n.sent,i=a.db(t.db),c=i.collection(t.cl),Go(o)||(o=[o]),o=mn(o,(function(t){return t.id||(t.id=Io()),t})),c.insertMany(o,(function(t,e){t?u.reject(t):e.insertedCount>0?(e={n:lo(o),nInserted:e.insertedCount,ok:e.acknowledged?1:0},u.resolve(e),r.emit("change","insert",o,e)):u.reject(t),a.close()})),n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function s(t){return v.apply(this,arguments)}function v(){return v=c(p.mark((function n(o){var u,a,i,l,s,v,h,d,y=arguments;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return u=y.length>1&&void 0!==y[1]?y[1]:{},o=ge(o),a=Ie(u,"autoInsert",!0),i=Ie(u,"atomic",!1),l=so(),n.next=7,e.connect(t.url,Vo);case 7:return s=n.sent,v=s.db(t.db),h=v.collection(t.cl),Go(o)||(o=[o]),d=null,d=i?"findOneAndUpdate":"updateOne",Ro(o,function(){var t=c(p.mark((function t(r){var e;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=so(),h[d]({id:r.id},{$set:r},(function(t,n){t?e.reject(t):(n=n.lastErrorObject?{n:n.lastErrorObject.n,nModified:n.lastErrorObject.updatedExisting?1:0,ok:1}:{n:n.matchedCount,nModified:n.modifiedCount,ok:n.acknowledged?1:0},a&&0===n.n?f(r).then((function(t){e.resolve(t)})).catch((function(t){e.reject(t)})):e.resolve(n))})),t.abrupt("return",e);case 3:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()).then((function(t){l.resolve(t),r.emit("change","save",o,t)})).catch((function(t){l.reject(t)})).finally((function(){s.close()})),n.abrupt("return",l);case 15:case"end":return n.stop()}}),n)}))),v.apply(this,arguments)}function h(t){return d.apply(this,arguments)}function d(){return(d=c(p.mark((function n(o){var u,a,i,c;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=ge(o),u=so(),n.next=4,e.connect(t.url,Vo);case 4:return a=n.sent,i=a.db(t.db),c=i.collection(t.cl),Go(o)||(o=[o]),Ro(o,(function(t){var r=so();return c.deleteOne({id:t.id},(function(t,e){t?r.resolve(t):(e={n:e.deletedCount,nDeleted:e.deletedCount,ok:e.acknowledged?1:0},r.resolve(e))})),r})).then((function(t){u.resolve(t),r.emit("change","del",o,t)})).catch((function(t){u.reject(t)})).finally((function(){a.close()})),n.abrupt("return",u);case 10:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function y(){return b.apply(this,arguments)}function b(){return b=c(p.mark((function n(){var o,u,a,i,c=arguments;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=c.length>0&&void 0!==c[0]?c[0]:{},u=so(),n.next=4,e.connect(t.url,Vo);case 4:return a=n.sent,i=a.db(t.db),i.collection(t.cl).deleteMany(o,(function(t,e){t?u.resolve(t):(e={n:e.deletedCount,nDeleted:e.deletedCount,ok:e.acknowledged?1:0},u.resolve(e),r.emit("change","delAll",null,e)),a.close()})),n.abrupt("return",u);case 9:case"end":return n.stop()}}),n)}))),b.apply(this,arguments)}function g(t){return j.apply(this,arguments)}function j(){return(j=c(p.mark((function n(o){var i,c,f,l,s,v,h;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=so(),c=Io(),f=Buffer.from(o),n.next=5,e.connect(t.url,Vo);case 5:return l=n.sent,s=l.db(t.db),v=new u.default.GridFSBucket(s,{chunkSizeBytes:10485760,bucketName:t.cl}),(h=new a.default.Readable)._read=function(){},h.push(f),h.push(null),h.pipe(v.openUploadStream(c)).on("error",(function(t){i.reject(t),l.close()})).on("finish",(function(){var t={n:1,ok:1,id:c};i.resolve(t),r.emit("change","insertGfs",null,t),l.close()})),n.abrupt("return",i);case 14:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function w(t){return m.apply(this,arguments)}function m(){return(m=c(p.mark((function r(n){var o,a,i,c,f,l;return p.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=so(),r.next=3,e.connect(t.url,Vo);case 3:return a=r.sent,i=a.db(t.db),c=new u.default.GridFSBucket(i,{chunkSizeBytes:10485760,bucketName:t.cl}),f=Buffer.from(""),(l=c.openDownloadStreamByName(n)).on("data",(function(t){f=Buffer.concat([f,t])})),l.on("error",(function(t){o.reject(t),a.close()})),l.on("end",(function(){var t=new Uint8Array(f);f=null,o.resolve(t),a.close()})),r.abrupt("return",o);case 12:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function _(){return O.apply(this,arguments)}function O(){return O=c(p.mark((function r(){var n,o,a,i,c,f=arguments;return p.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=f.length>0&&void 0!==f[0]?f[0]:{},o=f.length>1&&void 0!==f[1]?f[1]:null,a=so(),null!==o){r.next=9;break}return r.next=6,e.connect(t.url,Vo);case 6:i=r.sent,c=i.db(t.db),o=new u.default.GridFSBucket(c,{chunkSizeBytes:10485760,bucketName:t.cl});case 9:return o.find(n).toArray((function(t,r){t?a.reject(t):a.resolve(r)})),r.abrupt("return",a);case 11:case"end":return r.stop()}}),r)}))),O.apply(this,arguments)}function x(t){return A.apply(this,arguments)}function A(){return(A=c(p.mark((function n(o){var a,i,c,f,l,s;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=so(),n.next=3,e.connect(t.url,Vo);case 3:return i=n.sent,c=i.db(t.db),f=new u.default.GridFSBucket(c,{chunkSizeBytes:10485760,bucketName:t.cl}),n.next=8,_({filename:o},f);case 8:return 0===(l=n.sent).length?(a.reject("can not find id"),i.close()):l.length>1?(a.reject("duplicate id"),i.close()):(s=l[0]._id,f.delete(s,(function(t){if(t)a.reject(t);else{var e={n:1,nDeleted:1,ok:1};a.resolve(e),r.emit("change","delGfs",null,e)}i.close()}))),n.abrupt("return",a);case 11:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function k(t,r){return S.apply(this,arguments)}function S(){return(S=c(p.mark((function t(r,e){var n;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=so(),e.delete(r,(function(t){t?n.reject(t):n.resolve({n:1,nDeleted:1,ok:1})})),t.abrupt("return",n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function E(){return L.apply(this,arguments)}function L(){return L=c(p.mark((function n(){var o,a,i,c,f,l,s,v,h=arguments;return p.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=h.length>0&&void 0!==h[0]?h[0]:{},a=so(),n.next=4,e.connect(t.url,Vo);case 4:return i=n.sent,c=i.db(t.db),f=new u.default.GridFSBucket(c,{chunkSizeBytes:10485760,bucketName:t.cl}),n.next=9,_(o,f);case 9:return l=n.sent,s=lo(l),v=mn(l,(function(t){return k(t._id,f)})),Promise.all(v).then((function(t){var e={n:s,ok:1};a.resolve(e),r.emit("change","delAllGfs",null,e)})).catch((function(t){a.reject(t)})).finally((function(){i.close()})),n.abrupt("return",a);case 14:case"end":return n.stop()}}),n)}))),L.apply(this,arguments)}return r.select=n,r.insert=f,r.save=s,r.del=h,r.delAll=y,r.selectGfs=w,r.insertGfs=g,r.delGfs=x,r.delAllGfs=E,r}}));
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("events"),require("mongodb"),require("stream")):"function"==typeof define&&define.amd?define(["events","mongodb","stream"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-orm-mongodb"]=e(t.events,t.mongodb,t.stream)}(this,(function(t,e,r){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u=function(){this.__data__=[],this.size=0};var a=function(t,e){return t===e||t!=t&&e!=e},i=a;var c=function(t,e){for(var r=t.length;r--;)if(i(t[r][0],e))return r;return-1},f=c,l=Array.prototype.splice;var s=c;var v=c;var d=c;var p=u,b=function(t){var e=this.__data__,r=f(e,t);return!(r<0)&&(r==e.length-1?e.pop():l.call(e,r,1),--this.size,!0)},y=function(t){var e=this.__data__,r=s(e,t);return r<0?void 0:e[r][1]},h=function(t){return v(this.__data__,t)>-1},j=function(t,e){var r=this.__data__,n=d(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function g(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}g.prototype.clear=p,g.prototype.delete=b,g.prototype.get=y,g.prototype.has=h,g.prototype.set=j;var _=g,w=_;var m=function(){this.__data__=new w,this.size=0};var O=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var A=function(t){return this.__data__.get(t)};var S=function(t){return this.__data__.has(t)},k="object"==typeof n&&n&&n.Object===Object&&n,P=k,x="object"==typeof self&&self&&self.Object===Object&&self,z=P||x||Function("return this")(),E=z.Symbol,B=E,F=Object.prototype,M=F.hasOwnProperty,I=F.toString,U=B?B.toStringTag:void 0;var N=function(t){var e=M.call(t,U),r=t[U];try{t[U]=void 0;var n=!0}catch(t){}var o=I.call(t);return n&&(e?t[U]=r:delete t[U]),o},C=Object.prototype.toString;var D=N,T=function(t){return C.call(t)},$=E?E.toStringTag:void 0;var G=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":$&&$ in Object(t)?D(t):T(t)};var R=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},L=G,V=R;var q,W=function(t){if(!V(t))return!1;var e=L(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},H=z["__core-js_shared__"],J=(q=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"";var K=function(t){return!!J&&J in t},Q=Function.prototype.toString;var X=function(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Y=W,Z=K,tt=R,et=X,rt=/^\[object .+?Constructor\]$/,nt=Function.prototype,ot=Object.prototype,ut=nt.toString,at=ot.hasOwnProperty,it=RegExp("^"+ut.call(at).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ct=function(t){return!(!tt(t)||Z(t))&&(Y(t)?it:rt).test(et(t))},ft=function(t,e){return null==t?void 0:t[e]};var lt=function(t,e){var r=ft(t,e);return ct(r)?r:void 0},st=lt(z,"Map"),vt=lt(Object,"create"),dt=vt;var pt=function(){this.__data__=dt?dt(null):{},this.size=0};var bt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},yt=vt,ht=Object.prototype.hasOwnProperty;var jt=function(t){var e=this.__data__;if(yt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return ht.call(e,t)?e[t]:void 0},gt=vt,_t=Object.prototype.hasOwnProperty;var wt=vt;var mt=pt,Ot=bt,At=jt,St=function(t){var e=this.__data__;return gt?void 0!==e[t]:_t.call(e,t)},kt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=wt&&void 0===e?"__lodash_hash_undefined__":e,this};function Pt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Pt.prototype.clear=mt,Pt.prototype.delete=Ot,Pt.prototype.get=At,Pt.prototype.has=St,Pt.prototype.set=kt;var xt=Pt,zt=_,Et=st;var Bt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ft=function(t,e){var r=t.__data__;return Bt(e)?r["string"==typeof e?"string":"hash"]:r.map},Mt=Ft;var It=Ft;var Ut=Ft;var Nt=Ft;var Ct=function(t,e){var r=Nt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},Dt=function(){this.size=0,this.__data__={hash:new xt,map:new(Et||zt),string:new xt}},Tt=function(t){var e=Mt(this,t).delete(t);return this.size-=e?1:0,e},$t=function(t){return It(this,t).get(t)},Gt=function(t){return Ut(this,t).has(t)},Rt=Ct;function Lt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Lt.prototype.clear=Dt,Lt.prototype.delete=Tt,Lt.prototype.get=$t,Lt.prototype.has=Gt,Lt.prototype.set=Rt;var Vt=Lt,qt=_,Wt=st,Ht=Vt;var Jt=_,Kt=m,Qt=O,Xt=A,Yt=S,Zt=function(t,e){var r=this.__data__;if(r instanceof qt){var n=r.__data__;if(!Wt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ht(n)}return r.set(t,e),this.size=r.size,this};function te(t){var e=this.__data__=new Jt(t);this.size=e.size}te.prototype.clear=Kt,te.prototype.delete=Qt,te.prototype.get=Xt,te.prototype.has=Yt,te.prototype.set=Zt;var ee=te;var re=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},ne=lt,oe=function(){try{var t=ne(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=oe;var ae=function(t,e,r){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},ie=ae,ce=a,fe=Object.prototype.hasOwnProperty;var le=function(t,e,r){var n=t[e];fe.call(t,e)&&ce(n,r)&&(void 0!==r||e in t)||ie(t,e,r)},se=le,ve=ae;var de=function(t,e,r,n){var o=!r;r||(r={});for(var u=-1,a=e.length;++u<a;){var i=e[u],c=n?n(r[i],t[i],i,r,t):void 0;void 0===c&&(c=t[i]),o?ve(r,i,c):se(r,i,c)}return r};var pe=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var be=function(t){return null!=t&&"object"==typeof t},ye=G,he=be;var je=function(t){return he(t)&&"[object Arguments]"==ye(t)},ge=be,_e=Object.prototype,we=_e.hasOwnProperty,me=_e.propertyIsEnumerable,Oe=je(function(){return arguments}())?je:function(t){return ge(t)&&we.call(t,"callee")&&!me.call(t,"callee")},Ae=Oe,Se=Array.isArray,ke={};var Pe=function(){return!1};!function(t,e){var r=z,n=Pe,o=e&&!e.nodeType&&e,u=o&&t&&!t.nodeType&&t,a=u&&u.exports===o?r.Buffer:void 0,i=(a?a.isBuffer:void 0)||n;t.exports=i}({get exports(){return ke},set exports(t){ke=t}},ke);var xe=/^(?:0|[1-9]\d*)$/;var ze=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&xe.test(t))&&t>-1&&t%1==0&&t<e};var Ee=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Be=G,Fe=Ee,Me=be,Ie={};Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var Ue=function(t){return Me(t)&&Fe(t.length)&&!!Ie[Be(t)]};var Ne=function(t){return function(e){return t(e)}},Ce={};!function(t,e){var r=k,n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,u=o&&o.exports===n&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=a}({get exports(){return Ce},set exports(t){Ce=t}},Ce);var De=Ue,Te=Ne,$e=Ce&&Ce.isTypedArray,Ge=$e?Te($e):De,Re=pe,Le=Ae,Ve=Se,qe=ke,We=ze,He=Ge,Je=Object.prototype.hasOwnProperty;var Ke=function(t,e){var r=Ve(t),n=!r&&Le(t),o=!r&&!n&&qe(t),u=!r&&!n&&!o&&He(t),a=r||n||o||u,i=a?Re(t.length,String):[],c=i.length;for(var f in t)!e&&!Je.call(t,f)||a&&("length"==f||o&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||We(f,c))||i.push(f);return i},Qe=Object.prototype;var Xe=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Qe)};var Ye=function(t,e){return function(r){return t(e(r))}},Ze=Ye(Object.keys,Object),tr=Xe,er=Ze,rr=Object.prototype.hasOwnProperty;var nr=function(t){if(!tr(t))return er(t);var e=[];for(var r in Object(t))rr.call(t,r)&&"constructor"!=r&&e.push(r);return e},or=W,ur=Ee;var ar=function(t){return null!=t&&ur(t.length)&&!or(t)},ir=Ke,cr=nr,fr=ar;var lr=function(t){return fr(t)?ir(t):cr(t)},sr=de,vr=lr;var dr=function(t,e){return t&&sr(e,vr(e),t)};var pr=R,br=Xe,yr=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},hr=Object.prototype.hasOwnProperty;var jr=Ke,gr=function(t){if(!pr(t))return yr(t);var e=br(t),r=[];for(var n in t)("constructor"!=n||!e&&hr.call(t,n))&&r.push(n);return r},_r=ar;var wr=function(t){return _r(t)?jr(t,!0):gr(t)},mr=de,Or=wr;var Ar=function(t,e){return t&&mr(e,Or(e),t)},Sr={};!function(t,e){var r=z,n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,u=o&&o.exports===n?r.Buffer:void 0,a=u?u.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}}({get exports(){return Sr},set exports(t){Sr=t}},Sr);var kr=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};var Pr=function(){return[]},xr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,u=[];++r<n;){var a=t[r];e(a,r,t)&&(u[o++]=a)}return u},zr=Pr,Er=Object.prototype.propertyIsEnumerable,Br=Object.getOwnPropertySymbols,Fr=Br?function(t){return null==t?[]:(t=Object(t),xr(Br(t),(function(e){return Er.call(t,e)})))}:zr,Mr=de,Ir=Fr;var Ur=function(t,e){return Mr(t,Ir(t),e)};var Nr=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t},Cr=Ye(Object.getPrototypeOf,Object),Dr=Nr,Tr=Cr,$r=Fr,Gr=Pr,Rr=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Dr(e,$r(t)),t=Tr(t);return e}:Gr,Lr=de,Vr=Rr;var qr=function(t,e){return Lr(t,Vr(t),e)},Wr=Nr,Hr=Se;var Jr=function(t,e,r){var n=e(t);return Hr(t)?n:Wr(n,r(t))},Kr=Jr,Qr=Fr,Xr=lr;var Yr=function(t){return Kr(t,Xr,Qr)},Zr=Jr,tn=Rr,en=wr;var rn=function(t){return Zr(t,en,tn)},nn=lt(z,"DataView"),on=st,un=lt(z,"Promise"),an=lt(z,"Set"),cn=lt(z,"WeakMap"),fn=G,ln=X,sn="[object Map]",vn="[object Promise]",dn="[object Set]",pn="[object WeakMap]",bn="[object DataView]",yn=ln(nn),hn=ln(on),jn=ln(un),gn=ln(an),_n=ln(cn),wn=fn;(nn&&wn(new nn(new ArrayBuffer(1)))!=bn||on&&wn(new on)!=sn||un&&wn(un.resolve())!=vn||an&&wn(new an)!=dn||cn&&wn(new cn)!=pn)&&(wn=function(t){var e=fn(t),r="[object Object]"==e?t.constructor:void 0,n=r?ln(r):"";if(n)switch(n){case yn:return bn;case hn:return sn;case jn:return vn;case gn:return dn;case _n:return pn}return e});var mn=wn,On=Object.prototype.hasOwnProperty;var An=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&On.call(t,"index")&&(r.index=t.index,r.input=t.input),r},Sn=z.Uint8Array,kn=Sn;var Pn=function(t){var e=new t.constructor(t.byteLength);return new kn(e).set(new kn(t)),e},xn=Pn;var zn=function(t,e){var r=e?xn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},En=/\w*$/;var Bn=function(t){var e=new t.constructor(t.source,En.exec(t));return e.lastIndex=t.lastIndex,e},Fn=E?E.prototype:void 0,Mn=Fn?Fn.valueOf:void 0;var In=Pn;var Un=Pn,Nn=zn,Cn=Bn,Dn=function(t){return Mn?Object(Mn.call(t)):{}},Tn=function(t,e){var r=e?In(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var $n=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return Un(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return Nn(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Tn(t,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return Cn(t);case"[object Symbol]":return Dn(t)}},Gn=R,Rn=Object.create,Ln=function(){function t(){}return function(e){if(!Gn(e))return{};if(Rn)return Rn(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Vn=Cr,qn=Xe;var Wn=function(t){return"function"!=typeof t.constructor||qn(t)?{}:Ln(Vn(t))},Hn=mn,Jn=be;var Kn=function(t){return Jn(t)&&"[object Map]"==Hn(t)},Qn=Ne,Xn=Ce&&Ce.isMap,Yn=Xn?Qn(Xn):Kn,Zn=mn,to=be;var eo=function(t){return to(t)&&"[object Set]"==Zn(t)},ro=Ne,no=Ce&&Ce.isSet,oo=no?ro(no):eo,uo=ee,ao=re,io=le,co=dr,fo=Ar,lo=Sr,so=kr,vo=Ur,po=qr,bo=Yr,yo=rn,ho=mn,jo=An,go=$n,_o=Wn,wo=Se,mo=ke,Oo=Yn,Ao=R,So=oo,ko=lr,Po=wr,xo="[object Arguments]",zo="[object Function]",Eo="[object Object]",Bo={};Bo[xo]=Bo["[object Array]"]=Bo["[object ArrayBuffer]"]=Bo["[object DataView]"]=Bo["[object Boolean]"]=Bo["[object Date]"]=Bo["[object Float32Array]"]=Bo["[object Float64Array]"]=Bo["[object Int8Array]"]=Bo["[object Int16Array]"]=Bo["[object Int32Array]"]=Bo["[object Map]"]=Bo["[object Number]"]=Bo[Eo]=Bo["[object RegExp]"]=Bo["[object Set]"]=Bo["[object String]"]=Bo["[object Symbol]"]=Bo["[object Uint8Array]"]=Bo["[object Uint8ClampedArray]"]=Bo["[object Uint16Array]"]=Bo["[object Uint32Array]"]=!0,Bo["[object Error]"]=Bo[zo]=Bo["[object WeakMap]"]=!1;var Fo=function t(e,r,n,o,u,a){var i,c=1&r,f=2&r,l=4&r;if(n&&(i=u?n(e,o,u,a):n(e)),void 0!==i)return i;if(!Ao(e))return e;var s=wo(e);if(s){if(i=jo(e),!c)return so(e,i)}else{var v=ho(e),d=v==zo||"[object GeneratorFunction]"==v;if(mo(e))return lo(e,c);if(v==Eo||v==xo||d&&!u){if(i=f||d?{}:_o(e),!c)return f?po(e,fo(i,e)):vo(e,co(i,e))}else{if(!Bo[v])return u?e:{};i=go(e,v,c)}}a||(a=new uo);var p=a.get(e);if(p)return p;a.set(e,i),So(e)?e.forEach((function(o){i.add(t(o,r,n,o,e,a))})):Oo(e)&&e.forEach((function(o,u){i.set(u,t(o,r,n,u,e,a))}));var b=s?void 0:(l?f?yo:bo:f?Po:ko)(e);return ao(b||e,(function(o,u){b&&(o=e[u=o]),io(i,u,t(o,r,n,u,e,a))})),i},Mo=Fo;var Io=function(t){return Mo(t,5)},Uo=G,No=be;var Co=function(t){return"symbol"==typeof t||No(t)&&"[object Symbol]"==Uo(t)},Do=Se,To=Co,$o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Go=/^\w*$/;var Ro=function(t,e){if(Do(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!To(t))||(Go.test(t)||!$o.test(t)||null!=e&&t in Object(e))},Lo=Vt;function Vo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],u=r.cache;if(u.has(o))return u.get(o);var a=t.apply(this,n);return r.cache=u.set(o,a)||u,a};return r.cache=new(Vo.Cache||Lo),r}Vo.Cache=Lo;var qo=Vo;var Wo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ho=/\\(\\)?/g,Jo=function(t){var e=qo(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Wo,(function(t,r,n,o){e.push(n?o.replace(Ho,"$1"):r||t)})),e}));var Ko=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},Qo=Ko,Xo=Se,Yo=Co,Zo=E?E.prototype:void 0,tu=Zo?Zo.toString:void 0;var eu=function t(e){if("string"==typeof e)return e;if(Xo(e))return Qo(e,t)+"";if(Yo(e))return tu?tu.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r},ru=eu;var nu=function(t){return null==t?"":ru(t)},ou=Se,uu=Ro,au=Jo,iu=nu;var cu=function(t,e){return ou(t)?t:uu(t,e)?[t]:au(iu(t))},fu=Co;var lu=function(t){if("string"==typeof t||fu(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e},su=cu,vu=lu;var du=function(t,e){for(var r=0,n=(e=su(e,t)).length;null!=t&&r<n;)t=t[vu(e[r++])];return r&&r==n?t:void 0},pu=du;var bu=function(t,e,r){var n=null==t?void 0:pu(t,e);return void 0===n?r:n};var yu=Vt,hu=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ju=function(t){return this.__data__.has(t)};function gu(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new yu;++e<r;)this.add(t[e])}gu.prototype.add=gu.prototype.push=hu,gu.prototype.has=ju;var _u=gu,wu=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},mu=function(t,e){return t.has(e)};var Ou=function(t,e,r,n,o,u){var a=1&r,i=t.length,c=e.length;if(i!=c&&!(a&&c>i))return!1;var f=u.get(t),l=u.get(e);if(f&&l)return f==e&&l==t;var s=-1,v=!0,d=2&r?new _u:void 0;for(u.set(t,e),u.set(e,t);++s<i;){var p=t[s],b=e[s];if(n)var y=a?n(b,p,s,e,t,u):n(p,b,s,t,e,u);if(void 0!==y){if(y)continue;v=!1;break}if(d){if(!wu(e,(function(t,e){if(!mu(d,e)&&(p===t||o(p,t,r,n,u)))return d.push(e)}))){v=!1;break}}else if(p!==b&&!o(p,b,r,n,u)){v=!1;break}}return u.delete(t),u.delete(e),v};var Au=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Su=Sn,ku=a,Pu=Ou,xu=Au,zu=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Eu=E?E.prototype:void 0,Bu=Eu?Eu.valueOf:void 0;var Fu=function(t,e,r,n,o,u,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!u(new Su(t),new Su(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ku(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var i=xu;case"[object Set]":var c=1&n;if(i||(i=zu),t.size!=e.size&&!c)return!1;var f=a.get(t);if(f)return f==e;n|=2,a.set(t,e);var l=Pu(i(t),i(e),n,o,u,a);return a.delete(t),l;case"[object Symbol]":if(Bu)return Bu.call(t)==Bu.call(e)}return!1},Mu=Yr,Iu=Object.prototype.hasOwnProperty;var Uu=ee,Nu=Ou,Cu=Fu,Du=function(t,e,r,n,o,u){var a=1&r,i=Mu(t),c=i.length;if(c!=Mu(e).length&&!a)return!1;for(var f=c;f--;){var l=i[f];if(!(a?l in e:Iu.call(e,l)))return!1}var s=u.get(t),v=u.get(e);if(s&&v)return s==e&&v==t;var d=!0;u.set(t,e),u.set(e,t);for(var p=a;++f<c;){var b=t[l=i[f]],y=e[l];if(n)var h=a?n(y,b,l,e,t,u):n(b,y,l,t,e,u);if(!(void 0===h?b===y||o(b,y,r,n,u):h)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var j=t.constructor,g=e.constructor;j==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof g&&g instanceof g||(d=!1)}return u.delete(t),u.delete(e),d},Tu=mn,$u=Se,Gu=ke,Ru=Ge,Lu="[object Arguments]",Vu="[object Array]",qu="[object Object]",Wu=Object.prototype.hasOwnProperty;var Hu=function(t,e,r,n,o,u){var a=$u(t),i=$u(e),c=a?Vu:Tu(t),f=i?Vu:Tu(e),l=(c=c==Lu?qu:c)==qu,s=(f=f==Lu?qu:f)==qu,v=c==f;if(v&&Gu(t)){if(!Gu(e))return!1;a=!0,l=!1}if(v&&!l)return u||(u=new Uu),a||Ru(t)?Nu(t,e,r,n,o,u):Cu(t,e,c,r,n,o,u);if(!(1&r)){var d=l&&Wu.call(t,"__wrapped__"),p=s&&Wu.call(e,"__wrapped__");if(d||p){var b=d?t.value():t,y=p?e.value():e;return u||(u=new Uu),o(b,y,r,n,u)}}return!!v&&(u||(u=new Uu),Du(t,e,r,n,o,u))},Ju=be;var Ku=function t(e,r,n,o,u){return e===r||(null==e||null==r||!Ju(e)&&!Ju(r)?e!=e&&r!=r:Hu(e,r,n,o,t,u))},Qu=ee,Xu=Ku;var Yu=R;var Zu=function(t){return t==t&&!Yu(t)},ta=Zu,ea=lr;var ra=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}},na=function(t,e,r,n){var o=r.length,u=o,a=!n;if(null==t)return!u;for(t=Object(t);o--;){var i=r[o];if(a&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++o<u;){var c=(i=r[o])[0],f=t[c],l=i[1];if(a&&i[2]){if(void 0===f&&!(c in t))return!1}else{var s=new Qu;if(n)var v=n(f,l,c,t,e,s);if(!(void 0===v?Xu(l,f,3,n,s):v))return!1}}return!0},oa=function(t){for(var e=ea(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ta(o)]}return e},ua=ra;var aa=cu,ia=Ae,ca=Se,fa=ze,la=Ee,sa=lu;var va=function(t,e){return null!=t&&e in Object(t)},da=function(t,e,r){for(var n=-1,o=(e=aa(e,t)).length,u=!1;++n<o;){var a=sa(e[n]);if(!(u=null!=t&&r(t,a)))break;t=t[a]}return u||++n!=o?u:!!(o=null==t?0:t.length)&&la(o)&&fa(a,o)&&(ca(t)||ia(t))};var pa=Ku,ba=bu,ya=function(t,e){return null!=t&&da(t,e,va)},ha=Ro,ja=Zu,ga=ra,_a=lu;var wa=function(t){return t};var ma=function(t){return function(e){return null==e?void 0:e[t]}},Oa=du;var Aa=ma,Sa=function(t){return function(e){return Oa(e,t)}},ka=Ro,Pa=lu;var xa=function(t){var e=oa(t);return 1==e.length&&e[0][2]?ua(e[0][0],e[0][1]):function(r){return r===t||na(r,t,e)}},za=function(t,e){return ha(t)&&ja(e)?ga(_a(t),e):function(r){var n=ba(r,t);return void 0===n&&n===e?ya(r,t):pa(e,n,3)}},Ea=wa,Ba=Se,Fa=function(t){return ka(t)?Aa(Pa(t)):Sa(t)};var Ma=function(t){return"function"==typeof t?t:null==t?Ea:"object"==typeof t?Ba(t)?za(t[0],t[1]):xa(t):Fa(t)};var Ia=function(t){return function(e,r,n){for(var o=-1,u=Object(e),a=n(e),i=a.length;i--;){var c=a[t?i:++o];if(!1===r(u[c],c,u))break}return e}}(),Ua=lr;var Na=ar;var Ca=function(t,e){return function(r,n){if(null==r)return r;if(!Na(r))return t(r,n);for(var o=r.length,u=e?o:-1,a=Object(r);(e?u--:++u<o)&&!1!==n(a[u],u,a););return r}}((function(t,e){return t&&Ia(t,e,Ua)})),Da=Ca,Ta=ar;var $a=Ko,Ga=Ma,Ra=function(t,e){var r=-1,n=Ta(t)?Array(t.length):[];return Da(t,(function(t,o,u){n[++r]=e(t,o,u)})),n},La=Se;var Va=function(t,e){return(La(t)?$a:Ra)(t,Ga(e))};var qa=function(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var u=Array(o);++n<o;)u[n]=t[n+e];return u},Wa=du,Ha=qa;var Ja=cu,Ka=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},Qa=function(t,e){return e.length<2?t:Wa(t,Ha(e,0,-1))},Xa=lu;var Ya=function(t,e){return e=Ja(e,t),null==(t=Qa(t,e))||delete t[Xa(Ka(e))]},Za=G,ti=Cr,ei=be,ri=Function.prototype,ni=Object.prototype,oi=ri.toString,ui=ni.hasOwnProperty,ai=oi.call(Object);var ii=function(t){if(!ei(t)||"[object Object]"!=Za(t))return!1;var e=ti(t);if(null===e)return!0;var r=ui.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&oi.call(r)==ai};var ci=function(t){return ii(t)?void 0:t},fi=Ae,li=Se,si=E?E.isConcatSpreadable:void 0;var vi=Nr,di=function(t){return li(t)||fi(t)||!!(si&&t&&t[si])};var pi=function t(e,r,n,o,u){var a=-1,i=e.length;for(n||(n=di),u||(u=[]);++a<i;){var c=e[a];r>0&&n(c)?r>1?t(c,r-1,n,o,u):vi(u,c):o||(u[u.length]=c)}return u},bi=pi;var yi=function(t){return(null==t?0:t.length)?bi(t,1):[]};var hi=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)},ji=Math.max;var gi=function(t,e,r){return e=ji(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,u=ji(n.length-e,0),a=Array(u);++o<u;)a[o]=n[e+o];o=-1;for(var i=Array(e+1);++o<e;)i[o]=n[o];return i[e]=r(a),hi(t,this,i)}};var _i=function(t){return function(){return t}},wi=oe,mi=wi?function(t,e){return wi(t,"toString",{configurable:!0,enumerable:!1,value:_i(e),writable:!0})}:wa,Oi=Date.now;var Ai=function(t){var e=0,r=0;return function(){var n=Oi(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Si=Ai(mi),ki=yi,Pi=gi,xi=Si;var zi=Ko,Ei=Fo,Bi=Ya,Fi=cu,Mi=de,Ii=ci,Ui=rn,Ni=function(t){return xi(Pi(t,void 0,ki),t+"")}((function(t,e){var r={};if(null==t)return r;var n=!1;e=zi(e,(function(e){return e=Fi(e,t),n||(n=e.length>1),e})),Mi(t,Ui(t),r),n&&(r=Ei(r,7,Ii));for(var o=e.length;o--;)Bi(r,e[o]);return r})),Ci=G,Di=Se,Ti=be;var $i=function(t){return"string"==typeof t||!Di(t)&&Ti(t)&&"[object String]"==Ci(t)},Gi=ma("length"),Ri=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Li=function(t){return Ri.test(t)},Vi="\\ud800-\\udfff",qi="["+Vi+"]",Wi="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Hi="\\ud83c[\\udffb-\\udfff]",Ji="[^"+Vi+"]",Ki="(?:\\ud83c[\\udde6-\\uddff]){2}",Qi="[\\ud800-\\udbff][\\udc00-\\udfff]",Xi="(?:"+Wi+"|"+Hi+")"+"?",Yi="[\\ufe0e\\ufe0f]?",Zi=Yi+Xi+("(?:\\u200d(?:"+[Ji,Ki,Qi].join("|")+")"+Yi+Xi+")*"),tc="(?:"+[Ji+Wi+"?",Wi,Ki,Qi,qi].join("|")+")",ec=RegExp(Hi+"(?="+Hi+")|"+tc+Zi,"g");var rc=Gi,nc=Li,oc=function(t){for(var e=ec.lastIndex=0;ec.test(t);)++e;return e};var uc=nr,ac=mn,ic=ar,cc=$i,fc=function(t){return nc(t)?oc(t):rc(t)};var lc=function(t){if(null==t)return 0;if(ic(t))return cc(t)?fc(t):t.length;var e=ac(t);return"[object Map]"==e||"[object Set]"==e?t.size:uc(t).length};function sc(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var vc=/\s/;var dc=function(t){for(var e=t.length;e--&&vc.test(t.charAt(e)););return e},pc=/^\s+/;var bc=function(t){return t?t.slice(0,dc(t)+1).replace(pc,""):t},yc=R,hc=Co,jc=/^[-+]0x[0-9a-f]+$/i,gc=/^0b[01]+$/i,_c=/^0o[0-7]+$/i,wc=parseInt;var mc=function(t){if("number"==typeof t)return t;if(hc(t))return NaN;if(yc(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=yc(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=bc(t);var r=gc.test(t);return r||_c.test(t)?wc(t.slice(2),r?2:8):jc.test(t)?NaN:+t},Oc=mc,Ac=1/0;var Sc=function(t){return t?(t=Oc(t))===Ac||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},kc=Sc;var Pc=function(t){var e=kc(t),r=e%1;return e==e?r?e-r:e:0},xc=Pc;var zc=function(t){return"number"==typeof t&&t==xc(t)};function Ec(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function Bc(t){let e=!1;return Ec(t)?e=!isNaN(Number(t)):function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)&&(e=!0),e}function Fc(t){if(!Bc(t))return 0;return Sc(t)}var Mc=Pc,Ic=mc,Uc=nu,Nc=z.isFinite,Cc=Math.min;var Dc=function(t){var e=Math[t];return function(t,r){if(t=Ic(t),(r=null==r?0:Cc(Mc(r),292))&&Nc(t)){var n=(Uc(t)+"e").split("e"),o=e(n[0]+"e"+(+n[1]+r));return+((n=(Uc(o)+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round");function Tc(t){if(!Bc(t))return 0;t=Fc(t);let e=Dc(t);return"0"===String(e)?0:e}function $c(t){if(!function(t){return!!Bc(t)&&(t=Fc(t),zc(t))}(t))return!1;return Tc(t)>0}let Gc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),Rc=Gc.length;function Lc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,e=[];t=$c(t)?Tc(t):32;for(let r=0;r<t;r++)e[r]=Gc[0|Math.random()*Rc];return e.join("")}function Vc(t){return"[object Array]"===Object.prototype.toString.call(t)}var qc=qa,Wc=Pc;var Hc=function(t,e,r){var n=null==t?0:t.length;return n?(e=r||void 0===e?1:Wc(e),qc(t,e<0?0:e,n)):[]},Jc={},Kc=wa;var Qc=re,Xc=Ca,Yc=function(t){return"function"==typeof t?t:Kc},Zc=Se;var tf=function(t,e){return(Zc(t)?Qc:Xc)(t,Yc(e))};!function(t){t.exports=tf}({get exports(){return Jc},set exports(t){Jc=t}});var ef=o(Jc);function rf(t){return"[object Object]"===Object.prototype.toString.call(t)}function nf(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function of(t,e){let r=sc();if(!Vc(t)&&!rf(t))return r.reject("rs is not an array or object"),r;let n=!1;if(rf(t)){n=!0;let e=[];ef(t,((t,r)=>{e.push({k:r,v:t})})),t=e}nf(e)||(e=function(t){return t});let o=-1,u=[];return t.reduce((function(t,r){return t.then((function(t){u.push(t),o+=1;let a=o,i=r;return n&&(a=r.k,i=r.v),nf(e)?e(i,a):i}))}),Promise.resolve()).then((function(t){u.push(t),u=Hc(u),r.resolve(u)})).catch((function(t){r.reject(t)})),r}let uf={useNewUrlParser:!0,useUnifiedTopology:!0};return function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.url||(n.url="mongodb://127.0.0.1:27017"),n.db||(n.db="worm"),n.cl||(n.cl="test");let o=new t.EventEmitter,u=e.MongoClient;async function a(t){let e=!1;t=Io(t);let r=new u(n.url,uf),a=null;try{let u=r.db(n.db).collection(n.cl);Vc(t)||(t=[t]),t=Va(t,(function(t){return t.id||(t.id=Lc()),t})),a=await u.insertMany(t),a.insertedCount>0?(a={n:lc(t),nInserted:a.insertedCount,ok:a.acknowledged?1:0},o.emit("change","insert",t,a)):(e=!0,a="no insert data")}catch(t){e=!0,a=t}finally{await r.close()}return e?Promise.reject(a):a}async function i(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=!1,n=null;try{let r=e.find(t);n=await r.toArray()}catch(t){r=!0,n=t}return r?Promise.reject(n):n}return o.select=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=new u(n.url,uf),o=null;try{let e=r.db(n.db).collection(n.cl).find(t);o=await e.toArray(),o=Va(o,(function(t){return t=Ni(t,"_id")}))}catch(t){e=!0,o=t}finally{await r.close()}return e?Promise.reject(o):o},o.insert=a,o.save=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!1;t=Io(t);let i=bu(e,"autoInsert",!0),c=bu(e,"atomic",!1),f=new u(n.url,uf),l=null;try{let e=f.db(n.db).collection(n.cl);Vc(t)||(t=[t]);let r=null;r=c?"findOneAndUpdate":"updateOne",l=await of(t,(async t=>{let n=null;return n=await e[r]({id:t.id},{$set:t}),n=n.lastErrorObject?{n:n.lastErrorObject.n,nModified:n.lastErrorObject.updatedExisting?1:0,ok:1}:{n:n.matchedCount,nModified:n.modifiedCount,ok:n.acknowledged?1:0},i&&0===n.n&&(n=await a(t)),n})),o.emit("change","save",t,l)}catch(t){r=!0,l=t}finally{await f.close()}return r?Promise.reject(l):l},o.del=async function(t){let e=!1;t=Io(t);let r=new u(n.url,uf),a=null;try{let e=r.db(n.db).collection(n.cl);Vc(t)||(t=[t]),a=await of(t,(async t=>{let r=null;return r=await e.deleteOne({id:t.id}),r={n:r.deletedCount,nDeleted:r.deletedCount,ok:r.acknowledged?1:0},r})),o.emit("change","del",t,a)}catch(t){e=!0,a=t}finally{await r.close()}return e?Promise.reject(a):a},o.delAll=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,r=new u(n.url,uf),a=null;try{let e=r.db(n.db).collection(n.cl);a=await e.deleteMany(t),a={n:a.deletedCount,nDeleted:a.deletedCount,ok:a.acknowledged?1:0},o.emit("change","delAll",null,a)}catch(t){e=!0,a=t}finally{await r.close()}return e?Promise.reject(a):a},o.selectGfs=async function(t){let r=!1,o=new u(n.url,uf),a=null;try{a=await(async t=>{let r=sc(),u=o.db(n.db),a=new e.GridFSBucket(u,{chunkSizeBytes:10485760,bucketName:n.cl}),i=Buffer.from(""),c=a.openDownloadStreamByName(t);return c.on("data",(function(t){i=Buffer.concat([i,t])})),c.on("error",(function(t){r.reject(t)})),c.on("end",(function(){let t=new Uint8Array(i);i=null,r.resolve(t)})),r})(t)}catch(t){r=!0,a=t}finally{await o.close()}return r?Promise.reject(a):a},o.insertGfs=async function(t){let a=!1,i=Lc(),c=Buffer.from(t),f=new u(n.url,uf),l=null;try{l=await(async(t,o)=>{let u=sc(),a=f.db(n.db),i=new e.GridFSBucket(a,{chunkSizeBytes:10485760,bucketName:n.cl}),c=new r.Readable;return c._read=()=>{},c.push(o),c.push(null),c.pipe(i.openUploadStream(t)).on("error",(function(t){u.reject(t)})).on("finish",(function(){let e={n:1,ok:1,id:t};u.resolve(e)})),u})(i,c),o.emit("change","insertGfs",null,l)}catch(t){a=!0,l=t}finally{await f.close()}return a?Promise.reject(l):l},o.delGfs=async function(t){let r=!1,a=new u(n.url,uf),c=null;try{let r=a.db(n.db),u=new e.GridFSBucket(r,{chunkSizeBytes:10485760,bucketName:n.cl});if(c=await i({filename:t},u),0===c.length)c=`can not find id[${t}]`;else if(c.length>1)c=`duplicate id[${t}]`;else{let t=c[0]._id;c=await u.delete(t),c={n:1,nDeleted:1,ok:1},o.emit("change","delGfs",null,c)}}catch(t){r=!0,c=t}finally{await a.close()}return r?Promise.reject(c):c},o.delAllGfs=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!1,a=new u(n.url,uf),c=null;try{let r=a.db(n.db),u=new e.GridFSBucket(r,{chunkSizeBytes:10485760,bucketName:n.cl});c=await i(t,u);let f=lc(c),l=Va(c,(function(t){return async function(t,e){let r=!1,n=null;try{n=await e.delete(t),n={n:1,nDeleted:1,ok:1}}catch(t){r=!0,n=t}return r?Promise.reject(n):n}(t._id,u)}));c=await Promise.all(l),c={n:f,ok:1},o.emit("change","delAllGfs",null,c)}catch(t){r=!0,c=t}finally{await a.close()}return r?Promise.reject(c):c},o}}));
7
7
  //# sourceMappingURL=w-orm-mongodb.umd.js.map