@cloudbase/js-sdk 2.0.0-alpha.0 → 2.0.0-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.
- package/database/dist/index.esm.js +2 -2
- package/database/dist/index.js +3 -3
- package/miniprogram_dist/analytics.js +1 -1
- package/miniprogram_dist/app.js +1 -1
- package/miniprogram_dist/auth.js +1 -1
- package/miniprogram_dist/database.js +1 -1
- package/miniprogram_dist/functions.js +1 -1
- package/miniprogram_dist/index.js +4 -4
- package/miniprogram_dist/storage.js +1 -1
- package/package.json +8 -8
|
@@ -14,7 +14,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
14
14
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
***************************************************************************** */
|
|
17
|
-
var dt=function(t,e){return(dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var yt=function(){return(yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function gt(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bt(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function _t(t){return this instanceof _t?(this.v=t,this):new _t(t)}var mt=Object.freeze({__proto__:null,__extends:function(t,e){function r(){this.constructor=t}dt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},get __assign(){return yt},__rest:function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r},__decorate:function(t,e,r,n){var o,i=arguments.length,u=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(u=(i<3?o(u):i>3?o(e,r,u):o(e,r))||u);return i>3&&u&&Object.defineProperty(e,r,u),u},__param:function(t,e){return function(r,n){e(r,n,t)}},__metadata:function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter:function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},__generator:function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},__createBinding:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},__exportStar:function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])},__values:gt,__read:bt,__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(bt(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],u=0,s=i.length;u<s;u++,o++)n[o]=i[u];return n},__await:_t,__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},u("next"),u("throw"),u("return"),n[Symbol.asyncIterator]=function(){return this},n;function u(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||s(t,e)}))})}function s(t,e){try{(r=o[t](e)).value instanceof _t?Promise.resolve(r.value.v).then(f,a):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function f(t){s("next",t)}function a(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}},__asyncDelegator:function(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:_t(t[n](e)),done:"return"===n}:o?o(e):e}:o}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=gt(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__classPrivateFieldGet:function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},__classPrivateFieldSet:function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}}),wt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=it.Long;var r=function(t){function e(r,n){var o=this;return o instanceof e?(o=it.Long.isLong(r)?t.call(this,r.low,r.high,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return mt.__extends(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(it.Long.fromInt(t,!0))},e.fromNumber=function(t){return new e(it.Long.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(it.Long.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp.i,t.$timestamp.t)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp("+this.getLowBits().toString()+", "+this.getHighBits().toString()+")"},e.MAX_VALUE=it.Long.MAX_UNSIGNED_VALUE,e}(e.LongWithoutOverridesClass);e.Timestamp=r}));i(wt),wt.Timestamp,wt.LongWithoutOverridesClass;var vt=u((function(t,e){function r(t){return Z.isObjectLike(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0,e.isBSONType=r;var n={$oid:lt.ObjectId,$binary:rt.Binary,$uuid:rt.Binary,$symbol:ht.BSONSymbol,$numberInt:ft.Int32,$numberDecimal:ut.Decimal128,$numberDouble:st.Double,$numberLong:it.Long,$minKey:ct.MinKey,$maxKey:at.MaxKey,$regex:pt.BSONRegExp,$regularExpression:pt.BSONRegExp,$timestamp:wt.Timestamp};function o(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function i(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var s=e.seenObjects.map((function(t){return t.propertyName})),f=s.slice(0,n).map((function(t){return t+" -> "})).join(""),a=s[n],c=" -> "+s.slice(n+1,s.length-1).map((function(t){return t+" -> "})).join(""),l=s[s.length-1],p=" ".repeat(f.length+a.length/2),h="-".repeat(c.length+(a.length+l.length)/2-1);throw new TypeError("Converting circular structure to EJSON:\n "+f+a+c+l+"\n "+p+"\\"+h+"/")}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,r){e.seenObjects.push({propertyName:"index "+r,obj:null});try{return i(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||Z.isDate(t)){var d=t.getTime(),y=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&y?{$date:t.getTime()}:{$date:o(t)}:e.relaxed&&y?{$date:o(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var g=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(g)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Z.isRegExp(t)){var b=t.flags;if(void 0===b){var _=t.toString().match(/[gimuy]*$/);_&&(b=_[0])}return new pt.BSONRegExp(t.source,b).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new Error("not an object instance");var n=t._bsontype;if(void 0===n){var o={};for(var s in t){e.seenObjects.push({propertyName:s,obj:null});try{o[s]=i(t[s],e)}finally{e.seenObjects.pop()}}return o}if(r(t)){var f=t;if("function"!=typeof f.toExtendedJSON){var a=u[t._bsontype];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+t._bsontype);f=a(f)}return"Code"===n&&f.scope?f=new nt.Code(f.code,i(f.scope,e)):"DBRef"===n&&f.oid&&(f=new ot.DBRef(f.collection,i(f.oid,e),f.db,f.fields)),f.toExtendedJSON(e)}throw new Error("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var u={Binary:function(t){return new rt.Binary(t.value(),t.sub_type)},Code:function(t){return new nt.Code(t.code,t.scope)},DBRef:function(t){return new ot.DBRef(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new ut.Decimal128(t.bytes)},Double:function(t){return new st.Double(t.value)},Int32:function(t){return new ft.Int32(t.value)},Long:function(t){return it.Long.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 at.MaxKey},MinKey:function(){return new ct.MinKey},ObjectID:function(t){return new lt.ObjectId(t)},ObjectId:function(t){return new lt.ObjectId(t)},BSONRegExp:function(t){return new pt.BSONRegExp(t.pattern,t.options)},Symbol:function(t){return new ht.BSONSymbol(t.value)},Timestamp:function(t){return wt.Timestamp.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ft.Int32(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return it.Long.fromNumber(e)}return new st.Double(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var o=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),i=0;i<o.length;i++){var u=n[o[i]];if(u)return u.fromExtendedJSON(e,r)}if(null!=e.$date){var s=e.$date,f=new Date;return r.legacy?"number"==typeof s?f.setTime(s):"string"==typeof s&&f.setTime(Date.parse(s)):"string"==typeof s?f.setTime(Date.parse(s)):it.Long.isLong(s)?f.setTime(s.toNumber()):"number"==typeof s&&r.relaxed&&f.setTime(s),f}if(null!=e.$code){var a=Object.assign({},e);return e.$scope&&(a.$scope=t(e.$scope)),nt.Code.fromExtendedJSON(e)}if(null!=e.$ref||null!=e.$dbPointer){var c=e.$ref?e:e.$dbPointer;if(c instanceof ot.DBRef)return c;var l=Object.keys(c).filter((function(t){return t.startsWith("$")})),p=!0;if(l.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(p=!1)})),p)return ot.DBRef.fromExtendedJSON(c)}return e}(e,r)}))}function r(t,e,r,n){null!=r&&"object"==typeof r&&(n=r,r=0),null==e||"object"!=typeof e||Array.isArray(e)||(n=e,e=void 0,r=0);var o=i(t,Object.assign({relaxed:!0,legacy:!1},n,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(e.EJSON||(e.EJSON={}))}));i(vt),vt.EJSON,vt.isBSONType;var Ot=u((function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0,e.Map=r;var n=function(t){return t&&t.Math==Math&&t};var i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof o&&o)||Function("return this")();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=r=i.Map:e.Map=r=function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],o=r[1];this._keys.push(n),this._values[n]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},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,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}()}));i(Ot),Ot.Map;var St=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128}));i(St),St.BSON_BINARY_SUBTYPE_USER_DEFINED,St.BSON_BINARY_SUBTYPE_MD5,St.BSON_BINARY_SUBTYPE_UUID_NEW,St.BSON_BINARY_SUBTYPE_UUID,St.BSON_BINARY_SUBTYPE_BYTE_ARRAY,St.BSON_BINARY_SUBTYPE_FUNCTION,St.BSON_BINARY_SUBTYPE_DEFAULT,St.BSON_DATA_MAX_KEY,St.BSON_DATA_MIN_KEY,St.BSON_DATA_DECIMAL128,St.BSON_DATA_LONG,St.BSON_DATA_TIMESTAMP,St.BSON_DATA_INT,St.BSON_DATA_CODE_W_SCOPE,St.BSON_DATA_SYMBOL,St.BSON_DATA_CODE,St.BSON_DATA_DBPOINTER,St.BSON_DATA_REGEXP,St.BSON_DATA_NULL,St.BSON_DATA_DATE,St.BSON_DATA_BOOLEAN,St.BSON_DATA_OID,St.BSON_DATA_UNDEFINED,St.BSON_DATA_BINARY,St.BSON_DATA_ARRAY,St.BSON_DATA_OBJECT,St.BSON_DATA_STRING,St.BSON_DATA_NUMBER,St.JS_INT_MIN,St.JS_INT_MAX,St.BSON_INT64_MIN,St.BSON_INT64_MAX,St.BSON_INT32_MIN,St.BSON_INT32_MAX;var Nt=u((function(t,e){function r(t,e,r){var o=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)o+=n(i.toString(),t[i],e,!0,r);else for(var u in t.toBSON&&(t=t.toBSON()),t)o+=n(u,t[u],e,!1,r);return o}function n(t,e,n,o,i){switch(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===i&&(i=!1),e&&e.toBSON&&(e=e.toBSON()),typeof e){case"string":return 1+v.Buffer.byteLength(t,"utf8")+1+4+v.Buffer.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=St.JS_INT_MIN&&e<=St.JS_INT_MAX&&e>=St.BSON_INT32_MIN&&e<=St.BSON_INT32_MAX?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+5:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;case"undefined":return o||!i?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||Z.isDate(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Z.isAnyArrayBuffer(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1+r(e.scope,n,i):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+v.Buffer.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var u=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(u.$db=e.db),(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+r(u,n,i)}return e instanceof RegExp||Z.isRegExp(e)?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.pattern,"utf8")+1+v.Buffer.byteLength(e.options,"utf8")+1:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+r(e,n,i)+1;case"function":if(e instanceof RegExp||Z.isRegExp(e)||"[object RegExp]"===String.call(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(n&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1+r(e.scope,n,i);if(n)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1}return 0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0,e.calculateObjectSize=r}));i(Nt),Nt.calculateObjectSize;var Bt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;e.validateUtf8=function(t,e,r){for(var n=0,o=e;o<r;o+=1){var i=t[o];if(n){if(128!=(192&i))return!1;n-=1}else if(128&i)if(192==(224&i))n=1;else if(224==(240&i))n=2;else{if(240!=(248&i))return!1;n=3}}return!n}}));i(Bt),Bt.validateUtf8;var Et=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;var r=it.Long.fromNumber(St.JS_INT_MAX),n=it.Long.fromNumber(St.JS_INT_MIN),o={};function i(t,e,s,f){void 0===f&&(f=!1);var a=null!=s.evalFunctions&&s.evalFunctions,c=null!=s.cacheFunctions&&s.cacheFunctions,l=null==s.fieldsAsRaw?null:s.fieldsAsRaw,p=null!=s.raw&&s.raw,h="boolean"==typeof s.bsonRegExp&&s.bsonRegExp,d=null!=s.promoteBuffers&&s.promoteBuffers,y=null==s.promoteLongs||s.promoteLongs,g=null==s.promoteValues||s.promoteValues,b=e;if(t.length<5)throw new Error("corrupt bson message < 5 bytes long");var _=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(_<5||_>t.length)throw new Error("corrupt bson message");for(var m=f?[]:{},w=0;;){var O=t[e++];if(0===O)break;for(var S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.byteLength)throw new Error("Bad BSON Document: illegal CString");var N=f?w++:t.toString("utf8",e,S),B=void 0;if(e=S+1,O===St.BSON_DATA_STRING){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");B=t.toString("utf8",e,e+V-1),e+=V}else if(O===St.BSON_DATA_OID){var E=v.Buffer.alloc(12);t.copy(E,0,e,e+12),B=new lt.ObjectId(E),e+=12}else if(O===St.BSON_DATA_INT&&!1===g)B=new ft.Int32(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(O===St.BSON_DATA_INT)B=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(O===St.BSON_DATA_NUMBER&&!1===g)B=new st.Double(t.readDoubleLE(e)),e+=8;else if(O===St.BSON_DATA_NUMBER)B=t.readDoubleLE(e),e+=8;else if(O===St.BSON_DATA_DATE){var A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new Date(new it.Long(A,T).toNumber())}else if(O===St.BSON_DATA_BOOLEAN){if(0!==t[e]&&1!==t[e])throw new Error("illegal boolean type value");B=1===t[e++]}else if(O===St.BSON_DATA_OBJECT){var I=e;if((G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||G>t.length-e)throw new Error("bad embedded document length in bson");B=p?t.slice(e,e+G):i(t,I,s,!1),e+=G}else if(O===St.BSON_DATA_ARRAY){I=e;var D=s,x=e+(G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(l&&l[N]){for(var R in D={},s)D[R]=s[R];D.raw=!0}if(B=i(t,I,D,!0),0!==t[(e+=G)-1])throw new Error("invalid array terminator byte");if(e!==x)throw new Error("corrupted array bson")}else if(O===St.BSON_DATA_UNDEFINED)B=void 0;else if(O===St.BSON_DATA_NULL)B=null;else if(O===St.BSON_DATA_LONG){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var P=new it.Long(A,T);B=y&&!0===g&&P.lessThanOrEqual(r)&&P.greaterThanOrEqual(n)?P.toNumber():P}else if(O===St.BSON_DATA_DECIMAL128){var U=v.Buffer.alloc(16);t.copy(U,0,e,e+16),e+=16;var L=new ut.Decimal128(U);B="toObject"in L&&"function"==typeof L.toObject?L.toObject():L}else if(O===St.BSON_DATA_BINARY){var j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,M=j,C=t[e++];if(j<0)throw new Error("Negative binary type element size found");if(j>t.byteLength)throw new Error("Binary type size larger than document size");if(null!=t.slice){if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}B=d&&g?t.slice(e,e+j):new rt.Binary(t.slice(e,e+j),C)}else{var Y=v.Buffer.alloc(j);if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(S=0;S<j;S++)Y[S]=t[e+S];B=d&&g?Y:new rt.Binary(Y,C)}e+=j}else if(O===St.BSON_DATA_REGEXP&&!1===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var $=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var q=t.toString("utf8",e,S);e=S+1;var F=new Array(q.length);for(S=0;S<q.length;S++)switch(q[S]){case"m":F[S]="m";break;case"s":F[S]="g";break;case"i":F[S]="i"}B=new RegExp($,F.join(""))}else if(O===St.BSON_DATA_REGEXP&&!0===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");$=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");q=t.toString("utf8",e,S);e=S+1,B=new pt.BSONRegExp($,q)}else if(O===St.BSON_DATA_SYMBOL){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var k=t.toString("utf8",e,e+V-1);B=g?k:new ht.BSONSymbol(k),e+=V}else if(O===St.BSON_DATA_TIMESTAMP){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new wt.Timestamp(A,T)}else if(O===St.BSON_DATA_MIN_KEY)B=new ct.MinKey;else if(O===St.BSON_DATA_MAX_KEY)B=new at.MaxKey;else if(O===St.BSON_DATA_CODE){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var z=t.toString("utf8",e,e+V-1);B=a?c?u(z,o,m):u(z):new nt.Code(z),e+=V}else if(O===St.BSON_DATA_CODE_W_SCOPE){var J=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(J<13)throw new Error("code_w_scope total size shorter minimum expected length");if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");z=t.toString("utf8",e,e+V-1),I=e+=V;var G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,H=i(t,I,s,!1);if(e+=G,J<8+G+V)throw new Error("code_w_scope total size is too short, truncating scope");if(J>8+G+V)throw new Error("code_w_scope total size is too long, clips outer document");a?(B=c?u(z,o,m):u(z)).scope=H:B=new nt.Code(z,H)}else{if(O!==St.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+O.toString(16)+' for fieldname "'+N+'"');var V;if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");var K=t.toString("utf8",e,e+V-1);e+=V;var W=v.Buffer.alloc(12);t.copy(W,0,e,e+12);E=new lt.ObjectId(W);e+=12,B=new ot.DBRef(K,E)}"__proto__"===N?Object.defineProperty(m,N,{value:B,writable:!0,enumerable:!0,configurable:!0}):m[N]=B}if(_!==e-b){if(f)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var X=Object.keys(m).filter((function(t){return t.startsWith("$")})),Z=!0;if(X.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(Z=!1)})),!Z)return m;if(ot.isDBRefLike(m)){var Q=Object.assign({},m);return delete Q.$ref,delete Q.$id,delete Q.$db,new ot.DBRef(m.$ref,m.$id,m.$db,Q)}return m}function u(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}e.deserialize=function(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,o=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(o<5)throw new Error("bson size must be >= 5, is "+o);if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new Error("buffer length "+t.length+" must be >= bson size "+o);if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new Error("buffer length "+t.length+" must === bson size "+o);if(o+n>t.byteLength)throw new Error("(bson size "+o+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return i(t,n,e,r)}}));i(Et),Et.deserialize;var At=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0,e.readIEEE754=function(t,e,r,n,o){var i,u,s="big"===r,f=8*o-n-1,a=(1<<f)-1,c=a>>1,l=-7,p=s?0:o-1,h=s?1:-1,d=t[e+p];for(p+=h,i=d&(1<<-l)-1,d>>=-l,l+=f;l>0;i=256*i+t[e+p],p+=h,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=n;l>0;u=256*u+t[e+p],p+=h,l-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),i-=c}return(d?-1:1)*u*Math.pow(2,i-n)},e.writeIEEE754=function(t,e,r,n,o,i){var u,s,f,a="big"===n,c=8*i-o-1,l=(1<<c)-1,p=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=a?i-1:0,y=a?-1:1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+p>=1?h/f:h*Math.pow(2,1-p))*f>=2&&(u++,f/=2),u+p>=l?(s=0,u=l):u+p>=1?(s=(e*f-1)*Math.pow(2,o),u+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,o),u=0)),isNaN(e)&&(s=0);o>=8;)t[r+d]=255&s,d+=y,s/=256,o-=8;for(u=u<<o|s,isNaN(e)&&(u+=8),c+=o;c>0;)t[r+d]=255&u,d+=y,u/=256,c-=8;t[r+d-y]|=128*g}}));i(At),At.writeIEEE754,At.readIEEE754;var Tt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;var r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function o(t,e,r,n,o){t[n++]=St.BSON_DATA_STRING;var i=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+i+1)-1]=0;var u=t.write(r,n+4,void 0,"utf8");return t[n+3]=u+1>>24&255,t[n+2]=u+1>>16&255,t[n+1]=u+1>>8&255,t[n]=u+1&255,n=n+4+u,t[n++]=0,n}function i(t,e,r,n,o){Number.isInteger(r)&&r>=St.BSON_INT32_MIN&&r<=St.BSON_INT32_MAX?(t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r,n,"little",52,8),n+=8);return n}function u(t,e,r,n,o){return t[n++]=St.BSON_DATA_NULL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function s(t,e,r,n,o){return t[n++]=St.BSON_DATA_BOOLEAN,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function f(t,e,r,n,o){t[n++]=St.BSON_DATA_DATE,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=it.Long.fromNumber(r.getTime()),u=i.getLowBits(),s=i.getHighBits();return t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function a(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,n.source&&null!=n.source.match(r))throw Error("value "+n.source+" must not contain null bytes");return o+=t.write(n.source,o,void 0,"utf8"),t[o++]=0,n.ignoreCase&&(t[o++]=105),n.global&&(t[o++]=115),n.multiline&&(t[o++]=109),t[o++]=0,o}function c(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,null!=n.pattern.match(r))throw Error("pattern "+n.pattern+" must not contain null bytes");return o+=t.write(n.pattern,o,void 0,"utf8"),t[o++]=0,o+=t.write(n.options.split("").sort().join(""),o,void 0,"utf8"),t[o++]=0,o}function l(t,e,r,n,o){return null===r?t[n++]=St.BSON_DATA_NULL:"MinKey"===r._bsontype?t[n++]=St.BSON_DATA_MIN_KEY:t[n++]=St.BSON_DATA_MAX_KEY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function p(t,e,r,n,o){if(t[n++]=St.BSON_DATA_OID,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12}function h(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.length;return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=St.BSON_BINARY_SUBTYPE_DEFAULT,t.set(Q.ensureBuffer(r),n),n+=i}function d(t,e,r,n,o,i,u,s,f,a){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),void 0===a&&(a=[]);for(var c=0;c<a.length;c++)if(a[c]===r)throw new Error("cyclic dependency detected");a.push(r),t[n++]=Array.isArray(r)?St.BSON_DATA_ARRAY:St.BSON_DATA_OBJECT,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var l=N(t,r,o,n,i+1,u,s,a);return a.pop(),l}function y(t,e,r,n,o){return t[n++]=St.BSON_DATA_DECIMAL128,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.bytes.copy(t,n,0,16),n+16}function g(t,e,r,n,o){t[n++]="Long"===r._bsontype?St.BSON_DATA_LONG:St.BSON_DATA_TIMESTAMP,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.getLowBits(),u=r.getHighBits();return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n}function b(t,e,r,n,o){return r=r.valueOf(),t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function _(t,e,r,n,o){return t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r.value,n,"little",52,8),n+=8}function m(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_CODE,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=Z.normalizedFunctionString(r),f=t.write(s,n+4,void 0,"utf8")+1;return t[n]=255&f,t[n+1]=f>>8&255,t[n+2]=f>>16&255,t[n+3]=f>>24&255,n=n+4+f-1,t[n++]=0,n}function w(t,e,r,n,o,i,u,s,f){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),r.scope&&"object"==typeof r.scope){t[n++]=St.BSON_DATA_CODE_W_SCOPE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,c="string"==typeof r.code?r.code:r.code.toString();n+=4;var l=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&l,t[n+1]=l>>8&255,t[n+2]=l>>16&255,t[n+3]=l>>24&255,t[n+4+l-1]=0,n=n+l+4;var p=N(t,r.scope,o,n,i+1,u,s);n=p-1;var h=p-a;t[a++]=255&h,t[a++]=h>>8&255,t[a++]=h>>16&255,t[a++]=h>>24&255,t[n++]=0}else{t[n++]=St.BSON_DATA_CODE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;c=r.code.toString();var d=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&d,t[n+1]=d>>8&255,t[n+2]=d>>16&255,t[n+3]=d>>24&255,n=n+4+d-1,t[n++]=0}return n}function v(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.value(!0),u=r.position;return r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),t.set(i,n),n+=r.position}function O(t,e,r,n,o){t[n++]=St.BSON_DATA_SYMBOL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&i,t[n+1]=i>>8&255,t[n+2]=i>>16&255,t[n+3]=i>>24&255,n=n+4+i-1,t[n++]=0,n}function S(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_OBJECT,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=n,f={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(f.$db=r.db);var a=N(t,f=Object.assign(f,r.fields),!1,n,o+1,i),c=a-s;return t[s++]=255&c,t[s++]=c>>8&255,t[s++]=c>>16&255,t[s++]=c>>24&255,a}function N(t,e,N,B,E,A,T,I){void 0===N&&(N=!1),void 0===B&&(B=0),void 0===E&&(E=0),void 0===A&&(A=!1),void 0===T&&(T=!0),void 0===I&&(I=[]),B=B||0,(I=I||[]).push(e);var D=B+4;if(Array.isArray(e))for(var x=0;x<e.length;x++){var R=""+x;if((M=e[x])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}if("string"==typeof M)D=o(t,R,M,D,!0);else if("number"==typeof M)D=i(t,R,M,D,!0);else{if("bigint"==typeof M)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof M)D=s(t,R,M,D,!0);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D,!0);else if(void 0===M)D=u(t,R,0,D,!0);else if(null===M)D=u(t,R,0,D,!0);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D,!0);else if(Z.isUint8Array(M))D=h(t,R,M,D,!0);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D,!0);else if("object"==typeof M&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!0,I);else if("object"==typeof M&&vt.isBSONType(M)&&"Decimal128"===M._bsontype)D=y(t,R,M,D,!0);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D,!0);else if("Double"===M._bsontype)D=_(t,R,M,D,!0);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,!0);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T,!0);else if("Binary"===M._bsontype)D=v(t,R,M,D,!0);else if("Symbol"===M._bsontype)D=O(t,R,M,D,!0);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A,!0);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D,!0);else if("Int32"===M._bsontype)D=b(t,R,M,D,!0);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D,!0);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}else if(e instanceof Ot.Map||Z.isMap(e))for(var P=e.entries(),U=!1;!U;){var L=P.next();if(!(U=!!L.done)){R=L.value[0];var j=typeof(M=L.value[1]);if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j||Z.isBigInt64Array(M)||Z.isBigUInt64Array(M))throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(null===M||void 0===M&&!1===T)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new TypeError("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!=typeof e)throw new TypeError("toBSON function did not return an object")}for(var R in e){var M;if((M=e[R])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}j=typeof M;if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(void 0===M)!1===T&&(D=u(t,R,0,D));else if(null===M)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}I.pop(),t[D++]=0;var C=D-B;return t[B++]=255&C,t[B++]=C>>8&255,t[B++]=C>>16&255,t[B++]=C>>24&255,D}e.serializeInto=N}));i(Tt),Tt.serializeInto;var It=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.UUID=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return rt.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return nt.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return ot.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return ut.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return st.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return ft.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return it.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return Ot.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return at.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return ct.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return pt.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return ht.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"UUID",{enumerable:!0,get:function(){return et.UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return St.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return St.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return St.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return St.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return St.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return St.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return St.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return St.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return St.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return St.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return St.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return St.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return St.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return St.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return St.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return St.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return St.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return St.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return St.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return St.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return St.BSON_INT64_MIN}});var r=vt;Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return r.EJSON}});var n=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return n.LongWithoutOverridesClass}});var o=v.Buffer.alloc(17825792);function i(t){o.length<t&&(o=v.Buffer.alloc(t))}function u(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,u="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;o.length<u&&(o=v.Buffer.alloc(u));var s=Tt.serializeInto(o,t,r,0,0,n,i,[]),f=v.Buffer.alloc(s);return o.copy(f,0,0,f.length),f}function s(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,u="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,f=Tt.serializeInto(o,t,n,0,0,i,u);return o.copy(e,s,0,f),s+f-1}function f(t,e){return void 0===e&&(e={}),Et.deserialize(Q.ensureBuffer(t),e)}function a(t,e){void 0===e&&(e={});var r="boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return Nt.calculateObjectSize(t,r,n)}function c(t,e,r,n,o,i){for(var u=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),s=Q.ensureBuffer(t),f=e,a=0;a<r;a++){var c=s[f]|s[f+1]<<8|s[f+2]<<16|s[f+3]<<24;u.index=f,n[o+a]=Et.deserialize(s,u),f+=c}return f}e.setInternalBufferSize=i,e.serialize=u,e.serializeWithBufferAndIndex=s,e.deserialize=f,e.calculateObjectSize=a,e.deserializeStream=c;var l={Binary:rt.Binary,Code:nt.Code,DBRef:ot.DBRef,Decimal128:ut.Decimal128,Double:st.Double,Int32:ft.Int32,Long:it.Long,UUID:et.UUID,Map:Ot.Map,MaxKey:at.MaxKey,MinKey:ct.MinKey,ObjectId:lt.ObjectId,ObjectID:lt.ObjectId,BSONRegExp:pt.BSONRegExp,BSONSymbol:ht.BSONSymbol,Timestamp:wt.Timestamp,EJSON:vt.EJSON,setInternalBufferSize:i,serialize:u,serializeWithBufferAndIndex:s,deserialize:f,calculateObjectSize:a,deserializeStream:c};e.default=l})),Dt=(i(It),It.ObjectID,It.Decimal128,It.BSONRegExp,It.MaxKey,It.MinKey,It.Int32,It.Double,It.Timestamp,It.Long,It.UUID,It.ObjectId,It.Binary,It.DBRef,It.BSONSymbol,It.Map,It.Code,It.LongWithoutOverridesClass,It.EJSON);It.BSON_INT64_MIN,It.BSON_INT64_MAX,It.BSON_INT32_MIN,It.BSON_INT32_MAX,It.BSON_DATA_UNDEFINED,It.BSON_DATA_TIMESTAMP,It.BSON_DATA_SYMBOL,It.BSON_DATA_STRING,It.BSON_DATA_REGEXP,It.BSON_DATA_OID,It.BSON_DATA_OBJECT,It.BSON_DATA_NUMBER,It.BSON_DATA_NULL,It.BSON_DATA_MIN_KEY,It.BSON_DATA_MAX_KEY,It.BSON_DATA_LONG,It.BSON_DATA_INT,It.BSON_DATA_DECIMAL128,It.BSON_DATA_DBPOINTER,It.BSON_DATA_DATE,It.BSON_DATA_CODE_W_SCOPE,It.BSON_DATA_CODE,It.BSON_DATA_BOOLEAN,It.BSON_DATA_BINARY,It.BSON_DATA_ARRAY,It.BSON_BINARY_SUBTYPE_UUID_NEW,It.BSON_BINARY_SUBTYPE_UUID,It.BSON_BINARY_SUBTYPE_USER_DEFINED,It.BSON_BINARY_SUBTYPE_MD5,It.BSON_BINARY_SUBTYPE_FUNCTION,It.BSON_BINARY_SUBTYPE_DEFAULT,It.BSON_BINARY_SUBTYPE_BYTE_ARRAY,It.deserializeStream,It.calculateObjectSize,It.deserialize,It.serializeWithBufferAndIndex,It.serialize,It.setInternalBufferSize}).call(this,r(1),r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.registerDatabase=void 0;var o=r(7);var i={name:"database",entity:{database:function(t){var e=this.platform,r=e.adapter,i=e.runtime;return o.Db.reqClass=this.request.constructor,o.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},o.Db.runtime=i,this.wsClientClass&&(o.Db.wsClass=r.wsClass,o.Db.wsClientClass=this.wsClientClass),o.Db.ws||(o.Db.ws=null),new o.Db(n(n({},this.config),t))}}};try{cloudbase.registerComponent(i)}catch(t){}e.registerDatabase=function(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";(function(t){
|
|
17
|
+
var dt=function(t,e){return(dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var yt=function(){return(yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function gt(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bt(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function _t(t){return this instanceof _t?(this.v=t,this):new _t(t)}var mt=Object.freeze({__proto__:null,__extends:function(t,e){function r(){this.constructor=t}dt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},get __assign(){return yt},__rest:function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r},__decorate:function(t,e,r,n){var o,i=arguments.length,u=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(u=(i<3?o(u):i>3?o(e,r,u):o(e,r))||u);return i>3&&u&&Object.defineProperty(e,r,u),u},__param:function(t,e){return function(r,n){e(r,n,t)}},__metadata:function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter:function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},__generator:function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},__createBinding:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},__exportStar:function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])},__values:gt,__read:bt,__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(bt(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],u=0,s=i.length;u<s;u++,o++)n[o]=i[u];return n},__await:_t,__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},u("next"),u("throw"),u("return"),n[Symbol.asyncIterator]=function(){return this},n;function u(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||s(t,e)}))})}function s(t,e){try{(r=o[t](e)).value instanceof _t?Promise.resolve(r.value.v).then(f,a):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function f(t){s("next",t)}function a(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}},__asyncDelegator:function(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:_t(t[n](e)),done:"return"===n}:o?o(e):e}:o}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=gt(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__classPrivateFieldGet:function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},__classPrivateFieldSet:function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}}),wt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=it.Long;var r=function(t){function e(r,n){var o=this;return o instanceof e?(o=it.Long.isLong(r)?t.call(this,r.low,r.high,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return mt.__extends(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(it.Long.fromInt(t,!0))},e.fromNumber=function(t){return new e(it.Long.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(it.Long.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp.i,t.$timestamp.t)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp("+this.getLowBits().toString()+", "+this.getHighBits().toString()+")"},e.MAX_VALUE=it.Long.MAX_UNSIGNED_VALUE,e}(e.LongWithoutOverridesClass);e.Timestamp=r}));i(wt),wt.Timestamp,wt.LongWithoutOverridesClass;var vt=u((function(t,e){function r(t){return Z.isObjectLike(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0,e.isBSONType=r;var n={$oid:lt.ObjectId,$binary:rt.Binary,$uuid:rt.Binary,$symbol:ht.BSONSymbol,$numberInt:ft.Int32,$numberDecimal:ut.Decimal128,$numberDouble:st.Double,$numberLong:it.Long,$minKey:ct.MinKey,$maxKey:at.MaxKey,$regex:pt.BSONRegExp,$regularExpression:pt.BSONRegExp,$timestamp:wt.Timestamp};function o(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function i(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var s=e.seenObjects.map((function(t){return t.propertyName})),f=s.slice(0,n).map((function(t){return t+" -> "})).join(""),a=s[n],c=" -> "+s.slice(n+1,s.length-1).map((function(t){return t+" -> "})).join(""),l=s[s.length-1],p=" ".repeat(f.length+a.length/2),h="-".repeat(c.length+(a.length+l.length)/2-1);throw new TypeError("Converting circular structure to EJSON:\n "+f+a+c+l+"\n "+p+"\\"+h+"/")}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,r){e.seenObjects.push({propertyName:"index "+r,obj:null});try{return i(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||Z.isDate(t)){var d=t.getTime(),y=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&y?{$date:t.getTime()}:{$date:o(t)}:e.relaxed&&y?{$date:o(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var g=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(g)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Z.isRegExp(t)){var b=t.flags;if(void 0===b){var _=t.toString().match(/[gimuy]*$/);_&&(b=_[0])}return new pt.BSONRegExp(t.source,b).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new Error("not an object instance");var n=t._bsontype;if(void 0===n){var o={};for(var s in t){e.seenObjects.push({propertyName:s,obj:null});try{o[s]=i(t[s],e)}finally{e.seenObjects.pop()}}return o}if(r(t)){var f=t;if("function"!=typeof f.toExtendedJSON){var a=u[t._bsontype];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+t._bsontype);f=a(f)}return"Code"===n&&f.scope?f=new nt.Code(f.code,i(f.scope,e)):"DBRef"===n&&f.oid&&(f=new ot.DBRef(f.collection,i(f.oid,e),f.db,f.fields)),f.toExtendedJSON(e)}throw new Error("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var u={Binary:function(t){return new rt.Binary(t.value(),t.sub_type)},Code:function(t){return new nt.Code(t.code,t.scope)},DBRef:function(t){return new ot.DBRef(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new ut.Decimal128(t.bytes)},Double:function(t){return new st.Double(t.value)},Int32:function(t){return new ft.Int32(t.value)},Long:function(t){return it.Long.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 at.MaxKey},MinKey:function(){return new ct.MinKey},ObjectID:function(t){return new lt.ObjectId(t)},ObjectId:function(t){return new lt.ObjectId(t)},BSONRegExp:function(t){return new pt.BSONRegExp(t.pattern,t.options)},Symbol:function(t){return new ht.BSONSymbol(t.value)},Timestamp:function(t){return wt.Timestamp.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ft.Int32(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return it.Long.fromNumber(e)}return new st.Double(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var o=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),i=0;i<o.length;i++){var u=n[o[i]];if(u)return u.fromExtendedJSON(e,r)}if(null!=e.$date){var s=e.$date,f=new Date;return r.legacy?"number"==typeof s?f.setTime(s):"string"==typeof s&&f.setTime(Date.parse(s)):"string"==typeof s?f.setTime(Date.parse(s)):it.Long.isLong(s)?f.setTime(s.toNumber()):"number"==typeof s&&r.relaxed&&f.setTime(s),f}if(null!=e.$code){var a=Object.assign({},e);return e.$scope&&(a.$scope=t(e.$scope)),nt.Code.fromExtendedJSON(e)}if(null!=e.$ref||null!=e.$dbPointer){var c=e.$ref?e:e.$dbPointer;if(c instanceof ot.DBRef)return c;var l=Object.keys(c).filter((function(t){return t.startsWith("$")})),p=!0;if(l.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(p=!1)})),p)return ot.DBRef.fromExtendedJSON(c)}return e}(e,r)}))}function r(t,e,r,n){null!=r&&"object"==typeof r&&(n=r,r=0),null==e||"object"!=typeof e||Array.isArray(e)||(n=e,e=void 0,r=0);var o=i(t,Object.assign({relaxed:!0,legacy:!1},n,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(e.EJSON||(e.EJSON={}))}));i(vt),vt.EJSON,vt.isBSONType;var Ot=u((function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0,e.Map=r;var n=function(t){return t&&t.Math==Math&&t};var i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof o&&o)||Function("return this")();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=r=i.Map:e.Map=r=function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],o=r[1];this._keys.push(n),this._values[n]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},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,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}()}));i(Ot),Ot.Map;var St=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128}));i(St),St.BSON_BINARY_SUBTYPE_USER_DEFINED,St.BSON_BINARY_SUBTYPE_MD5,St.BSON_BINARY_SUBTYPE_UUID_NEW,St.BSON_BINARY_SUBTYPE_UUID,St.BSON_BINARY_SUBTYPE_BYTE_ARRAY,St.BSON_BINARY_SUBTYPE_FUNCTION,St.BSON_BINARY_SUBTYPE_DEFAULT,St.BSON_DATA_MAX_KEY,St.BSON_DATA_MIN_KEY,St.BSON_DATA_DECIMAL128,St.BSON_DATA_LONG,St.BSON_DATA_TIMESTAMP,St.BSON_DATA_INT,St.BSON_DATA_CODE_W_SCOPE,St.BSON_DATA_SYMBOL,St.BSON_DATA_CODE,St.BSON_DATA_DBPOINTER,St.BSON_DATA_REGEXP,St.BSON_DATA_NULL,St.BSON_DATA_DATE,St.BSON_DATA_BOOLEAN,St.BSON_DATA_OID,St.BSON_DATA_UNDEFINED,St.BSON_DATA_BINARY,St.BSON_DATA_ARRAY,St.BSON_DATA_OBJECT,St.BSON_DATA_STRING,St.BSON_DATA_NUMBER,St.JS_INT_MIN,St.JS_INT_MAX,St.BSON_INT64_MIN,St.BSON_INT64_MAX,St.BSON_INT32_MIN,St.BSON_INT32_MAX;var Nt=u((function(t,e){function r(t,e,r){var o=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)o+=n(i.toString(),t[i],e,!0,r);else for(var u in t.toBSON&&(t=t.toBSON()),t)o+=n(u,t[u],e,!1,r);return o}function n(t,e,n,o,i){switch(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===i&&(i=!1),e&&e.toBSON&&(e=e.toBSON()),typeof e){case"string":return 1+v.Buffer.byteLength(t,"utf8")+1+4+v.Buffer.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=St.JS_INT_MIN&&e<=St.JS_INT_MAX&&e>=St.BSON_INT32_MIN&&e<=St.BSON_INT32_MAX?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+5:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;case"undefined":return o||!i?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||Z.isDate(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Z.isAnyArrayBuffer(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1+r(e.scope,n,i):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+v.Buffer.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var u=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(u.$db=e.db),(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+r(u,n,i)}return e instanceof RegExp||Z.isRegExp(e)?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.pattern,"utf8")+1+v.Buffer.byteLength(e.options,"utf8")+1:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+r(e,n,i)+1;case"function":if(e instanceof RegExp||Z.isRegExp(e)||"[object RegExp]"===String.call(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(n&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1+r(e.scope,n,i);if(n)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1}return 0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0,e.calculateObjectSize=r}));i(Nt),Nt.calculateObjectSize;var Bt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;e.validateUtf8=function(t,e,r){for(var n=0,o=e;o<r;o+=1){var i=t[o];if(n){if(128!=(192&i))return!1;n-=1}else if(128&i)if(192==(224&i))n=1;else if(224==(240&i))n=2;else{if(240!=(248&i))return!1;n=3}}return!n}}));i(Bt),Bt.validateUtf8;var Et=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;var r=it.Long.fromNumber(St.JS_INT_MAX),n=it.Long.fromNumber(St.JS_INT_MIN),o={};function i(t,e,s,f){void 0===f&&(f=!1);var a=null!=s.evalFunctions&&s.evalFunctions,c=null!=s.cacheFunctions&&s.cacheFunctions,l=null==s.fieldsAsRaw?null:s.fieldsAsRaw,p=null!=s.raw&&s.raw,h="boolean"==typeof s.bsonRegExp&&s.bsonRegExp,d=null!=s.promoteBuffers&&s.promoteBuffers,y=null==s.promoteLongs||s.promoteLongs,g=null==s.promoteValues||s.promoteValues,b=e;if(t.length<5)throw new Error("corrupt bson message < 5 bytes long");var _=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(_<5||_>t.length)throw new Error("corrupt bson message");for(var m=f?[]:{},w=0;;){var O=t[e++];if(0===O)break;for(var S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.byteLength)throw new Error("Bad BSON Document: illegal CString");var N=f?w++:t.toString("utf8",e,S),B=void 0;if(e=S+1,O===St.BSON_DATA_STRING){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");B=t.toString("utf8",e,e+V-1),e+=V}else if(O===St.BSON_DATA_OID){var E=v.Buffer.alloc(12);t.copy(E,0,e,e+12),B=new lt.ObjectId(E),e+=12}else if(O===St.BSON_DATA_INT&&!1===g)B=new ft.Int32(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(O===St.BSON_DATA_INT)B=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(O===St.BSON_DATA_NUMBER&&!1===g)B=new st.Double(t.readDoubleLE(e)),e+=8;else if(O===St.BSON_DATA_NUMBER)B=t.readDoubleLE(e),e+=8;else if(O===St.BSON_DATA_DATE){var A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new Date(new it.Long(A,T).toNumber())}else if(O===St.BSON_DATA_BOOLEAN){if(0!==t[e]&&1!==t[e])throw new Error("illegal boolean type value");B=1===t[e++]}else if(O===St.BSON_DATA_OBJECT){var I=e;if((G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||G>t.length-e)throw new Error("bad embedded document length in bson");B=p?t.slice(e,e+G):i(t,I,s,!1),e+=G}else if(O===St.BSON_DATA_ARRAY){I=e;var D=s,x=e+(G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(l&&l[N]){for(var R in D={},s)D[R]=s[R];D.raw=!0}if(B=i(t,I,D,!0),0!==t[(e+=G)-1])throw new Error("invalid array terminator byte");if(e!==x)throw new Error("corrupted array bson")}else if(O===St.BSON_DATA_UNDEFINED)B=void 0;else if(O===St.BSON_DATA_NULL)B=null;else if(O===St.BSON_DATA_LONG){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var P=new it.Long(A,T);B=y&&!0===g&&P.lessThanOrEqual(r)&&P.greaterThanOrEqual(n)?P.toNumber():P}else if(O===St.BSON_DATA_DECIMAL128){var U=v.Buffer.alloc(16);t.copy(U,0,e,e+16),e+=16;var L=new ut.Decimal128(U);B="toObject"in L&&"function"==typeof L.toObject?L.toObject():L}else if(O===St.BSON_DATA_BINARY){var j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,M=j,C=t[e++];if(j<0)throw new Error("Negative binary type element size found");if(j>t.byteLength)throw new Error("Binary type size larger than document size");if(null!=t.slice){if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}B=d&&g?t.slice(e,e+j):new rt.Binary(t.slice(e,e+j),C)}else{var Y=v.Buffer.alloc(j);if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(S=0;S<j;S++)Y[S]=t[e+S];B=d&&g?Y:new rt.Binary(Y,C)}e+=j}else if(O===St.BSON_DATA_REGEXP&&!1===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var $=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var q=t.toString("utf8",e,S);e=S+1;var F=new Array(q.length);for(S=0;S<q.length;S++)switch(q[S]){case"m":F[S]="m";break;case"s":F[S]="g";break;case"i":F[S]="i"}B=new RegExp($,F.join(""))}else if(O===St.BSON_DATA_REGEXP&&!0===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");$=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");q=t.toString("utf8",e,S);e=S+1,B=new pt.BSONRegExp($,q)}else if(O===St.BSON_DATA_SYMBOL){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var k=t.toString("utf8",e,e+V-1);B=g?k:new ht.BSONSymbol(k),e+=V}else if(O===St.BSON_DATA_TIMESTAMP){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new wt.Timestamp(A,T)}else if(O===St.BSON_DATA_MIN_KEY)B=new ct.MinKey;else if(O===St.BSON_DATA_MAX_KEY)B=new at.MaxKey;else if(O===St.BSON_DATA_CODE){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var z=t.toString("utf8",e,e+V-1);B=a?c?u(z,o,m):u(z):new nt.Code(z),e+=V}else if(O===St.BSON_DATA_CODE_W_SCOPE){var J=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(J<13)throw new Error("code_w_scope total size shorter minimum expected length");if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");z=t.toString("utf8",e,e+V-1),I=e+=V;var G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,H=i(t,I,s,!1);if(e+=G,J<8+G+V)throw new Error("code_w_scope total size is too short, truncating scope");if(J>8+G+V)throw new Error("code_w_scope total size is too long, clips outer document");a?(B=c?u(z,o,m):u(z)).scope=H:B=new nt.Code(z,H)}else{if(O!==St.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+O.toString(16)+' for fieldname "'+N+'"');var V;if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");var K=t.toString("utf8",e,e+V-1);e+=V;var W=v.Buffer.alloc(12);t.copy(W,0,e,e+12);E=new lt.ObjectId(W);e+=12,B=new ot.DBRef(K,E)}"__proto__"===N?Object.defineProperty(m,N,{value:B,writable:!0,enumerable:!0,configurable:!0}):m[N]=B}if(_!==e-b){if(f)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var X=Object.keys(m).filter((function(t){return t.startsWith("$")})),Z=!0;if(X.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(Z=!1)})),!Z)return m;if(ot.isDBRefLike(m)){var Q=Object.assign({},m);return delete Q.$ref,delete Q.$id,delete Q.$db,new ot.DBRef(m.$ref,m.$id,m.$db,Q)}return m}function u(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}e.deserialize=function(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,o=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(o<5)throw new Error("bson size must be >= 5, is "+o);if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new Error("buffer length "+t.length+" must be >= bson size "+o);if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new Error("buffer length "+t.length+" must === bson size "+o);if(o+n>t.byteLength)throw new Error("(bson size "+o+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return i(t,n,e,r)}}));i(Et),Et.deserialize;var At=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0,e.readIEEE754=function(t,e,r,n,o){var i,u,s="big"===r,f=8*o-n-1,a=(1<<f)-1,c=a>>1,l=-7,p=s?0:o-1,h=s?1:-1,d=t[e+p];for(p+=h,i=d&(1<<-l)-1,d>>=-l,l+=f;l>0;i=256*i+t[e+p],p+=h,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=n;l>0;u=256*u+t[e+p],p+=h,l-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),i-=c}return(d?-1:1)*u*Math.pow(2,i-n)},e.writeIEEE754=function(t,e,r,n,o,i){var u,s,f,a="big"===n,c=8*i-o-1,l=(1<<c)-1,p=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=a?i-1:0,y=a?-1:1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+p>=1?h/f:h*Math.pow(2,1-p))*f>=2&&(u++,f/=2),u+p>=l?(s=0,u=l):u+p>=1?(s=(e*f-1)*Math.pow(2,o),u+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,o),u=0)),isNaN(e)&&(s=0);o>=8;)t[r+d]=255&s,d+=y,s/=256,o-=8;for(u=u<<o|s,isNaN(e)&&(u+=8),c+=o;c>0;)t[r+d]=255&u,d+=y,u/=256,c-=8;t[r+d-y]|=128*g}}));i(At),At.writeIEEE754,At.readIEEE754;var Tt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;var r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function o(t,e,r,n,o){t[n++]=St.BSON_DATA_STRING;var i=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+i+1)-1]=0;var u=t.write(r,n+4,void 0,"utf8");return t[n+3]=u+1>>24&255,t[n+2]=u+1>>16&255,t[n+1]=u+1>>8&255,t[n]=u+1&255,n=n+4+u,t[n++]=0,n}function i(t,e,r,n,o){Number.isInteger(r)&&r>=St.BSON_INT32_MIN&&r<=St.BSON_INT32_MAX?(t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r,n,"little",52,8),n+=8);return n}function u(t,e,r,n,o){return t[n++]=St.BSON_DATA_NULL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function s(t,e,r,n,o){return t[n++]=St.BSON_DATA_BOOLEAN,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function f(t,e,r,n,o){t[n++]=St.BSON_DATA_DATE,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=it.Long.fromNumber(r.getTime()),u=i.getLowBits(),s=i.getHighBits();return t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function a(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,n.source&&null!=n.source.match(r))throw Error("value "+n.source+" must not contain null bytes");return o+=t.write(n.source,o,void 0,"utf8"),t[o++]=0,n.ignoreCase&&(t[o++]=105),n.global&&(t[o++]=115),n.multiline&&(t[o++]=109),t[o++]=0,o}function c(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,null!=n.pattern.match(r))throw Error("pattern "+n.pattern+" must not contain null bytes");return o+=t.write(n.pattern,o,void 0,"utf8"),t[o++]=0,o+=t.write(n.options.split("").sort().join(""),o,void 0,"utf8"),t[o++]=0,o}function l(t,e,r,n,o){return null===r?t[n++]=St.BSON_DATA_NULL:"MinKey"===r._bsontype?t[n++]=St.BSON_DATA_MIN_KEY:t[n++]=St.BSON_DATA_MAX_KEY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function p(t,e,r,n,o){if(t[n++]=St.BSON_DATA_OID,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12}function h(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.length;return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=St.BSON_BINARY_SUBTYPE_DEFAULT,t.set(Q.ensureBuffer(r),n),n+=i}function d(t,e,r,n,o,i,u,s,f,a){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),void 0===a&&(a=[]);for(var c=0;c<a.length;c++)if(a[c]===r)throw new Error("cyclic dependency detected");a.push(r),t[n++]=Array.isArray(r)?St.BSON_DATA_ARRAY:St.BSON_DATA_OBJECT,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var l=N(t,r,o,n,i+1,u,s,a);return a.pop(),l}function y(t,e,r,n,o){return t[n++]=St.BSON_DATA_DECIMAL128,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.bytes.copy(t,n,0,16),n+16}function g(t,e,r,n,o){t[n++]="Long"===r._bsontype?St.BSON_DATA_LONG:St.BSON_DATA_TIMESTAMP,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.getLowBits(),u=r.getHighBits();return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n}function b(t,e,r,n,o){return r=r.valueOf(),t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function _(t,e,r,n,o){return t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r.value,n,"little",52,8),n+=8}function m(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_CODE,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=Z.normalizedFunctionString(r),f=t.write(s,n+4,void 0,"utf8")+1;return t[n]=255&f,t[n+1]=f>>8&255,t[n+2]=f>>16&255,t[n+3]=f>>24&255,n=n+4+f-1,t[n++]=0,n}function w(t,e,r,n,o,i,u,s,f){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),r.scope&&"object"==typeof r.scope){t[n++]=St.BSON_DATA_CODE_W_SCOPE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,c="string"==typeof r.code?r.code:r.code.toString();n+=4;var l=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&l,t[n+1]=l>>8&255,t[n+2]=l>>16&255,t[n+3]=l>>24&255,t[n+4+l-1]=0,n=n+l+4;var p=N(t,r.scope,o,n,i+1,u,s);n=p-1;var h=p-a;t[a++]=255&h,t[a++]=h>>8&255,t[a++]=h>>16&255,t[a++]=h>>24&255,t[n++]=0}else{t[n++]=St.BSON_DATA_CODE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;c=r.code.toString();var d=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&d,t[n+1]=d>>8&255,t[n+2]=d>>16&255,t[n+3]=d>>24&255,n=n+4+d-1,t[n++]=0}return n}function v(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.value(!0),u=r.position;return r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),t.set(i,n),n+=r.position}function O(t,e,r,n,o){t[n++]=St.BSON_DATA_SYMBOL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&i,t[n+1]=i>>8&255,t[n+2]=i>>16&255,t[n+3]=i>>24&255,n=n+4+i-1,t[n++]=0,n}function S(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_OBJECT,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=n,f={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(f.$db=r.db);var a=N(t,f=Object.assign(f,r.fields),!1,n,o+1,i),c=a-s;return t[s++]=255&c,t[s++]=c>>8&255,t[s++]=c>>16&255,t[s++]=c>>24&255,a}function N(t,e,N,B,E,A,T,I){void 0===N&&(N=!1),void 0===B&&(B=0),void 0===E&&(E=0),void 0===A&&(A=!1),void 0===T&&(T=!0),void 0===I&&(I=[]),B=B||0,(I=I||[]).push(e);var D=B+4;if(Array.isArray(e))for(var x=0;x<e.length;x++){var R=""+x;if((M=e[x])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}if("string"==typeof M)D=o(t,R,M,D,!0);else if("number"==typeof M)D=i(t,R,M,D,!0);else{if("bigint"==typeof M)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof M)D=s(t,R,M,D,!0);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D,!0);else if(void 0===M)D=u(t,R,0,D,!0);else if(null===M)D=u(t,R,0,D,!0);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D,!0);else if(Z.isUint8Array(M))D=h(t,R,M,D,!0);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D,!0);else if("object"==typeof M&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!0,I);else if("object"==typeof M&&vt.isBSONType(M)&&"Decimal128"===M._bsontype)D=y(t,R,M,D,!0);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D,!0);else if("Double"===M._bsontype)D=_(t,R,M,D,!0);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,!0);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T,!0);else if("Binary"===M._bsontype)D=v(t,R,M,D,!0);else if("Symbol"===M._bsontype)D=O(t,R,M,D,!0);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A,!0);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D,!0);else if("Int32"===M._bsontype)D=b(t,R,M,D,!0);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D,!0);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}else if(e instanceof Ot.Map||Z.isMap(e))for(var P=e.entries(),U=!1;!U;){var L=P.next();if(!(U=!!L.done)){R=L.value[0];var j=typeof(M=L.value[1]);if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j||Z.isBigInt64Array(M)||Z.isBigUInt64Array(M))throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(null===M||void 0===M&&!1===T)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new TypeError("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!=typeof e)throw new TypeError("toBSON function did not return an object")}for(var R in e){var M;if((M=e[R])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}j=typeof M;if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(void 0===M)!1===T&&(D=u(t,R,0,D));else if(null===M)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}I.pop(),t[D++]=0;var C=D-B;return t[B++]=255&C,t[B++]=C>>8&255,t[B++]=C>>16&255,t[B++]=C>>24&255,D}e.serializeInto=N}));i(Tt),Tt.serializeInto;var It=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.UUID=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return rt.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return nt.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return ot.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return ut.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return st.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return ft.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return it.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return Ot.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return at.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return ct.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return pt.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return ht.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"UUID",{enumerable:!0,get:function(){return et.UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return St.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return St.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return St.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return St.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return St.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return St.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return St.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return St.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return St.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return St.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return St.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return St.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return St.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return St.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return St.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return St.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return St.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return St.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return St.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return St.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return St.BSON_INT64_MIN}});var r=vt;Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return r.EJSON}});var n=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return n.LongWithoutOverridesClass}});var o=v.Buffer.alloc(17825792);function i(t){o.length<t&&(o=v.Buffer.alloc(t))}function u(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,u="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;o.length<u&&(o=v.Buffer.alloc(u));var s=Tt.serializeInto(o,t,r,0,0,n,i,[]),f=v.Buffer.alloc(s);return o.copy(f,0,0,f.length),f}function s(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,u="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,f=Tt.serializeInto(o,t,n,0,0,i,u);return o.copy(e,s,0,f),s+f-1}function f(t,e){return void 0===e&&(e={}),Et.deserialize(Q.ensureBuffer(t),e)}function a(t,e){void 0===e&&(e={});var r="boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return Nt.calculateObjectSize(t,r,n)}function c(t,e,r,n,o,i){for(var u=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),s=Q.ensureBuffer(t),f=e,a=0;a<r;a++){var c=s[f]|s[f+1]<<8|s[f+2]<<16|s[f+3]<<24;u.index=f,n[o+a]=Et.deserialize(s,u),f+=c}return f}e.setInternalBufferSize=i,e.serialize=u,e.serializeWithBufferAndIndex=s,e.deserialize=f,e.calculateObjectSize=a,e.deserializeStream=c;var l={Binary:rt.Binary,Code:nt.Code,DBRef:ot.DBRef,Decimal128:ut.Decimal128,Double:st.Double,Int32:ft.Int32,Long:it.Long,UUID:et.UUID,Map:Ot.Map,MaxKey:at.MaxKey,MinKey:ct.MinKey,ObjectId:lt.ObjectId,ObjectID:lt.ObjectId,BSONRegExp:pt.BSONRegExp,BSONSymbol:ht.BSONSymbol,Timestamp:wt.Timestamp,EJSON:vt.EJSON,setInternalBufferSize:i,serialize:u,serializeWithBufferAndIndex:s,deserialize:f,calculateObjectSize:a,deserializeStream:c};e.default=l})),Dt=(i(It),It.ObjectID,It.Decimal128,It.BSONRegExp,It.MaxKey,It.MinKey,It.Int32,It.Double,It.Timestamp,It.Long,It.UUID,It.ObjectId,It.Binary,It.DBRef,It.BSONSymbol,It.Map,It.Code,It.LongWithoutOverridesClass,It.EJSON);It.BSON_INT64_MIN,It.BSON_INT64_MAX,It.BSON_INT32_MIN,It.BSON_INT32_MAX,It.BSON_DATA_UNDEFINED,It.BSON_DATA_TIMESTAMP,It.BSON_DATA_SYMBOL,It.BSON_DATA_STRING,It.BSON_DATA_REGEXP,It.BSON_DATA_OID,It.BSON_DATA_OBJECT,It.BSON_DATA_NUMBER,It.BSON_DATA_NULL,It.BSON_DATA_MIN_KEY,It.BSON_DATA_MAX_KEY,It.BSON_DATA_LONG,It.BSON_DATA_INT,It.BSON_DATA_DECIMAL128,It.BSON_DATA_DBPOINTER,It.BSON_DATA_DATE,It.BSON_DATA_CODE_W_SCOPE,It.BSON_DATA_CODE,It.BSON_DATA_BOOLEAN,It.BSON_DATA_BINARY,It.BSON_DATA_ARRAY,It.BSON_BINARY_SUBTYPE_UUID_NEW,It.BSON_BINARY_SUBTYPE_UUID,It.BSON_BINARY_SUBTYPE_USER_DEFINED,It.BSON_BINARY_SUBTYPE_MD5,It.BSON_BINARY_SUBTYPE_FUNCTION,It.BSON_BINARY_SUBTYPE_DEFAULT,It.BSON_BINARY_SUBTYPE_BYTE_ARRAY,It.deserializeStream,It.calculateObjectSize,It.deserialize,It.serializeWithBufferAndIndex,It.serialize,It.setInternalBufferSize}).call(this,r(1),r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.registerDatabase=void 0;var o=r(7);var i={name:"database",entity:{database:function(t){var e=this.platform,r=e.adapter,i=e.runtime;return o.Db.reqClass=this.request.constructor,o.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},o.Db.runtime=i,this.wsClientClass&&(o.Db.wsClass=r.wsClass,o.Db.wsClientClass=this.wsClientClass),o.Db.ws||(o.Db.ws=null),new o.Db(n(n(n({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(i)}catch(t){}e.registerDatabase=function(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";(function(t){
|
|
18
18
|
/*!
|
|
19
19
|
* The buffer module from node.js, for the browser.
|
|
20
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_functions",[],e):"object"==typeof exports?exports.cloudbase_functions=e():t.cloudbase_functions=e()}("undefined"!=typeof window?window:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.transformPhone=e.sleep=e.printGroupLog=e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.createSign=e.formatUrl=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=n(r(11)),i=n(r(14)),a=n(r(15)),s=r(3);function c(t){var e=i.default.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e},e.createSign=function(t,e){var r=c(a.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(a.default.parse(JSON.stringify(t)));return r+"."+c(o.default(r,e))},e.toQueryString=function(t){void 0===t&&(t={});var e=[];for(var r in t)e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||window.location.search,n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""},e.removeParam=function(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===t&&n.splice(i,1);r=r+"?"+n.join("&")}return r},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("["+s.getSdkName()+"]["+t+"]:"+e)},e.printError=function(t,e){console.error({code:t,msg:"["+s.getSdkName()+"]["+t+"]:"+e})},e.printInfo=function(t,e){console.log("["+s.getSdkName()+"]["+t+"]:"+e)},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"["+s.getSdkName()+"]["+t+"]:"+e}))},e.printGroupLog=function(t){var e=t.title,r=t.subtitle,n=void 0===r?"":r,o=t.content,i=void 0===o?[]:o,a=t.printTrace,s=void 0!==a&&a,c=t.collapsed;void 0!==c&&c?console.groupCollapsed(e,n):console.group(e,n);for(var u=0,f=i;u<f.length;u++){var l=f[u],p=l.type,d=l.body;switch(p){case"info":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d)}}s&&console.trace("stack trace:"),console.groupEnd()},e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},e.transformPhone=function(t){return"+86"+t}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.jwt=e.helpers=e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var s=i(r(3));e.constants=s;var c=i(r(9));e.adapters=c;var u=i(r(16));e.cache=u;var f=i(r(18));e.events=f;var l=i(r(0));e.utils=l;var p=i(r(19));e.helpers=p;var d={decode:a(r(21)).default};e.jwt=d},function(t,e,r){var n;t.exports=(n=n||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,o=t.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var a=r[i>>>2]>>>24-i%4*8&255;e[n+i>>>2]|=a<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)e[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],o=function(e){e=e;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return o/=4294967296,(o+=.5)*(t.random()>.5?1:-1)}},i=0;i<e;i+=4){var s=o(4294967296*(r||t.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,e)}}),s=n.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new a.init(r,e/2)}},u=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new a.init(r,e)}},f=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*i,u=t.min(4*c,o);if(c){for(var f=0;f<c;f+=i)this._doProcessBlock(n,f);var l=n.splice(0,c);r.sigBytes-=u}return new a.init(l,u)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(o.Hasher=l.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.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(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),n.algo={});return n}(Math),n)},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,o(r(4),e),o(r(8),e),e.OATUH_LOGINTYPE="constants"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var n="@cloudbase/js-sdk";e.setSdkName=function(t){n=t},e.getSdkName=function(){return n};var o="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";e.setProtocol=function(t){o=t},e.getProtocol=function(){return o},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},function(t,e,r){"use strict";var n;r.r(e),r.d(e,"StorageType",(function(){return n})),r.d(e,"AbstractSDKRequest",(function(){return o})),r.d(e,"AbstractStorage",(function(){return i})),r.d(e,"formatUrl",(function(){return a})),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var o=function(){},i=function(){};function a(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.registerFunctions=void 0;var n=r(7);e.registerFunctions=n.registerFunctions},function(t,e,r){"use strict";r.r(e),r.d(e,"registerFunctions",(function(){return h}));var n=r(1),o=function(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},s=function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},c=n.constants.getSdkName,u=n.constants.ERRORS,f=n.constants.COMMUNITY_SITE_URL,l=n.utils.execCallback,p=n.helpers.catchErrorsDecorator,d={name:"functions",entity:{callFunction:(new(function(){function t(){}return t.prototype.callFunction=function(t,e){return a(this,void 0,void 0,(function(){var r,n,o,i,a,f,p,d,h,v,y,g;return s(this,(function(s){switch(s.label){case 0:if(r=t.name,n=t.data,o=t.query,i=t.parse,a=t.search,!r)throw new Error(JSON.stringify({code:u.INVALID_PARAMS,msg:"[functions.callFunction] invalid function name"}));try{f=n?JSON.stringify(n):""}catch(t){throw new Error(JSON.stringify({code:u.INVALID_PARAMS,msg:"[functions.callFunction] invalid data"}))}p="functions.invokeFunction",d={inQuery:o,parse:i,search:a,function_name:r,request_data:f},h=this.request,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,h.send(p,d)];case 2:if((v=s.sent()).code)return[2,l(e,null,v)];if(y=v.data.response_data,i)return[2,l(e,null,{result:y,requestId:v.requestId})];try{return y=JSON.parse(v.data.response_data),[2,l(e,null,{result:y,requestId:v.requestId})]}catch(t){l(e,new Error("["+c()+"]["+u.INVALID_PARAMS+"][functions.callFunction] response data must be json"))}return[3,4];case 3:return g=s.sent(),l(e,g),[3,4];case 4:return[2]}}))}))},o([p({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+f]}),i("design:type",Function),i("design:paramtypes",[Object,Function]),i("design:returntype",Promise)],t.prototype,"callFunction",null),t}())).callFunction}};try{cloudbase.registerComponent(d)}catch(t){}function h(t){try{t.registerComponent(d)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var a,s=i(r(10)),c=r(0);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(a=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,r=c.isArray(t)?t:[t];e<r.length;e++){var n=r[e],o=n.isMatch,i=n.genAdapter,a=n.runtime;if(o())return{adapter:i(),runtime:a}}},e.useDefaultAdapter=function(){return{adapter:s.genAdapter(),runtime:a.WEB}}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=r(5),u=r(0),f=r(4),l=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(e,t),e.prototype.get=function(t){return this._request(i(i({},t),{method:"get"}),this._restrictedMethods.includes("get"))},e.prototype.post=function(t){return this._request(i(i({},t),{method:"post"}),this._restrictedMethods.includes("post"))},e.prototype.put=function(t){return this._request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=new FormData;for(var a in e)o.append(a,e[a]);return o.append("key",n),o.append("file",r),this._request(i(i({},t),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},e.prototype.download=function(t){return a(this,void 0,void 0,(function(){var e,r,n,o;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},t),{headers:{},responseType:"blob"}))];case 1:return e=a.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype._request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,a,s=t.url,c=t.headers,l=void 0===c?{}:c,p=t.data,d=t.responseType,h=t.withCredentials,v=t.body,y=t.onUploadProgress,g=u.formatUrl(f.getProtocol(),s,"get"===n?p:{}),m=new XMLHttpRequest;for(var _ in m.open(n,g),d&&(m.responseType=d),l)m.setRequestHeader(_,l[_]);y&&m.upload.addEventListener("progress",y),m.onreadystatechange=function(){var t={};if(4===m.readyState){var e=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=m.status;try{t.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(e){t.data="blob"===d?m.response:m.responseText}clearTimeout(i),o(t)}},e&&r._timeout&&(i=setTimeout((function(){console.warn(r._timeoutMsg),m.abort()}),r._timeout)),a=u.isFormData(p)?p:"application/x-www-form-urlencoded"===l["content-type"]?u.toQueryString(p):v||(p?JSON.stringify(p):void 0),h&&(m.withCredentials=!0),m.send(a)}))},e}(c.AbstractSDKRequest);e.WebRequest=l,e.genAdapter=function(){return{root:window,reqClass:l,wsClass:WebSocket,localStorage:localStorage}}},function(t,e,r){var n;t.exports=(n=r(2),r(12),r(13),n.HmacSHA256)},function(t,e,r){var n;t.exports=(n=r(2),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,a=e.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(s[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var u=[],f=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],f=r[5],l=r[6],p=r[7],d=0;d<64;d++){if(d<16)u[d]=0|t[e+d];else{var h=u[d-15],v=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,y=u[d-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;u[d]=v+u[d-7]+g+u[d-16]}var m=n&o^n&i^o&i,_=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&l)+c[d]+u[d];p=l,l=f,f=s,s=a+b|0,a=i,i=o,o=n,n=b+(_+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+p|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(f),e.HmacSHA256=i._createHmacHelper(f)}(Math),n.SHA256)},function(t,e,r){var n,o,i,a;t.exports=(n=r(2),i=(o=n).lib.Base,a=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=a.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),s=o.words,c=i.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=n,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 e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))},function(t,e,r){var n,o,i;t.exports=(i=r(2),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var o=[],i=0;i<r;i+=3)for(var a=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<r;s++)o.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var a=r.charAt(64);if(a){var s=t.indexOf(a);-1!==s&&(e=s)}return function(t,e,r){for(var n=[],i=0,a=0;a<e;a++)if(a%4){var s=r[t.charCodeAt(a-1)]<<a%4*2,c=r[t.charCodeAt(a)]>>>6-a%4*2;n[i>>>2]|=(s|c)<<24-i%4*8,i++}return o.create(n,i)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,r){var n;t.exports=(n=r(2),n.enc.Utf8)},function(t,e,r){"use strict";(function(t){var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var s=r(5),c=r(0),u=r(3),f=function(t){function e(e){var r=t.call(this)||this;return r._root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return o(e,t),e.prototype.setItem=function(t,e){this._root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this._root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this._root.tcbCacheObject[t]},e.prototype.clear=function(){delete this._root.tcbCacheObject},e}(s.AbstractStorage);var l=function(){function e(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,i=void 0===o?{}:o;this._platformInfo=n,this._storage||(this._persistence=this._platformInfo.adapter.primaryStorage||e,this._storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root));case"none":return new f(e.root);default:return e.localStorage?e.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root))}}(this._persistence,this._platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:e};this._storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"["+u.getSdkName()+"]["+u.ERRORS.OPERATION_FAIL+"]setStore failed",info:t}))}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,r){return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this._storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,r){var n;if("async"!==this.mode){try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return t.env.tcb_token;if(!this._storage)return""}catch(t){return""}r=r||"localCachev1";var o=this._storage.getItem(e);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,r){var n;return i(this,void 0,void 0,(function(){var o;return a(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return[2,t.env.tcb_token];if(!this._storage)return[2,""]}catch(t){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this._storage.removeItem(t):c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this._storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},e}();e.CloudbaseCache=l}).call(this,r(17))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var c,u=[],f=!1,l=-1;function p(){f&&c&&(f=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!f){var t=s(p);f=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||f||s(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var a=r(0);var s=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=s;var c=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return o(e,t),e}(s);e.IErrorEvent=c;var u=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this._listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this._listeners),this},t.prototype.fire=function(t,e){if(a.isInstanceOf(t,c))return console.error(t.error),this;var r=a.isString(t)?new s(t,e||{}):t,n=r.name;if(this._listens(n)){r.target=this;for(var o=0,u=this._listeners[n]?i(this._listeners[n]):[];o<u.length;o++){u[o].call(this,r)}}return this},t.prototype._listens=function(t){return this._listeners[t]&&this._listeners[t].length>0},t}();e.CloudbaseEventEmitter=u;var f=new u;e.addEventListener=function(t,e){f.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),f.fire(t,e)},e.removeEventListener=function(t,e){f.off(t,e)}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(20),e)},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var i=r(0),a=r(3),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var c=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?\:\/\/.+\:\d*\/.*\.js\:\d+\:\d+/;function f(t){var e=t.err,r=t.className,n=t.methodName,o=t.sourceLink;if(!o)return null;var i,a=e.stack.split("\n"),c=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]\\s*\\(.*\\)$"),f=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]"),l=a.findIndex((function(t){return c.test(t)}));if(-1!==l){var p=a.filter((function(t,e){return e>l}));p.unshift(a[l].replace(f,r+"."+n).replace(u,o)),(i=new Error).stack=(s?"@debugger":"Error")+"\n"+p.join("\n")}return i}e.catchErrorsDecorator=function(t){var e=t.mode,r=void 0===e?"async":e,s=t.customInfo,l=void 0===s?{}:s,p=t.title,d=t.messages,h=void 0===d?[]:d;return function(t,e,s){if(a.IS_DEBUG_MODE){var d=l.className||t.constructor.name,v=l.methodName||e,y=s.value,g=function(t){var e="",r=t.stack.split("\n"),n=r.findIndex((function(t){return c.test(t)}));if(-1!==n){var o=u.exec(r[n+1]||"");e=o?o[0]:""}return e}(new Error);s.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=f({err:new Error,className:d,methodName:v,sourceLink:g});try{return y.apply(this,t)}catch(t){var n=t,o=t.message,a=t.error,s=t.error_description,c={title:p||d+"."+v+" failed",content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(t.code=u.code,t.message=u.msg),n=r||t,c.content=h.map((function(t){return{type:"info",body:t}})))}throw a&&s&&(c.subtitle=s,r?(r.code=a,r.msg=s):(t.code=a,t.message=s),n=r||t,c.content=h.map((function(t){return{type:"info",body:t}}))),i.printGroupLog(c),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(this,void 0,void 0,(function(){var e,r,n,a,s,c,u,l;return o(this,(function(o){switch(o.label){case 0:e=f({err:new Error,className:d,methodName:v,sourceLink:g}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,y.apply(this,t)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,a=r.message,s=r.error,c=r.error_description,u={title:p||d+"."+v+" failed",content:[{type:"error",body:r}]},a&&/^\{.*\}$/.test(a)&&(l=JSON.parse(a),u.subtitle=l,l.code&&(e?(e.code=l.code,e.message=l.msg):(r.code=l.code,r.message=l.msg),n=e||r,u.content=h.map((function(t){return{type:"info",body:t}})))),s&&c&&(u.subtitle=c,e?(e.code=s,e.msg=c):(r.code=s,r.message=c),n=e||r,u.content=h.map((function(t){return{type:"info",body:t}}))),i.printGroupLog(u),n;case 4:return[2]}}))}))}}}}},function(t,e,r){"use strict";function n(t){this.message=t}r.r(e),r.d(e,"InvalidTokenError",(function(){return a})),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,a=0,s="";o=e.charAt(a++);~o&&(r=i%4?64*r+o:o,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function i(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(o(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return o(e)}}function a(t){this.message=t}a.prototype=new Error,a.prototype.name="InvalidTokenError",e.default=function(t,e){if("string"!=typeof t)throw new a("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new a("Invalid token specified: "+t.message)}}}])}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_functions",[],e):"object"==typeof exports?exports.cloudbase_functions=e():t.cloudbase_functions=e()}("undefined"!=typeof window?window:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.transformPhone=e.sleep=e.printGroupLog=e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.createSign=e.formatUrl=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=n(r(11)),i=n(r(14)),s=n(r(15)),a=r(3);function c(t){var e=i.default.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e},e.createSign=function(t,e){var r=c(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(s.default.parse(JSON.stringify(t)));return r+"."+c(o.default(r,e))},e.toQueryString=function(t){void 0===t&&(t={});var e=[];for(var r in t)e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||window.location.search,n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""},e.removeParam=function(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===t&&n.splice(i,1);r=r+"?"+n.join("&")}return r},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("["+a.getSdkName()+"]["+t+"]:"+e)},e.printError=function(t,e){console.error({code:t,msg:"["+a.getSdkName()+"]["+t+"]:"+e})},e.printInfo=function(t,e){console.log("["+a.getSdkName()+"]["+t+"]:"+e)},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"["+a.getSdkName()+"]["+t+"]:"+e}))},e.printGroupLog=function(t){var e=t.title,r=t.subtitle,n=void 0===r?"":r,o=t.content,i=void 0===o?[]:o,s=t.printTrace,a=void 0!==s&&s,c=t.collapsed;void 0!==c&&c?console.groupCollapsed(e,n):console.group(e,n);for(var u=0,f=i;u<f.length;u++){var l=f[u],p=l.type,d=l.body;switch(p){case"info":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d)}}a&&console.trace("stack trace:"),console.groupEnd()},e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},e.transformPhone=function(t){return"+86"+t}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.jwt=e.helpers=e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var a=i(r(3));e.constants=a;var c=i(r(9));e.adapters=c;var u=i(r(16));e.cache=u;var f=i(r(18));e.events=f;var l=i(r(0));e.utils=l;var p=i(r(19));e.helpers=p;var d={decode:s(r(21)).default};e.jwt=d},function(t,e,r){var n;t.exports=(n=n||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=o.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,o=t.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;e[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)e[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],o=function(e){e=e;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return o/=4294967296,(o+=.5)*(t.random()>.5?1:-1)}},i=0;i<e;i+=4){var a=o(4294967296*(r||t.random()));r=987654071*a(),n.push(4294967296*a()|0)}return new s.init(n,e)}}),a=n.enc={},c=a.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new s.init(r,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new s.init(r,e)}},f=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,a=o/(4*i),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*i,u=t.min(4*c,o);if(c){for(var f=0;f<c;f+=i)this._doProcessBlock(n,f);var l=n.splice(0,c);r.sigBytes-=u}return new s.init(l,u)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(o.Hasher=l.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.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(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),n.algo={});return n}(Math),n)},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,o(r(4),e),o(r(8),e),e.OATUH_LOGINTYPE="constants"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var n="@cloudbase/js-sdk";e.setSdkName=function(t){n=t},e.getSdkName=function(){return n};var o="https:";e.setProtocol=function(t){o=t},e.getProtocol=function(){return o},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},function(t,e,r){"use strict";var n;r.r(e),r.d(e,"StorageType",(function(){return n})),r.d(e,"AbstractSDKRequest",(function(){return o})),r.d(e,"AbstractStorage",(function(){return i})),r.d(e,"formatUrl",(function(){return s})),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.registerFunctions=void 0;var n=r(7);e.registerFunctions=n.registerFunctions},function(t,e,r){"use strict";r.r(e),r.d(e,"registerFunctions",(function(){return h}));var n=r(1),o=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},a=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},c=n.constants.getSdkName,u=n.constants.ERRORS,f=n.constants.COMMUNITY_SITE_URL,l=n.utils.execCallback,p=n.helpers.catchErrorsDecorator,d={name:"functions",entity:{callFunction:(new(function(){function t(){}return t.prototype.callFunction=function(t,e){return s(this,void 0,void 0,(function(){var r,n,o,i,s,f,p,d,h,v,y,g;return a(this,(function(a){switch(a.label){case 0:if(r=t.name,n=t.data,o=t.query,i=t.parse,s=t.search,!r)throw new Error(JSON.stringify({code:u.INVALID_PARAMS,msg:"[functions.callFunction] invalid function name"}));try{f=n?JSON.stringify(n):""}catch(t){throw new Error(JSON.stringify({code:u.INVALID_PARAMS,msg:"[functions.callFunction] invalid data"}))}p="functions.invokeFunction",d={inQuery:o,parse:i,search:s,function_name:r,request_data:f},h=this.request,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,h.send(p,d)];case 2:if((v=a.sent()).code)return[2,l(e,null,v)];if(y=v.data.response_data,i)return[2,l(e,null,{result:y,requestId:v.requestId})];try{return y=JSON.parse(v.data.response_data),[2,l(e,null,{result:y,requestId:v.requestId})]}catch(t){l(e,new Error("["+c()+"]["+u.INVALID_PARAMS+"][functions.callFunction] response data must be json"))}return[3,4];case 3:return g=a.sent(),l(e,g),[3,4];case 4:return[2]}}))}))},o([p({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+f]}),i("design:type",Function),i("design:paramtypes",[Object,Function]),i("design:returntype",Promise)],t.prototype,"callFunction",null),t}())).callFunction}};try{cloudbase.registerComponent(d)}catch(t){}function h(t){try{t.registerComponent(d)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,a=i(r(10)),c=r(0);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,r=c.isArray(t)?t:[t];e<r.length;e++){var n=r[e],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=r(5),u=r(0),f=r(4),l=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(e,t),e.prototype.get=function(t){return this._request(i(i({},t),{method:"get"}),this._restrictedMethods.includes("get"))},e.prototype.post=function(t){return this._request(i(i({},t),{method:"post"}),this._restrictedMethods.includes("post"))},e.prototype.put=function(t){return this._request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=new FormData;for(var s in e)o.append(s,e[s]);return o.append("key",n),o.append("file",r),this._request(i(i({},t),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,(function(){var e,r,n,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},t),{headers:{},responseType:"blob"}))];case 1:return e=s.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype._request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,c=t.headers,l=void 0===c?{}:c,p=t.data,d=t.responseType,h=t.withCredentials,v=t.body,y=t.onUploadProgress,g=u.formatUrl(f.getProtocol(),a,"get"===n?p:{}),m=new XMLHttpRequest;for(var _ in m.open(n,g),d&&(m.responseType=d),l)m.setRequestHeader(_,l[_]);y&&m.upload.addEventListener("progress",y),m.onreadystatechange=function(){var t={};if(4===m.readyState){var e=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=m.status;try{t.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(e){t.data="blob"===d?m.response:m.responseText}clearTimeout(i),o(t)}},e&&r._timeout&&(i=setTimeout((function(){console.warn(r._timeoutMsg),m.abort()}),r._timeout)),s=u.isFormData(p)?p:"application/x-www-form-urlencoded"===l["content-type"]?u.toQueryString(p):v||(p?JSON.stringify(p):void 0),h&&(m.withCredentials=!0),m.send(s)}))},e}(c.AbstractSDKRequest);e.WebRequest=l,e.genAdapter=function(){return{root:window,reqClass:l,wsClass:WebSocket,localStorage:localStorage}}},function(t,e,r){var n;t.exports=(n=r(2),r(12),r(13),n.HmacSHA256)},function(t,e,r){var n;t.exports=(n=r(2),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,s=e.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var u=[],f=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],f=r[5],l=r[6],p=r[7],d=0;d<64;d++){if(d<16)u[d]=0|t[e+d];else{var h=u[d-15],v=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,y=u[d-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;u[d]=v+u[d-7]+g+u[d-16]}var m=n&o^n&i^o&i,_=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+c[d]+u[d];p=l,l=f,f=a,a=s+b|0,s=i,i=o,o=n,n=b+(_+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+p|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(f),e.HmacSHA256=i._createHmacHelper(f)}(Math),n.SHA256)},function(t,e,r){var n,o,i,s;t.exports=(n=r(2),i=(o=n).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),a=o.words,c=i.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=n,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 e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))},function(t,e,r){var n,o,i;t.exports=(i=r(2),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,r){for(var n=[],i=0,s=0;s<e;s++)if(s%4){var a=r[t.charCodeAt(s-1)]<<s%4*2,c=r[t.charCodeAt(s)]>>>6-s%4*2;n[i>>>2]|=(a|c)<<24-i%4*8,i++}return o.create(n,i)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,r){var n;t.exports=(n=r(2),n.enc.Utf8)},function(t,e,r){"use strict";(function(t){var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=r(5),c=r(0),u=r(3),f=function(t){function e(e){var r=t.call(this)||this;return r._root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return o(e,t),e.prototype.setItem=function(t,e){this._root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this._root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this._root.tcbCacheObject[t]},e.prototype.clear=function(){delete this._root.tcbCacheObject},e}(a.AbstractStorage);var l=function(){function e(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,i=void 0===o?{}:o;this._platformInfo=n,this._storage||(this._persistence=this._platformInfo.adapter.primaryStorage||e,this._storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root));case"none":return new f(e.root);default:return e.localStorage?e.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root))}}(this._persistence,this._platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:e};this._storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"["+u.getSdkName()+"]["+u.ERRORS.OPERATION_FAIL+"]setStore failed",info:t}))}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this._storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,r){var n;if("async"!==this.mode){try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return t.env.tcb_token;if(!this._storage)return""}catch(t){return""}r=r||"localCachev1";var o=this._storage.getItem(e);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,r){var n;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return[2,t.env.tcb_token];if(!this._storage)return[2,""]}catch(t){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this._storage.removeItem(t):c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},e}();e.CloudbaseCache=l}).call(this,r(17))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],f=!1,l=-1;function p(){f&&c&&(f=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!f){var t=a(p);f=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||f||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var s=r(0);var a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var c=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return o(e,t),e}(a);e.IErrorEvent=c;var u=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this._listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this._listeners),this},t.prototype.fire=function(t,e){if(s.isInstanceOf(t,c))return console.error(t.error),this;var r=s.isString(t)?new a(t,e||{}):t,n=r.name;if(this._listens(n)){r.target=this;for(var o=0,u=this._listeners[n]?i(this._listeners[n]):[];o<u.length;o++){u[o].call(this,r)}}return this},t.prototype._listens=function(t){return this._listeners[t]&&this._listeners[t].length>0},t}();e.CloudbaseEventEmitter=u;var f=new u;e.addEventListener=function(t,e){f.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),f.fire(t,e)},e.removeEventListener=function(t,e){f.off(t,e)}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(20),e)},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var i=r(0),s=r(3),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var c=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?\:\/\/.+\:\d*\/.*\.js\:\d+\:\d+/;function f(t){var e=t.err,r=t.className,n=t.methodName,o=t.sourceLink;if(!o)return null;var i,s=e.stack.split("\n"),c=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]\\s*\\(.*\\)$"),f=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]"),l=s.findIndex((function(t){return c.test(t)}));if(-1!==l){var p=s.filter((function(t,e){return e>l}));p.unshift(s[l].replace(f,r+"."+n).replace(u,o)),(i=new Error).stack=(a?"@debugger":"Error")+"\n"+p.join("\n")}return i}e.catchErrorsDecorator=function(t){var e=t.mode,r=void 0===e?"async":e,a=t.customInfo,l=void 0===a?{}:a,p=t.title,d=t.messages,h=void 0===d?[]:d;return function(t,e,a){if(s.IS_DEBUG_MODE){var d=l.className||t.constructor.name,v=l.methodName||e,y=a.value,g=function(t){var e="",r=t.stack.split("\n"),n=r.findIndex((function(t){return c.test(t)}));if(-1!==n){var o=u.exec(r[n+1]||"");e=o?o[0]:""}return e}(new Error);a.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=f({err:new Error,className:d,methodName:v,sourceLink:g});try{return y.apply(this,t)}catch(t){var n=t,o=t.message,s=t.error,a=t.error_description,c={title:p||d+"."+v+" failed",content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(t.code=u.code,t.message=u.msg),n=r||t,c.content=h.map((function(t){return{type:"info",body:t}})))}throw s&&a&&(c.subtitle=a,r?(r.code=s,r.msg=a):(t.code=s,t.message=a),n=r||t,c.content=h.map((function(t){return{type:"info",body:t}}))),i.printGroupLog(c),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(this,void 0,void 0,(function(){var e,r,n,s,a,c,u,l;return o(this,(function(o){switch(o.label){case 0:e=f({err:new Error,className:d,methodName:v,sourceLink:g}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,y.apply(this,t)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a=r.error,c=r.error_description,u={title:p||d+"."+v+" failed",content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(l=JSON.parse(s),u.subtitle=l,l.code&&(e?(e.code=l.code,e.message=l.msg):(r.code=l.code,r.message=l.msg),n=e||r,u.content=h.map((function(t){return{type:"info",body:t}})))),a&&c&&(u.subtitle=c,e?(e.code=a,e.msg=c):(r.code=a,r.message=c),n=e||r,u.content=h.map((function(t){return{type:"info",body:t}}))),i.printGroupLog(u),n;case 4:return[2]}}))}))}}}}},function(t,e,r){"use strict";function n(t){this.message=t}r.r(e),r.d(e,"InvalidTokenError",(function(){return s})),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,s=0,a="";o=e.charAt(s++);~o&&(r=i%4?64*r+o:o,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a};function i(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(o(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return o(e)}}function s(t){this.message=t}s.prototype=new Error,s.prototype.name="InvalidTokenError",e.default=function(t,e){if("string"!=typeof t)throw new s("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new s("Invalid token specified: "+t.message)}}}])}));
|