@cloudbase/js-sdk 2.5.35-beta.0 → 2.5.36-beta.0
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/miniprogram_dist/app.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase",[],e):"object"==typeof exports?exports.cloudbase=e():t.cloudbase=e()}("undefined"!=typeof window?window:this,(function(){return function(){var t={2829:function(t,e,n){"use strict";var r;n.d(e,{jJ:function(){return o},x_:function(){return i},Z1:function(){return r},CN:function(){return s}}),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var o=function(){},i=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";for(var i in n)""===o?!r&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},8721:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var i=n(2881),s=n(8656),a=n(7135),u=n(4371),c=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new i.Db.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(s.EJSON.parse)}]:[2,t]}}))}))},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,n=t.stageKey,r=t.stageValue;return(e={})[n]=JSON.parse(r),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return t.query&&(t.query=a.QuerySerializer.encode(t.query)),t.distanceMultiplier&&"number"==typeof t.distanceMultiplier&&(t.distanceMultiplier=t.distanceMultiplier),t.near&&(t.near=new u.Point(t.near.longitude,t.near.latitude).toJSON()),this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",a.QuerySerializer.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}();e.default=c},9914:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(2282),s=n(1249),a=n(8721),u=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new i.DocumentReference(this._db,this._coll,t)},e.prototype.add=function(t,e){return new i.DocumentReference(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new a.default(this._db,this._coll)},e}(s.Query);e.CollectionReference=u},3265:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1917),s=n(997),a=n(8721);e.Command={eq:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.EQ,[t])},neq:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.NEQ,[t])},lt:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.LT,[t])},lte:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.LTE,[t])},gt:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GT,[t])},gte:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GTE,[t])},in:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.IN,t)},nin:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.NIN,t)},all:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.ALL,t)},elemMatch:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.ELEM_MATCH,[t])},exists:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.EXISTS,[t])},size:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.SIZE,[t])},mod:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.MOD,[t])},geoNear:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_NEAR,[t])},geoWithin:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_WITHIN,[t])},geoIntersects:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.AND,n)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.NOR,n)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.OR,n)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.NOT,n)},set:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.SET,[t])},remove:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.REMOVE,[])},inc:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.INC,[t])},mul:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MUL,[t])},push:function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(s.isObject(e[0])&&e[0].hasOwnProperty("each")){var r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=s.isArray(e[0])?e[0]:Array.from(e);return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PUSH,t)},pull:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PULL,t)},pullAll:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PULL_ALL,t)},pop:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.POP,[])},shift:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.UNSHIFT,n)},addToSet:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.ADD_TO_SET,t)},rename:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.RENAME,[t])},bit:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.BIT,[t])},max:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MAX,[t])},min:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return s.isString(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new a.default},abs:function(t){return new u("abs",t)},add:function(t){return new u("add",t)},ceil:function(t){return new u("ceil",t)},divide:function(t){return new u("divide",t)},exp:function(t){return new u("exp",t)},floor:function(t){return new u("floor",t)},ln:function(t){return new u("ln",t)},log:function(t){return new u("log",t)},log10:function(t){return new u("log10",t)},mod:function(t){return new u("mod",t)},multiply:function(t){return new u("multiply",t)},pow:function(t){return new u("pow",t)},sqrt:function(t){return new u("sqrt",t)},subtract:function(t){return new u("subtract",t)},trunc:function(t){return new u("trunc",t)},arrayElemAt:function(t){return new u("arrayElemAt",t)},arrayToObject:function(t){return new u("arrayToObject",t)},concatArrays:function(t){return new u("concatArrays",t)},filter:function(t){return new u("filter",t)},in:function(t){return new u("in",t)},indexOfArray:function(t){return new u("indexOfArray",t)},isArray:function(t){return new u("isArray",t)},map:function(t){return new u("map",t)},range:function(t){return new u("range",t)},reduce:function(t){return new u("reduce",t)},reverseArray:function(t){return new u("reverseArray",t)},size:function(t){return new u("size",t)},slice:function(t){return new u("slice",t)},zip:function(t){return new u("zip",t)},and:function(t){return new u("and",t)},not:function(t){return new u("not",t)},or:function(t){return new u("or",t)},cmp:function(t){return new u("cmp",t)},eq:function(t){return new u("eq",t)},gt:function(t){return new u("gt",t)},gte:function(t){return new u("gte",t)},lt:function(t){return new u("lt",t)},lte:function(t){return new u("lte",t)},neq:function(t){return new u("ne",t)},cond:function(t){return new u("cond",t)},ifNull:function(t){return new u("ifNull",t)},switch:function(t){return new u("switch",t)},dateFromParts:function(t){return new u("dateFromParts",t)},dateFromString:function(t){return new u("dateFromString",t)},dayOfMonth:function(t){return new u("dayOfMonth",t)},dayOfWeek:function(t){return new u("dayOfWeek",t)},dayOfYear:function(t){return new u("dayOfYear",t)},isoDayOfWeek:function(t){return new u("isoDayOfWeek",t)},isoWeek:function(t){return new u("isoWeek",t)},isoWeekYear:function(t){return new u("isoWeekYear",t)},millisecond:function(t){return new u("millisecond",t)},minute:function(t){return new u("minute",t)},month:function(t){return new u("month",t)},second:function(t){return new u("second",t)},hour:function(t){return new u("hour",t)},week:function(t){return new u("week",t)},year:function(t){return new u("year",t)},literal:function(t){return new u("literal",t)},mergeObjects:function(t){return new u("mergeObjects",t)},objectToArray:function(t){return new u("objectToArray",t)},allElementsTrue:function(t){return new u("allElementsTrue",t)},anyElementTrue:function(t){return new u("anyElementTrue",t)},setDifference:function(t){return new u("setDifference",t)},setEquals:function(t){return new u("setEquals",t)},setIntersection:function(t){return new u("setIntersection",t)},setIsSubset:function(t){return new u("setIsSubset",t)},setUnion:function(t){return new u("setUnion",t)},concat:function(t){return new u("concat",t)},dateToString:function(t){return new u("dateToString",t)},indexOfBytes:function(t){return new u("indexOfBytes",t)},indexOfCP:function(t){return new u("indexOfCP",t)},split:function(t){return new u("split",t)},strLenBytes:function(t){return new u("strLenBytes",t)},strLenCP:function(t){return new u("strLenCP",t)},strcasecmp:function(t){return new u("strcasecmp",t)},substr:function(t){return new u("substr",t)},substrBytes:function(t){return new u("substrBytes",t)},substrCP:function(t){return new u("substrCP",t)},toLower:function(t){return new u("toLower",t)},toUpper:function(t){return new u("toUpper",t)},meta:function(t){return new u("meta",t)},addToSet:function(t){return new u("addToSet",t)},avg:function(t){return new u("avg",t)},first:function(t){return new u("first",t)},last:function(t){return new u("last",t)},max:function(t){return new u("max",t)},min:function(t){return new u("min",t)},push:function(t){return new u("push",t)},stdDevPop:function(t){return new u("stdDevPop",t)},stdDevSamp:function(t){return new u("stdDevSamp",t)},sum:function(t){return new u("sum",t)},let:function(t){return new u("let",t)}},project:{slice:function(t){return new c("slice",t)},elemMatch:function(t){return new c("elemMatch",t)}}};var u=function(t,e){this["$"+t]=e},c=function(t,e){this["$"+t]=e};e.default=e.Command},7505:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(1999),i=n(9112);e.AND="and",e.OR="or",e.NOT="not",e.NOR="nor",function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(r=e.LOGIC_COMMANDS_LITERAL||(e.LOGIC_COMMANDS_LITERAL={}));var s=function(){function t(t,e,n){if(this._internalType=o.SYMBOL_LOGIC_COMMAND,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||o.SYMBOL_UNSET_FIELD_NAME,this.fieldName!==o.SYMBOL_UNSET_FIELD_NAME)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var r=0,s=e.length;r<s;r++)(a(u=e[r])||i.isQueryCommand(u))&&(e[r]=u._setFieldName(this.fieldName))}else{var u;(a(u=e)||i.isQueryCommand(u))&&(e=u._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var n=this.operands.map((function(n){return n instanceof t?n._setFieldName(e):n}));return new t(this.operator,n,e)},t.prototype.and=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return o.unshift(this),new t(r.AND,o,this.fieldName)},t.prototype.or=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return o.unshift(this),new t(r.OR,o,this.fieldName)},t}();function a(t){return t&&t instanceof s&&t._internalType===o.SYMBOL_LOGIC_COMMAND}e.LogicCommand=s,e.isLogicCommand=a,e.isKnownLogicCommand=function(t){return a&&t.operator.toUpperCase()in r},e.default=s},9112:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,s=n(7505),a=n(1999),u=n(4371),c=n(997);e.EQ="eq",e.NEQ="neq",e.GT="gt",e.GTE="gte",e.LT="lt",e.LTE="lte",e.IN="in",e.NIN="nin",e.ALL="all",e.ELEM_MATCH="elemMatch",e.EXISTS="exists",e.SIZE="size",e.MOD="mod",function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(i=e.QUERY_COMMANDS_LITERAL||(e.QUERY_COMMANDS_LITERAL={}));var f=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o.operator=e,o._internalType=a.SYMBOL_QUERY_COMMAND,o}return o(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case i.IN:case i.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var n=new e(i.EQ,[t],this.fieldName);return this.and(n)},e.prototype.neq=function(t){var n=new e(i.NEQ,[t],this.fieldName);return this.and(n)},e.prototype.gt=function(t){var n=new e(i.GT,[t],this.fieldName);return this.and(n)},e.prototype.gte=function(t){var n=new e(i.GTE,[t],this.fieldName);return this.and(n)},e.prototype.lt=function(t){var n=new e(i.LT,[t],this.fieldName);return this.and(n)},e.prototype.lte=function(t){var n=new e(i.LTE,[t],this.fieldName);return this.and(n)},e.prototype.in=function(t){var n=new e(i.IN,t,this.fieldName);return this.and(n)},e.prototype.nin=function(t){var n=new e(i.NIN,t,this.fieldName);return this.and(n)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof u.Point))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!c.isNumber(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!c.isNumber(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var n=new e(i.GEO_NEAR,[t],this.fieldName);return this.and(n)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof u.MultiPolygon||t.geometry instanceof u.Polygon))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var n=new e(i.GEO_WITHIN,[t],this.fieldName);return this.and(n)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof u.Point||t.geometry instanceof u.LineString||t.geometry instanceof u.Polygon||t.geometry instanceof u.MultiPoint||t.geometry instanceof u.MultiLineString||t.geometry instanceof u.MultiPolygon))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var n=new e(i.GEO_INTERSECTS,[t],this.fieldName);return this.and(n)},e}(s.LogicCommand);function l(t){return t&&t instanceof f&&t._internalType===a.SYMBOL_QUERY_COMMAND}e.QueryCommand=f,e.isQueryCommand=l,e.isKnownQueryCommand=function(t){return l(t)&&t.operator.toUpperCase()in i},e.isComparisonCommand=function(t){return l(t)},e.default=f},1917:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(1999);!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(r=e.UPDATE_COMMANDS_LITERAL||(e.UPDATE_COMMANDS_LITERAL={}));var i=function(){function t(t,e,n){this._internalType=o.SYMBOL_UPDATE_COMMAND,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||o.SYMBOL_UNSET_FIELD_NAME}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function s(t){return t&&t instanceof i&&t._internalType===o.SYMBOL_UPDATE_COMMAND}e.UpdateCommand=i,e.isUpdateCommand=s,e.isKnownUpdateCommand=function(t){return s(t)&&t.operator.toUpperCase()in r},e.default=i},6828:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS={CREATE_WATCH_NET_ERROR:{code:"CREATE_WATCH_NET_ERROR",message:"create watch network error"},CREATE_WACTH_EXCEED_ERROR:{code:"CREATE_WACTH_EXCEED_ERROR",message:"maximum connections exceed"},CREATE_WATCH_SERVER_ERROR:{code:"CREATE_WATCH_SERVER_ERROR",message:"create watch server error"},CONN_ERROR:{code:"CONN_ERROR",message:"connection error"},INVALID_PARAM:{code:"INVALID_PARAM",message:"Invalid request param"},INSERT_DOC_FAIL:{code:"INSERT_DOC_FAIL",message:"insert document failed"},DATABASE_TRANSACTION_CONFLICT:{code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"}}},2049:function(t,e){"use strict";var n,r,o;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(r||(r={})),e.ErrorCode=r,e.FieldType={String:"String",Number:"Number",Object:"Object",Array:"Array",Boolean:"Boolean",Null:"Null",GeoPoint:"GeoPoint",GeoLineString:"GeoLineString",GeoPolygon:"GeoPolygon",GeoMultiPoint:"GeoMultiPoint",GeoMultiLineString:"GeoMultiLineString",GeoMultiPolygon:"GeoMultiPolygon",Timestamp:"Date",Command:"Command",ServerDate:"ServerDate",BsonDate:"BsonDate"},e.OrderDirectionList=["desc","asc"],e.WhereFilterOpList=["<","<=","==",">=",">"],function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(o||(o={})),e.Opeartor=o;var i,s=((n={})[o.eq]="$eq",n[o.lt]="$lt",n[o.lte]="$lte",n[o.gt]="$gt",n[o.gte]="$gte",n);e.OperatorMap=s,e.UpdateOperatorList=["$set","$inc","$mul","$unset","$push","$pop","$unshift","$shift","$currentDate","$each","$position"],function(t){t.WHERE="WHERE",t.DOC="DOC"}(i||(i={})),e.QueryType=i},2282:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2544),i=n(2881),s=n(8551),a=n(3763),u=n(4674),c=n(1917),f=n(2049),l=n(4641),h=function(){function t(t,e,n,o){var s=this;void 0===o&&(o={}),this.watch=function(t){return l.getWsInstance(s._db).watch(r(r({},t),{envId:s._db.config.env,collectionName:s._coll,query:JSON.stringify({_id:s.id})}))},this._db=t,this._coll=e,this.id=n,this.request=new i.Db.reqClass(this._db.config),this.projection=o}return t.prototype.create=function(t,e){e=e||o.createPromiseCallback();var n={collectionName:this._coll,data:u.serialize(t)};return this.id&&(n._id=this.id),this.request.send("database.addDocument",n).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||o.createPromiseCallback(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof c.UpdateCommand?n=!0:"object"==typeof t[e]&&r(t[e])};if(r(t),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var i={collectionName:this._coll,queryType:f.QueryType.DOC,data:u.serialize(t),multi:!1,merge:!1,upsert:!0};return this.id&&(i.query={_id:this.id}),this.request.send("database.updateDocument",i).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||o.createPromiseCallback(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:a.UpdateSerializer.encode(t),query:n,queryType:f.QueryType.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||o.createPromiseCallback();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:f.QueryType.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||o.createPromiseCallback();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:f.QueryType.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n=s.Util.formatResDocumentData(e.data.list);t(0,{data:n,requestId:e.requestId})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var n in e)e[n]?e[n]=1:e[n]=0;return new t(this._db,this._coll,this.id,e)},t}();e.DocumentReference=h},4371:function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(8456)),r(n(6379)),r(n(848)),r(n(5105)),r(n(8437)),r(n(9820))},6379:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(8456),s=n(997),a=function(){function t(t){if(!s.isArray(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof i.Point))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("LineString"!==t.type||!s.isArray(t.coordinates))return!1;try{for(var o=r(t.coordinates),i=o.next();!i.done;i=o.next()){var a=i.value;if(!s.isNumber(a[0])||!s.isNumber(a[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],n=t.points[t.points.length-1];if(e.latitude===n.latitude&&e.longitude===n.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_LINE_STRING},enumerable:!0,configurable:!0}),t}();e.LineString=a},8437:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(6379),a=function(){function t(t){if(!i.isArray(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof s.LineString))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,o,s;if("MultiLineString"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var a=r(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var f=(o=void 0,r(c)),l=f.next();!l.done;l=f.next()){var h=l.value;if(!i.isNumber(h[0])||!i.isNumber(h[1]))return!1}}catch(t){o={error:t}}finally{try{l&&!l.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_LINE_STRING},enumerable:!0,configurable:!0}),t}();e.MultiLineString=a},5105:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(8456),s=n(997),a=function(){function t(t){if(!s.isArray(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof i.Point))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("MultiPoint"!==t.type||!s.isArray(t.coordinates))return!1;try{for(var o=r(t.coordinates),i=o.next();!i.done;i=o.next()){var a=i.value;if(!s.isNumber(a[0])||!s.isNumber(a[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_POINT},enumerable:!0,configurable:!0}),t}();e.MultiPoint=a},9820:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(848),a=function(){function t(t){var e,n;if(!i.isArray(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;if(!(u instanceof s.Polygon))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof u+"[]")}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,n,o,s,a,u;if("MultiPolygon"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var c=r(t.coordinates),f=c.next();!f.done;f=c.next()){var l=f.value;try{for(var h=(o=void 0,r(l)),p=h.next();!p.done;p=h.next()){var d=p.value;try{for(var y=(a=void 0,r(d)),g=y.next();!g.done;g=y.next()){var v=g.value;if(!i.isNumber(v[0])||!i.isNumber(v[1]))return!1}}catch(t){a={error:t}}finally{try{g&&!g.done&&(u=y.return)&&u.call(y)}finally{if(a)throw a.error}}}}catch(t){o={error:t}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_POLYGON},enumerable:!0,configurable:!0}),t}();e.MultiPolygon=a},8456:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9895),o=n(1999),i=n(997),s=function(){function t(t,e){r.Validate.isGeopoint("longitude",t),r.Validate.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&i.isArray(t.coordinates)&&r.Validate.isGeopoint("longitude",t.coordinates[0])&&r.Validate.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_POINT},enumerable:!0,configurable:!0}),t}();e.Point=s},848:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(6379),a=function(){function t(t){if(!i.isArray(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof s.LineString))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!s.LineString.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,o,s;if("Polygon"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var a=r(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;if(!this.isCloseLineString(c))return!1;try{for(var f=(o=void 0,r(c)),l=f.next();!l.done;l=f.next()){var h=l.value;if(!i.isNumber(h[0])||!i.isNumber(h[1]))return!1}}catch(t){o={error:t}}finally{try{l&&!l.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_POLYGON},enumerable:!0,configurable:!0}),t}();e.Polygon=a},1999:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(656);!function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(656)),e.SYMBOL_UNSET_FIELD_NAME=r.default.for("UNSET_FIELD_NAME"),e.SYMBOL_UPDATE_COMMAND=r.default.for("UPDATE_COMMAND"),e.SYMBOL_QUERY_COMMAND=r.default.for("QUERY_COMMAND"),e.SYMBOL_LOGIC_COMMAND=r.default.for("LOGIC_COMMAND"),e.SYMBOL_GEO_POINT=r.default.for("GEO_POINT"),e.SYMBOL_GEO_LINE_STRING=r.default.for("SYMBOL_GEO_LINE_STRING"),e.SYMBOL_GEO_POLYGON=r.default.for("SYMBOL_GEO_POLYGON"),e.SYMBOL_GEO_MULTI_POINT=r.default.for("SYMBOL_GEO_MULTI_POINT"),e.SYMBOL_GEO_MULTI_LINE_STRING=r.default.for("SYMBOL_GEO_MULTI_LINE_STRING"),e.SYMBOL_GEO_MULTI_POLYGON=r.default.for("SYMBOL_GEO_MULTI_POLYGON"),e.SYMBOL_SERVER_DATE=r.default.for("SERVER_DATE"),e.SYMBOL_REGEXP=r.default.for("REGEXP")},2881:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4371),o=n(9914),i=n(3265),s=n(7719),a=n(3602),u=n(1780),c=n(7505),f=n(9112),l=n(1917),h=n(1249);e.Query=h.Query;var p=n(9914);e.CollectionReference=p.CollectionReference;var d=n(2282);e.DocumentReference=d.DocumentReference;var y=function(){function t(t){this.config=t,this.Geo=r,this.serverDate=s.ServerDateConstructor,this.command=i.Command,this.RegExp=a.RegExpConstructor,this.startTransaction=u.startTransaction,this.runTransaction=u.runTransaction,this.logicCommand=c.LogicCommand,this.updateCommand=l.UpdateCommand,this.queryCommand=f.QueryCommand}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new o.CollectionReference(this,t)},t.prototype.createCollection=function(e){var n={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",n)},t}();e.Db=y},2544:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),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 n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t}},7164:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1917);for(var s in e.OperatorMap={},r.QUERY_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;for(var s in o.LOGIC_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;for(var s in i.UPDATE_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;e.OperatorMap[r.QUERY_COMMANDS_LITERAL.NEQ]="$ne",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.REMOVE]="$unset",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.SHIFT]="$pop",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.UNSHIFT]="$push",e.operatorToString=function(t){return e.OperatorMap[t]||"$"+t}},1249:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2544),i=n(2049),s=n(2881),a=n(9895),u=n(8551),c=n(7135),f=n(3763),l=n(2049),h=n(4641),p=function(){function t(t,e,n,o,i){var a=this;this.watch=function(t){return h.getWsInstance(a._db).watch(r(r({},t),{envId:a._db.config.env,collectionName:a._coll,query:JSON.stringify(a._fieldFilters||{}),limit:a._queryOptions.limit,orderBy:a._fieldOrders?a._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=n,this._fieldOrders=o||[],this._queryOptions=i||{},this._request=new s.Db.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||o.createPromiseCallback();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var n={collectionName:this._coll,queryType:i.QueryType.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),e.length>0&&(n.order=e),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n={data:u.Util.formatResDocumentData(e.data.list),requestId:e.requestId};e.total&&(n.total=e.total),e.limit&&(n.limit=e.limit),e.offset&&(n.offset=e.offset),t(0,n)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||o.createPromiseCallback();var e={collectionName:this._coll,queryType:i.QueryType.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(l.ErrorCode.QueryParamTypeError);var n=Object.keys(e),r=n.some((function(t){return void 0!==e[t]}));if(n.length&&!r)throw Error(l.ErrorCode.QueryParamValueError);return new t(this._db,this._coll,c.QuerySerializer.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){a.Validate.isFieldPath(e),a.Validate.isFieldOrder(n);var r={field:e,direction:n},o=this._fieldOrders.concat(r);return new t(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){a.Validate.isInteger("limit",e);var n=r({},this._queryOptions);return n.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){a.Validate.isInteger("offset",e);var n=r({},this._queryOptions);return n.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.update=function(t,e){if(e=e||o.createPromiseCallback(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:i.QueryType.WHERE,multi:!0,merge:!0,upsert:!1,data:f.UpdateSerializer.encode(t)};return this._request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var o=r({},this._queryOptions);return o.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,o)},t.prototype.remove=function(t){t=t||o.createPromiseCallback(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:c.QuerySerializer.encode(this._fieldFilters),queryType:i.QueryType.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}();e.Query=p},3602:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1999),o=function(){function t(t){var e=t.regexp,n=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=n}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return r.SYMBOL_REGEXP},enumerable:!0,configurable:!0}),t}();e.RegExp=o,e.RegExpConstructor=function(t){return new o(t)}},9778:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var s=n(997),a=n(4674);function u(t,e,n,o){var a=r({},t);for(var c in t)if(!/^\$/.test(c)){var f=t[c];if(f&&s.isObject(f)&&!e(f)){if(o.indexOf(f)>-1)throw new Error("Cannot convert circular structure to JSON");var l=u(f,e,i(n,[c]),i(o,[f]));a[c]=l;var h=!1;for(var p in l)/^\$/.test(p)?h=!0:(a[c+"."+p]=l[p],delete a[c][p]);h||delete a[c]}}return a}function c(t){return s.isInternalObject(t)||s.isDate(t)||s.isRegExp(t)}e.flattenQueryObject=function(t){return u(t,c,[],[t])},e.flattenObject=function(t){return u(t,(function(t){return!1}),[],[t])},e.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?s.isArray(t[r])?t[r].push(e[r]):s.isObject(t[r])?s.isObject(e[r])?Object.assign(t[r],e[r]):(console.warn("unmergable condition, query is object but condition is "+s.getType(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+s.getType(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},e.isConversionRequired=c,e.encodeInternalDataType=function(t){return a.serialize(t)},e.decodeInternalDataType=function(t){return a.deserialize(t)}},4674:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var s=n(1999),a=n(997),u=n(4371),c=n(7719);function f(t,e){if(!a.isInternalObject(t)){if(a.isDate(t))return{$date:+t};if(a.isRegExp(t))return{$regex:t.source,$options:t.flags};if(a.isArray(t))return t.map((function(t){if(e.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return f(t,i(e,[t]))}));if(a.isObject(t)){var n=r({},t);for(var o in n){if(e.indexOf(n[o])>-1)throw new Error("Cannot convert circular structure to JSON");n[o]=f(n[o],i(e,[n[o]]))}return n}return t}switch(t._internalType){case s.SYMBOL_GEO_POINT:return t.toJSON();case s.SYMBOL_SERVER_DATE:case s.SYMBOL_REGEXP:return t.parse();default:return t.toJSON?t.toJSON():t}}e.serialize=function(t){return f(t,[t])},e.deserialize=function(t){var e=r({},t);for(var n in e)switch(n){case"$date":switch(a.getType(e[n])){case"number":return new Date(e[n]);case"object":return new c.ServerDate(e[n])}break;case"type":if("Point"===e.type&&a.isArray(e.coordinates)&&a.isNumber(e.coordinates[0])&&a.isNumber(e.coordinates[1]))return new u.Point(e.coordinates[0],e.coordinates[1])}return t}},7135:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1999),s=n(997),a=n(7164),u=n(9778),c=function(){function t(){}return t.encode=function(t){return(new f).encodeQuery(t)},t}();e.QuerySerializer=c;var f=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var n;return u.isConversionRequired(t)?o.isLogicCommand(t)?this.encodeLogicCommand(t):r.isQueryCommand(t)?this.encodeQueryCommand(t):((n={})[e]=this.encodeQueryObject(t),n):s.isObject(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,n,r,i,u,c,f,l=this;switch(t.operator){case o.LOGIC_COMMANDS_LITERAL.NOR:case o.LOGIC_COMMANDS_LITERAL.AND:case o.LOGIC_COMMANDS_LITERAL.OR:var h=a.operatorToString(t.operator),p=t.operands.map((function(e){return l.encodeQuery(e,t.fieldName)}));return(e={})[h]=p,e;case o.LOGIC_COMMANDS_LITERAL.NOT:h=a.operatorToString(t.operator);var d=t.operands[0];return s.isRegExp(d)?((n={})[t.fieldName]=((r={})[h]=this.encodeRegExp(d),r),n):(p=this.encodeQuery(d)[t.fieldName],(i={})[t.fieldName]=((u={})[h]=p,u),i);default:if(h=a.operatorToString(t.operator),1===t.operands.length){var y=this.encodeQuery(t.operands[0]);return(c={})[h]=y,c}return p=t.operands.map(this.encodeQuery.bind(this)),(f={})[h]=p,f}},t.prototype.encodeQueryCommand=function(t){return r.isComparisonCommand(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,n,o,s,c,f,l,h,p;if(t.fieldName===i.SYMBOL_UNSET_FIELD_NAME)throw new Error("Cannot encode a comparison command with unset field name");var d=a.operatorToString(t.operator);switch(t.operator){case r.QUERY_COMMANDS_LITERAL.EQ:case r.QUERY_COMMANDS_LITERAL.NEQ:case r.QUERY_COMMANDS_LITERAL.LT:case r.QUERY_COMMANDS_LITERAL.LTE:case r.QUERY_COMMANDS_LITERAL.GT:case r.QUERY_COMMANDS_LITERAL.GTE:case r.QUERY_COMMANDS_LITERAL.ELEM_MATCH:case r.QUERY_COMMANDS_LITERAL.EXISTS:case r.QUERY_COMMANDS_LITERAL.SIZE:case r.QUERY_COMMANDS_LITERAL.MOD:return(e={})[t.fieldName]=((n={})[d]=u.encodeInternalDataType(t.operands[0]),n),e;case r.QUERY_COMMANDS_LITERAL.IN:case r.QUERY_COMMANDS_LITERAL.NIN:case r.QUERY_COMMANDS_LITERAL.ALL:return(o={})[t.fieldName]=((s={})[d]=u.encodeInternalDataType(t.operands),s),o;case r.QUERY_COMMANDS_LITERAL.GEO_NEAR:var y=t.operands[0];return(c={})[t.fieldName]={$nearSphere:{$geometry:y.geometry.toJSON(),$maxDistance:y.maxDistance,$minDistance:y.minDistance}},c;case r.QUERY_COMMANDS_LITERAL.GEO_WITHIN:return y=t.operands[0],(f={})[t.fieldName]={$geoWithin:{$geometry:y.geometry.toJSON()}},f;case r.QUERY_COMMANDS_LITERAL.GEO_INTERSECTS:return y=t.operands[0],(l={})[t.fieldName]={$geoIntersects:{$geometry:y.geometry.toJSON()}},l;default:return(h={})[t.fieldName]=((p={})[d]=u.encodeInternalDataType(t.operands[0]),p),h}},t.prototype.encodeQueryObject=function(t){var e=u.flattenQueryObject(t);for(var n in e){var i=e[n];if(o.isLogicCommand(i)){e[n]=i._setFieldName(n);var s=this.encodeLogicCommand(e[n]);this.mergeConditionAfterEncode(e,s,n)}else r.isComparisonCommand(i)?(e[n]=i._setFieldName(n),s=this.encodeComparisonCommand(e[n]),this.mergeConditionAfterEncode(e,s,n)):u.isConversionRequired(i)&&(e[n]=u.encodeInternalDataType(i))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?s.isArray(t[r])?t[r]=t[r].concat(e[r]):s.isObject(t[r])?s.isObject(e[r])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+s.getType(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+s.getType(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},t}()},3763:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1917),o=n(1999),i=n(997),s=n(7164),a=n(9778),u=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return r.isUpdateCommand(t)?this.encodeUpdateCommand(t):"object"===i.getType(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===o.SYMBOL_UNSET_FIELD_NAME)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case r.UPDATE_COMMANDS_LITERAL.PUSH:case r.UPDATE_COMMANDS_LITERAL.PULL:case r.UPDATE_COMMANDS_LITERAL.PULL_ALL:case r.UPDATE_COMMANDS_LITERAL.POP:case r.UPDATE_COMMANDS_LITERAL.SHIFT:case r.UPDATE_COMMANDS_LITERAL.UNSHIFT:case r.UPDATE_COMMANDS_LITERAL.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,n,o,i,a=s.operatorToString(t.operator);return t.operator===r.UPDATE_COMMANDS_LITERAL.REMOVE?((e={})[a]=((n={})[t.fieldName]="",n),e):((o={})[a]=((i={})[t.fieldName]=t.operands[0],i),o)},t.prototype.encodeArrayUpdateCommand=function(t){var e,n,o,u,c,f,l,h,p,d,y=s.operatorToString(t.operator);switch(t.operator){case r.UPDATE_COMMANDS_LITERAL.PUSH:var g=void 0;return g=i.isArray(t.operands)?{$each:t.operands.map(a.encodeInternalDataType)}:t.operands,(e={})[y]=((n={})[t.fieldName]=g,n),e;case r.UPDATE_COMMANDS_LITERAL.UNSHIFT:return g={$each:t.operands.map(a.encodeInternalDataType),$position:0},(o={})[y]=((u={})[t.fieldName]=g,u),o;case r.UPDATE_COMMANDS_LITERAL.POP:return(c={})[y]=((f={})[t.fieldName]=1,f),c;case r.UPDATE_COMMANDS_LITERAL.SHIFT:return(l={})[y]=((h={})[t.fieldName]=-1,h),l;default:return(p={})[y]=((d={})[t.fieldName]=a.encodeInternalDataType(t.operands),d),p}},t.prototype.encodeUpdateObject=function(t){var e=a.flattenQueryObject(t);for(var n in e)if(!/^\$/.test(n)){var o=e[n];if(r.isUpdateCommand(o)){e[n]=o._setFieldName(n);var i=this.encodeUpdateCommand(e[n]);a.mergeConditionAfterEncode(e,i,n)}else{e[n]=o=a.encodeInternalDataType(o);var s=new r.UpdateCommand(r.UPDATE_COMMANDS_LITERAL.SET,[o],n);i=this.encodeUpdateCommand(s),a.mergeConditionAfterEncode(e,i,n)}}return e},t}();e.UpdateSerializer=u},7719:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1999),o=function(){function t(t){var e=(void 0===t?{}:t).offset,n=void 0===e?0:e;this.offset=n}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return r.SYMBOL_SERVER_DATE},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();e.ServerDate=o,e.ServerDateConstructor=function(t){return new o(t)}},6896:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(2302),s=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new i.DocumentReference(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new i.DocumentReference(this._transaction,this._coll,e).create(t)},e}(n(4702).Query);e.CollectionReference=s},2302:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var s=n(8656),a=n(6828),u=n(3763),c=n(4674),f=n(8551),l="database.updateDocInTransaction",h=function(){function t(t,e,n){this._coll=e,this.id=n,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return o(this,void 0,void 0,(function(){var e,n,o,u;return i(this,(function(i){switch(i.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:s.EJSON.stringify(c.serialize(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((n=i.sent()).code)throw n;if(o=s.EJSON.parse(n.inserted),1==(u=s.EJSON.parse(n.ok))&&1==o)return[2,r(r({},n),{ok:u,inserted:o})];throw new Error(a.ERRORS.INSERT_DOC_FAIL.message)}}))}))},t.prototype.get=function(){return o(this,void 0,void 0,(function(){var t,e;return i(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,{data:"null"!==e.data?f.Util.formatField(s.EJSON.parse(e.data)):s.EJSON.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return o(this,void 0,void 0,(function(){var e,n;return i(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:s.EJSON.stringify(c.serialize(t),{relaxed:!1}),upsert:!0},[4,this._request.send(l,e)];case 1:if((n=o.sent()).code)throw n;return[2,r(r({},n),{updated:s.EJSON.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},t.prototype.update=function(t){return o(this,void 0,void 0,(function(){var e,n;return i(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:s.EJSON.stringify(u.UpdateSerializer.encode(t),{relaxed:!1})},[4,this._request.send(l,e)];case 1:if((n=o.sent()).code)throw n;return[2,r(r({},n),{updated:s.EJSON.parse(n.updated)})]}}))}))},t.prototype.delete=function(){return o(this,void 0,void 0,(function(){var t,e;return i(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,r(r({},e),{deleted:s.EJSON.parse(e.deleted)})]}}))}))},t}();e.DocumentReference=h},1780:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var i=n(2881),s=n(6896),a=n(6828),u=function(){function t(t){this._db=t,this._request=new i.Db.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new s.CollectionReference(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return r(this,void 0,void 0,(function(){var t,e;return o(this,(function(n){switch(n.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=n.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return r(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=t,[2,n]}}))}))},t}();e.Transaction=u,e.startTransaction=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,(t=new u(this)).init()];case 1:return e.sent(),[2,t]}}))}))},e.runTransaction=function t(e,n){return void 0===n&&(n=3),r(this,void 0,void 0,(function(){var i,s,c,f,l=this;return o(this,(function(h){switch(h.label){case 0:return h.trys.push([0,4,,10]),[4,(i=new u(this)).init()];case 1:return h.sent(),[4,e(i)];case 2:if(s=h.sent(),!0===i.aborted)throw i.abortReason;return[4,i.commit()];case 3:return h.sent(),[2,s];case 4:if(c=h.sent(),!1===i.inited)throw c;return f=function(t){return r(l,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(i.aborted||i.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.rollback()];case 2:case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===i.aborted)throw i.abortReason;throw t}}))}))},n<=0?[4,f(c)]:[3,6];case 5:h.sent(),h.label=6;case 6:return c&&c.code===a.ERRORS.DATABASE_TRANSACTION_CONFLICT.code?[4,t.bind(this)(e,--n)]:[3,8];case 7:return[2,h.sent()];case 8:return[4,f(c)];case 9:return h.sent(),[3,10];case 10:return[2]}}))}))}},4702:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Query=function(t,e){this._coll=e,this._transaction=t}},8551:function(t,e,n){"use strict";var r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2049),i=n(4371),s=n(7719),a=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var n=Object.keys(e),s={};return Array.isArray(e)&&(s=[]),n.forEach((function(n){var a,u=e[n];switch(t.whichType(u)){case o.FieldType.GeoPoint:a=new i.Point(u.coordinates[0],u.coordinates[1]);break;case o.FieldType.GeoLineString:a=new i.LineString(u.coordinates.map((function(t){return new i.Point(t[0],t[1])})));break;case o.FieldType.GeoPolygon:a=new i.Polygon(u.coordinates.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})));break;case o.FieldType.GeoMultiPoint:a=new i.MultiPoint(u.coordinates.map((function(t){return new i.Point(t[0],t[1])})));break;case o.FieldType.GeoMultiLineString:a=new i.MultiLineString(u.coordinates.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})));break;case o.FieldType.GeoMultiPolygon:a=new i.MultiPolygon(u.coordinates.map((function(t){return new i.Polygon(t.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})))})));break;case o.FieldType.Timestamp:a=new Date(1e3*u.$timestamp);break;case o.FieldType.Object:case o.FieldType.Array:a=t.formatField(u);break;case o.FieldType.ServerDate:a=new Date(u.$date);break;default:a=u}Array.isArray(s)?s.push(a):s[n]=a})),s},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===o.FieldType.Timestamp)return o.FieldType.BsonDate;if(e===o.FieldType.Object){if(t instanceof i.Point)return o.FieldType.GeoPoint;if(t instanceof Date)return o.FieldType.Timestamp;if(t instanceof s.ServerDate)return o.FieldType.ServerDate;t.$timestamp?e=o.FieldType.Timestamp:t.$date?e=o.FieldType.ServerDate:i.Point.validate(t)?e=o.FieldType.GeoPoint:i.LineString.validate(t)?e=o.FieldType.GeoLineString:i.Polygon.validate(t)?e=o.FieldType.GeoPolygon:i.MultiPoint.validate(t)?e=o.FieldType.GeoMultiPoint:i.MultiLineString.validate(t)?e=o.FieldType.GeoMultiLineString:i.MultiPolygon.validate(t)&&(e=o.FieldType.GeoMultiPolygon)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",n=0;n<24;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}();e.Util=a},656:function(t,e){"use strict";var n,r=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 n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n(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)});Object.defineProperty(e,"__esModule",{value:!0});var o=[],i={},s=function(t){function e(e,n){if(n!==i)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return r(e,t),e.for=function(t){for(var n=0,r=o.length;n<r;n++)if(o[n].target===t)return o[n].instance;var s=new e(t,i);return o.push({target:t,instance:s}),s},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})}));e.InternalSymbol=s,e.default=s},997:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(656);e.getType=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},e.isObject=function(t){return"object"===e.getType(t)},e.isString=function(t){return"string"===e.getType(t)},e.isNumber=function(t){return"number"===e.getType(t)},e.isPromise=function(t){return"promise"===e.getType(t)},e.isFunction=function(t){return"function"==typeof t},e.isArray=function(t){return Array.isArray(t)},e.isDate=function(t){return"date"===e.getType(t)},e.isRegExp=function(t){return"regexp"===e.getType(t)},e.isInternalObject=function(t){return t&&t._internalType instanceof r.InternalSymbol},e.isPlainObject=function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}},4641:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2881);e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))};var o={};e.autoCount=function(t){return void 0===t&&(t="any"),o[t]||(o[t]=0),o[t]++};var i={};e.getWsInstance=function(t){if(!r.Db.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return i[e]||(i[e]=new r.Db.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new r.Db.reqClass(t.config)}}})),i[e]}},9895:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2049),o=n(8551),i=function(){function t(){}return t.isGeopoint=function(t,e){if(o.Util.whichType(e)!==r.FieldType.Number)throw new Error("Geo Point must be number type");var n=Math.abs(e);if("latitude"===t&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+r.ErrorCode.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===r.OrderDirectionList.indexOf(t))throw new Error(r.ErrorCode.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===r.WhereFilterOpList.indexOf(t))throw new Error(r.ErrorCode.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(r.ErrorCode.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(r.ErrorCode.DocIDError);return!0},t}();e.Validate=i},9195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},o=r(n(7805)),i=n(2828),s=n(7338),a=n(7766),u=n(3337),c=n(3098),f=n(4797),l=r(n(4536)).default.version;o.default.registerVersion(l);try{(0,i.registerAuth)(o.default),(0,s.registerFunctions)(o.default),(0,a.registerStorage)(o.default),(0,f.registerDatabase)(o.default),(0,u.registerRealtime)(o.default),(0,c.registerAnalytics)(o.default)}catch(t){}try{window.cloudbase=o.default}catch(t){}e.default=o.default,t.exports=o.default},3098:function(t,e,n){"use strict";n.r(e),n.d(e,{registerAnalytics:function(){return h}});var r=n(1142),o=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=r._G.Sg,s=r._G.vM,a=r.BM.D,u="analytics",c=["mall"],f=new(function(){function t(){}return t.prototype.analytics=function(t){return e=this,n=void 0,o=function(){var e,n,r;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){if(!function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))return!1;var e=t.report_data,n=t.report_type;return!1!==c.includes(n)&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!(void 0!==e.action_time&&!Number.isInteger(e.action_time))&&"string"==typeof e.action_type}(t))throw new Error(JSON.stringify({code:i.INVALID_PARAMS,msg:"[".concat(u,".analytics] invalid report data")}));return e=void 0===t.report_data.action_time?Math.floor(Date.now()/1e3):t.report_data.action_time,n={analytics_scene:t.report_type,analytics_data:Object.assign({},t.report_data,{action_time:e})},r={requestData:n},this.request.send("analytics.report",r),[2]}))},new((r=void 0)||(r=Promise))((function(t,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o},function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);i>3&&s&&Object.defineProperty(e,n,s)}([a({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(s)]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],t.prototype,"analytics",null),t}()),l={name:u,entity:{analytics:f.analytics}};try{cloudbase.registerComponent(l)}catch(t){}function h(t){try{t.registerComponent(l)}catch(t){console.warn(t)}}},7805:function(t,e,n){"use strict";n.r(e),n.d(e,{cloudbase:function(){return st},default:function(){return at},getBaseEndPoint:function(){return x}});var r,o=n(1142),i=n(2829),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)},u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return s(e,t),e.prototype.post=function(t){var e=this;return new Promise((function(n,r){var o=t.url,s=t.data,a=t.headers,u=wx.request({url:(0,i.CN)("https:",o),data:s,timeout:e._timeout,method:"POST",header:a,success:function(t){n(t)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("post")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e.prototype.upload=function(t){var e=this,n=this;return new Promise((function(r){return o=e,i=void 0,u=function(){var e,o,i,s,u,c;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(f){return e=t.url,o=t.file,i=t.data,s=t.headers,u=t.onUploadProgress,c=wx.uploadFile({url:e,filePath:o,name:"file",formData:a({},i),header:s,timeout:this._timeout,success:function(t){var e={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&i.success_action_status&&(e.statusCode=parseInt(i.success_action_status,10)),r(e)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{c.abort()}catch(t){}}}}),u&&c.onProgressUpdate((function(t){u(t)})),[2]}))},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function r(t){try{a(u.throw(t))}catch(t){e(t)}}function a(e){var o;e.done?t(e.value):(o=e.value,o instanceof s?o:new s((function(t){t(o)}))).then(n,r)}a((u=u.apply(o,i||[])).next())}));var o,i,s,u}))},e.prototype.download=function(t){var e=this,n=this;return new Promise((function(r,o){var s=t.url,a=t.headers,u=wx.downloadFile({url:(0,i.CN)("https:",s),header:a,timeout:e._timeout,success:function(t){200===t.statusCode&&t.tempFilePath?r({statusCode:200,tempFilePath:t.tempFilePath}):r(t)},fail:function(t){o(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("download")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e}(i.jJ),c={setItem:function(t,e){wx.setStorageSync(t,e)},getItem:function(t){return wx.getStorageSync(t)},removeItem:function(t){wx.removeStorageSync(t)},clear:function(){wx.clearStorageSync()}},f=function(t,e){void 0===e&&(e={});var n=wx.connectSocket(a({url:t},e));return{set onopen(t){n.onOpen(t)},set onmessage(t){n.onMessage(t)},set onclose(t){n.onClose(t)},set onerror(t){n.onError(t)},send:function(t){return n.send({data:t})},close:function(t,e){return n.close({code:t,reason:e})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}},l={genAdapter:function(){return{root:{},reqClass:u,wsClass:f,localStorage:c,primaryStorage:i.Z1.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0},runtime:"wx_mp"},h=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},p=o._G.Sg,d={};function y(t,e){var n=e.name,r=e.namespace,o=e.entity,i=e.injectEvents,s=e.IIFE,a=void 0!==s&&s;if(d[n]||r&&t[r])throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:p.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(t)}if(d[n]=e,r?t.prototype[r]=o:g(t.prototype,o),i){var u=i.bus,c=i.events;if(!u||!c||0===c.length)return;var f=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=h(h([],t.prototype.events[n].events,!0),c,!0):t.prototype.events[n]={bus:u,events:c},t.prototype.fire=function(t,e){f(t,e);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var o=r[n],i=this.events[o],s=i.bus;if(i.events.includes(t)){s.fire(t,e);break}}}}}function g(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=g(t[o],e[o]))}return t}var v={},m=function(){return m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},m.apply(this,arguments)},b="user_info",_=o.Fs.q,w={},E={};function S(t){var e=t.env,n=t.platformInfo,r={userInfoKey:"".concat(b,"_").concat(e)};w[e]=w[e]||new _(m(m({},t),{keys:r,platformInfo:n})),E[e]=E[e]||new _(m(m({},t),{keys:r,platformInfo:n,persistence:"local"}))}function I(t){return E[t]}var O,A=o._G.tC,T=o._G.pM,N="",R="@cloudbase/js-sdk",L="https:",C="//tcb-api.tencentcloudapi.com/web";function P(t,e){C=t,e&&(L=e,T(e))}function D(){return{BASE_URL:C,PROTOCOL:L}}function x(){var t=D(),e=t.PROTOCOL,n=t.BASE_URL;return"".concat(e).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(O||(O={}));var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},U.apply(this,arguments)},M=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},j=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},B=o._G.Sg,k=o.P6.Jc,q=o.P6.hp,F=o.P6.CN,W=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function G(t,e,n){var r=t[e];t[e]=function(e){var o={},i={};n.forEach((function(n){var r=n.call(t,e),s=r.data,a=r.headers;Object.assign(o,s),Object.assign(i,a)}));var s=e.data;return s&&(q(s)?Object.keys(o).forEach((function(t){s.append(t,o[t])})):e.data=U(U({},s),o)),e.headers=U(U({},e.headers||{}),i),r.call(t,e)}}function $(){var t=k();return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(N),"x-seqid":t}}}var V=function(){function t(t){this.throwWhenRequestFail=!1,this.config=t;var e={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new v.adapter.reqClass(e),this.throwWhenRequestFail=t.throw||!1,this.localCache=I(this.config.env),G(this.reqClass,"post",[$]),G(this.reqClass,"upload",[$]),G(this.reqClass,"download",[$])}return t.prototype.post=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.post(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.upload=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.upload(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.download(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getBaseEndPoint=function(){return x()},t.prototype.getOauthAccessTokenV2=function(t){return M(this,void 0,void 0,(function(){var e,n;return j(this,(function(r){switch(r.label){case 0:return[4,t.getAccessToken()];case 1:return e=r.sent(),[4,t.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},t.prototype.request=function(t,e,n){var r;return M(this,void 0,void 0,(function(){var o,i,s,a,u,c,f,l,h,p,d,y,g,v,m,b,_,w,E,S;return j(this,(function(I){switch(I.label){case 0:if(o="x-tcb-trace_".concat(this.config.env),i="application/x-www-form-urlencoded",s=U({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==W.indexOf(t))return[3,2];if(!(a=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=a.oauthInstance,c=u.oauth2client,f=s,[4,this.getOauthAccessTokenV2(c)];case 1:f.access_token=I.sent().accessToken,I.label=2;case 2:return"storage.uploadFile"===t?(l=new FormData,Object.keys(l).forEach((function(t){Object.prototype.hasOwnProperty.call(l,t)&&void 0!==l[t]&&l.append(t,s[t])})),i="multipart/form-data"):(i="application/json;charset=UTF-8",l={},Object.keys(s).forEach((function(t){void 0!==s[t]&&(l[t]=s[t])}))),h={headers:{"content-type":i}},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(o))&&(h.headers["X-TCB-Trace"]=p),d=e.parse,y=e.inQuery,g=e.search,v={env:this.config.env},d&&(v.parse=!0),y&&(v=U(U({},y),v)),m=D(),b=m.BASE_URL,_=m.PROTOCOL,w=F(_,b,v),g&&(w+=g),[4,this.post(U({url:w,data:l},h))];case 3:if(E=I.sent(),(S=null===(r=E.header)||void 0===r?void 0:r["x-tcb-trace"])&&this.localCache.setStore(o,S),200!==Number(E.status)&&200!==Number(E.statusCode)||!E.data)throw new Error("network request error");return[2,E]}}))}))},t.prototype.send=function(t,e){return void 0===e&&(e={}),M(this,void 0,void 0,(function(){var n;return j(this,(function(r){switch(r.label){case 0:return[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 1:if((n=r.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:B.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},t}(),H={},Y=function(){return Y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Y.apply(this,arguments)},J=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},K=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Q=o.j$.Fk,z=o.j$.xY,X=o._G.Sg,Z=o._G.vM,tt=o.P6.xe,et=o.BM.D,nt={timeout:15e3,persistence:"local"},rt=6e5,ot={},it=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return v},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,w[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return I(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this.cloudbaseConfig.env,H[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){if(!e.env)throw new Error(JSON.stringify({code:X.INVALID_PARAMS,msg:"env must not be specified"}));v.adapter||this.useDefaultAdapter();var n={timeout:e.timeout||5e3,timeoutMsg:"[".concat(R,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(e.timeout/1e3,"s")};this.requestClient=new v.adapter.reqClass(n),this.cloudbaseConfig=Y(Y({},nt),e),this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var r=this.cloudbaseConfig,o=r.env,i=r.persistence,s=r.debug,a=r.timeout,u=r.oauthClient;S({env:o,persistence:i,debug:s,platformInfo:this.platform}),function(t,e,n){P(e?"//".concat(t,".").concat(e,".tcb-api.tencentcloudapi.com/web"):"//".concat(t,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),void 0)}(o,e.region||"");var c=new t(this.cloudbaseConfig);return function(t){H[t.env]=new V(U(U({},t),{throw:!0}))}({env:o,region:e.region||"",timeout:a,oauthClient:u,_fromApp:c}),c.requestClient=this.requestClient,c},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,S({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.registerExtension=function(t){ot[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,r=void 0,i=function(){var n;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(r){switch(r.label){case 0:if(!(n=ot[t]))throw new Error(JSON.stringify({code:X.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,r.sent()]}}))},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{u(i.next(t))}catch(t){e(t)}}function a(t){try{u(i.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}u((i=i.apply(n,r||[])).next())}));var n,r,o,i},t.prototype.useAdapters=function(t){var e=Q(t)||{},n=e.adapter,r=e.runtime;n&&(v.adapter=n),r&&(v.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,r=e.target;if(Object.prototype.hasOwnProperty.call(t,r))throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var o=t.prototype[r];if("function"!=typeof o)throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not a function which is the only type supports hook")}));t.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,h([this],t,!1)),o.call.apply(o,h([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){y(t,e)},t.prototype.registerVersion=function(t){!function(t){N=t}(t)},t.prototype.registerSdkName=function(t){!function(t){R=t,A(t)}(t)},t.prototype.registerEndPoint=function(t,e){P(t,e)},t.prototype.useDefaultAdapter=function(){var t=z(),e=t.adapter,n=t.runtime;v.adapter=e,v.runtime=n},t.prototype.formatTimeout=function(t){switch(!0){case t>rt:return tt(X.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),rt;case t<100:return tt(X.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},J([et({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Z)]}),K("design:type",Function),K("design:paramtypes",[Object]),K("design:returntype",t)],t.prototype,"init",null),J([et({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Z)]}),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),st=new it;st.useAdapters(l);var at=st},2828:function(t,e,n){"use strict";n.r(e),n.d(e,{Auth:function(){return z},LoginState:function(){return Q},registerAuth:function(){return Z}});var r,o,i,s,a,u,c,f=n(1142);function l(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}!function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(r||(r={})),(c=o||(o={})).UNREACHABLE="unreachable",c.LOCAL="local",c.CANCELLED="cancelled",c.UNKNOWN="unknown",c.INVALID_ARGUMENT="invalid_argument",c.DEADLINE_EXCEEDED="deadline_exceeded",c.NOT_FOUND="not_found",c.ALREADY_EXISTS="already_exists",c.PERMISSION_DENIED="permission_denied",c.UNAUTHENTICATED="unauthenticated",c.RESOURCE_EXHAUSTED="resource_exhausted",c.FAILED_PRECONDITION="failed_precondition",c.ABORTED="aborted",c.OUT_OF_RANGE="out_of_range",c.UNIMPLEMENTED="unimplemented",c.INTERNAL="internal",c.UNAVAILABLE="unavailable",c.DATA_LOSS="data_loss",c.CAPTCHA_REQUIRED="captcha_required",c.CAPTCHA_INVALID="captcha_invalid",c.INVALID_PASSWORD="invalid_password",c.INVALID_STATUS="invalid_status",c.USER_PENDING="user_pending",c.USER_BLOCKED="user_blocked",c.INVALID_VERIFICATION_CODE="invalid_verification_code",c.TWO_FACTOR_REQUIRED="two_factor_required",c.INVALID_TWO_FACTOR="invalid_two_factor",c.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",c.UNDER_REVIEW="under_review",c.INVALID_REQUEST="invalid_request",c.UNAUTHORIZED_CLIENT="unauthorized_client",c.ACCESS_DENIED="access_denied",c.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",c.INVALID_SCOPE="invalid_scope",c.INVALID_GRANT="invalid_grant",c.SERVER_ERROR="server_error",c.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",c.INTERACTION_REQUIRED="interaction_required",c.LOGIN_REQUIRED="login_required",c.ACCOUNT_SELECTION_REQUIRED="account_selection_required",c.CONSENT_REQUIRED="consent_required",c.INVALID_REQUEST_URI="invalid_request_uri",c.INVALID_REQUEST_OBJECT="invalid_request_object",c.REQUEST_NOT_SUPPORTED="request_not_supported",c.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",c.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(i||(i={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider"}(s||(s={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(a||(a={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(u||(u={}));var h=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},p=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},d=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return h(this,void 0,void 0,(function(){var n,r=this;return p(this,(function(o){switch(o.label){case 0:return[4,n=this.fnPromiseMap.get(t)];case 1:return o.sent()||(n=new Promise((function(n,o){h(r,void 0,void 0,(function(){var r,i,s;return p(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),i=n,[4,r];case 2:return i.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),o(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),y=function(){return y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},y.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},v=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},m="x-request-id",b="x-device-id",_="device_id",w=function(t,e){return g(this,void 0,void 0,(function(){var n,r,i,s,a;return v(this,(function(u){switch(u.label){case 0:n=null,r=null,u.label=1;case 1:return u.trys.push([1,4,,5]),(i=Object.assign({},e)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(t,i)];case 2:return[4,u.sent().json()];case 3:return(null==(s=u.sent())?void 0:s.error)?(r=s).error_uri=new URL(t).pathname:n=s,[3,5];case 4:return a=u.sent(),r={error:o.UNREACHABLE,error_description:a.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},E=new(function(){function t(){}return t.prototype.getItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return g(this,void 0,void 0,(function(){return v(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function S(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var I=function(){function t(t){this.credentials=null,this.singlePromise=new d,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return g(this,void 0,void 0,(function(){var e;return v(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return g(t,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return S(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return g(t,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return t=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),O=function(){function t(e){this.singlePromise=new d,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=w,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||E,this.localCredentials=new I({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return g(this,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:o.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return g(this,void 0,void 0,(function(){var r,i,s,a,u,c,f;return v(this,(function(h){switch(h.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=y(y({},this.headers),n.headers)),n.headers[m]||(n.headers[m]=l()),n.headers[b]?[3,2]:[4,this.getDeviceId()];case 1:i=h.sent(),n.headers[b]=i,h.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=h.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(s.access_token)):n.headers.Authorization="".concat(s.token_type," ").concat(s.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),h.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),a=null,u=r+1,c=0,h.label=6;case 6:if(!(c<u))return[3,15];h.label=7;case 7:return h.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return a=h.sent(),[3,15];case 9:return f=h.sent(),n.withCredentials&&f&&f.error===o.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return h.sent(),[2,Promise.reject(f)];case 11:return c!==r&&f&&"unreachable"===f.error?[3,12]:[2,Promise.reject(f)];case 12:return[4,this.sleep(t.retryInterval)];case 13:h.sent(),h.label=14;case 14:return c++,[3,6];case 15:return[2,a]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t,e,n;return v(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return S(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||!t.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==o.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:o.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==o.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return g(this,void 0,void 0,(function(){var n,r;return v(this,(function(o){switch(o.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=i.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=s.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=o.sent(),[2,y(y({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(_)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=l(),[4,this.storage.setItem(_,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:o.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}(),A=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},T=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},N=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=E),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o,i;return T(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,e)];case 3:return o=s.sent(),[3,7];case 4:return"captcha_required"!==(i=s.sent()).error&&"captcha_invalid"!==i.error?[3,6]:[4,this.appendCaptchaTokenToURL(t,n,"captcha_invalid"===i.error)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(i)];case 7:return[2,o]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t){return A(this,void 0,void 0,(function(){var e,n;return T(this,(function(r){return e=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),e.innerHTML="",n.setAttribute("src",t),n.setAttribute("id","review-panel-iframe"),n.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",e.appendChild(n),e.style.display="block",[2,new Promise((function(t,r){n.onload=function(){try{var o=window.location,i=n.contentWindow.location;if(i.host+i.pathname===o.host+o.pathname){e.style.display="none";var s=new URLSearchParams(i.search),a=s.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}e.style.display="block"}catch(t){e.style.display="block"}}}))]}))}))},t.prototype.getCaptchaToken=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o,i,s;return T(this,(function(a){switch(a.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=a.sent())return[2,n];a.label=2;case 2:return r="".concat(window.location.origin+window.location.pathname,"?__captcha=on"),[4,this.config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this.config.clientId,redirect_uri:r,state:e},withCredentials:!1})];case 3:return(o=a.sent()).captcha_token?(i={captcha_token:o.captcha_token,expires_in:o.expires_in},this.saveCaptchaToken(i),[2,o.captcha_token]):[4,this.config.openURIWithCallback(o.url)];case 4:return s=a.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(o){switch(o.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=o.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return A(this,void 0,void 0,(function(){var e;return T(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return A(this,void 0,void 0,(function(){var t,e;return T(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),e.expires_at<new Date?[2,null]:[2,e.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},t}(),R=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=R(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},L=function(){return L=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},L.apply(this,arguments)},C=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},P=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},D=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new O(r)}if(!e){var o=n.request.bind(n),i=new N({clientId:t.clientId,request:o,storage:t.storage});e=i.request.bind(i)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||E}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=R(t),o=(null===(n={v2:s}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||i[e];return r&&delete r.version,{params:r,url:o}},t.prototype.signIn=function(t){return C(this,void 0,void 0,(function(){var e,n,r;return P(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.config.request(n.url,{method:"POST",body:n.params})];case 1:return r=o.sent(),[4,this.config.credentialsClient.setCredentials(L(L({},r),{version:e}))];case 2:return o.sent(),[2,Promise.resolve(r)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.request(i.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return C(this,void 0,void 0,(function(){var t,e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(i.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(L(L({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){return e="".concat(i.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(L(L({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),C(this,void 0,void 0,(function(){var n,r,o;return P(this,(function(i){switch(i.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(o=i.sent()).sub&&(o.uid=o.sub),[2,o]}}))}))},t.prototype.getWedaUserInfo=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){switch(t.label){case 0:return[4,this.config.request(i.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return C(this,void 0,void 0,(function(){var n,r;return P(this,(function(o){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.request(i.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return t.target="CUR_USER",[2,this.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(i.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(L(L({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(i.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(L(L({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t}(),x=function(){return x=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},x.apply(this,arguments)},U=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,o=t.request,i=t.anonymousSignInFunc;this.oauth2client=new O({apiOrigin:e,clientId:n,storage:r,baseRequest:o,anonymousSignInFunc:i}),this.authApi=new D(x(x({credentialsClient:this.oauth2client},t),{request:o?this.oauth2client.request.bind(this.oauth2client):void 0}))},M=function(){return M=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},M.apply(this,arguments)},j=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},B=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},k=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},q=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},F=f.P6.xe,W=f.P6._y,G=f._G.Sg,$=f._G.vM,V=f.BM.D,H=f.U3.yE,Y="loginStateChanged",J=new H,K=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return k(this,void 0,void 0,(function(){var t,e,n,r;return q(this,(function(o){switch(o.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=o.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(M({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&W(G.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},j([V({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"update",null),j([V({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String,String]),B("design:returntype",void 0)],t.prototype,"updatePassword",null),j([V({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String]),B("design:returntype",void 0)],t.prototype,"updateUsername",null),j([V({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"refresh",null),t}(),Q=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||W(G.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new K({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),z=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}F(G.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return k(this,void 0,void 0,(function(){var t;return q(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&W(G.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return k(this,void 0,void 0,(function(){var t;return q(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),J.fire(Y),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;F(G.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return k(this,void 0,void 0,(function(){var e,n=this;return q(this,(function(r){switch(r.label){case 0:return J.on(Y,(function(){return k(n,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.createLoginState=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,(e=new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),J.fire(Y),[2,e]}}))}))},j([V({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),j([V({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"unbindProvider",null),j([V({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",void 0)],t.prototype,"bindEmail",null),j([V({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"verify",null),j([V({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"getVerification",null),j([V({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getCurrentUser",null),j([V({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signInAnonymously",null),j([V({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),j([V({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signUp",null),j([V({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String]),B("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),j([V({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"signOut",null),j([V({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getLoginState",null),j([V({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"getUserInfo",null),j([V({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),j([V({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"bindWithProvider",null),t}(),X={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return F(G.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,o=t.persistence||n.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=this.config,s=i.env,a=i.persistence,u=i.debug,c=i.clientId,f=i.storage,l=new U({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||f,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc});return this.oauthInstance=l,this.authInstance=new z({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:l}),this.authInstance}};try{cloudbase.registerComponent(X)}catch(t){}function Z(t){try{t.registerComponent(X)}catch(t){console.warn(t)}}},4797:function(t,e,n){"use strict";n.r(e),n.d(e,{registerDatabase:function(){return s}});var r=n(2881),o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o.apply(this,arguments)},i={name:"database",entity:{database:function(t){var e=this.platform,n=e.adapter,i=e.runtime;return r.Db.reqClass=this.request.constructor,r.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},r.Db.runtime=i,this.wsClientClass&&(r.Db.wsClass=n.wsClass,r.Db.wsClientClass=this.wsClientClass),r.Db.ws||(r.Db.ws=null),new r.Db(o(o(o({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(i)}catch(t){}function s(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},7338:function(t,e,n){"use strict";n.r(e),n.d(e,{registerFunctions:function(){return p}});var r=n(1142),o=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=r._G.eX,s=r._G.Sg,a=r._G.vM,u=r.P6.Gc,c=r.BM.D,f="functions",l=new(function(){function t(){}return t.prototype.callFunction=function(t,e){return n=this,r=void 0,a=function(){var n,r,o,a,c,l,h,p,d,y,g,v;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(m){switch(m.label){case 0:if(n=t.name,r=t.data,o=t.query,a=t.parse,c=t.search,!n)throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(f,".callFunction] invalid function name")}));try{l=r?JSON.stringify(r):""}catch(t){throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(f,".callFunction] invalid data")}))}h="functions.invokeFunction",p={inQuery:o,parse:a,search:c,function_name:n,request_data:l},d=this.request,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,d.send(h,p)];case 2:if((y=m.sent()).code)return[2,u(e,null,y)];if(g=y.data.response_data,a)return[2,u(e,null,{result:g,requestId:y.requestId})];try{return g=JSON.parse(y.data.response_data),[2,u(e,null,{result:g,requestId:y.requestId})]}catch(t){u(e,new Error("[".concat(i(),"][").concat(s.INVALID_PARAMS,"][").concat(f,".callFunction] response data must be json")))}return[3,4];case 3:return v=m.sent(),u(e,v),[3,4];case 4:return[2]}}))},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{u(a.next(t))}catch(t){e(t)}}function s(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,s)}u((a=a.apply(n,r||[])).next())}));var n,r,o,a},function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);i>3&&s&&Object.defineProperty(e,n,s)}([c({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(a)]}),o("design:type",Function),o("design:paramtypes",[Object,Function]),o("design:returntype",Promise)],t.prototype,"callFunction",null),t}()),h={name:f,entity:{callFunction:l.callFunction}};try{cloudbase.registerComponent(h)}catch(t){}function p(t){try{t.registerComponent(h)}catch(t){console.warn(t)}}},3337:function(t,e,n){"use strict";n.r(e),n.d(e,{registerRealtime:function(){return F}});var r=n(880),o=n.n(r),i=n(3373),s=n.n(i),a=n(9907),u=n.n(a);function c(t){return void 0===t&&(t=""),"".concat(t?"".concat(t,"_"):"").concat(+new Date,"_").concat(Math.random())}var f,l,h=function(t){this.close=t.close,this.onChange=t.onChange,this.onError=t.onError,t.debug&&Object.defineProperty(this,"virtualClient",{get:function(){return t.virtualClient}})},p=function(t){var e,n,r=t.id,o=t.docChanges,i=t.docs,s=t.msgType,a=t.type;Object.defineProperties(this,{id:{get:function(){return r},enumerable:!0},docChanges:{get:function(){return e||(e=JSON.parse(JSON.stringify(o))),e},enumerable:!0},docs:{get:function(){return n||(n=JSON.parse(JSON.stringify(i))),n},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})},d=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(t){function e(e){var n=t.call(this,"Watch Error ".concat(JSON.stringify(e.msgData)," (requestid: ").concat(e.requestId,")"))||this;return n.isRealtimeErrorMessageError=!0,n.payload=e,n}return d(e,t),e}(Error),g=function(t){return null==t?void 0:t.isRealtimeErrorMessageError},v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeout",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cancelled",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),b=function(t){function e(e){var n=t.call(this,e.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(_[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t}}}),n.errCode=e.errCode||"UNKNOWN_ERROR",n.errMsg=e.errMsg,n}return d(e,t),Object.defineProperty(e.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t},enumerable:!1,configurable:!0}),e}(Error),_={UNKNOWN_ERROR:"UNKNOWN_ERROR",SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG:"SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG",SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA:"SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED",SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL",SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR:"SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR"},w=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},E=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},I=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};!function(t){t.LOGGINGIN="LOGGINGIN",t.INITING="INITING",t.REBUILDING="REBUILDING",t.ACTIVE="ACTIVE",t.ERRORED="ERRORED",t.CLOSING="CLOSING",t.CLOSED="CLOSED",t.PAUSED="PAUSED",t.RESUMING="RESUMING"}(l||(l={}));var O=function(){function t(t){var e=this;this.watchStatus=l.INITING,this.wsLogin=function(t,n){return E(e,void 0,void 0,(function(){var e;return S(this,(function(r){switch(r.label){case 0:return this.watchStatus=l.LOGGINGIN,[4,this.login(t,n)];case 1:return e=r.sent(),this.envId||(this.envId=e.envId),[2,e]}}))}))},this.initWatch=function(t){return E(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.initWatchPromise&&void 0!==this.initWatchPromise)return[2,this.initWatchPromise];this.initWatchPromise=new Promise((function(e,r){E(n,void 0,void 0,(function(){var n,o,i,s,a,u,f,h,d,y;return S(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,4]),this.watchStatus===l.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:return n=g.sent().envId,this.watchStatus===l.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):(this.watchStatus=l.INITING,o={watchId:this.watchId,requestId:c(),msgType:"INIT_WATCH",msgData:{envId:n,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(i=g.sent(),s=i.msgData,a=s.events,u=s.currEvent,this.sessionInfo={queryID:i.msgData.queryID,currentEventId:u-1,currentDocs:[]},a.length>0){for(f=0,h=a;f<h.length;f++)h[f].ID=u;this.handleServerEvents(i)}else this.sessionInfo.currentEventId=u,d=new p({id:u,docChanges:[],docs:[],type:"init"}),this.listener.onChange(d),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=l.ACTIVE,this.availableRetries.INIT_WATCH=2,e(),[3,4];case 3:return y=g.sent(),this.handleWatchEstablishmentError(y,{operationName:"INIT_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.initWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.initWatchPromise=void 0,[7];case 4:return console.log("[realtime] initWatch ".concat(e?"success":"fail")),[2]}}))}))},this.rebuildWatch=function(t){return E(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.rebuildWatchPromise&&void 0!==this.rebuildWatchPromise)return[2,this.rebuildWatchPromise];this.rebuildWatchPromise=new Promise((function(e,r){E(n,void 0,void 0,(function(){var n,o,i,s;return S(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===l.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:if(n=a.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===l.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):(this.watchStatus=l.REBUILDING,o={watchId:this.watchId,requestId:c(),msgType:"REBUILD_WATCH",msgData:{envId:n,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return i=a.sent(),this.handleServerEvents(i),this.watchStatus=l.ACTIVE,this.availableRetries.REBUILD_WATCH=2,e(),[3,4];case 3:return s=a.sent(),this.handleWatchEstablishmentError(s,{operationName:"REBUILD_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.rebuildWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.rebuildWatchPromise=void 0,[7];case 4:return console.log("[realtime] rebuildWatch ".concat(e?"success":"fail")),[2]}}))}))},this.handleWatchEstablishmentError=function(t,n){return E(e,void 0,void 0,(function(){var e,r,o,i=this;return S(this,(function(s){return e="INIT_WATCH"===n.operationName,r=function(){i.closeWithError(new b({errCode:e?_.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:_.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:t})),n.reject(t)},o=function(t){i.useRetryTicket(n.operationName)?e?(i.initWatchPromise=void 0,n.resolve(i.initWatch(t))):(i.rebuildWatchPromise=void 0,n.resolve(i.rebuildWatch(t))):r()},this.handleCommonError(t,{onSignError:function(){return o(!0)},onTimeoutError:function(){return o(!1)},onNotRetryableError:r,onCancelledError:n.reject,onUnknownError:function(){E(i,void 0,void 0,(function(){var t,e=this;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),t=function(){return E(e,void 0,void 0,(function(){return S(this,(function(t){switch(t.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return t.sent(),o(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,t()];case 1:return r.sent(),[3,7];case 2:return[4,w(100)];case 3:return r.sent(),this.watchStatus!==l.PAUSED?[3,4]:(n.reject(new m("".concat(n.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,t()];case 5:return r.sent(),[3,7];case 6:o(!1),r.label=7;case 7:return[3,9];case 8:return r.sent(),o(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return E(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:if(t=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==l.ACTIVE)return this.watchStatus=l.CLOSED,this.onWatchClose(this,t),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=l.CLOSING,e={watchId:this.watchId,requestId:c(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:e})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=l.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:n})),[3,5];case 4:return this.onWatchClose(this,t),[7];case 5:return[2]}}))}))},this.scheduleSendACK=function(){e.clearACKSchedule(),e.ackTimeoutId=setTimeout((function(){e.waitExpectedTimeoutId?e.scheduleSendACK():e.sendACK()}),1e4)},this.clearACKSchedule=function(){e.ackTimeoutId&&clearTimeout(e.ackTimeoutId)},this.sendACK=function(){return E(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==l.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(t={watchId:this.watchId,requestId:c(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:t})]):(console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)"),[2]);case 1:return r.sent(),this.scheduleSendACK(),[3,3];case 2:if(e=r.sent(),g(e))switch((n=e.payload).msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return this.rebuildWatch(),[2];case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:n.msgData.code})),[2]}return this.availableRetries.CHECK_LAST&&this.availableRetries.CHECK_LAST>0?(this.availableRetries.CHECK_LAST-=1,this.scheduleSendACK()):this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:e})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(t,e){if(g(t))switch(t.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void e.onSignError(t);default:return void e.onNotRetryableError(t)}else{if(function(t){return"timeout"===t.type}(t))return void e.onTimeoutError(t);if(function(t){return"cancelled"===t.type}(t))return void e.onCancelledError(t)}e.onUnknownError(t)},this.watchId="watchid_".concat(+new Date,"_").concat(Math.random()),this.envId=t.envId,this.collectionName=t.collectionName,this.query=t.query,this.limit=t.limit,this.orderBy=t.orderBy,this.send=t.send,this.login=t.login,this.isWSConnected=t.isWSConnected,this.onceWSConnected=t.onceWSConnected,this.getWaitExpectedTimeoutLength=t.getWaitExpectedTimeoutLength,this.onWatchStart=t.onWatchStart,this.onWatchClose=t.onWatchClose,this.debug=t.debug,this.availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new h({close:function(){e.closeWatch()},onChange:t.onChange,onError:t.onError,debug:this.debug,virtualClient:this}),this.initWatch()}return t.prototype.onMessage=function(t){var e=this;switch(this.watchStatus){case l.PAUSED:if("ERROR"!==t.msgType)return;break;case l.LOGGINGIN:case l.INITING:case l.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case l.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case l.ERRORED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has ended with error")}if(this.sessionInfo)switch(this.scheduleSendACK(),t.msgType){case"NEXT_EVENT":console.warn("nextevent ".concat(t.msgData.currEvent," ignored"),t),this.handleServerEvents(t);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<t.msgData.currEvent&&(this.sessionInfo.expectEventId=t.msgData.currEvent,this.clearWaitExpectedEvent(),this.waitExpectedTimeoutId=setTimeout((function(){e.rebuildWatch()}),this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength ".concat(this.getWaitExpectedTimeoutLength())));break;case"ERROR":this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:"".concat(t.msgData.code," - ").concat(t.msgData.message)}));break;default:console.warn("[realtime listener] virtual client receive unexpected msg ".concat(t.msgType,": "),t)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")},t.prototype.closeWithError=function(t){var e;this.watchStatus=l.ERRORED,this.clearACKSchedule(),this.listener.onError(t),this.onWatchClose(this,(null===(e=this.sessionInfo)||void 0===e?void 0:e.queryID)||""),console.log("[realtime] client closed (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.pause=function(){this.watchStatus=l.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.resume=function(){return E(this,void 0,void 0,(function(){var t;return S(this,(function(e){switch(e.label){case 0:this.watchStatus=l.RESUMING,console.log("[realtime] client resuming with ".concat(this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"," (").concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.sessionInfo?this.rebuildWatch():this.initWatch()];case 2:return e.sent(),console.log("[realtime] client successfully resumed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),[3,4];case 3:return t=e.sent(),console.error("[realtime] client resume failed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")"),t),[3,4];case 4:return[2]}}))}))},t.prototype.useRetryTicket=function(t){return!!(this.availableRetries[t]&&this.availableRetries[t]>0)&&(this.availableRetries[t]-=1,console.log("[realtime] ".concat(t," use a retry ticket, now only ").concat(this.availableRetries[t]," retry left")),!0)},t.prototype.handleServerEvents=function(t){return E(this,void 0,void 0,(function(){var e;return S(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this.handleServerEventsInternel(t)];case 1:return n.sent(),this.postHandleServerEventsValidityCheck(t),[3,3];case 2:throw e=n.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",e),e;case 3:return[2]}}))}))},t.prototype.handleServerEventsInternel=function(t){return E(this,void 0,void 0,(function(){var e,n,r,i,a,c,f,l,h,d,y,g;return S(this,(function(v){switch(v.label){case 0:if(e=t.requestId,n=t.msgData.events,r=t.msgType,!n.length||!this.sessionInfo)return[2];i=this.sessionInfo;try{a=n.map(A)}catch(t){return this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:t})),[2]}c=I([],i.currentDocs,!0),f=!1,l=function(n,l){var d,y,g,v,m,w,E,O,A,T,N,R;return S(this,(function(S){switch(S.label){case 0:return d=a[n],i.currentEventId>=d.id?(!a[n-1]||d.id>a[n-1].id?console.warn("[realtime] duplicate event received, cur ".concat(i.currentEventId," but got ").concat(d.id)):console.error("[realtime listener] server non-fatal error: events out of order (the latter event's id is smaller than that of the former) (requestId ".concat(e,")")),[2,"continue"]):[3,1];case 1:if(i.currentEventId!==d.id-1)return[3,2];switch(d.dataType){case"update":if(!d.doc)switch(d.queueType){case"update":case"dequeue":if(y=c.find((function(t){return t._id===d.docId})),y){if(g=u()(y),d.updatedFields&&Object.keys(d.updatedFields).forEach((function(t){o()(g,t,d.updatedFields[t])})),d.removedFields)for(v=0,m=d.removedFields;v<m.length;v++)w=m[v],s()(g,w);d.doc=g}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O}break;case"replace":if(!d.doc)throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O;break;case"remove":(E=c.find((function(t){return t._id===d.docId})))?d.doc=E:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!d.doc)switch(d.queueType){case"dequeue":(E=c.find((function(t){return t._id===d.docId})))?d.doc=E:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O}}switch(d.queueType){case"init":f?c.push(d.doc):(f=!0,c=[d.doc]);break;case"enqueue":c.push(d.doc);break;case"dequeue":A=c.findIndex((function(t){return t._id===d.docId})),A>-1?c.splice(A,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":A=c.findIndex((function(t){return t._id===d.docId})),A>-1?c[A]=d.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(n===l-1||a[n+1]&&a[n+1].id!==d.id)&&(T=I([],c,!0),N=a.slice(0,n+1).filter((function(t){return t.id===d.id})),h.sessionInfo.currentEventId=d.id,h.sessionInfo.currentDocs=c,R=new p({id:d.id,docChanges:N,docs:T,msgType:r}),h.listener.onChange(R)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(h.sessionInfo.currentEventId," but got ").concat(d.id)),[4,h.rebuildWatch()];case 3:return S.sent(),[2,{value:void 0}];case 4:return[2]}}))},h=this,d=0,y=a.length,v.label=1;case 1:return d<y?[5,l(d,y)]:[3,4];case 2:if("object"==typeof(g=v.sent()))return[2,g.value];v.label=3;case 3:return d++,[3,1];case 4:return[2]}}))}))},t.prototype.postHandleServerEventsValidityCheck=function(t){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<t.msgData.currEvent&&console.warn("[realtime listener] internal non-fatal error: client eventId does not match with server event id after server event handling")):console.error("[realtime listener] internal non-fatal error: sessionInfo lost after server event handling, this should never occur")},t.prototype.clearWaitExpectedEvent=function(){this.waitExpectedTimeoutId&&(clearTimeout(this.waitExpectedTimeoutId),this.waitExpectedTimeoutId=void 0)},t}();function A(t){var e={id:t.ID,dataType:t.DataType,queueType:t.QueueType,docId:t.DocID,doc:t.Doc&&"{}"!==t.Doc?JSON.parse(t.Doc):void 0};return"update"===t.DataType&&(t.UpdatedFields&&(e.updatedFields=JSON.parse(t.UpdatedFields)),(t.removedFields||t.RemovedFields)&&(e.removedFields=JSON.parse(t.removedFields))),e}var T,N={1e3:{code:1e3,name:"Normal Closure",description:"Normal closure; the connection successfully completed whatever purpose for which it was created."},1001:{code:1001,name:"Going Away",description:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{code:1002,name:"Protocol Error",description:"The endpoint is terminating the connection due to a protocol error."},1003:{code:1003,name:"Unsupported Data",description:"The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data)."},1005:{code:1005,name:"No Status Received",description:"Indicates that no status code was provided even though one was expected."},1006:{code:1006,name:"Abnormal Closure",description:"Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{code:1007,name:"Invalid frame payload data",description:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{code:1008,name:"Policy Violation",description:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{code:1009,name:"Message too big",description:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{code:1010,name:"Missing Extension",description:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{code:1011,name:"Internal Error",description:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{code:1012,name:"Service Restart",description:"The server is terminating the connection because it is restarting."},1013:{code:1013,name:"Try Again Later",description:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{code:1014,name:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{code:1015,name:"TLS Handshake",description:"Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},3e3:{code:3e3,name:"Reconnect WebSocket",description:"The client is terminating the connection because it wants to reconnect"},3001:{code:3001,name:"No Realtime Listeners",description:"The client is terminating the connection because no more realtime listeners exist"},3002:{code:3002,name:"Heartbeat Ping Error",description:"The client is terminating the connection due to its failure in sending heartbeat messages"},3003:{code:3003,name:"Heartbeat Pong Timeout Error",description:"The client is terminating the connection because no heartbeat response is received from the server"},3050:{code:3050,name:"Server Close",description:"The client is terminating the connection because no heartbeat response is received from the server"}};!function(t){t[t.NormalClosure=1e3]="NormalClosure",t[t.GoingAway=1001]="GoingAway",t[t.ProtocolError=1002]="ProtocolError",t[t.UnsupportedData=1003]="UnsupportedData",t[t.NoStatusReceived=1005]="NoStatusReceived",t[t.AbnormalClosure=1006]="AbnormalClosure",t[t.InvalidFramePayloadData=1007]="InvalidFramePayloadData",t[t.PolicyViolation=1008]="PolicyViolation",t[t.MessageTooBig=1009]="MessageTooBig",t[t.MissingExtension=1010]="MissingExtension",t[t.InternalError=1011]="InternalError",t[t.ServiceRestart=1012]="ServiceRestart",t[t.TryAgainLater=1013]="TryAgainLater",t[t.BadGateway=1014]="BadGateway",t[t.TLSHandshake=1015]="TLSHandshake",t[t.ReconnectWebSocket=3e3]="ReconnectWebSocket",t[t.NoRealtimeListeners=3001]="NoRealtimeListeners",t[t.HeartbeatPingError=3002]="HeartbeatPingError",t[t.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",t[t.NoAuthentication=3050]="NoAuthentication"}(T||(T={}));var R=function(t,e){var n=N[t],r=n?"".concat(n.name,", code ").concat(t,", reason ").concat(e||n.description):"code ".concat(t);return new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},L=null,C="web";function P(){return L}function D(){return C}function x(t){C=t}var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},U.apply(this,arguments)},M=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},j=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},B=function(){function t(t){var e=this;this.virtualWSClient=new Set,this.queryIdClientMap=new Map,this.watchIdClientMap=new Map,this.pingFailed=0,this.pongMissed=0,this.logins=new Map,this.wsReadySubsribers=[],this.wsResponseWait=new Map,this.rttObserved=[],this.send=function(t){return M(e,void 0,void 0,(function(){var e=this;return j(this,(function(n){return[2,new Promise((function(n,r){M(e,void 0,void 0,(function(){var e,o,i,s,a,u,c,f,l=this;return j(this,(function(h){switch(h.label){case 0:o=!1,i=!1,s=function(t){o=!0,e&&clearTimeout(e),n(t)},a=function(t){i=!0,e&&clearTimeout(e),r(t)},t.timeout&&(e=setTimeout((function(){M(l,void 0,void 0,(function(){return j(this,(function(t){switch(t.label){case 0:return o&&i?[3,2]:[4,w(0)];case 1:t.sent(),o&&i||a(new v("wsclient.send timedout")),t.label=2;case 2:return[2]}}))}))}),t.timeout)),h.label=1;case 1:return h.trys.push([1,8,,9]),void 0===this.wsInitPromise&&null===this.wsInitPromise?[3,3]:[4,this.wsInitPromise];case 2:h.sent(),h.label=3;case 3:if(!this.ws)return a(new Error("invalid state: ws connection not exists, can not send message")),[2];if(1!==this.ws.readyState)return a(new Error("ws readyState invalid: ".concat(this.ws.readyState,", can not send message"))),[2];t.waitResponse&&(u={resolve:s,reject:a,skipOnMessage:t.skipOnMessage},this.wsResponseWait.set(t.msg.requestId,u)),h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.ws.send(JSON.stringify(t.msg))];case 5:return h.sent(),t.waitResponse||s(void 0),[3,7];case 6:return(c=h.sent())&&(a(c),t.waitResponse&&this.wsResponseWait.delete(t.msg.requestId)),[3,7];case 7:return[3,9];case 8:return f=h.sent(),a(f),[3,9];case 9:return[2]}}))}))}))]}))}))},this.closeAllClients=function(t){e.virtualWSClient.forEach((function(e){e.closeWithError(t)}))},this.pauseClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.pause()}))},this.resumeClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.resume()}))},this.initWebSocketConnection=function(t,n){return void 0===n&&(n=e.maxReconnect),M(e,void 0,void 0,(function(){var e=this;return j(this,(function(r){switch(r.label){case 0:if(t&&this.reconnectState)return[2];if(t&&(this.reconnectState=!0),void 0!==this.wsInitPromise&&null!==this.wsInitPromise)return[2,this.wsInitPromise];t&&this.pauseClients(),this.close(T.ReconnectWebSocket),this.wsInitPromise=new Promise((function(r,o){M(e,void 0,void 0,(function(){var e,i,s=this;return j(this,(function(a){switch(a.label){case 0:return a.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return e=a.sent(),[4,new Promise((function(t){var n=e.wsUrl||"wss://tcb-ws.tencentcloudapi.com",r=P();s.ws=r?new r(n):new WebSocket(n),t(void 0)}))];case 2:return a.sent(),this.ws.connect?[4,this.ws.connect()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return a.sent(),r(),t&&(this.resumeClients(),this.reconnectState=!1),[3,11];case 6:return i=a.sent(),console.error("[realtime] initWebSocketConnection connect fail",i),n>0?(this.wsInitPromise=void 0,[4,w(this.reconnectInterval)]):[3,9];case 7:a.sent(),t&&(this.reconnectState=!1),a.label=8;case 8:return r(this.initWebSocketConnection(t,n-1)),[3,10];case 9:o(i),t&&this.closeAllClients(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:i})),a.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.wsInitPromise];case 2:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.resolve)()})),[3,5];case 3:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.reject)()})),[3,5];case 4:return this.wsInitPromise=void 0,this.wsReadySubsribers=[],[7];case 5:return[2]}}))}))},this.initWebSocketEvent=function(){return new Promise((function(t,n){if(!e.ws)throw new Error("can not initWebSocketEvent, ws not exists");var r=!1;e.ws.onopen=function(e){console.warn("[realtime] ws event: open",e),r=!0,t()},e.ws.onerror=function(t){e.logins=new Map,r?(console.error("[realtime] ws event: error",t),e.clearHeartbeat(),e.virtualWSClient.forEach((function(e){return e.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:t}))}))):(console.error("[realtime] ws open failed with ws event: error",t),n(t))},e.ws.onclose=function(t){switch(console.warn("[realtime] ws event: close",t),e.logins=new Map,e.clearHeartbeat(),t.code){case T.ReconnectWebSocket:case T.NoRealtimeListeners:break;case T.HeartbeatPingError:case T.HeartbeatPongTimeoutError:case T.NormalClosure:case T.AbnormalClosure:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(R(t.code));break;case T.NoAuthentication:e.closeAllClients(R(t.code,t.reason));break;default:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(R(t.code))}},e.ws.onmessage=function(t){var n,r=t.data;e.heartbeat();try{n=JSON.parse(r)}catch(t){throw new Error("[realtime] onMessage parse res.data error: ".concat(t))}if("ERROR"===n.msgType){var o=null;e.virtualWSClient.forEach((function(t){t.watchId===n.watchId&&(o=t)})),o&&o.listener.onError(n)}var i=e.wsResponseWait.get(n.requestId);if(i){try{"ERROR"===n.msgType?i.reject(new y(n)):i.resolve(n)}catch(t){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",t)}finally{e.wsResponseWait.delete(n.requestId)}if(i.skipOnMessage)return}if("PONG"!==n.msgType){var s=n.watchId&&e.watchIdClientMap.get(n.watchId);if(s)s.onMessage(n);else switch(console.error("[realtime] no realtime listener found responsible for watchId ".concat(n.watchId,": "),n),n.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":(s=e.queryIdClientMap.get(n.msgData.queryID))&&s.onMessage(n);break;default:for(var a=0,u=Array.from(e.watchIdClientMap.entries());a<u.length;a++){u[a][1].onMessage(n);break}}}else if(e.lastPingSendTS){var c=Date.now()-e.lastPingSendTS;if(c>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(c));e.rttObserved.length>=3&&e.rttObserved.splice(0,e.rttObserved.length-3+1),e.rttObserved.push(c)}},e.heartbeat()}))},this.isWSConnected=function(){return Boolean(e.ws&&1===e.ws.readyState)},this.onceWSConnected=function(){return M(e,void 0,void 0,(function(){var t=this;return j(this,(function(e){return this.isWSConnected()?[2]:null!==this.wsInitPromise&&void 0!==this.wsInitPromise?[2,this.wsInitPromise]:[2,new Promise((function(e,n){t.wsReadySubsribers.push({resolve:e,reject:n})}))]}))}))},this.webLogin=function(t,n){return M(e,void 0,void 0,(function(){var e,r,o,i,s,a,u,f,l=this;return j(this,(function(h){switch(h.label){case 0:if(!n)if(t){if(e=this.logins.get(t)){if(e.loggedIn&&e.loginResult)return[2,e.loginResult];if(null!==e.loggingInPromise&&void 0!==e.loggingInPromise)return[2,e.loggingInPromise]}}else if(null!==(null==(r=this.logins.get(""))?void 0:r.loggingInPromise)&&void 0!==(null==r?void 0:r.loggingInPromise))return[2,r.loggingInPromise];o=new Promise((function(t,e){M(l,void 0,void 0,(function(){var n,r,o,i,s;return j(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return n=a.sent(),r={envId:n.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},o={watchId:void 0,requestId:c(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:D(),signStr:n.signStr,secretVersion:n.secretVersion}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(i=a.sent()).msgData.code?e(new Error("".concat(i.msgData.code," ").concat(i.msgData.message))):t({envId:n.envId}),[3,4];case 3:return s=a.sent(),e(s),[3,4];case 4:return[2]}}))}))})),i=t&&this.logins.get(t),s=Date.now(),i?(i.loggedIn=!1,i.loggingInPromise=o,i.loginStartTS=s):(i={loggedIn:!1,loggingInPromise:o,loginStartTS:s},this.logins.set(t||"",i)),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,o];case 2:if(a=h.sent(),(u=t&&this.logins.get(t))&&u===i&&u.loginStartTS===s)return i.loggedIn=!0,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=a,[2,a];if(u){if(u.loggedIn&&u.loginResult)return[2,u.loginResult];if(null!==u.loggingInPromise&&void 0!==u.loggingInPromise)return[2,u.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw f=h.sent(),i.loggedIn=!1,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=void 0,f;case 4:return[2]}}))}))},this.getWsSign=function(){return M(e,void 0,void 0,(function(){var t,e,n,r,o,i,s;return j(this,(function(a){switch(a.label){case 0:return this.wsSign&&this.wsSign.expiredTs>Date.now()?[2,this.wsSign]:(t=Date.now()+6e4,[4,this.context.appConfig.request.send("auth.wsWebSign",{runtime:D()})]);case 1:if((e=a.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(e.code));if(e.data)return n=e.data,r=n.signStr,o=n.wsUrl,i=n.secretVersion,s=n.envId,[2,{signStr:r,wsUrl:o,secretVersion:i,envId:s,expiredTs:t}];throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")}}))}))},this.getWaitExpectedTimeoutLength=function(){return e.rttObserved.length?e.rttObserved.reduce((function(t,e){return t+e}))/e.rttObserved.length*1.5:5e3},this.ping=function(){return M(e,void 0,void 0,(function(){var t;return j(this,(function(e){switch(e.label){case 0:return t={watchId:void 0,requestId:c(),msgType:"PING",msgData:null},[4,this.send({msg:t})];case 1:return e.sent(),[2]}}))}))},this.onWatchStart=function(t,n){e.queryIdClientMap.set(n,t)},this.onWatchClose=function(t,n){n&&e.queryIdClientMap.delete(n),e.watchIdClientMap.delete(t.watchId),e.virtualWSClient.delete(t),e.virtualWSClient.size||e.close(T.NoRealtimeListeners)},this.maxReconnect=t.maxReconnect||5,this.reconnectInterval=t.reconnectInterval||1e4,this.context=t.context}return t.prototype.clearHeartbeat=function(){this.pingTimeoutId&&clearTimeout(this.pingTimeoutId),this.pongTimeoutId&&clearTimeout(this.pongTimeoutId)},t.prototype.close=function(t){this.clearHeartbeat(),this.ws&&(this.ws.close(t,N[t].name),this.ws=void 0)},t.prototype.watch=function(t){this.ws||void 0!==this.wsInitPromise&&null!==this.wsInitPromise||this.initWebSocketConnection(!1);var e=new O(U(U({},t),{send:this.send,login:this.webLogin,isWSConnected:this.isWSConnected,onceWSConnected:this.onceWSConnected,getWaitExpectedTimeoutLength:this.getWaitExpectedTimeoutLength,onWatchStart:this.onWatchStart,onWatchClose:this.onWatchClose,debug:!0}));return this.virtualWSClient.add(e),this.watchIdClientMap.set(e.watchId,e),e.listener},t.prototype.heartbeat=function(t){var e=this;this.clearHeartbeat(),this.pingTimeoutId=setTimeout((function(){M(e,void 0,void 0,(function(){var t=this;return j(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.ws&&1===this.ws.readyState?(this.lastPingSendTS=Date.now(),[4,this.ping()]):[2];case 1:return e.sent(),this.pingFailed=0,this.pongTimeoutId=setTimeout((function(){console.error("pong timed out"),t.pongMissed<2?(t.pongMissed+=1,t.heartbeat(!0)):t.initWebSocketConnection(!0)}),this.context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return e.sent(),this.pingFailed<2?(this.pingFailed+=1,this.heartbeat()):this.close(T.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),t?0:this.context.appConfig.realtimePingInterval)},t}(),k={target:"database",entity:function(){var t,e=this.platform,n=e.adapter,r=e.runtime;t=n.wsClass,L=t,x(r)}},q={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=B}};try{cloudbase.registerComponent(q),cloudbase.registerHook(k)}catch(t){}function F(t){try{t.registerComponent(q),t.registerHook(k)}catch(t){console.warn(t)}}},7766:function(t,e,n){"use strict";n.r(e),n.d(e,{registerStorage:function(){return w}});var r,o=n(1142),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},s=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},c=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};!function(t){t.put="put",t.post="post"}(r||(r={}));var f=o._G.eX,l=o._G.Sg,h=o._G.vM,p=o.P6.kJ,d=o.P6.HD,y=o.P6.JV,g=o.P6.Gc,v=o.BM.D,m="storage",b=new(function(){function t(){}return t.prototype.uploadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,o,s,a,u,h,p,y,v,b,_,w,E,S,I,O,A,T,N,R,L,C,P,D,x;return c(this,(function(c){switch(c.label){case 0:if(n=t.cloudPath,o=t.filePath,s=t.onUploadProgress,a=t.method,u=void 0===a?"put":a,h=t.headers,p=void 0===h?{}:h,!d(n)||!o)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".uploadFile] invalid params")}));return y={put:r.put,post:r.post}[u.toLocaleLowerCase()]||r.put,v=this.request,b={path:n,method:y},y===r.put&&(b.headers=p),[4,v.send("storage.getUploadMetadata",b)];case 1:return _=c.sent(),w=_.data,E=w.url,S=w.authorization,I=w.token,O=w.fileId,A=w.cosFileId,T=w.download_url,N=_.requestId,L=i(i({},R={url:E,file:o,name:n,onUploadProgress:s}),{method:r.put,headers:i(i({},p),{authorization:S,"x-cos-meta-fileid":A,"x-cos-security-token":I})}),C=i(i({},R),{method:r.post,data:{key:n,signature:S,"x-cos-meta-fileid":A,success_action_status:"201","x-cos-security-token":I}}),(x={})[r.put]={params:L,isSuccess:function(t){return t>=200&&t<300}},x[r.post]={params:C,isSuccess:function(t){return 201===t}},P=x,[4,v.upload(P[y].params)];case 2:return D=c.sent(),P[y].isSuccess(D.statusCode)?[2,g(e,null,{fileID:O,download_url:T,requestId:N})]:[2,g(e,new Error("[".concat(f(),"][").concat(l.OPERATION_FAIL,"][").concat(m,"]:").concat(D.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s;return c(this,(function(a){switch(a.label){case 0:if(n=t.cloudPath,!d(n))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getUploadMetadata] invalid cloudPath")}));r=this.request,o="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(o,{path:n})];case 2:return i=a.sent(),[2,g(e,null,i)];case 3:return s=a.sent(),[2,g(e,s)];case 4:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileList must not be empty")}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!d(i))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=u.sent()).code?[2,g(e,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,g(e,null,a)])}}))}))},t.prototype.getTempFileURL=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++)if(s=i[o],y(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!d(s))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] invalid fileList")}));r.push({fileid:s})}return[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=u.sent()).code?[2,g(e,null,a)]:[2,g(e,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},t.prototype.downloadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(n=t.fileID,!d(n))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=u.sent(),"SUCCESS"!==(o=r.fileList[0]).code?[2,g(e,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=u.sent(),[2,g(e,null,a)]}}))}))},s([v({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"uploadFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getUploadMetadata",null),s([v({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"deleteFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getTempFileURL",null),s([v({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"downloadFile",null),t}()),_={name:m,entity:{uploadFile:b.uploadFile,deleteFile:b.deleteFile,getTempFileURL:b.getTempFileURL,downloadFile:b.downloadFile,getUploadMetadata:b.getUploadMetadata}};try{cloudbase.registerComponent(_)}catch(t){}function w(t){try{t.registerComponent(_)}catch(t){console.warn(t)}}},1142:function(t,e,n){"use strict";n.d(e,{j$:function(){return i},Fs:function(){return s},_G:function(){return r},U3:function(){return a},BM:function(){return u},P6:function(){return o}});var r={};n.r(r),n.d(r,{vM:function(){return y},Sg:function(){return g},Fk:function(){return d},eX:function(){return l},pM:function(){return p},tC:function(){return f}});var o={};n.r(o),n.d(o,{Gc:function(){return A},CN:function(){return I},Jc:function(){return S},kJ:function(){return m},hp:function(){return E},V9:function(){return w},JV:function(){return _},HD:function(){return b},Jz:function(){return R},xe:function(){return T},_y:function(){return N},UK:function(){return O}});var i={};n.r(i),n.d(i,{Fk:function(){return U},xY:function(){return M}});var s={};n.r(s),n.d(s,{q:function(){return F}});var a={};n.r(a),n.d(a,{yE:function(){return V}});var u={};n.r(u),n.d(u,{D:function(){return z}});var c="@cloudbase/js-sdk";function f(t){c=t}function l(){return c}var h="https:";function p(t){h=t}var d=!1,y="https://support.qq.com/products/148793",g={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},v=n(2829);function m(t){return"[object Array]"===Object.prototype.toString.call(t)}function b(t){return"string"==typeof t}function _(t){return"[object Object]"===Object.prototype.toString.call(t)}function w(t,e){return t instanceof e}function E(t){return"[object FormData]"===Object.prototype.toString.call(t)}function S(){return Math.random().toString(16).slice(2)}function I(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}function O(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}function A(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n}function T(t,e){console.warn("[".concat(l(),"][").concat(t,"]:").concat(e))}function N(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(l(),"][").concat(t,"]:").concat(e)}))}function R(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,o=t.content,i=void 0===o?[]:o,s=t.printTrace,a=void 0!==s&&s,u=t.collapsed;void 0!==u&&u?console.groupCollapsed(e,r):console.group(e,r);for(var c=0,f=i;c<f.length;c++){var l=f[c],h=l.type,p=l.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()}var L,C,P=(L=function(t,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},L(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}L(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(){return D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},D.apply(this,arguments)},x=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return P(e,t),e.prototype.get=function(t){return this.request(D(D({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(D(D({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(D(D({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(D(D({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(D(D({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,o=function(){var e,n,r,o;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(D(D({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,u=t.headers,c=void 0===u?{}:u,f=t.data,l=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,g=I(h,a,"get"===r?f:{}),v=new XMLHttpRequest;v.open(r,g),l&&(v.responseType=l),Object.keys(c).forEach((function(t){v.setRequestHeader(t,c[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=v.status;try{t.data="blob"===l?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===l?v.response:v.responseText}clearTimeout(i),o(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=E(f)?f:"application/x-www-form-urlencoded"===c["content-type"]?O(f):d||(f?JSON.stringify(f):void 0),p&&(v.withCredentials=!0),v.send(s)}))},e}(v.jJ);function U(t){for(var e=0,n=m(t)?t:[t];e<n.length;e++){var r=n[e],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}}function M(){return{adapter:{root:window,reqClass:x,wsClass:WebSocket,localStorage:localStorage},runtime:C.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(C||(C={}));var j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),B=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},k=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},q=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return j(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}(v.x_),F=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(T(g.INVALID_PARAMS,"localStorage is not supported on current platform"),new q(e.root));case"none":return new q(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:g.OPERATION_FAIL,msg:"[".concat(l(),"][").concat(g.OPERATION_FAIL,"]setStore failed"),info:t}))}}else T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return B(this,void 0,void 0,(function(){var r;return k(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]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return B(this,void 0,void 0,(function(){var r;return k(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return B(this,void 0,void 0,(function(){return k(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),W=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),G=function(t,e){this.data=e||null,this.name=t},$=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return W(e,t),e}(G),V=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(w(t,$))return console.error(t.error),this;var n=b(t)?new G(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];o<i.length;o++)i[o].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new V;var H=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Y=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},J=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(J=-1!==navigator.userAgent.indexOf("Firefox"));var K=J?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,Q=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function z(t){var e=t.mode,n=void 0===e?"async":e,r=t.customInfo,o=void 0===r?{}:r,i=t.title,s=t.messages,a=void 0===s?[]:s;return function(t,e,r){if(d){var s=o.className||t.constructor.name,u=o.methodName||e,c=r.value,f=function(t){var e="",n=(new Error).stack.split("\n"),r=n.findIndex((function(t){return K.test(t)}));if(-1!==r){var o=Q.exec(n[r+1]||"");e=o?o[0]:""}return e}();r.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=X({err:new Error,className:s,methodName:u,sourceLink:f});try{return c.apply(this,t)}catch(t){var r=t,o=t.message,l=t.error,h=t.error_description,p={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var d=JSON.parse(o);p.subtitle=o,d.code&&(n?(n.code=d.code,n.msg=d.msg):(t.code=d.code,t.message=d.msg),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}})))}throw l&&h&&(p.subtitle=h,n?(n.code=l,n.msg=h):(t.code=l,t.message=h),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}}))),R(p),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H(this,void 0,void 0,(function(){var e,n,r,o,l,h,p,d;return Y(this,(function(y){switch(y.label){case 0:e=X({err:new Error,className:s,methodName:u,sourceLink:f}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,c.apply(this,t)];case 2:return[2,y.sent()];case 3:throw n=y.sent(),r=n,o=n.message,l=n.error,h=n.error_description,p={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:n}]},o&&/^\{.*\}$/.test(o)&&(d=JSON.parse(o),p.subtitle=d,d.code&&(e?(e.code=d.code,e.message=d.msg):(n.code=d.code,n.message=d.msg),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}})))),l&&h&&(p.subtitle=h,e?(e.code=l,e.msg=h):(n.code=l,n.message=h),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}}))),R(p),r;case 4:return[2]}}))}))}}}}function X(t){var e=t.err,n=t.className,r=t.methodName,o=t.sourceLink;if(!o)return null;var i,s=e.stack.split("\n"),a=J?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),u=J?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),c=s.findIndex((function(t){return a.test(t)}));if(-1!==c){var f=s.filter((function(t,e){return e>c}));f.unshift(s[c].replace(u,"".concat(n,".").concat(r)).replace(Q,o)),(i=new Error).stack="".concat(J?"@debugger":"Error","\n").concat(f.join("\n"))}return i}function Z(t){this.message=t}function tt(t){this.message=t}Z.prototype=new Error,Z.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),tt.prototype=new Error,tt.prototype.name="InvalidTokenError"},8656:function(t,e,n){"use strict";n.r(e),n.d(e,{BSONError:function(){return _},BSONRegExp:function(){return ee},BSONSymbol:function(){return ne},BSONTypeError:function(){return w},BSON_BINARY_SUBTYPE_BYTE_ARRAY:function(){return yt},BSON_BINARY_SUBTYPE_COLUMN:function(){return _t},BSON_BINARY_SUBTYPE_DEFAULT:function(){return pt},BSON_BINARY_SUBTYPE_ENCRYPTED:function(){return bt},BSON_BINARY_SUBTYPE_FUNCTION:function(){return dt},BSON_BINARY_SUBTYPE_MD5:function(){return mt},BSON_BINARY_SUBTYPE_USER_DEFINED:function(){return wt},BSON_BINARY_SUBTYPE_UUID:function(){return gt},BSON_BINARY_SUBTYPE_UUID_NEW:function(){return vt},BSON_DATA_ARRAY:function(){return K},BSON_DATA_BINARY:function(){return Q},BSON_DATA_BOOLEAN:function(){return Z},BSON_DATA_CODE:function(){return ot},BSON_DATA_CODE_W_SCOPE:function(){return st},BSON_DATA_DATE:function(){return tt},BSON_DATA_DBPOINTER:function(){return rt},BSON_DATA_DECIMAL128:function(){return ft},BSON_DATA_INT:function(){return at},BSON_DATA_LONG:function(){return ct},BSON_DATA_MAX_KEY:function(){return ht},BSON_DATA_MIN_KEY:function(){return lt},BSON_DATA_NULL:function(){return et},BSON_DATA_NUMBER:function(){return H},BSON_DATA_OBJECT:function(){return J},BSON_DATA_OID:function(){return X},BSON_DATA_REGEXP:function(){return nt},BSON_DATA_STRING:function(){return Y},BSON_DATA_SYMBOL:function(){return it},BSON_DATA_TIMESTAMP:function(){return ut},BSON_DATA_UNDEFINED:function(){return z},BSON_INT32_MAX:function(){return q},BSON_INT32_MIN:function(){return F},BSON_INT64_MAX:function(){return W},BSON_INT64_MIN:function(){return G},Binary:function(){return Et},Code:function(){return It},DBRef:function(){return At},Decimal128:function(){return Ht},Double:function(){return Yt},EJSON:function(){return de},Int32:function(){return Jt},Long:function(){return Dt},LongWithoutOverridesClass:function(){return re},Map:function(){return ye},MaxKey:function(){return Kt},MinKey:function(){return Qt},ObjectID:function(){return te},ObjectId:function(){return te},Timestamp:function(){return oe},UUID:function(){return St},calculateObjectSize:function(){return gn},deserialize:function(){return yn},deserializeStream:function(){return vn},serialize:function(){return pn},serializeWithBufferAndIndex:function(){return dn},setInternalBufferSize:function(){return hn}});for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],o[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var o,i,s=[],a=e;a<n;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var l=function(t){var e,n,r=c(t),s=r[0],a=r[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),f=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===a&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,u[f++]=255&e),1===a&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},h=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(f(t,a,a+s>u?u:a+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")},p=function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,f=-7,l=n?o-1:0,h=n?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+t[e+l],l+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=c}return(p?-1:1)*s*Math.pow(2,i-r)},d=function(t,e,n,r,o,i){var s,a,u,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,o),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;t[n+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[n+p]=255&s,p+=d,s/=256,c-=8);t[n+p-d]|=128*y},y=function(t,e){return function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=i,e.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function o(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,i.prototype),e}function i(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|g(t,e),r=o(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){var e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return i.from(r,e,n);var s=function(t){if(i.isBuffer(t)){var e=0|y(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||G(t.length)?o(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return a(t),o(t<0?0:0|y(t))}function c(t){for(var e=t.length<0?0:0|y(t.length),n=o(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,i.prototype),r}function y(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(o)return r?-1:k(t).length;e=(""+e).toLowerCase(),o=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=i.from(e,r)),i.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,o){var i,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var f=-1;for(i=n;i<a;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===u)return f*s}else-1!==f&&(i-=i-f),f=-1}else for(n+u>a&&(n=a-u),i=n;i>=0;i--){for(var l=!0,h=0;h<u;h++)if(c(t,i+h)!==c(e,h)){l=!1;break}if(l)return i}return-1}function w(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(G(a))return s;t[n+s]=a}return s}function E(t,e,n,r){return F(k(e,t.length-n),t,n,r)}function S(t,e,n,r){return F(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function I(t,e,n,r){return F(q(e),t,n,r)}function O(t,e,n,r){return F(function(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?h(t):h(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,s,a,u,c=t[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(f=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),o+=l}return function(t){var e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=N));return n}(r)}e.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,e){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,o=0,s=Math.min(n,r);o<s;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=i.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var s=t[n];if(W(s,Uint8Array))o+s.length>r.length?i.from(s).copy(r,o):Uint8Array.prototype.set.call(r,s,o);else{if(!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o)}o+=s.length}return r},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):v.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(t,e,n,r,o){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(r,o),f=t.slice(e,n),l=0;l<u;++l)if(c[l]!==f[l]){s=c[l],a=f[l];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},i.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},i.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},i.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return I(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function R(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function L(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function C(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=$[t[i]];return o}function P(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length-1;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function D(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function U(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,4),d(t,e,n,r,23,4),n+4}function j(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,8),d(t,e,n,r,52,8),n+8}i.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,i.prototype),r},i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),p(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),p(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),p(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),p(this,t,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),o},i.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var o=t.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=i.isBuffer(t)?t:i.from(t,r),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var B=/[^+/0-9A-Za-z-_]/g;function k(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(t){return l(function(t){if((t=(t=t.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}var $=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)e[r+o]=t[n]+t[o];return e}()}(e={exports:{}},e.exports),e.exports}(),g=y.Buffer;y.SlowBuffer,y.INSPECT_MAX_BYTES,y.kMaxLength;var v=function(t,e){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},v(t,e)};function m(t,e){function n(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var b=function(){return b=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},b.apply(this,arguments)},_=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return m(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),w=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return m(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function E(t){return t&&t.Math==Math&&t}function S(){return E("object"==typeof globalThis&&globalThis)||E("object"==typeof window&&window)||E("object"==typeof self&&self)||E("object"==typeof n.g&&n.g)||Function("return this")()}function I(t){return t.toString().replace("function(","function (")}var O=function(t){var e,n="object"==typeof(e=S()).navigator&&"ReactNative"===e.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var r=g.alloc(t),o=0;o<t;++o)r[o]=Math.floor(256*Math.random());return r},A=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(g.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(g.alloc(t))}:O}();function T(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function N(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function R(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)}function L(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)}function C(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function P(t){return D(t)&&"[object Date]"===Object.prototype.toString.call(t)}function D(t){return"object"==typeof t&&null!==t}function x(t,e){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return n||(console.warn(e),n=!0),t.apply(this,r)}}function U(t){if(ArrayBuffer.isView(t))return g.from(t.buffer,t.byteOffset,t.byteLength);if(T(t))return g.from(t);throw new w("Must use either Buffer or TypedArray")}var M=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,j=function(t){return"string"==typeof t&&M.test(t)},B=function(t){if(!j(t))throw new w('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return g.from(e,"hex")},k=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},q=2147483647,F=-2147483648,W=Math.pow(2,63)-1,G=-Math.pow(2,63),$=Math.pow(2,53),V=-Math.pow(2,53),H=1,Y=2,J=3,K=4,Q=5,z=6,X=7,Z=8,tt=9,et=10,nt=11,rt=12,ot=13,it=14,st=15,at=16,ut=17,ct=18,ft=19,lt=255,ht=127,pt=0,dt=1,yt=2,gt=3,vt=4,mt=5,bt=6,_t=7,wt=128,Et=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new w("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=g.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=g.from(e,"binary"):Array.isArray(e)?this.buffer=g.from(e):this.buffer=U(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new w("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new w("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new w("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=g.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=g.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(U(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new St(this.buffer.slice(0,this.position));throw new _('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,o;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,r=g.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=g.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,r=B(e.$uuid)),!r)throw new w("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return o===vt?new St(r):new t(r,o)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(Et.prototype,"_bsontype",{value:"Binary"});var St=function(t){function e(n){var r,o,i=this;if(null==n)r=e.generate();else if(n instanceof e)r=g.from(n.buffer),o=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=U(n);else{if("string"!=typeof n)throw new w("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=B(n)}return(i=t.call(this,r,vt)||this).__id=o,i}return m(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=k(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=k(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new Et(this.id,Et.SUBTYPE_UUID)},e.generate=function(){var t=A(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,g.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?j(t):!!N(t)&&16===t.length&&64==(240&t[6])&&128==(128&t[8])))},e.createFromHexString=function(t){return new e(B(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(Et),It=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();function Ot(t){return D(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}Object.defineProperty(It.prototype,"_bsontype",{value:"Code"});var At=function(){function t(e,n,r,o){if(!(this instanceof t))return new t(e,n,r,o);var i=e.split(".");2===i.length&&(r=i.shift(),e=i.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=o||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(At.prototype,"_bsontype",{value:"DBRef"});var Tt=void 0;try{Tt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}var Nt=4294967296,Rt=0x10000000000000000,Lt=Rt/2,Ct={},Pt={},Dt=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,o,i;return n?(i=0<=(e>>>=0)&&e<256)&&(o=Pt[e])?o:(r=t.fromBits(e,(0|e)<0?-1:0,!0),i&&(Pt[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(o=Ct[e])?o:(r=t.fromBits(e,e<0?-1:0,!1),i&&(Ct[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=Rt)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Lt)return t.MIN_VALUE;if(e+1>=Lt)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%Nt|0,e/Nt|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return t.fromString(e.substring(1),n,r).neg();for(var i=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var f=t.fromNumber(Math.pow(r,u));s=s.mul(f).add(t.fromNumber(c))}else s=(s=s.mul(i)).add(t.fromNumber(c))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return D(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,f=0,l=0,h=0;return l+=(h+=i+(65535&e.low))>>>16,h&=65535,f+=(l+=o+u)>>>16,l&=65535,c+=(f+=r+a)>>>16,f&=65535,c+=n+s,c&=65535,t.fromBits(l<<16|h,c<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Tt){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?Tt.div_u:Tt.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;i=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=t.ZERO}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(o);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),i=i.add(u),o=o.sub(c)}return i},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Tt){var n=(this.unsigned?Tt.rem_u:Tt.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Tt){var n=Tt.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,c=e.low>>>16,f=65535&e.low,l=0,h=0,p=0,d=0;return p+=(d+=s*f)>>>16,d&=65535,h+=(p+=i*f)>>>16,p&=65535,h+=(p+=s*c)>>>16,p&=65535,l+=(h+=o*f)>>>16,h&=65535,l+=(h+=i*c)>>>16,h&=65535,l+=(h+=s*u)>>>16,h&=65535,l+=r*f+o*c+i*u+s*a,l&=65535,t.fromBits(p<<16|d,l<<16|h,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Nt+(this.low>>>0):this.high*Nt+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(i),c=(s.sub(u.mul(i)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Dt.prototype,"__isLong__",{value:!0}),Object.defineProperty(Dt.prototype,"_bsontype",{value:"Long"});var xt=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ut=/^(\+|-)?(Infinity|inf)$/i,Mt=/^(\+|-)?NaN$/i,jt=6111,Bt=-6176,kt=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),qt=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ft=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Wt=/^([-+])?(\d+)?$/;function Gt(t){return!isNaN(parseInt(t,10))}function $t(t){var e=Dt.fromNumber(1e9),n=Dt.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Dt(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Vt(t,e){throw new w('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ht=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!N(e))throw new w("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new w("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,o=!1,i=!1,s=0,a=0,u=0,c=0,f=0,l=[0],h=0,p=0,d=0,y=0,v=0,m=0,b=new Dt(0,0),_=new Dt(0,0),E=0;if(e.length>=7e3)throw new w(e+" not a valid Decimal128 string");var S=e.match(xt),I=e.match(Ut),O=e.match(Mt);if(!S&&!I&&!O||0===e.length)throw new w(e+" not a valid Decimal128 string");if(S){var A=S[2],T=S[4],N=S[5],R=S[6];T&&void 0===R&&Vt(e,"missing exponent power"),T&&void 0===A&&Vt(e,"missing exponent base"),void 0===T&&(N||R)&&Vt(e,"missing e before exponent")}if("+"!==e[E]&&"-"!==e[E]||(r="-"===e[E++]),!Gt(e[E])&&"."!==e[E]){if("i"===e[E]||"I"===e[E])return new t(g.from(r?qt:Ft));if("N"===e[E])return new t(g.from(kt))}for(;Gt(e[E])||"."===e[E];)"."!==e[E]?(h<34&&("0"!==e[E]||i)&&(i||(f=a),i=!0,l[p++]=parseInt(e[E],10),h+=1),i&&(u+=1),o&&(c+=1),a+=1,E+=1):(o&&Vt(e,"contains multiple periods"),o=!0,E+=1);if(o&&!a)throw new w(e+" not a valid Decimal128 string");if("e"===e[E]||"E"===e[E]){var L=e.substr(++E).match(Wt);if(!L||!L[2])return new t(g.from(kt));v=parseInt(L[0],10),E+=L[0].length}if(e[E])return new t(g.from(kt));if(d=0,h){if(y=h-1,1!==(s=u))for(;0===l[f+s-1];)s-=1}else d=0,y=0,l[0]=0,u=1,h=1,s=0;for(v<=c&&c-v>16384?v=Bt:v-=c;v>jt;){if((y+=1)-d>34){if(l.join("").match(/^0+$/)){v=jt;break}Vt(e,"overflow")}v-=1}for(;v<Bt||h<u;){if(0===y&&s<h){v=Bt,s=0;break}if(h<u?u-=1:y-=1,v<jt)v+=1;else{if(l.join("").match(/^0+$/)){v=jt;break}Vt(e,"overflow")}}if(y-d+1<s){var C=a;o&&(f+=1,C+=1),r&&(f+=1,C+=1);var P=parseInt(e[f+y+1],10),D=0;if(P>=5&&(D=1,5===P))for(D=l[y]%2==1?1:0,m=f+y+2;m<C;m++)if(parseInt(e[m],10)){D=1;break}if(D)for(var x=y;x>=0;x--)if(++l[x]>9&&(l[x]=0,0===x)){if(!(v<jt))return new t(g.from(r?qt:Ft));v+=1,l[x]=1}}if(b=Dt.fromNumber(0),_=Dt.fromNumber(0),0===s)b=Dt.fromNumber(0),_=Dt.fromNumber(0);else if(y-d<17)for(x=d,_=Dt.fromNumber(l[x++]),b=new Dt(0,0);x<=y;x++)_=(_=_.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]));else{for(x=d,b=Dt.fromNumber(l[x++]);x<=y-17;x++)b=(b=b.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]));for(_=Dt.fromNumber(l[x++]);x<=y;x++)_=(_=_.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]))}var U,M,j,B,k=function(t,e){if(!t&&!e)return{high:Dt.fromNumber(0),low:Dt.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Dt(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new Dt(e.getLowBits(),0),s=n.multiply(o),a=n.multiply(i),u=r.multiply(o),c=r.multiply(i);return s=s.add(a.shiftRightUnsigned(32)),a=new Dt(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new Dt(c.getLowBits(),0))}}(b,Dt.fromString("100000000000000000"));k.low=k.low.add(_),M=_,((j=(U=k.low).high>>>0)<(B=M.high>>>0)||j===B&&U.low>>>0<M.low>>>0)&&(k.high=k.high.add(Dt.fromNumber(1))),n=v+6176;var q={low:Dt.fromNumber(0),high:Dt.fromNumber(0)};k.high.shiftRightUnsigned(49).and(Dt.fromNumber(1)).equals(Dt.fromNumber(1))?(q.high=q.high.or(Dt.fromNumber(3).shiftLeft(61)),q.high=q.high.or(Dt.fromNumber(n).and(Dt.fromNumber(16383).shiftLeft(47))),q.high=q.high.or(k.high.and(Dt.fromNumber(0x7fffffffffff)))):(q.high=q.high.or(Dt.fromNumber(16383&n).shiftLeft(49)),q.high=q.high.or(k.high.and(Dt.fromNumber(562949953421311)))),q.low=k.low,r&&(q.high=q.high.or(Dt.fromString("9223372036854775808")));var F=g.alloc(16);return E=0,F[E++]=255&q.low.low,F[E++]=q.low.low>>8&255,F[E++]=q.low.low>>16&255,F[E++]=q.low.low>>24&255,F[E++]=255&q.low.high,F[E++]=q.low.high>>8&255,F[E++]=q.low.high>>16&255,F[E++]=q.low.high>>24&255,F[E++]=255&q.high.low,F[E++]=q.high.low>>8&255,F[E++]=q.high.low>>16&255,F[E++]=q.high.low>>24&255,F[E++]=255&q.high.high,F[E++]=q.high.high>>8&255,F[E++]=q.high.high>>16&255,F[E++]=q.high.high>>24&255,new t(F)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var o,i,s,a=0,u=!1,c={parts:[0,0,0,0]},f=[];a=0;var l=this.bytes,h=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,p=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,d=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,y=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24;a=0,(new Dt(h,p),new Dt(d,y)).lessThan(Dt.ZERO)&&f.push("-");var g=y>>26&31;if(g>>3==3){if(30===g)return f.join("")+"Infinity";if(31===g)return"NaN";t=y>>15&16383,o=8+(y>>14&1)}else o=y>>14&7,t=y>>17&16383;var v=t-6176;if(c.parts[0]=(16383&y)+((15&o)<<14),c.parts[1]=d,c.parts[2]=p,c.parts[3]=h,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var m=0,b=$t(c);if(c=b.quotient,m=b.rem.low)for(i=8;i>=0;i--)n[9*s+i]=m%10,m=Math.floor(m/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var _=e-1+v;if(_>=34||_<=-7||v>0){if(e>34)return f.push("".concat(0)),v>0?f.push("E+".concat(v)):v<0&&f.push("E".concat(v)),f.join("");for(f.push("".concat(n[a++])),(e-=1)&&f.push("."),r=0;r<e;r++)f.push("".concat(n[a++]));f.push("E"),_>0?f.push("+".concat(_)):f.push("".concat(_))}else if(v>=0)for(r=0;r<e;r++)f.push("".concat(n[a++]));else{var w=e+v;if(w>0)for(r=0;r<w;r++)f.push("".concat(n[a++]));else f.push("0");for(f.push(".");w++<0;)f.push("0");for(r=0;r<e-Math.max(w-1,0);r++)f.push("".concat(n[a++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Ht.prototype,"_bsontype",{value:"Decimal128"});var Yt=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(Yt.prototype,"_bsontype",{value:"Double"});var Jt=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Jt.prototype,"_bsontype",{value:"Int32"});var Kt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Kt.prototype,"_bsontype",{value:"MaxKey"});var Qt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Qt.prototype,"_bsontype",{value:"MinKey"});var zt=new RegExp("^[0-9a-fA-F]{24}$"),Xt=null,Zt=Symbol("id"),te=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new w("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?g.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Zt]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Zt]=n instanceof g?n:U(n);else{if("string"!=typeof n)throw new w("Argument passed in does not match the accepted types");if(12===n.length){var r=g.from(n);if(12!==r.byteLength)throw new w("Argument passed in must be a string of 12 bytes");this[Zt]=r}else{if(24!==n.length||!zt.test(n))throw new w("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Zt]=g.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Zt]},set:function(e){this[Zt]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=g.alloc(12);return r.writeUInt32BE(e,0),null===Xt&&(Xt=A(5)),r[4]=Xt[0],r[5]=Xt[1],r[6]=Xt[2],r[7]=Xt[3],r[8]=Xt[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Zt][11]===e[Zt][11]&&this[Zt].equals(e[Zt]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&N(this.id))return e===g.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return g.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=g.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new w("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(g.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(te.prototype,"generate",{value:x((function(t){return te.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(te.prototype,"getInc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"get_inc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te,"get_inc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"_bsontype",{value:"ObjectID"});var ee=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new _("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new _("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new _("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new w("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(ee.prototype,"_bsontype",{value:"BSONRegExp"});var ne=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(ne.prototype,"_bsontype",{value:"Symbol"});var re=Dt,oe=function(t){function e(n,r){var o=this;return o instanceof e?(o=Dt.isLong(n)?t.call(this,n.low,n.high,!0)||this:D(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(n,r)}return m(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Dt.fromInt(t,!0))},e.fromNumber=function(t){return new e(Dt.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Dt.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Dt.MAX_UNSIGNED_VALUE,e}(re);function ie(t){return D(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}var se=2147483647,ae=-2147483648,ue=0x8000000000000000,ce=-0x8000000000000000,fe={$oid:te,$binary:Et,$uuid:Et,$symbol:ne,$numberInt:Jt,$numberDecimal:Ht,$numberDouble:Yt,$numberLong:Dt,$minKey:Qt,$maxKey:Kt,$regex:ee,$regularExpression:ee,$timestamp:oe};function le(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ae&&t<=se)return new Jt(t);if(t>=ce&&t<=ue)return Dt.fromNumber(t)}return new Yt(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var o=fe[n[r]];if(o)return o.fromExtendedJSON(t,e)}if(null!=t.$date){var i=t.$date,s=new Date;return e.legacy?"number"==typeof i?s.setTime(i):"string"==typeof i&&s.setTime(Date.parse(i)):"string"==typeof i?s.setTime(Date.parse(i)):Dt.isLong(i)?s.setTime(i.toNumber()):"number"==typeof i&&e.relaxed&&s.setTime(i),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=le(t.$scope)),It.fromExtendedJSON(t)}if(Ot(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof At)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),f=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(f=!1)})),f)return At.fromExtendedJSON(u)}return t}function he(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function pe(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 r=e.seenObjects.map((function(t){return t.propertyName})),o=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),i=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],u=" ".repeat(o.length+i.length/2),c="-".repeat(s.length+(i.length+a.length)/2-1);throw new w("Converting circular structure to EJSON:\n"+" ".concat(o).concat(i).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return pe(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||P(t)){var f=t.getTime(),l=f>-1&&f<2534023188e5;return e.legacy?e.relaxed&&l?{$date:t.getTime()}:{$date:he(t)}:e.relaxed&&l?{$date:he(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var h=t>=ce&&t<=ue;if(t>=ae&&t<=se)return{$numberInt:t.toString()};if(h)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||C(t)){var p=t.flags;if(void 0===p){var d=t.toString().match(/[gimuy]*$/);d&&(p=d[0])}return new ee(t.source,p).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new _("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var o in t){e.seenObjects.push({propertyName:o,obj:null});try{var i=pe(t[o],e);"__proto__"===o?Object.defineProperty(r,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):r[o]=i}finally{e.seenObjects.pop()}}return r}if(ie(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=ge[t._bsontype];if(!a)throw new w("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new It(s.code,pe(s.scope,e)):"DBRef"===n&&s.oid&&(s=new At(pe(s.collection,e),pe(s.oid,e),pe(s.db,e),pe(s.fields,e))),s.toExtendedJSON(e)}throw new _("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var de,ye,ge={Binary:function(t){return new Et(t.value(),t.sub_type)},Code:function(t){return new It(t.code,t.scope)},DBRef:function(t){return new At(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ht(t.bytes)},Double:function(t){return new Yt(t.value)},Int32:function(t){return new Jt(t.value)},Long:function(t){return Dt.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 Kt},MinKey:function(){return new Qt},ObjectID:function(t){return new te(t)},ObjectId:function(t){return new te(t)},BSONRegExp:function(t){return new ee(t.pattern,t.options)},Symbol:function(t){return new ne(t.value)},Timestamp:function(t){return oe.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new _("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return le(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var o=pe(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(de||(de={}));var ve=S();function me(t,e,n){var r=5;if(Array.isArray(t))for(var o=0;o<t.length;o++)r+=be(o.toString(),t[o],e,!0,n);else for(var i in"function"==typeof(null==t?void 0:t.toBSON)&&(t=t.toBSON()),t)r+=be(i,t[i],e,!1,n);return r}function be(t,e,n,r,o){switch(void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),"function"==typeof(null==e?void 0:e.toBSON)&&(e=e.toBSON()),typeof e){case"string":return 1+g.byteLength(t,"utf8")+1+4+g.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=V&&e<=$&&e>=F&&e<=q?(null!=t?g.byteLength(t,"utf8")+1:0)+5:(null!=t?g.byteLength(t,"utf8")+1:0)+9;case"undefined":return r||!o?(null!=t?g.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?g.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||P(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||T(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(e.code.toString(),"utf8")+1+me(e.scope,n,o):(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype){var i=e;return i.sub_type===Et.SUBTYPE_BYTE_ARRAY?(null!=t?g.byteLength(t,"utf8")+1:0)+(i.position+1+4+1+4):(null!=t?g.byteLength(t,"utf8")+1:0)+(i.position+1+4+1)}if("Symbol"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+g.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var s=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(s.$db=e.db),(null!=t?g.byteLength(t,"utf8")+1:0)+1+me(s,n,o)}return e instanceof RegExp||C(e)?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.pattern,"utf8")+1+g.byteLength(e.options,"utf8")+1:(null!=t?g.byteLength(t,"utf8")+1:0)+me(e,n,o)+1;case"function":if(e instanceof RegExp||C(e)||"[object RegExp]"===String.call(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.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?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(I(e),"utf8")+1+me(e.scope,n,o);if(n)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(I(e),"utf8")+1}return 0}ye=ve.Map?ve.Map: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 n=t[e],r=n[0],o=n[1];this._keys.push(r),this._values[r]={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 n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,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 n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},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 n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var _e=128,we=192,Ee=224,Se=240,Ie=248,Oe=192,Ae=224,Te=240,Ne=128;function Re(t,e,n){for(var r=0,o=e;o<n;o+=1){var i=t[o];if(r){if((i&we)!==Ne)return!1;r-=1}else if(i&_e)if((i&Ee)===Oe)r=1;else if((i&Se)===Ae)r=2;else{if((i&Ie)!==Te)return!1;r=3}}return!r}var Le=Dt.fromNumber($),Ce=Dt.fromNumber(V),Pe={};function De(t,e,n){var r=(e=null==e?{}:e)&&e.index?e.index:0,o=t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24;if(o<5)throw new _("bson size must be >= 5, is ".concat(o));if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new _("buffer length ".concat(t.length," must be >= bson size ").concat(o));if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new _("buffer length ".concat(t.length," must === bson size ").concat(o));if(o+r>t.byteLength)throw new _("(bson size ".concat(o," + options.index ").concat(r," must be <= buffer length ").concat(t.byteLength,")"));if(0!==t[r+o-1])throw new _("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return Ue(t,r,e,n)}var xe=/^\$ref$|^\$id$|^\$db$/;function Ue(t,e,n,r){void 0===r&&(r=!1);var o,i=null!=n.evalFunctions&&n.evalFunctions,s=null!=n.cacheFunctions&&n.cacheFunctions,a=null==n.fieldsAsRaw?null:n.fieldsAsRaw,u=null!=n.raw&&n.raw,c="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,f=null!=n.promoteBuffers&&n.promoteBuffers,l=null==n.promoteLongs||n.promoteLongs,h=null==n.promoteValues||n.promoteValues,p=null==n.validation?{utf8:!0}:n.validation,d=!0,y=new Set,v=p.utf8;if("boolean"==typeof v)o=v;else{d=!1;var m=Object.keys(v).map((function(t){return v[t]}));if(0===m.length)throw new _("UTF-8 validation setting cannot be empty");if("boolean"!=typeof m[0])throw new _("Invalid UTF-8 validation option, must specify boolean values");if(o=m[0],!m.every((function(t){return t===o})))throw new _("Invalid UTF-8 validation option - keys must be all true or all false")}if(!d)for(var w=0,E=Object.keys(v);w<E.length;w++){var S=E[w];y.add(S)}var I=e;if(t.length<5)throw new _("corrupt bson message < 5 bytes long");var O=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(O<5||O>t.length)throw new _("corrupt bson message");for(var A=r?[]:{},T=0,N=!r&&null,R=new DataView(t.buffer,t.byteOffset,t.byteLength);;){var L=t[e++];if(0===L)break;for(var C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.byteLength)throw new _("Bad BSON Document: illegal CString");var P,D=r?T++:t.toString("utf8",e,C);P=d||y.has(D)?o:!o,!1!==N&&"$"===D[0]&&(N=xe.test(D));var x=void 0;if(e=C+1,L===Y){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");x=je(t,e,e+Lt-1,P),e+=Lt}else if(L===X){var U=g.alloc(12);t.copy(U,0,e,e+12),x=new te(U),e+=12}else if(L===at&&!1===h)x=new Jt(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(L===at)x=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(L===H&&!1===h)x=new Yt(R.getFloat64(e,!0)),e+=8;else if(L===H)x=R.getFloat64(e,!0),e+=8;else if(L===tt){var M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;x=new Date(new Dt(M,j).toNumber())}else if(L===Z){if(0!==t[e]&&1!==t[e])throw new _("illegal boolean type value");x=1===t[e++]}else if(L===J){var B=e;if((Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||Nt>t.length-e)throw new _("bad embedded document length in bson");if(u)x=t.slice(e,e+Nt);else{var k=n;d||(k=b(b({},n),{validation:{utf8:P}})),x=Ue(t,B,k,!1)}e+=Nt}else if(L===K){B=e;var q=n,F=e+(Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(a&&a[D]){for(var W in q={},n)q[W]=n[W];q.raw=!0}if(d||(q=b(b({},q),{validation:{utf8:P}})),x=Ue(t,B,q,!0),0!==t[(e+=Nt)-1])throw new _("invalid array terminator byte");if(e!==F)throw new _("corrupted array bson")}else if(L===z)x=void 0;else if(L===et)x=null;else if(L===ct){M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var G=new Dt(M,j);x=l&&!0===h&&G.lessThanOrEqual(Le)&&G.greaterThanOrEqual(Ce)?G.toNumber():G}else if(L===ft){var $=g.alloc(16);t.copy($,0,e,e+16),e+=16;var V=new Ht($);x="toObject"in V&&"function"==typeof V.toObject?V.toObject():V}else if(L===Q){var pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,dt=pt,yt=t[e++];if(pt<0)throw new _("Negative binary type element size found");if(pt>t.byteLength)throw new _("Binary type size larger than document size");if(null!=t.slice){if(yt===Et.SUBTYPE_BYTE_ARRAY){if((pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new _("Negative binary type element size found for subtype 0x02");if(pt>dt-4)throw new _("Binary type with subtype 0x02 contains too long binary size");if(pt<dt-4)throw new _("Binary type with subtype 0x02 contains too short binary size")}f&&h?x=t.slice(e,e+pt):(x=new Et(t.slice(e,e+pt),yt),yt===vt&&(x=x.toUUID()))}else{var gt=g.alloc(pt);if(yt===Et.SUBTYPE_BYTE_ARRAY){if((pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new _("Negative binary type element size found for subtype 0x02");if(pt>dt-4)throw new _("Binary type with subtype 0x02 contains too long binary size");if(pt<dt-4)throw new _("Binary type with subtype 0x02 contains too short binary size")}for(C=0;C<pt;C++)gt[C]=t[e+C];x=f&&h?gt:yt===vt?new Et(t.slice(e,e+pt),yt).toUUID():new Et(t.slice(e,e+pt),yt)}e+=pt}else if(L===nt&&!1===c){for(C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");var mt=t.toString("utf8",e,C);for(C=e=C+1;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");var bt=t.toString("utf8",e,C);e=C+1;var _t=new Array(bt.length);for(C=0;C<bt.length;C++)switch(bt[C]){case"m":_t[C]="m";break;case"s":_t[C]="g";break;case"i":_t[C]="i"}x=new RegExp(mt,_t.join(""))}else if(L===nt&&!0===c){for(C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");for(mt=t.toString("utf8",e,C),C=e=C+1;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");bt=t.toString("utf8",e,C),e=C+1,x=new ee(mt,bt)}else if(L===it){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");var wt=je(t,e,e+Lt-1,P);x=h?wt:new ne(wt),e+=Lt}else if(L===ut)M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,x=new oe(M,j);else if(L===lt)x=new Qt;else if(L===ht)x=new Kt;else if(L===ot){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");var St=je(t,e,e+Lt-1,P);x=i?s?Me(St,Pe,A):Me(St):new It(St),e+=Lt}else if(L===st){var Tt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(Tt<13)throw new _("code_w_scope total size shorter minimum expected length");if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");St=je(t,e,e+Lt-1,P),B=e+=Lt;var Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,Rt=Ue(t,B,n,!1);if(e+=Nt,Tt<8+Nt+Lt)throw new _("code_w_scope total size is too short, truncating scope");if(Tt>8+Nt+Lt)throw new _("code_w_scope total size is too long, clips outer document");i?(x=s?Me(St,Pe,A):Me(St)).scope=Rt:x=new It(St,Rt)}else{if(L!==rt)throw new _("Detected unknown BSON type ".concat(L.toString(16),' for fieldname "').concat(D,'"'));var Lt;if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");if(null!=p&&p.utf8&&!Re(t,e,e+Lt-1))throw new _("Invalid UTF-8 string in BSON document");var Ct=t.toString("utf8",e,e+Lt-1);e+=Lt;var Pt=g.alloc(12);t.copy(Pt,0,e,e+12),U=new te(Pt),e+=12,x=new At(Ct,U)}"__proto__"===D?Object.defineProperty(A,D,{value:x,writable:!0,enumerable:!0,configurable:!0}):A[D]=x}if(O!==e-I){if(r)throw new _("corrupt array bson");throw new _("corrupt object bson")}if(!N)return A;if(Ot(A)){var xt=Object.assign({},A);return delete xt.$ref,delete xt.$id,delete xt.$db,new At(A.$ref,A.$id,A.$db,xt)}return A}function Me(t,e,n){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(n)):new Function(t)}function je(t,e,n,r){var o=t.toString("utf8",e,n);if(r)for(var i=0;i<o.length;i++)if(65533===o.charCodeAt(i)){if(!Re(t,e,n))throw new _("Invalid UTF-8 string in BSON document");break}return o}var Be=/\x00/,ke=new Set(["$db","$ref","$id","$clusterTime"]);function qe(t,e,n,r,o){t[r++]=Y;var i=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8");t[(r=r+i+1)-1]=0;var s=t.write(n,r+4,void 0,"utf8");return t[r+3]=s+1>>24&255,t[r+2]=s+1>>16&255,t[r+1]=s+1>>8&255,t[r]=s+1&255,r=r+4+s,t[r++]=0,r}var Fe=new Uint8Array(8),We=new DataView(Fe.buffer,Fe.byteOffset,Fe.byteLength);function Ge(t,e,n,r,o){return Number.isInteger(n)&&n>=F&&n<=q?(t[r++]=at,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=255&n,t[r++]=n>>8&255,t[r++]=n>>16&255,t[r++]=n>>24&255):(t[r++]=H,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,We.setFloat64(0,n,!0),t.set(Fe,r),r+=8),r}function $e(t,e,n,r,o){return t[r++]=et,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,r}function Ve(t,e,n,r,o){return t[r++]=Z,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=n?1:0,r}function He(t,e,n,r,o){t[r++]=tt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=Dt.fromNumber(n.getTime()),s=i.getLowBits(),a=i.getHighBits();return t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,t[r++]=255&a,t[r++]=a>>8&255,t[r++]=a>>16&255,t[r++]=a>>24&255,r}function Ye(t,e,n,r,o){if(t[r++]=nt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,n.source&&null!=n.source.match(Be))throw Error("value "+n.source+" must not contain null bytes");return r+=t.write(n.source,r,void 0,"utf8"),t[r++]=0,n.ignoreCase&&(t[r++]=105),n.global&&(t[r++]=115),n.multiline&&(t[r++]=109),t[r++]=0,r}function Je(t,e,n,r,o){if(t[r++]=nt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,null!=n.pattern.match(Be))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=t.write(n.pattern,r,void 0,"utf8"),t[r++]=0,r+=t.write(n.options.split("").sort().join(""),r,void 0,"utf8"),t[r++]=0,r}function Ke(t,e,n,r,o){return null===n?t[r++]=et:"MinKey"===n._bsontype?t[r++]=lt:t[r++]=ht,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,r}function Qe(t,e,n,r,o){if(t[r++]=X,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,"string"==typeof n.id)t.write(n.id,r,void 0,"binary");else{if(!N(n.id))throw new w("object ["+JSON.stringify(n)+"] is not a valid ObjectId");t.set(n.id.subarray(0,12),r)}return r+12}function ze(t,e,n,r,o){t[r++]=Q,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.length;return t[r++]=255&i,t[r++]=i>>8&255,t[r++]=i>>16&255,t[r++]=i>>24&255,t[r++]=pt,t.set(U(n),r),r+i}function Xe(t,e,n,r,o,i,s,a,u,c){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),void 0===c&&(c=[]);for(var f=0;f<c.length;f++)if(c[f]===n)throw new _("cyclic dependency detected");c.push(n),t[r++]=Array.isArray(n)?K:J,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var l=cn(t,n,o,r,i+1,s,a,c);return c.pop(),l}function Ze(t,e,n,r,o){return t[r++]=ft,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t.set(n.bytes.subarray(0,16),r),r+16}function tn(t,e,n,r,o){t[r++]="Long"===n._bsontype?ct:ut,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.getLowBits(),s=n.getHighBits();return t[r++]=255&i,t[r++]=i>>8&255,t[r++]=i>>16&255,t[r++]=i>>24&255,t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,r}function en(t,e,n,r,o){return n=n.valueOf(),t[r++]=at,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=255&n,t[r++]=n>>8&255,t[r++]=n>>16&255,t[r++]=n>>24&255,r}function nn(t,e,n,r,o){return t[r++]=H,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,We.setFloat64(0,n.value,!0),t.set(Fe,r),r+8}function rn(t,e,n,r,o,i,s){t[r++]=ot,r+=s?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var a=I(n),u=t.write(a,r+4,void 0,"utf8")+1;return t[r]=255&u,t[r+1]=u>>8&255,t[r+2]=u>>16&255,t[r+3]=u>>24&255,r=r+4+u-1,t[r++]=0,r}function on(t,e,n,r,o,i,s,a,u){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),n.scope&&"object"==typeof n.scope){t[r++]=st,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var c=r,f="string"==typeof n.code?n.code:n.code.toString();r+=4;var l=t.write(f,r+4,void 0,"utf8")+1;t[r]=255&l,t[r+1]=l>>8&255,t[r+2]=l>>16&255,t[r+3]=l>>24&255,t[r+4+l-1]=0,r=r+l+4;var h=cn(t,n.scope,o,r,i+1,s,a);r=h-1;var p=h-c;t[c++]=255&p,t[c++]=p>>8&255,t[c++]=p>>16&255,t[c++]=p>>24&255,t[r++]=0}else{t[r++]=ot,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,f=n.code.toString();var d=t.write(f,r+4,void 0,"utf8")+1;t[r]=255&d,t[r+1]=d>>8&255,t[r+2]=d>>16&255,t[r+3]=d>>24&255,r=r+4+d-1,t[r++]=0}return r}function sn(t,e,n,r,o){t[r++]=Q,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.value(!0),s=n.position;return n.sub_type===Et.SUBTYPE_BYTE_ARRAY&&(s+=4),t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,t[r++]=n.sub_type,n.sub_type===Et.SUBTYPE_BYTE_ARRAY&&(s-=4,t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255),t.set(i,r),r+n.position}function an(t,e,n,r,o){t[r++]=it,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=t.write(n.value,r+4,void 0,"utf8")+1;return t[r]=255&i,t[r+1]=i>>8&255,t[r+2]=i>>16&255,t[r+3]=i>>24&255,r=r+4+i-1,t[r++]=0,r}function un(t,e,n,r,o,i,s){t[r++]=J,r+=s?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var a=r,u={$ref:n.collection||n.namespace,$id:n.oid};null!=n.db&&(u.$db=n.db);var c=cn(t,u=Object.assign(u,n.fields),!1,r,o+1,i),f=c-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,c}function cn(t,e,n,r,o,i,s,a){void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=!1),void 0===s&&(s=!0),void 0===a&&(a=[]),r=r||0,(a=a||[]).push(e);var u,c=r+4;if(Array.isArray(e))for(var f=0;f<e.length;f++){var l="".concat(f);if("function"==typeof(null==(g=e[f])?void 0:g.toBSON)&&(g=g.toBSON()),"string"==typeof g)c=qe(t,l,g,c,!0);else if("number"==typeof g)c=Ge(t,l,g,c,!0);else{if("bigint"==typeof g)throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof g)c=Ve(t,l,g,c,!0);else if(g instanceof Date||P(g))c=He(t,l,g,c,!0);else if(void 0===g)c=$e(t,l,0,c,!0);else if(null===g)c=$e(t,l,0,c,!0);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c,!0);else if(N(g))c=ze(t,l,g,c,!0);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c,!0);else if("object"==typeof g&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!0,a);else if("object"==typeof g&&ie(g)&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c,!0);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c,!0);else if("Double"===g._bsontype)c=nn(t,l,g,c,!0);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,!0);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s,!0);else if("Binary"===g._bsontype)c=sn(t,l,g,c,!0);else if("Symbol"===g._bsontype)c=an(t,l,g,c,!0);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i,!0);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c,!0);else if("Int32"===g._bsontype)c=en(t,l,g,c,!0);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c,!0);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}else if(e instanceof ye||(u=e,"[object Map]"===Object.prototype.toString.call(u)))for(var h=e.entries(),p=!1;!p;){var d=h.next();if(!(p=!!d.done)){l=d.value[0];var y=typeof(g=d.value[1]);if("string"==typeof l&&!ke.has(l)){if(null!=l.match(Be))throw Error("key "+l+" must not contain null bytes");if(n){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)c=qe(t,l,g,c);else if("number"===y)c=Ge(t,l,g,c);else{if("bigint"===y||R(g)||L(g))throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"===y)c=Ve(t,l,g,c);else if(g instanceof Date||P(g))c=He(t,l,g,c);else if(null===g||void 0===g&&!1===s)c=$e(t,l,0,c);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c);else if(N(g))c=ze(t,l,g,c);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c);else if("object"===y&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!1,a);else if("object"===y&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c);else if("Double"===g._bsontype)c=nn(t,l,g,c);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,i);else if("Binary"===g._bsontype)c=sn(t,l,g,c);else if("Symbol"===g._bsontype)c=an(t,l,g,c);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c);else if("Int32"===g._bsontype)c=en(t,l,g,c);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}}else{if("function"==typeof(null==e?void 0:e.toBSON)&&null!=(e=e.toBSON())&&"object"!=typeof e)throw new w("toBSON function did not return an object");for(var l in e){var g;if("function"==typeof(null==(g=e[l])?void 0:g.toBSON)&&(g=g.toBSON()),y=typeof g,"string"==typeof l&&!ke.has(l)){if(null!=l.match(Be))throw Error("key "+l+" must not contain null bytes");if(n){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)c=qe(t,l,g,c);else if("number"===y)c=Ge(t,l,g,c);else{if("bigint"===y)throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"===y)c=Ve(t,l,g,c);else if(g instanceof Date||P(g))c=He(t,l,g,c);else if(void 0===g)!1===s&&(c=$e(t,l,0,c));else if(null===g)c=$e(t,l,0,c);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c);else if(N(g))c=ze(t,l,g,c);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c);else if("object"===y&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!1,a);else if("object"===y&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c);else if("Double"===g._bsontype)c=nn(t,l,g,c);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,i);else if("Binary"===g._bsontype)c=sn(t,l,g,c);else if("Symbol"===g._bsontype)c=an(t,l,g,c);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c);else if("Int32"===g._bsontype)c=en(t,l,g,c);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}}a.pop(),t[c++]=0;var v=c-r;return t[r++]=255&v,t[r++]=v>>8&255,t[r++]=v>>16&255,t[r++]=v>>24&255,c}var fn=17825792,ln=g.alloc(fn);function hn(t){ln.length<t&&(ln=g.alloc(t))}function pn(t,e){void 0===e&&(e={});var n="boolean"==typeof e.checkKeys&&e.checkKeys,r="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,o="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,i="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:fn;ln.length<i&&(ln=g.alloc(i));var s=cn(ln,t,n,0,0,r,o,[]),a=g.alloc(s);return ln.copy(a,0,0,a.length),a}function dn(t,e,n){void 0===n&&(n={});var r="boolean"==typeof n.checkKeys&&n.checkKeys,o="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,i="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0,a=cn(ln,t,r,0,0,o,i);return ln.copy(e,s,0,a),s+a-1}function yn(t,e){return void 0===e&&(e={}),De(t instanceof g?t:U(t),e)}function gn(t,e){return void 0===e&&(e={}),me(t,"boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,"boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined)}function vn(t,e,n,r,o,i){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),a=U(t),u=e,c=0;c<n;c++){var f=a[u]|a[u+1]<<8|a[u+2]<<16|a[u+3]<<24;s.index=u,r[o+c]=De(a,s),u+=f}return u}var mn={Binary:Et,Code:It,DBRef:At,Decimal128:Ht,Double:Yt,Int32:Jt,Long:Dt,UUID:St,Map:ye,MaxKey:Kt,MinKey:Qt,ObjectId:te,ObjectID:te,BSONRegExp:ee,BSONSymbol:ne,Timestamp:oe,EJSON:de,setInternalBufferSize:hn,serialize:pn,serializeWithBufferAndIndex:dn,deserialize:yn,calculateObjectSize:gn,deserializeStream:vn,BSONError:_,BSONTypeError:w};e.default=mn},9907:function(t,e,n){t=n.nmd(t);var r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",f="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",N="[object Uint16Array]",R="[object Uint32Array]",L=/\w*$/,C=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,D={};D[i]=D["[object Array]"]=D[b]=D[_]=D[s]=D[a]=D[w]=D[E]=D[S]=D[I]=D[O]=D[f]=D[l]=D[h]=D[d]=D[y]=D[g]=D[v]=D[A]=D[T]=D[N]=D[R]=!0,D["[object Error]"]=D[u]=D[m]=!1;var x="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,M=x||U||Function("return this")(),j=e&&!e.nodeType&&e,B=j&&t&&!t.nodeType&&t,k=B&&B.exports===j;function q(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function W(t,e,n,r){var o=-1,i=t?t.length:0;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function G(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function $(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function V(t,e){return function(n){return t(e(n))}}function H(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var Y,J=Array.prototype,K=Function.prototype,Q=Object.prototype,z=M["__core-js_shared__"],X=(Y=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",Z=K.toString,tt=Q.hasOwnProperty,et=Q.toString,nt=RegExp("^"+Z.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=k?M.Buffer:void 0,ot=M.Symbol,it=M.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ut=Q.propertyIsEnumerable,ct=J.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Mt(M,"DataView"),dt=Mt(M,"Map"),yt=Mt(M,"Promise"),gt=Mt(M,"Set"),vt=Mt(M,"WeakMap"),mt=Mt(Object,"create"),bt=Ft(pt),_t=Ft(dt),wt=Ft(yt),Et=Ft(gt),St=Ft(vt),It=ot?ot.prototype:void 0,Ot=It?It.valueOf:void 0;function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rt(t){this.__data__=new Tt(t)}function Lt(t,e,n){var r=t[e];tt.call(t,e)&&Wt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(Wt(t[n][0],e))return n;return-1}function Pt(t,e,n,r,o,p,m){var C;if(r&&(C=p?r(t,o,p,m):r(t)),void 0!==C)return C;if(!Yt(t))return t;var P=Gt(t);if(P){if(C=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,C)}else{var x=Bt(t),U=x==u||x==c;if(Vt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(x==h||x==i||U&&!p){if(G(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||qt(t)?{}:Yt(e=st(t))?at(e):{};var e}(U?{}:t),!e)return function(t,e){return xt(t,jt(t),e)}(t,function(t,e){return t&&xt(e,Jt(e),t)}(C,t))}else{if(!D[x])return p?t:{};C=function(t,e,n,r){var o,i=t.constructor;switch(e){case b:return Dt(t);case s:case a:return new i(+t);case _:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case w:case E:case S:case I:case O:case A:case T:case N:case R:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return W(e?n($(t),!0):$(t),q,new t.constructor)}(t,r,n);case l:case g:return new i(t);case d:return function(t){var e=new t.constructor(t.source,L.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return W(e?n(H(t),!0):H(t),F,new t.constructor)}(t,r,n);case v:return o=t,Ot?Object(Ot.call(o)):{}}}(t,x,Pt,e)}}m||(m=new Rt);var M=m.get(t);if(M)return M;if(m.set(t,C),!P)var j=n?function(t){return function(t,e,n){var r=e(t);return Gt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Jt,jt)}(t):Jt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(j||t,(function(o,i){j&&(o=t[i=o]),Lt(C,i,Pt(o,e,n,r,i,t,m))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function xt(t,e,n,r){n||(n={});for(var o=-1,i=e.length;++o<i;){var s=e[o],a=r?r(n[s],t[s],s,n,t):void 0;Lt(n,s,void 0===a?t[s]:a)}return n}function Ut(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Mt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Yt(t)||(e=t,X&&X in e))&&(Ht(t)||G(t)?nt:C).test(Ft(t));var e}(n)?n:void 0}At.prototype.clear=function(){this.__data__=mt?mt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(mt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return mt?void 0!==e[t]:tt.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=mt&&void 0===e?r:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ct.call(e,n,1),0))},Tt.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},Tt.prototype.has=function(t){return Ct(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Nt.prototype.clear=function(){this.__data__={hash:new At,map:new(dt||Tt),string:new At}},Nt.prototype.delete=function(t){return Ut(this,t).delete(t)},Nt.prototype.get=function(t){return Ut(this,t).get(t)},Nt.prototype.has=function(t){return Ut(this,t).has(t)},Nt.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},Rt.prototype.clear=function(){this.__data__=new Tt},Rt.prototype.delete=function(t){return this.__data__.delete(t)},Rt.prototype.get=function(t){return this.__data__.get(t)},Rt.prototype.has=function(t){return this.__data__.has(t)},Rt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Tt){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Nt(r)}return n.set(t,e),this};var jt=ft?V(ft,Object):function(){return[]},Bt=function(t){return et.call(t)};function kt(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function qt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Q)}function Ft(t){if(null!=t){try{return Z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Wt(t,e){return t===e||t!=t&&e!=e}(pt&&Bt(new pt(new ArrayBuffer(1)))!=_||dt&&Bt(new dt)!=f||yt&&Bt(yt.resolve())!=p||gt&&Bt(new gt)!=y||vt&&Bt(new vt)!=m)&&(Bt=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?Ft(n):void 0;if(r)switch(r){case bt:return _;case _t:return f;case wt:return p;case Et:return y;case St:return m}return e});var Gt=Array.isArray;function $t(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!Ht(t)}var Vt=lt||function(){return!1};function Ht(t){var e=Yt(t)?et.call(t):"";return e==u||e==c}function Yt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return $t(t)?function(t,e){var n=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&$t(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==i)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var s in t)!e&&!tt.call(t,s)||o&&("length"==s||kt(s,r))||n.push(s);return n}(t):function(t){if(!qt(t))return ht(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}},880:function(t,e,n){var r,o="Expected a function",i="__lodash_hash_undefined__",s=1/0,a=9007199254740991,u="[object Function]",c="[object GeneratorFunction]",f="[object Symbol]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,p=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,v=/^(?:0|[1-9]\d*)$/,m="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,b="object"==typeof self&&self&&self.Object===Object&&self,_=m||b||Function("return this")(),w=Array.prototype,E=Function.prototype,S=Object.prototype,I=_["__core-js_shared__"],O=(r=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",A=E.toString,T=S.hasOwnProperty,N=S.toString,R=RegExp("^"+A.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=_.Symbol,C=w.splice,P=W(_,"Map"),D=W(Object,"create"),x=L?L.prototype:void 0,U=x?x.toString:void 0;function M(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function k(t,e,n){var r=t[e];T.call(t,e)&&Y(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function q(t,e){for(var n=t.length;n--;)if(Y(t[n][0],e))return n;return-1}function F(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function W(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!K(t)||O&&O in t)return!1;var e=function(t){var e=K(t)?N.call(t):"";return e==u||e==c}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?R:g;return e.test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function G(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||v.test(t))&&t>-1&&t%1==0&&t<e}M.prototype.clear=function(){this.__data__=D?D(null):{}},M.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},M.prototype.get=function(t){var e=this.__data__;if(D){var n=e[t];return n===i?void 0:n}return T.call(e,t)?e[t]:void 0},M.prototype.has=function(t){var e=this.__data__;return D?void 0!==e[t]:T.call(e,t)},M.prototype.set=function(t,e){return this.__data__[t]=D&&void 0===e?i:e,this},j.prototype.clear=function(){this.__data__=[]},j.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():C.call(e,n,1),0))},j.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},j.prototype.has=function(t){return q(this.__data__,t)>-1},j.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},B.prototype.clear=function(){this.__data__={hash:new M,map:new(P||j),string:new M}},B.prototype.delete=function(t){return F(this,t).delete(t)},B.prototype.get=function(t){return F(this,t).get(t)},B.prototype.has=function(t){return F(this,t).has(t)},B.prototype.set=function(t,e){return F(this,t).set(t,e),this};var $=H((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Q(t))return U?U.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(d,(function(t,e,r,o){n.push(r?o.replace(y,"$1"):e||t)})),n}));function V(t){if("string"==typeof t||Q(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function H(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(H.Cache||B),n}function Y(t,e){return t===e||t!=t&&e!=e}H.Cache=B;var J=Array.isArray;function K(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Q(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&N.call(t)==f}t.exports=function(t,e,n){return null==t?t:function(t,e,n,r){if(!K(t))return t;e=function(t,e){if(J(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Q(t))||h.test(t)||!l.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return J(t)?t:$(t)}(e);for(var o=-1,i=e.length,s=i-1,a=t;null!=a&&++o<i;){var u=V(e[o]),c=n;if(o!=s){var f=a[u];void 0===(c=r?r(f,u,a):void 0)&&(c=K(f)?f:G(e[o+1])?[]:{})}k(a,u,c),a=a[u]}return t}(t,e,n)}},3373:function(t,e,n){var r,o="Expected a function",i="__lodash_hash_undefined__",s=1/0,a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,h=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,v="object"==typeof self&&self&&self.Object===Object&&self,m=g||v||Function("return this")(),b=Array.prototype,_=Function.prototype,w=Object.prototype,E=m["__core-js_shared__"],S=(r=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",I=_.toString,O=w.hasOwnProperty,A=w.toString,T=RegExp("^"+I.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=m.Symbol,R=b.splice,L=q(m,"Map"),C=q(Object,"create"),P=N?N.prototype:void 0,D=P?P.toString:void 0;function x(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function M(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function B(t){return V(t)?t:W(t)}function k(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!H(t)||S&&S in t)return!1;var e=function(t){var e=H(t)?A.call(t):"";return e==a||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?T:y;return e.test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function F(t,e){if(V(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Y(t))||l.test(t)||!f.test(t)||null!=e&&t in Object(e)}x.prototype.clear=function(){this.__data__=C?C(null):{}},x.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},x.prototype.get=function(t){var e=this.__data__;if(C){var n=e[t];return n===i?void 0:n}return O.call(e,t)?e[t]:void 0},x.prototype.has=function(t){var e=this.__data__;return C?void 0!==e[t]:O.call(e,t)},x.prototype.set=function(t,e){return this.__data__[t]=C&&void 0===e?i:e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,n=j(e,t);return!(n<0||(n==e.length-1?e.pop():R.call(e,n,1),0))},U.prototype.get=function(t){var e=this.__data__,n=j(e,t);return n<0?void 0:e[n][1]},U.prototype.has=function(t){return j(this.__data__,t)>-1},U.prototype.set=function(t,e){var n=this.__data__,r=j(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},M.prototype.clear=function(){this.__data__={hash:new x,map:new(L||U),string:new x}},M.prototype.delete=function(t){return k(this,t).delete(t)},M.prototype.get=function(t){return k(this,t).get(t)},M.prototype.has=function(t){return k(this,t).has(t)},M.prototype.set=function(t,e){return k(this,t).set(t,e),this};var W=$((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Y(t))return D?D.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return h.test(t)&&n.push(""),t.replace(p,(function(t,e,r,o){n.push(r?o.replace(d,"$1"):e||t)})),n}));function G(t){if("string"==typeof t||Y(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function $(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new($.Cache||M),n}$.Cache=M;var V=Array.isArray;function H(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&A.call(t)==c}t.exports=function(t,e){return null==t||function(t,e){t=function(t,e){return 1==e.length?t:function(t,e){for(var n=0,r=(e=F(e,t)?[e]:B(e)).length;null!=t&&n<r;)t=t[G(e[n++])];return n&&n==r?t:void 0}(t,function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i}(e,0,-1))}(t,e=F(e,t)?[e]:B(e));var n,r,o=G((r=(n=e)?n.length:0)?n[r-1]:void 0);return!(null!=t&&O.call(t,o))||delete t[o]}(t,e)}},5047:function(t){var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,s=Object.create(i.prototype),a=new L(r||[]);return o(s,"_invoke",{value:A(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",g={};function v(){}function m(){}function b(){}var _={};c(_,s,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(C([])));E&&E!==n&&r.call(E,s)&&(_=E);var S=b.prototype=v.prototype=Object.create(_);function I(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function n(o,i,s,a){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function A(t,e,n){var r=h;return function(o,i){if(r===d)throw new Error("Generator is already running");if(r===y){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=T(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(t,e,n);if("normal"===u.type){if(r=n.done?y:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=y,n.method="throw",n.arg=u.arg)}}}function T(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=l(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var s=i.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function C(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},I(O.prototype),c(O.prototype,a,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var s=new O(f(e,n,r,o),i);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(S),c(S,u,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return a.type="throw",a.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;R(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},4536:function(t){"use strict";t.exports=JSON.parse('{"version":"2.5.35-beta.0"}')}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},n(5047),n(9195)}()}));
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase",[],e):"object"==typeof exports?exports.cloudbase=e():t.cloudbase=e()}("undefined"!=typeof window?window:this,(function(){return function(){var t={2829:function(t,e,n){"use strict";var r;n.d(e,{jJ:function(){return o},x_:function(){return i},Z1:function(){return r},CN:function(){return s}}),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var o=function(){},i=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";for(var i in n)""===o?!r&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},8721:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var i=n(2881),s=n(8656),a=n(7135),u=n(4371),c=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new i.Db.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(s.EJSON.parse)}]:[2,t]}}))}))},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,n=t.stageKey,r=t.stageValue;return(e={})[n]=JSON.parse(r),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return t.query&&(t.query=a.QuerySerializer.encode(t.query)),t.distanceMultiplier&&"number"==typeof t.distanceMultiplier&&(t.distanceMultiplier=t.distanceMultiplier),t.near&&(t.near=new u.Point(t.near.longitude,t.near.latitude).toJSON()),this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",a.QuerySerializer.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}();e.default=c},9914:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(2282),s=n(1249),a=n(8721),u=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new i.DocumentReference(this._db,this._coll,t)},e.prototype.add=function(t,e){return new i.DocumentReference(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new a.default(this._db,this._coll)},e}(s.Query);e.CollectionReference=u},3265:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1917),s=n(997),a=n(8721);e.Command={eq:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.EQ,[t])},neq:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.NEQ,[t])},lt:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.LT,[t])},lte:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.LTE,[t])},gt:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GT,[t])},gte:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GTE,[t])},in:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.IN,t)},nin:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.NIN,t)},all:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.ALL,t)},elemMatch:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.ELEM_MATCH,[t])},exists:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.EXISTS,[t])},size:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.SIZE,[t])},mod:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.MOD,[t])},geoNear:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_NEAR,[t])},geoWithin:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_WITHIN,[t])},geoIntersects:function(t){return new r.QueryCommand(r.QUERY_COMMANDS_LITERAL.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.AND,n)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.NOR,n)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.OR,n)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new o.LogicCommand(o.LOGIC_COMMANDS_LITERAL.NOT,n)},set:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.SET,[t])},remove:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.REMOVE,[])},inc:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.INC,[t])},mul:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MUL,[t])},push:function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(s.isObject(e[0])&&e[0].hasOwnProperty("each")){var r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=s.isArray(e[0])?e[0]:Array.from(e);return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PUSH,t)},pull:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PULL,t)},pullAll:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.PULL_ALL,t)},pop:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.POP,[])},shift:function(){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=s.isArray(arguments[0])?arguments[0]:Array.from(arguments);return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.UNSHIFT,n)},addToSet:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.ADD_TO_SET,t)},rename:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.RENAME,[t])},bit:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.BIT,[t])},max:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MAX,[t])},min:function(t){return new i.UpdateCommand(i.UPDATE_COMMANDS_LITERAL.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return s.isString(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new a.default},abs:function(t){return new u("abs",t)},add:function(t){return new u("add",t)},ceil:function(t){return new u("ceil",t)},divide:function(t){return new u("divide",t)},exp:function(t){return new u("exp",t)},floor:function(t){return new u("floor",t)},ln:function(t){return new u("ln",t)},log:function(t){return new u("log",t)},log10:function(t){return new u("log10",t)},mod:function(t){return new u("mod",t)},multiply:function(t){return new u("multiply",t)},pow:function(t){return new u("pow",t)},sqrt:function(t){return new u("sqrt",t)},subtract:function(t){return new u("subtract",t)},trunc:function(t){return new u("trunc",t)},arrayElemAt:function(t){return new u("arrayElemAt",t)},arrayToObject:function(t){return new u("arrayToObject",t)},concatArrays:function(t){return new u("concatArrays",t)},filter:function(t){return new u("filter",t)},in:function(t){return new u("in",t)},indexOfArray:function(t){return new u("indexOfArray",t)},isArray:function(t){return new u("isArray",t)},map:function(t){return new u("map",t)},range:function(t){return new u("range",t)},reduce:function(t){return new u("reduce",t)},reverseArray:function(t){return new u("reverseArray",t)},size:function(t){return new u("size",t)},slice:function(t){return new u("slice",t)},zip:function(t){return new u("zip",t)},and:function(t){return new u("and",t)},not:function(t){return new u("not",t)},or:function(t){return new u("or",t)},cmp:function(t){return new u("cmp",t)},eq:function(t){return new u("eq",t)},gt:function(t){return new u("gt",t)},gte:function(t){return new u("gte",t)},lt:function(t){return new u("lt",t)},lte:function(t){return new u("lte",t)},neq:function(t){return new u("ne",t)},cond:function(t){return new u("cond",t)},ifNull:function(t){return new u("ifNull",t)},switch:function(t){return new u("switch",t)},dateFromParts:function(t){return new u("dateFromParts",t)},dateFromString:function(t){return new u("dateFromString",t)},dayOfMonth:function(t){return new u("dayOfMonth",t)},dayOfWeek:function(t){return new u("dayOfWeek",t)},dayOfYear:function(t){return new u("dayOfYear",t)},isoDayOfWeek:function(t){return new u("isoDayOfWeek",t)},isoWeek:function(t){return new u("isoWeek",t)},isoWeekYear:function(t){return new u("isoWeekYear",t)},millisecond:function(t){return new u("millisecond",t)},minute:function(t){return new u("minute",t)},month:function(t){return new u("month",t)},second:function(t){return new u("second",t)},hour:function(t){return new u("hour",t)},week:function(t){return new u("week",t)},year:function(t){return new u("year",t)},literal:function(t){return new u("literal",t)},mergeObjects:function(t){return new u("mergeObjects",t)},objectToArray:function(t){return new u("objectToArray",t)},allElementsTrue:function(t){return new u("allElementsTrue",t)},anyElementTrue:function(t){return new u("anyElementTrue",t)},setDifference:function(t){return new u("setDifference",t)},setEquals:function(t){return new u("setEquals",t)},setIntersection:function(t){return new u("setIntersection",t)},setIsSubset:function(t){return new u("setIsSubset",t)},setUnion:function(t){return new u("setUnion",t)},concat:function(t){return new u("concat",t)},dateToString:function(t){return new u("dateToString",t)},indexOfBytes:function(t){return new u("indexOfBytes",t)},indexOfCP:function(t){return new u("indexOfCP",t)},split:function(t){return new u("split",t)},strLenBytes:function(t){return new u("strLenBytes",t)},strLenCP:function(t){return new u("strLenCP",t)},strcasecmp:function(t){return new u("strcasecmp",t)},substr:function(t){return new u("substr",t)},substrBytes:function(t){return new u("substrBytes",t)},substrCP:function(t){return new u("substrCP",t)},toLower:function(t){return new u("toLower",t)},toUpper:function(t){return new u("toUpper",t)},meta:function(t){return new u("meta",t)},addToSet:function(t){return new u("addToSet",t)},avg:function(t){return new u("avg",t)},first:function(t){return new u("first",t)},last:function(t){return new u("last",t)},max:function(t){return new u("max",t)},min:function(t){return new u("min",t)},push:function(t){return new u("push",t)},stdDevPop:function(t){return new u("stdDevPop",t)},stdDevSamp:function(t){return new u("stdDevSamp",t)},sum:function(t){return new u("sum",t)},let:function(t){return new u("let",t)}},project:{slice:function(t){return new c("slice",t)},elemMatch:function(t){return new c("elemMatch",t)}}};var u=function(t,e){this["$"+t]=e},c=function(t,e){this["$"+t]=e};e.default=e.Command},7505:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(1999),i=n(9112);e.AND="and",e.OR="or",e.NOT="not",e.NOR="nor",function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(r=e.LOGIC_COMMANDS_LITERAL||(e.LOGIC_COMMANDS_LITERAL={}));var s=function(){function t(t,e,n){if(this._internalType=o.SYMBOL_LOGIC_COMMAND,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||o.SYMBOL_UNSET_FIELD_NAME,this.fieldName!==o.SYMBOL_UNSET_FIELD_NAME)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var r=0,s=e.length;r<s;r++)(a(u=e[r])||i.isQueryCommand(u))&&(e[r]=u._setFieldName(this.fieldName))}else{var u;(a(u=e)||i.isQueryCommand(u))&&(e=u._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var n=this.operands.map((function(n){return n instanceof t?n._setFieldName(e):n}));return new t(this.operator,n,e)},t.prototype.and=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return o.unshift(this),new t(r.AND,o,this.fieldName)},t.prototype.or=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return o.unshift(this),new t(r.OR,o,this.fieldName)},t}();function a(t){return t&&t instanceof s&&t._internalType===o.SYMBOL_LOGIC_COMMAND}e.LogicCommand=s,e.isLogicCommand=a,e.isKnownLogicCommand=function(t){return a&&t.operator.toUpperCase()in r},e.default=s},9112:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,s=n(7505),a=n(1999),u=n(4371),c=n(997);e.EQ="eq",e.NEQ="neq",e.GT="gt",e.GTE="gte",e.LT="lt",e.LTE="lte",e.IN="in",e.NIN="nin",e.ALL="all",e.ELEM_MATCH="elemMatch",e.EXISTS="exists",e.SIZE="size",e.MOD="mod",function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(i=e.QUERY_COMMANDS_LITERAL||(e.QUERY_COMMANDS_LITERAL={}));var f=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o.operator=e,o._internalType=a.SYMBOL_QUERY_COMMAND,o}return o(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case i.IN:case i.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var n=new e(i.EQ,[t],this.fieldName);return this.and(n)},e.prototype.neq=function(t){var n=new e(i.NEQ,[t],this.fieldName);return this.and(n)},e.prototype.gt=function(t){var n=new e(i.GT,[t],this.fieldName);return this.and(n)},e.prototype.gte=function(t){var n=new e(i.GTE,[t],this.fieldName);return this.and(n)},e.prototype.lt=function(t){var n=new e(i.LT,[t],this.fieldName);return this.and(n)},e.prototype.lte=function(t){var n=new e(i.LTE,[t],this.fieldName);return this.and(n)},e.prototype.in=function(t){var n=new e(i.IN,t,this.fieldName);return this.and(n)},e.prototype.nin=function(t){var n=new e(i.NIN,t,this.fieldName);return this.and(n)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof u.Point))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!c.isNumber(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!c.isNumber(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var n=new e(i.GEO_NEAR,[t],this.fieldName);return this.and(n)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof u.MultiPolygon||t.geometry instanceof u.Polygon))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var n=new e(i.GEO_WITHIN,[t],this.fieldName);return this.and(n)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof u.Point||t.geometry instanceof u.LineString||t.geometry instanceof u.Polygon||t.geometry instanceof u.MultiPoint||t.geometry instanceof u.MultiLineString||t.geometry instanceof u.MultiPolygon))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var n=new e(i.GEO_INTERSECTS,[t],this.fieldName);return this.and(n)},e}(s.LogicCommand);function l(t){return t&&t instanceof f&&t._internalType===a.SYMBOL_QUERY_COMMAND}e.QueryCommand=f,e.isQueryCommand=l,e.isKnownQueryCommand=function(t){return l(t)&&t.operator.toUpperCase()in i},e.isComparisonCommand=function(t){return l(t)},e.default=f},1917:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(1999);!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(r=e.UPDATE_COMMANDS_LITERAL||(e.UPDATE_COMMANDS_LITERAL={}));var i=function(){function t(t,e,n){this._internalType=o.SYMBOL_UPDATE_COMMAND,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||o.SYMBOL_UNSET_FIELD_NAME}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function s(t){return t&&t instanceof i&&t._internalType===o.SYMBOL_UPDATE_COMMAND}e.UpdateCommand=i,e.isUpdateCommand=s,e.isKnownUpdateCommand=function(t){return s(t)&&t.operator.toUpperCase()in r},e.default=i},6828:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS={CREATE_WATCH_NET_ERROR:{code:"CREATE_WATCH_NET_ERROR",message:"create watch network error"},CREATE_WACTH_EXCEED_ERROR:{code:"CREATE_WACTH_EXCEED_ERROR",message:"maximum connections exceed"},CREATE_WATCH_SERVER_ERROR:{code:"CREATE_WATCH_SERVER_ERROR",message:"create watch server error"},CONN_ERROR:{code:"CONN_ERROR",message:"connection error"},INVALID_PARAM:{code:"INVALID_PARAM",message:"Invalid request param"},INSERT_DOC_FAIL:{code:"INSERT_DOC_FAIL",message:"insert document failed"},DATABASE_TRANSACTION_CONFLICT:{code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"}}},2049:function(t,e){"use strict";var n,r,o;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(r||(r={})),e.ErrorCode=r,e.FieldType={String:"String",Number:"Number",Object:"Object",Array:"Array",Boolean:"Boolean",Null:"Null",GeoPoint:"GeoPoint",GeoLineString:"GeoLineString",GeoPolygon:"GeoPolygon",GeoMultiPoint:"GeoMultiPoint",GeoMultiLineString:"GeoMultiLineString",GeoMultiPolygon:"GeoMultiPolygon",Timestamp:"Date",Command:"Command",ServerDate:"ServerDate",BsonDate:"BsonDate"},e.OrderDirectionList=["desc","asc"],e.WhereFilterOpList=["<","<=","==",">=",">"],function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(o||(o={})),e.Opeartor=o;var i,s=((n={})[o.eq]="$eq",n[o.lt]="$lt",n[o.lte]="$lte",n[o.gt]="$gt",n[o.gte]="$gte",n);e.OperatorMap=s,e.UpdateOperatorList=["$set","$inc","$mul","$unset","$push","$pop","$unshift","$shift","$currentDate","$each","$position"],function(t){t.WHERE="WHERE",t.DOC="DOC"}(i||(i={})),e.QueryType=i},2282:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2544),i=n(2881),s=n(8551),a=n(3763),u=n(4674),c=n(1917),f=n(2049),l=n(4641),h=function(){function t(t,e,n,o){var s=this;void 0===o&&(o={}),this.watch=function(t){return l.getWsInstance(s._db).watch(r(r({},t),{envId:s._db.config.env,collectionName:s._coll,query:JSON.stringify({_id:s.id})}))},this._db=t,this._coll=e,this.id=n,this.request=new i.Db.reqClass(this._db.config),this.projection=o}return t.prototype.create=function(t,e){e=e||o.createPromiseCallback();var n={collectionName:this._coll,data:u.serialize(t)};return this.id&&(n._id=this.id),this.request.send("database.addDocument",n).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||o.createPromiseCallback(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof c.UpdateCommand?n=!0:"object"==typeof t[e]&&r(t[e])};if(r(t),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var i={collectionName:this._coll,queryType:f.QueryType.DOC,data:u.serialize(t),multi:!1,merge:!1,upsert:!0};return this.id&&(i.query={_id:this.id}),this.request.send("database.updateDocument",i).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||o.createPromiseCallback(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:a.UpdateSerializer.encode(t),query:n,queryType:f.QueryType.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||o.createPromiseCallback();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:f.QueryType.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||o.createPromiseCallback();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:f.QueryType.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n=s.Util.formatResDocumentData(e.data.list);t(0,{data:n,requestId:e.requestId})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var n in e)e[n]?e[n]=1:e[n]=0;return new t(this._db,this._coll,this.id,e)},t}();e.DocumentReference=h},4371:function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(8456)),r(n(6379)),r(n(848)),r(n(5105)),r(n(8437)),r(n(9820))},6379:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(8456),s=n(997),a=function(){function t(t){if(!s.isArray(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof i.Point))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("LineString"!==t.type||!s.isArray(t.coordinates))return!1;try{for(var o=r(t.coordinates),i=o.next();!i.done;i=o.next()){var a=i.value;if(!s.isNumber(a[0])||!s.isNumber(a[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],n=t.points[t.points.length-1];if(e.latitude===n.latitude&&e.longitude===n.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_LINE_STRING},enumerable:!0,configurable:!0}),t}();e.LineString=a},8437:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(6379),a=function(){function t(t){if(!i.isArray(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof s.LineString))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,o,s;if("MultiLineString"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var a=r(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var f=(o=void 0,r(c)),l=f.next();!l.done;l=f.next()){var h=l.value;if(!i.isNumber(h[0])||!i.isNumber(h[1]))return!1}}catch(t){o={error:t}}finally{try{l&&!l.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_LINE_STRING},enumerable:!0,configurable:!0}),t}();e.MultiLineString=a},5105:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(8456),s=n(997),a=function(){function t(t){if(!s.isArray(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof i.Point))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("MultiPoint"!==t.type||!s.isArray(t.coordinates))return!1;try{for(var o=r(t.coordinates),i=o.next();!i.done;i=o.next()){var a=i.value;if(!s.isNumber(a[0])||!s.isNumber(a[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_POINT},enumerable:!0,configurable:!0}),t}();e.MultiPoint=a},9820:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(848),a=function(){function t(t){var e,n;if(!i.isArray(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;if(!(u instanceof s.Polygon))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof u+"[]")}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,n,o,s,a,u;if("MultiPolygon"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var c=r(t.coordinates),f=c.next();!f.done;f=c.next()){var l=f.value;try{for(var h=(o=void 0,r(l)),p=h.next();!p.done;p=h.next()){var d=p.value;try{for(var y=(a=void 0,r(d)),g=y.next();!g.done;g=y.next()){var v=g.value;if(!i.isNumber(v[0])||!i.isNumber(v[1]))return!1}}catch(t){a={error:t}}finally{try{g&&!g.done&&(u=y.return)&&u.call(y)}finally{if(a)throw a.error}}}}catch(t){o={error:t}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_POLYGON},enumerable:!0,configurable:!0}),t}();e.MultiPolygon=a},8456:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9895),o=n(1999),i=n(997),s=function(){function t(t,e){r.Validate.isGeopoint("longitude",t),r.Validate.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&i.isArray(t.coordinates)&&r.Validate.isGeopoint("longitude",t.coordinates[0])&&r.Validate.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_POINT},enumerable:!0,configurable:!0}),t}();e.Point=s},848:function(t,e,n){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0});var o=n(1999),i=n(997),s=n(6379),a=function(){function t(t){if(!i.isArray(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof s.LineString))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!s.LineString.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,o,s;if("Polygon"!==t.type||!i.isArray(t.coordinates))return!1;try{for(var a=r(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;if(!this.isCloseLineString(c))return!1;try{for(var f=(o=void 0,r(c)),l=f.next();!l.done;l=f.next()){var h=l.value;if(!i.isNumber(h[0])||!i.isNumber(h[1]))return!1}}catch(t){o={error:t}}finally{try{l&&!l.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return o.SYMBOL_GEO_MULTI_POLYGON},enumerable:!0,configurable:!0}),t}();e.Polygon=a},1999:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(656);!function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(656)),e.SYMBOL_UNSET_FIELD_NAME=r.default.for("UNSET_FIELD_NAME"),e.SYMBOL_UPDATE_COMMAND=r.default.for("UPDATE_COMMAND"),e.SYMBOL_QUERY_COMMAND=r.default.for("QUERY_COMMAND"),e.SYMBOL_LOGIC_COMMAND=r.default.for("LOGIC_COMMAND"),e.SYMBOL_GEO_POINT=r.default.for("GEO_POINT"),e.SYMBOL_GEO_LINE_STRING=r.default.for("SYMBOL_GEO_LINE_STRING"),e.SYMBOL_GEO_POLYGON=r.default.for("SYMBOL_GEO_POLYGON"),e.SYMBOL_GEO_MULTI_POINT=r.default.for("SYMBOL_GEO_MULTI_POINT"),e.SYMBOL_GEO_MULTI_LINE_STRING=r.default.for("SYMBOL_GEO_MULTI_LINE_STRING"),e.SYMBOL_GEO_MULTI_POLYGON=r.default.for("SYMBOL_GEO_MULTI_POLYGON"),e.SYMBOL_SERVER_DATE=r.default.for("SERVER_DATE"),e.SYMBOL_REGEXP=r.default.for("REGEXP")},2881:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4371),o=n(9914),i=n(3265),s=n(7719),a=n(3602),u=n(1780),c=n(7505),f=n(9112),l=n(1917),h=n(1249);e.Query=h.Query;var p=n(9914);e.CollectionReference=p.CollectionReference;var d=n(2282);e.DocumentReference=d.DocumentReference;var y=function(){function t(t){this.config=t,this.Geo=r,this.serverDate=s.ServerDateConstructor,this.command=i.Command,this.RegExp=a.RegExpConstructor,this.startTransaction=u.startTransaction,this.runTransaction=u.runTransaction,this.logicCommand=c.LogicCommand,this.updateCommand=l.UpdateCommand,this.queryCommand=f.QueryCommand}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new o.CollectionReference(this,t)},t.prototype.createCollection=function(e){var n={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",n)},t}();e.Db=y},2544:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),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 n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t}},7164:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1917);for(var s in e.OperatorMap={},r.QUERY_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;for(var s in o.LOGIC_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;for(var s in i.UPDATE_COMMANDS_LITERAL)e.OperatorMap[s]="$"+s;e.OperatorMap[r.QUERY_COMMANDS_LITERAL.NEQ]="$ne",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.REMOVE]="$unset",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.SHIFT]="$pop",e.OperatorMap[i.UPDATE_COMMANDS_LITERAL.UNSHIFT]="$push",e.operatorToString=function(t){return e.OperatorMap[t]||"$"+t}},1249:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2544),i=n(2049),s=n(2881),a=n(9895),u=n(8551),c=n(7135),f=n(3763),l=n(2049),h=n(4641),p=function(){function t(t,e,n,o,i){var a=this;this.watch=function(t){return h.getWsInstance(a._db).watch(r(r({},t),{envId:a._db.config.env,collectionName:a._coll,query:JSON.stringify(a._fieldFilters||{}),limit:a._queryOptions.limit,orderBy:a._fieldOrders?a._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=n,this._fieldOrders=o||[],this._queryOptions=i||{},this._request=new s.Db.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||o.createPromiseCallback();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var n={collectionName:this._coll,queryType:i.QueryType.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),e.length>0&&(n.order=e),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n={data:u.Util.formatResDocumentData(e.data.list),requestId:e.requestId};e.total&&(n.total=e.total),e.limit&&(n.limit=e.limit),e.offset&&(n.offset=e.offset),t(0,n)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||o.createPromiseCallback();var e={collectionName:this._coll,queryType:i.QueryType.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(l.ErrorCode.QueryParamTypeError);var n=Object.keys(e),r=n.some((function(t){return void 0!==e[t]}));if(n.length&&!r)throw Error(l.ErrorCode.QueryParamValueError);return new t(this._db,this._coll,c.QuerySerializer.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){a.Validate.isFieldPath(e),a.Validate.isFieldOrder(n);var r={field:e,direction:n},o=this._fieldOrders.concat(r);return new t(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){a.Validate.isInteger("limit",e);var n=r({},this._queryOptions);return n.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){a.Validate.isInteger("offset",e);var n=r({},this._queryOptions);return n.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.update=function(t,e){if(e=e||o.createPromiseCallback(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:i.QueryType.WHERE,multi:!0,merge:!0,upsert:!1,data:f.UpdateSerializer.encode(t)};return this._request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var o=r({},this._queryOptions);return o.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,o)},t.prototype.remove=function(t){t=t||o.createPromiseCallback(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:c.QuerySerializer.encode(this._fieldFilters),queryType:i.QueryType.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}();e.Query=p},3602:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1999),o=function(){function t(t){var e=t.regexp,n=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=n}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return r.SYMBOL_REGEXP},enumerable:!0,configurable:!0}),t}();e.RegExp=o,e.RegExpConstructor=function(t){return new o(t)}},9778:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var s=n(997),a=n(4674);function u(t,e,n,o){var a=r({},t);for(var c in t)if(!/^\$/.test(c)){var f=t[c];if(f&&s.isObject(f)&&!e(f)){if(o.indexOf(f)>-1)throw new Error("Cannot convert circular structure to JSON");var l=u(f,e,i(n,[c]),i(o,[f]));a[c]=l;var h=!1;for(var p in l)/^\$/.test(p)?h=!0:(a[c+"."+p]=l[p],delete a[c][p]);h||delete a[c]}}return a}function c(t){return s.isInternalObject(t)||s.isDate(t)||s.isRegExp(t)}e.flattenQueryObject=function(t){return u(t,c,[],[t])},e.flattenObject=function(t){return u(t,(function(t){return!1}),[],[t])},e.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?s.isArray(t[r])?t[r].push(e[r]):s.isObject(t[r])?s.isObject(e[r])?Object.assign(t[r],e[r]):(console.warn("unmergable condition, query is object but condition is "+s.getType(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+s.getType(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},e.isConversionRequired=c,e.encodeInternalDataType=function(t){return a.serialize(t)},e.decodeInternalDataType=function(t){return a.deserialize(t)}},4674:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var s=n(1999),a=n(997),u=n(4371),c=n(7719);function f(t,e){if(!a.isInternalObject(t)){if(a.isDate(t))return{$date:+t};if(a.isRegExp(t))return{$regex:t.source,$options:t.flags};if(a.isArray(t))return t.map((function(t){if(e.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return f(t,i(e,[t]))}));if(a.isObject(t)){var n=r({},t);for(var o in n){if(e.indexOf(n[o])>-1)throw new Error("Cannot convert circular structure to JSON");n[o]=f(n[o],i(e,[n[o]]))}return n}return t}switch(t._internalType){case s.SYMBOL_GEO_POINT:return t.toJSON();case s.SYMBOL_SERVER_DATE:case s.SYMBOL_REGEXP:return t.parse();default:return t.toJSON?t.toJSON():t}}e.serialize=function(t){return f(t,[t])},e.deserialize=function(t){var e=r({},t);for(var n in e)switch(n){case"$date":switch(a.getType(e[n])){case"number":return new Date(e[n]);case"object":return new c.ServerDate(e[n])}break;case"type":if("Point"===e.type&&a.isArray(e.coordinates)&&a.isNumber(e.coordinates[0])&&a.isNumber(e.coordinates[1]))return new u.Point(e.coordinates[0],e.coordinates[1])}return t}},7135:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9112),o=n(7505),i=n(1999),s=n(997),a=n(7164),u=n(9778),c=function(){function t(){}return t.encode=function(t){return(new f).encodeQuery(t)},t}();e.QuerySerializer=c;var f=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var n;return u.isConversionRequired(t)?o.isLogicCommand(t)?this.encodeLogicCommand(t):r.isQueryCommand(t)?this.encodeQueryCommand(t):((n={})[e]=this.encodeQueryObject(t),n):s.isObject(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,n,r,i,u,c,f,l=this;switch(t.operator){case o.LOGIC_COMMANDS_LITERAL.NOR:case o.LOGIC_COMMANDS_LITERAL.AND:case o.LOGIC_COMMANDS_LITERAL.OR:var h=a.operatorToString(t.operator),p=t.operands.map((function(e){return l.encodeQuery(e,t.fieldName)}));return(e={})[h]=p,e;case o.LOGIC_COMMANDS_LITERAL.NOT:h=a.operatorToString(t.operator);var d=t.operands[0];return s.isRegExp(d)?((n={})[t.fieldName]=((r={})[h]=this.encodeRegExp(d),r),n):(p=this.encodeQuery(d)[t.fieldName],(i={})[t.fieldName]=((u={})[h]=p,u),i);default:if(h=a.operatorToString(t.operator),1===t.operands.length){var y=this.encodeQuery(t.operands[0]);return(c={})[h]=y,c}return p=t.operands.map(this.encodeQuery.bind(this)),(f={})[h]=p,f}},t.prototype.encodeQueryCommand=function(t){return r.isComparisonCommand(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,n,o,s,c,f,l,h,p;if(t.fieldName===i.SYMBOL_UNSET_FIELD_NAME)throw new Error("Cannot encode a comparison command with unset field name");var d=a.operatorToString(t.operator);switch(t.operator){case r.QUERY_COMMANDS_LITERAL.EQ:case r.QUERY_COMMANDS_LITERAL.NEQ:case r.QUERY_COMMANDS_LITERAL.LT:case r.QUERY_COMMANDS_LITERAL.LTE:case r.QUERY_COMMANDS_LITERAL.GT:case r.QUERY_COMMANDS_LITERAL.GTE:case r.QUERY_COMMANDS_LITERAL.ELEM_MATCH:case r.QUERY_COMMANDS_LITERAL.EXISTS:case r.QUERY_COMMANDS_LITERAL.SIZE:case r.QUERY_COMMANDS_LITERAL.MOD:return(e={})[t.fieldName]=((n={})[d]=u.encodeInternalDataType(t.operands[0]),n),e;case r.QUERY_COMMANDS_LITERAL.IN:case r.QUERY_COMMANDS_LITERAL.NIN:case r.QUERY_COMMANDS_LITERAL.ALL:return(o={})[t.fieldName]=((s={})[d]=u.encodeInternalDataType(t.operands),s),o;case r.QUERY_COMMANDS_LITERAL.GEO_NEAR:var y=t.operands[0];return(c={})[t.fieldName]={$nearSphere:{$geometry:y.geometry.toJSON(),$maxDistance:y.maxDistance,$minDistance:y.minDistance}},c;case r.QUERY_COMMANDS_LITERAL.GEO_WITHIN:return y=t.operands[0],(f={})[t.fieldName]={$geoWithin:{$geometry:y.geometry.toJSON()}},f;case r.QUERY_COMMANDS_LITERAL.GEO_INTERSECTS:return y=t.operands[0],(l={})[t.fieldName]={$geoIntersects:{$geometry:y.geometry.toJSON()}},l;default:return(h={})[t.fieldName]=((p={})[d]=u.encodeInternalDataType(t.operands[0]),p),h}},t.prototype.encodeQueryObject=function(t){var e=u.flattenQueryObject(t);for(var n in e){var i=e[n];if(o.isLogicCommand(i)){e[n]=i._setFieldName(n);var s=this.encodeLogicCommand(e[n]);this.mergeConditionAfterEncode(e,s,n)}else r.isComparisonCommand(i)?(e[n]=i._setFieldName(n),s=this.encodeComparisonCommand(e[n]),this.mergeConditionAfterEncode(e,s,n)):u.isConversionRequired(i)&&(e[n]=u.encodeInternalDataType(i))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?s.isArray(t[r])?t[r]=t[r].concat(e[r]):s.isObject(t[r])?s.isObject(e[r])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+s.getType(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+s.getType(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},t}()},3763:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1917),o=n(1999),i=n(997),s=n(7164),a=n(9778),u=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return r.isUpdateCommand(t)?this.encodeUpdateCommand(t):"object"===i.getType(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===o.SYMBOL_UNSET_FIELD_NAME)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case r.UPDATE_COMMANDS_LITERAL.PUSH:case r.UPDATE_COMMANDS_LITERAL.PULL:case r.UPDATE_COMMANDS_LITERAL.PULL_ALL:case r.UPDATE_COMMANDS_LITERAL.POP:case r.UPDATE_COMMANDS_LITERAL.SHIFT:case r.UPDATE_COMMANDS_LITERAL.UNSHIFT:case r.UPDATE_COMMANDS_LITERAL.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,n,o,i,a=s.operatorToString(t.operator);return t.operator===r.UPDATE_COMMANDS_LITERAL.REMOVE?((e={})[a]=((n={})[t.fieldName]="",n),e):((o={})[a]=((i={})[t.fieldName]=t.operands[0],i),o)},t.prototype.encodeArrayUpdateCommand=function(t){var e,n,o,u,c,f,l,h,p,d,y=s.operatorToString(t.operator);switch(t.operator){case r.UPDATE_COMMANDS_LITERAL.PUSH:var g=void 0;return g=i.isArray(t.operands)?{$each:t.operands.map(a.encodeInternalDataType)}:t.operands,(e={})[y]=((n={})[t.fieldName]=g,n),e;case r.UPDATE_COMMANDS_LITERAL.UNSHIFT:return g={$each:t.operands.map(a.encodeInternalDataType),$position:0},(o={})[y]=((u={})[t.fieldName]=g,u),o;case r.UPDATE_COMMANDS_LITERAL.POP:return(c={})[y]=((f={})[t.fieldName]=1,f),c;case r.UPDATE_COMMANDS_LITERAL.SHIFT:return(l={})[y]=((h={})[t.fieldName]=-1,h),l;default:return(p={})[y]=((d={})[t.fieldName]=a.encodeInternalDataType(t.operands),d),p}},t.prototype.encodeUpdateObject=function(t){var e=a.flattenQueryObject(t);for(var n in e)if(!/^\$/.test(n)){var o=e[n];if(r.isUpdateCommand(o)){e[n]=o._setFieldName(n);var i=this.encodeUpdateCommand(e[n]);a.mergeConditionAfterEncode(e,i,n)}else{e[n]=o=a.encodeInternalDataType(o);var s=new r.UpdateCommand(r.UPDATE_COMMANDS_LITERAL.SET,[o],n);i=this.encodeUpdateCommand(s),a.mergeConditionAfterEncode(e,i,n)}}return e},t}();e.UpdateSerializer=u},7719:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1999),o=function(){function t(t){var e=(void 0===t?{}:t).offset,n=void 0===e?0:e;this.offset=n}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return r.SYMBOL_SERVER_DATE},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();e.ServerDate=o,e.ServerDateConstructor=function(t){return new o(t)}},6896:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(2302),s=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new i.DocumentReference(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new i.DocumentReference(this._transaction,this._coll,e).create(t)},e}(n(4702).Query);e.CollectionReference=s},2302:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var s=n(8656),a=n(6828),u=n(3763),c=n(4674),f=n(8551),l="database.updateDocInTransaction",h=function(){function t(t,e,n){this._coll=e,this.id=n,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return o(this,void 0,void 0,(function(){var e,n,o,u;return i(this,(function(i){switch(i.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:s.EJSON.stringify(c.serialize(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((n=i.sent()).code)throw n;if(o=s.EJSON.parse(n.inserted),1==(u=s.EJSON.parse(n.ok))&&1==o)return[2,r(r({},n),{ok:u,inserted:o})];throw new Error(a.ERRORS.INSERT_DOC_FAIL.message)}}))}))},t.prototype.get=function(){return o(this,void 0,void 0,(function(){var t,e;return i(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,{data:"null"!==e.data?f.Util.formatField(s.EJSON.parse(e.data)):s.EJSON.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return o(this,void 0,void 0,(function(){var e,n;return i(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:s.EJSON.stringify(c.serialize(t),{relaxed:!1}),upsert:!0},[4,this._request.send(l,e)];case 1:if((n=o.sent()).code)throw n;return[2,r(r({},n),{updated:s.EJSON.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},t.prototype.update=function(t){return o(this,void 0,void 0,(function(){var e,n;return i(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:s.EJSON.stringify(u.UpdateSerializer.encode(t),{relaxed:!1})},[4,this._request.send(l,e)];case 1:if((n=o.sent()).code)throw n;return[2,r(r({},n),{updated:s.EJSON.parse(n.updated)})]}}))}))},t.prototype.delete=function(){return o(this,void 0,void 0,(function(){var t,e;return i(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,r(r({},e),{deleted:s.EJSON.parse(e.deleted)})]}}))}))},t}();e.DocumentReference=h},1780:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=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});var i=n(2881),s=n(6896),a=n(6828),u=function(){function t(t){this._db=t,this._request=new i.Db.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new s.CollectionReference(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return r(this,void 0,void 0,(function(){var t,e;return o(this,(function(n){switch(n.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=n.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return r(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=t,[2,n]}}))}))},t}();e.Transaction=u,e.startTransaction=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,(t=new u(this)).init()];case 1:return e.sent(),[2,t]}}))}))},e.runTransaction=function t(e,n){return void 0===n&&(n=3),r(this,void 0,void 0,(function(){var i,s,c,f,l=this;return o(this,(function(h){switch(h.label){case 0:return h.trys.push([0,4,,10]),[4,(i=new u(this)).init()];case 1:return h.sent(),[4,e(i)];case 2:if(s=h.sent(),!0===i.aborted)throw i.abortReason;return[4,i.commit()];case 3:return h.sent(),[2,s];case 4:if(c=h.sent(),!1===i.inited)throw c;return f=function(t){return r(l,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(i.aborted||i.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.rollback()];case 2:case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===i.aborted)throw i.abortReason;throw t}}))}))},n<=0?[4,f(c)]:[3,6];case 5:h.sent(),h.label=6;case 6:return c&&c.code===a.ERRORS.DATABASE_TRANSACTION_CONFLICT.code?[4,t.bind(this)(e,--n)]:[3,8];case 7:return[2,h.sent()];case 8:return[4,f(c)];case 9:return h.sent(),[3,10];case 10:return[2]}}))}))}},4702:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Query=function(t,e){this._coll=e,this._transaction=t}},8551:function(t,e,n){"use strict";var r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0});var o=n(2049),i=n(4371),s=n(7719),a=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var n=Object.keys(e),s={};return Array.isArray(e)&&(s=[]),n.forEach((function(n){var a,u=e[n];switch(t.whichType(u)){case o.FieldType.GeoPoint:a=new i.Point(u.coordinates[0],u.coordinates[1]);break;case o.FieldType.GeoLineString:a=new i.LineString(u.coordinates.map((function(t){return new i.Point(t[0],t[1])})));break;case o.FieldType.GeoPolygon:a=new i.Polygon(u.coordinates.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})));break;case o.FieldType.GeoMultiPoint:a=new i.MultiPoint(u.coordinates.map((function(t){return new i.Point(t[0],t[1])})));break;case o.FieldType.GeoMultiLineString:a=new i.MultiLineString(u.coordinates.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})));break;case o.FieldType.GeoMultiPolygon:a=new i.MultiPolygon(u.coordinates.map((function(t){return new i.Polygon(t.map((function(t){return new i.LineString(t.map((function(t){var e=r(t,2),n=e[0],o=e[1];return new i.Point(n,o)})))})))})));break;case o.FieldType.Timestamp:a=new Date(1e3*u.$timestamp);break;case o.FieldType.Object:case o.FieldType.Array:a=t.formatField(u);break;case o.FieldType.ServerDate:a=new Date(u.$date);break;default:a=u}Array.isArray(s)?s.push(a):s[n]=a})),s},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===o.FieldType.Timestamp)return o.FieldType.BsonDate;if(e===o.FieldType.Object){if(t instanceof i.Point)return o.FieldType.GeoPoint;if(t instanceof Date)return o.FieldType.Timestamp;if(t instanceof s.ServerDate)return o.FieldType.ServerDate;t.$timestamp?e=o.FieldType.Timestamp:t.$date?e=o.FieldType.ServerDate:i.Point.validate(t)?e=o.FieldType.GeoPoint:i.LineString.validate(t)?e=o.FieldType.GeoLineString:i.Polygon.validate(t)?e=o.FieldType.GeoPolygon:i.MultiPoint.validate(t)?e=o.FieldType.GeoMultiPoint:i.MultiLineString.validate(t)?e=o.FieldType.GeoMultiLineString:i.MultiPolygon.validate(t)&&(e=o.FieldType.GeoMultiPolygon)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",n=0;n<24;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}();e.Util=a},656:function(t,e){"use strict";var n,r=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 n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n(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)});Object.defineProperty(e,"__esModule",{value:!0});var o=[],i={},s=function(t){function e(e,n){if(n!==i)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return r(e,t),e.for=function(t){for(var n=0,r=o.length;n<r;n++)if(o[n].target===t)return o[n].instance;var s=new e(t,i);return o.push({target:t,instance:s}),s},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})}));e.InternalSymbol=s,e.default=s},997:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(656);e.getType=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},e.isObject=function(t){return"object"===e.getType(t)},e.isString=function(t){return"string"===e.getType(t)},e.isNumber=function(t){return"number"===e.getType(t)},e.isPromise=function(t){return"promise"===e.getType(t)},e.isFunction=function(t){return"function"==typeof t},e.isArray=function(t){return Array.isArray(t)},e.isDate=function(t){return"date"===e.getType(t)},e.isRegExp=function(t){return"regexp"===e.getType(t)},e.isInternalObject=function(t){return t&&t._internalType instanceof r.InternalSymbol},e.isPlainObject=function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}},4641:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2881);e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))};var o={};e.autoCount=function(t){return void 0===t&&(t="any"),o[t]||(o[t]=0),o[t]++};var i={};e.getWsInstance=function(t){if(!r.Db.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return i[e]||(i[e]=new r.Db.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new r.Db.reqClass(t.config)}}})),i[e]}},9895:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2049),o=n(8551),i=function(){function t(){}return t.isGeopoint=function(t,e){if(o.Util.whichType(e)!==r.FieldType.Number)throw new Error("Geo Point must be number type");var n=Math.abs(e);if("latitude"===t&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+r.ErrorCode.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===r.OrderDirectionList.indexOf(t))throw new Error(r.ErrorCode.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===r.WhereFilterOpList.indexOf(t))throw new Error(r.ErrorCode.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(r.ErrorCode.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(r.ErrorCode.DocIDError);return!0},t}();e.Validate=i},9195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},o=r(n(7805)),i=n(2828),s=n(7338),a=n(7766),u=n(3337),c=n(3098),f=n(4797),l=r(n(4536)).default.version;o.default.registerVersion(l);try{(0,i.registerAuth)(o.default),(0,s.registerFunctions)(o.default),(0,a.registerStorage)(o.default),(0,f.registerDatabase)(o.default),(0,u.registerRealtime)(o.default),(0,c.registerAnalytics)(o.default)}catch(t){}try{window.cloudbase=o.default}catch(t){}e.default=o.default,t.exports=o.default},3098:function(t,e,n){"use strict";n.r(e),n.d(e,{registerAnalytics:function(){return h}});var r=n(1142),o=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=r._G.Sg,s=r._G.vM,a=r.BM.D,u="analytics",c=["mall"],f=new(function(){function t(){}return t.prototype.analytics=function(t){return e=this,n=void 0,o=function(){var e,n,r;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){if(!function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))return!1;var e=t.report_data,n=t.report_type;return!1!==c.includes(n)&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!(void 0!==e.action_time&&!Number.isInteger(e.action_time))&&"string"==typeof e.action_type}(t))throw new Error(JSON.stringify({code:i.INVALID_PARAMS,msg:"[".concat(u,".analytics] invalid report data")}));return e=void 0===t.report_data.action_time?Math.floor(Date.now()/1e3):t.report_data.action_time,n={analytics_scene:t.report_type,analytics_data:Object.assign({},t.report_data,{action_time:e})},r={requestData:n},this.request.send("analytics.report",r),[2]}))},new((r=void 0)||(r=Promise))((function(t,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o},function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);i>3&&s&&Object.defineProperty(e,n,s)}([a({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(s)]}),o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],t.prototype,"analytics",null),t}()),l={name:u,entity:{analytics:f.analytics}};try{cloudbase.registerComponent(l)}catch(t){}function h(t){try{t.registerComponent(l)}catch(t){console.warn(t)}}},7805:function(t,e,n){"use strict";n.r(e),n.d(e,{cloudbase:function(){return st},default:function(){return at},getBaseEndPoint:function(){return x}});var r,o=n(1142),i=n(2829),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)},u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return s(e,t),e.prototype.post=function(t){var e=this;return new Promise((function(n,r){var o=t.url,s=t.data,a=t.headers,u=wx.request({url:(0,i.CN)("https:",o),data:s,timeout:e._timeout,method:"POST",header:a,success:function(t){n(t)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("post")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e.prototype.upload=function(t){var e=this,n=this;return new Promise((function(r){return o=e,i=void 0,u=function(){var e,o,i,s,u,c;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(f){return e=t.url,o=t.file,i=t.data,s=t.headers,u=t.onUploadProgress,c=wx.uploadFile({url:e,filePath:o,name:"file",formData:a({},i),header:s,timeout:this._timeout,success:function(t){var e={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&i.success_action_status&&(e.statusCode=parseInt(i.success_action_status,10)),r(e)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{c.abort()}catch(t){}}}}),u&&c.onProgressUpdate((function(t){u(t)})),[2]}))},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function r(t){try{a(u.throw(t))}catch(t){e(t)}}function a(e){var o;e.done?t(e.value):(o=e.value,o instanceof s?o:new s((function(t){t(o)}))).then(n,r)}a((u=u.apply(o,i||[])).next())}));var o,i,s,u}))},e.prototype.download=function(t){var e=this,n=this;return new Promise((function(r,o){var s=t.url,a=t.headers,u=wx.downloadFile({url:(0,i.CN)("https:",s),header:a,timeout:e._timeout,success:function(t){200===t.statusCode&&t.tempFilePath?r({statusCode:200,tempFilePath:t.tempFilePath}):r(t)},fail:function(t){o(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("download")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e}(i.jJ),c={setItem:function(t,e){wx.setStorageSync(t,e)},getItem:function(t){return wx.getStorageSync(t)},removeItem:function(t){wx.removeStorageSync(t)},clear:function(){wx.clearStorageSync()}},f=function(t,e){void 0===e&&(e={});var n=wx.connectSocket(a({url:t},e));return{set onopen(t){n.onOpen(t)},set onmessage(t){n.onMessage(t)},set onclose(t){n.onClose(t)},set onerror(t){n.onError(t)},send:function(t){return n.send({data:t})},close:function(t,e){return n.close({code:t,reason:e})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}},l={genAdapter:function(){return{root:{},reqClass:u,wsClass:f,localStorage:c,primaryStorage:i.Z1.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0},runtime:"wx_mp"},h=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},p=o._G.Sg,d={};function y(t,e){var n=e.name,r=e.namespace,o=e.entity,i=e.injectEvents,s=e.IIFE,a=void 0!==s&&s;if(d[n]||r&&t[r])throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:p.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(t)}if(d[n]=e,r?t.prototype[r]=o:g(t.prototype,o),i){var u=i.bus,c=i.events;if(!u||!c||0===c.length)return;var f=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=h(h([],t.prototype.events[n].events,!0),c,!0):t.prototype.events[n]={bus:u,events:c},t.prototype.fire=function(t,e){f(t,e);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var o=r[n],i=this.events[o],s=i.bus;if(i.events.includes(t)){s.fire(t,e);break}}}}}function g(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=g(t[o],e[o]))}return t}var v={},m=function(){return m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},m.apply(this,arguments)},b="user_info",_=o.Fs.q,w={},E={};function S(t){var e=t.env,n=t.platformInfo,r={userInfoKey:"".concat(b,"_").concat(e)};w[e]=w[e]||new _(m(m({},t),{keys:r,platformInfo:n})),E[e]=E[e]||new _(m(m({},t),{keys:r,platformInfo:n,persistence:"local"}))}function I(t){return E[t]}var O,A=o._G.tC,T=o._G.pM,N="",R="@cloudbase/js-sdk",L="https:",C="//tcb-api.tencentcloudapi.com/web";function P(t,e){C=t,e&&(L=e,T(e))}function D(){return{BASE_URL:C,PROTOCOL:L}}function x(){var t=D(),e=t.PROTOCOL,n=t.BASE_URL;return"".concat(e).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(O||(O={}));var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},U.apply(this,arguments)},M=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},j=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},B=o._G.Sg,k=o.P6.Jc,q=o.P6.hp,F=o.P6.CN,W=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function G(t,e,n){var r=t[e];t[e]=function(e){var o={},i={};n.forEach((function(n){var r=n.call(t,e),s=r.data,a=r.headers;Object.assign(o,s),Object.assign(i,a)}));var s=e.data;return s&&(q(s)?Object.keys(o).forEach((function(t){s.append(t,o[t])})):e.data=U(U({},s),o)),e.headers=U(U({},e.headers||{}),i),r.call(t,e)}}function $(){var t=k();return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(N),"x-seqid":t}}}var V=function(){function t(t){this.throwWhenRequestFail=!1,this.config=t;var e={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new v.adapter.reqClass(e),this.throwWhenRequestFail=t.throw||!1,this.localCache=I(this.config.env),G(this.reqClass,"post",[$]),G(this.reqClass,"upload",[$]),G(this.reqClass,"download",[$])}return t.prototype.post=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.post(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.upload=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.upload(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return M(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.download(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getBaseEndPoint=function(){return x()},t.prototype.getOauthAccessTokenV2=function(t){return M(this,void 0,void 0,(function(){var e,n;return j(this,(function(r){switch(r.label){case 0:return[4,t.getAccessToken()];case 1:return e=r.sent(),[4,t.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},t.prototype.request=function(t,e,n){var r;return M(this,void 0,void 0,(function(){var o,i,s,a,u,c,f,l,h,p,d,y,g,v,m,b,_,w,E,S;return j(this,(function(I){switch(I.label){case 0:if(o="x-tcb-trace_".concat(this.config.env),i="application/x-www-form-urlencoded",s=U({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==W.indexOf(t))return[3,2];if(!(a=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=a.oauthInstance,c=u.oauth2client,f=s,[4,this.getOauthAccessTokenV2(c)];case 1:f.access_token=I.sent().accessToken,I.label=2;case 2:return"storage.uploadFile"===t?(l=new FormData,Object.keys(l).forEach((function(t){Object.prototype.hasOwnProperty.call(l,t)&&void 0!==l[t]&&l.append(t,s[t])})),i="multipart/form-data"):(i="application/json;charset=UTF-8",l={},Object.keys(s).forEach((function(t){void 0!==s[t]&&(l[t]=s[t])}))),h={headers:{"content-type":i}},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(o))&&(h.headers["X-TCB-Trace"]=p),d=e.parse,y=e.inQuery,g=e.search,v={env:this.config.env},d&&(v.parse=!0),y&&(v=U(U({},y),v)),m=D(),b=m.BASE_URL,_=m.PROTOCOL,w=F(_,b,v),g&&(w+=g),[4,this.post(U({url:w,data:l},h))];case 3:if(E=I.sent(),(S=null===(r=E.header)||void 0===r?void 0:r["x-tcb-trace"])&&this.localCache.setStore(o,S),200!==Number(E.status)&&200!==Number(E.statusCode)||!E.data)throw new Error("network request error");return[2,E]}}))}))},t.prototype.send=function(t,e){return void 0===e&&(e={}),M(this,void 0,void 0,(function(){var n;return j(this,(function(r){switch(r.label){case 0:return[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 1:if((n=r.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:B.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},t}(),H={},Y=function(){return Y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Y.apply(this,arguments)},J=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},K=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Q=o.j$.Fk,z=o.j$.xY,X=o._G.Sg,Z=o._G.vM,tt=o.P6.xe,et=o.BM.D,nt={timeout:15e3,persistence:"local"},rt=6e5,ot={},it=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return v},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,w[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return I(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this.cloudbaseConfig.env,H[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){if(!e.env)throw new Error(JSON.stringify({code:X.INVALID_PARAMS,msg:"env must not be specified"}));v.adapter||this.useDefaultAdapter();var n={timeout:e.timeout||5e3,timeoutMsg:"[".concat(R,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(e.timeout/1e3,"s")};this.requestClient=new v.adapter.reqClass(n),this.cloudbaseConfig=Y(Y({},nt),e),this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var r=this.cloudbaseConfig,o=r.env,i=r.persistence,s=r.debug,a=r.timeout,u=r.oauthClient;S({env:o,persistence:i,debug:s,platformInfo:this.platform}),function(t,e,n){P(e?"//".concat(t,".").concat(e,".tcb-api.tencentcloudapi.com/web"):"//".concat(t,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),void 0)}(o,e.region||"");var c=new t(this.cloudbaseConfig);return function(t){H[t.env]=new V(U(U({},t),{throw:!0}))}({env:o,region:e.region||"",timeout:a,oauthClient:u,_fromApp:c}),c.requestClient=this.requestClient,c},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,S({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.registerExtension=function(t){ot[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,r=void 0,i=function(){var n;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(r){switch(r.label){case 0:if(!(n=ot[t]))throw new Error(JSON.stringify({code:X.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,r.sent()]}}))},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{u(i.next(t))}catch(t){e(t)}}function a(t){try{u(i.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}u((i=i.apply(n,r||[])).next())}));var n,r,o,i},t.prototype.useAdapters=function(t){var e=Q(t)||{},n=e.adapter,r=e.runtime;n&&(v.adapter=n),r&&(v.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,r=e.target;if(Object.prototype.hasOwnProperty.call(t,r))throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var o=t.prototype[r];if("function"!=typeof o)throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not a function which is the only type supports hook")}));t.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,h([this],t,!1)),o.call.apply(o,h([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){y(t,e)},t.prototype.registerVersion=function(t){!function(t){N=t}(t)},t.prototype.registerSdkName=function(t){!function(t){R=t,A(t)}(t)},t.prototype.registerEndPoint=function(t,e){P(t,e)},t.prototype.useDefaultAdapter=function(){var t=z(),e=t.adapter,n=t.runtime;v.adapter=e,v.runtime=n},t.prototype.formatTimeout=function(t){switch(!0){case t>rt:return tt(X.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),rt;case t<100:return tt(X.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},J([et({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Z)]}),K("design:type",Function),K("design:paramtypes",[Object]),K("design:returntype",t)],t.prototype,"init",null),J([et({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Z)]}),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),st=new it;st.useAdapters(l);var at=st},2828:function(t,e,n){"use strict";n.r(e),n.d(e,{Auth:function(){return z},LoginState:function(){return Q},registerAuth:function(){return Z}});var r,o,i,s,a,u,c,f=n(1142);function l(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}!function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(r||(r={})),(c=o||(o={})).UNREACHABLE="unreachable",c.LOCAL="local",c.CANCELLED="cancelled",c.UNKNOWN="unknown",c.INVALID_ARGUMENT="invalid_argument",c.DEADLINE_EXCEEDED="deadline_exceeded",c.NOT_FOUND="not_found",c.ALREADY_EXISTS="already_exists",c.PERMISSION_DENIED="permission_denied",c.UNAUTHENTICATED="unauthenticated",c.RESOURCE_EXHAUSTED="resource_exhausted",c.FAILED_PRECONDITION="failed_precondition",c.ABORTED="aborted",c.OUT_OF_RANGE="out_of_range",c.UNIMPLEMENTED="unimplemented",c.INTERNAL="internal",c.UNAVAILABLE="unavailable",c.DATA_LOSS="data_loss",c.CAPTCHA_REQUIRED="captcha_required",c.CAPTCHA_INVALID="captcha_invalid",c.INVALID_PASSWORD="invalid_password",c.INVALID_STATUS="invalid_status",c.USER_PENDING="user_pending",c.USER_BLOCKED="user_blocked",c.INVALID_VERIFICATION_CODE="invalid_verification_code",c.TWO_FACTOR_REQUIRED="two_factor_required",c.INVALID_TWO_FACTOR="invalid_two_factor",c.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",c.UNDER_REVIEW="under_review",c.INVALID_REQUEST="invalid_request",c.UNAUTHORIZED_CLIENT="unauthorized_client",c.ACCESS_DENIED="access_denied",c.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",c.INVALID_SCOPE="invalid_scope",c.INVALID_GRANT="invalid_grant",c.SERVER_ERROR="server_error",c.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",c.INTERACTION_REQUIRED="interaction_required",c.LOGIN_REQUIRED="login_required",c.ACCOUNT_SELECTION_REQUIRED="account_selection_required",c.CONSENT_REQUIRED="consent_required",c.INVALID_REQUEST_URI="invalid_request_uri",c.INVALID_REQUEST_OBJECT="invalid_request_object",c.REQUEST_NOT_SUPPORTED="request_not_supported",c.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",c.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(i||(i={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider"}(s||(s={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(a||(a={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(u||(u={}));var h=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},p=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},d=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return h(this,void 0,void 0,(function(){var n,r=this;return p(this,(function(o){switch(o.label){case 0:return[4,n=this.fnPromiseMap.get(t)];case 1:return o.sent()||(n=new Promise((function(n,o){h(r,void 0,void 0,(function(){var r,i,s;return p(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),i=n,[4,r];case 2:return i.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),o(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),y=function(){return y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},y.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},v=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},m="x-request-id",b="x-device-id",_="device_id",w=function(t,e){return g(this,void 0,void 0,(function(){var n,r,i,s,a;return v(this,(function(u){switch(u.label){case 0:n=null,r=null,u.label=1;case 1:return u.trys.push([1,4,,5]),(i=Object.assign({},e)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(t,i)];case 2:return[4,u.sent().json()];case 3:return(null==(s=u.sent())?void 0:s.error)?(r=s).error_uri=new URL(t).pathname:n=s,[3,5];case 4:return a=u.sent(),r={error:o.UNREACHABLE,error_description:a.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},E=new(function(){function t(){}return t.prototype.getItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return g(this,void 0,void 0,(function(){return v(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function S(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var I=function(){function t(t){this.credentials=null,this.singlePromise=new d,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return g(this,void 0,void 0,(function(){var e;return v(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return g(t,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return S(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return g(t,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return t=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),O=function(){function t(e){this.singlePromise=new d,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=w,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||E,this.localCredentials=new I({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return g(this,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:o.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return g(this,void 0,void 0,(function(){var r,i,s,a,u,c,f;return v(this,(function(h){switch(h.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=y(y({},this.headers),n.headers)),n.headers[m]||(n.headers[m]=l()),n.headers[b]?[3,2]:[4,this.getDeviceId()];case 1:i=h.sent(),n.headers[b]=i,h.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=h.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(s.access_token)):n.headers.Authorization="".concat(s.token_type," ").concat(s.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),h.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),a=null,u=r+1,c=0,h.label=6;case 6:if(!(c<u))return[3,15];h.label=7;case 7:return h.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return a=h.sent(),[3,15];case 9:return f=h.sent(),n.withCredentials&&f&&f.error===o.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return h.sent(),[2,Promise.reject(f)];case 11:return c!==r&&f&&"unreachable"===f.error?[3,12]:[2,Promise.reject(f)];case 12:return[4,this.sleep(t.retryInterval)];case 13:h.sent(),h.label=14;case 14:return c++,[3,6];case 15:return[2,a]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t,e,n;return v(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return S(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||!t.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==o.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:o.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==o.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return g(this,void 0,void 0,(function(){var n,r;return v(this,(function(o){switch(o.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=i.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=s.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=o.sent(),[2,y(y({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(_)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=l(),[4,this.storage.setItem(_,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:o.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}(),A=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},T=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},N=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=E),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o,i;return T(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,e)];case 3:return o=s.sent(),[3,7];case 4:return"captcha_required"!==(i=s.sent()).error&&"captcha_invalid"!==i.error?[3,6]:[4,this.appendCaptchaTokenToURL(t,n,"captcha_invalid"===i.error)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(i)];case 7:return[2,o]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t){return A(this,void 0,void 0,(function(){var e,n;return T(this,(function(r){return e=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),e.innerHTML="",n.setAttribute("src",t),n.setAttribute("id","review-panel-iframe"),n.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",e.appendChild(n),e.style.display="block",[2,new Promise((function(t,r){n.onload=function(){try{var o=window.location,i=n.contentWindow.location;if(i.host+i.pathname===o.host+o.pathname){e.style.display="none";var s=new URLSearchParams(i.search),a=s.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}e.style.display="block"}catch(t){e.style.display="block"}}}))]}))}))},t.prototype.getCaptchaToken=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o,i,s;return T(this,(function(a){switch(a.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=a.sent())return[2,n];a.label=2;case 2:return r="".concat(window.location.origin+window.location.pathname,"?__captcha=on"),[4,this.config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this.config.clientId,redirect_uri:r,state:e},withCredentials:!1})];case 3:return(o=a.sent()).captcha_token?(i={captcha_token:o.captcha_token,expires_in:o.expires_in},this.saveCaptchaToken(i),[2,o.captcha_token]):[4,this.config.openURIWithCallback(o.url)];case 4:return s=a.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(o){switch(o.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=o.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return A(this,void 0,void 0,(function(){var e;return T(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return A(this,void 0,void 0,(function(){var t,e;return T(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),e.expires_at<new Date?[2,null]:[2,e.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},t}(),R=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=R(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},L=function(){return L=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},L.apply(this,arguments)},C=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},P=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},D=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new O(r)}if(!e){var o=n.request.bind(n),i=new N({clientId:t.clientId,request:o,storage:t.storage});e=i.request.bind(i)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||E}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=R(t),o=(null===(n={v2:s}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||i[e];return r&&delete r.version,{params:r,url:o}},t.prototype.signIn=function(t){return C(this,void 0,void 0,(function(){var e,n,r;return P(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.config.request(n.url,{method:"POST",body:n.params})];case 1:return r=o.sent(),[4,this.config.credentialsClient.setCredentials(L(L({},r),{version:e}))];case 2:return o.sent(),[2,Promise.resolve(r)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.request(i.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return C(this,void 0,void 0,(function(){var t,e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(i.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(L(L({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){return e="".concat(i.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return C(this,void 0,void 0,(function(){var e,n;return P(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(L(L({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),C(this,void 0,void 0,(function(){var n,r,o;return P(this,(function(i){switch(i.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(o=i.sent()).sub&&(o.uid=o.sub),[2,o]}}))}))},t.prototype.getWedaUserInfo=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){switch(t.label){case 0:return[4,this.config.request(i.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return C(this,void 0,void 0,(function(){var n,r;return P(this,(function(o){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.request(i.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return t.target="CUR_USER",[2,this.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request("".concat(i.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(i.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(L(L({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return C(this,void 0,void 0,(function(){return P(this,(function(e){return[2,this.config.request(i.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(i.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return C(this,void 0,void 0,(function(){var e;return P(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(L(L({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return C(this,void 0,void 0,(function(){return P(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t}(),x=function(){return x=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},x.apply(this,arguments)},U=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,o=t.request,i=t.anonymousSignInFunc;this.oauth2client=new O({apiOrigin:e,clientId:n,storage:r,baseRequest:o,anonymousSignInFunc:i}),this.authApi=new D(x(x({credentialsClient:this.oauth2client},t),{request:o?this.oauth2client.request.bind(this.oauth2client):void 0}))},M=function(){return M=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},M.apply(this,arguments)},j=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},B=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},k=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},q=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},F=f.P6.xe,W=f.P6._y,G=f._G.Sg,$=f._G.vM,V=f.BM.D,H=f.U3.yE,Y="loginStateChanged",J=new H,K=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return k(this,void 0,void 0,(function(){var t,e,n,r;return q(this,(function(o){switch(o.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=o.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(M({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&W(G.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},j([V({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"update",null),j([V({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String,String]),B("design:returntype",void 0)],t.prototype,"updatePassword",null),j([V({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String]),B("design:returntype",void 0)],t.prototype,"updateUsername",null),j([V({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"refresh",null),t}(),Q=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||W(G.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new K({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),z=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}F(G.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return k(this,void 0,void 0,(function(){var t;return q(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&W(G.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return k(this,void 0,void 0,(function(){var t;return q(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),J.fire(Y),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;F(G.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return k(this,void 0,void 0,(function(){var e,n=this;return q(this,(function(r){switch(r.label){case 0:return J.on(Y,(function(){return k(n,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return k(this,void 0,void 0,(function(){return q(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return k(this,void 0,void 0,(function(){return q(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.createLoginState=function(t){return k(this,void 0,void 0,(function(){var e;return q(this,(function(n){switch(n.label){case 0:return[4,(e=new Q({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),J.fire(Y),[2,e]}}))}))},j([V({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),j([V({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"unbindProvider",null),j([V({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",void 0)],t.prototype,"bindEmail",null),j([V({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"verify",null),j([V({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"getVerification",null),j([V({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getCurrentUser",null),j([V({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signInAnonymously",null),j([V({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),j([V({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"signUp",null),j([V({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[String]),B("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),j([V({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"signOut",null),j([V({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getLoginState",null),j([V({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"getUserInfo",null),j([V({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),j([V({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat($)]}),B("design:type",Function),B("design:paramtypes",[Object]),B("design:returntype",Promise)],t.prototype,"bindWithProvider",null),t}(),X={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return F(G.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,o=t.persistence||n.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=this.config,s=i.env,a=i.persistence,u=i.debug,c=i.clientId,f=i.storage,l=new U({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||f,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc});return this.oauthInstance=l,this.authInstance=new z({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:l}),this.authInstance}};try{cloudbase.registerComponent(X)}catch(t){}function Z(t){try{t.registerComponent(X)}catch(t){console.warn(t)}}},4797:function(t,e,n){"use strict";n.r(e),n.d(e,{registerDatabase:function(){return s}});var r=n(2881),o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o.apply(this,arguments)},i={name:"database",entity:{database:function(t){var e=this.platform,n=e.adapter,i=e.runtime;return r.Db.reqClass=this.request.constructor,r.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},r.Db.runtime=i,this.wsClientClass&&(r.Db.wsClass=n.wsClass,r.Db.wsClientClass=this.wsClientClass),r.Db.ws||(r.Db.ws=null),new r.Db(o(o(o({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(i)}catch(t){}function s(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},7338:function(t,e,n){"use strict";n.r(e),n.d(e,{registerFunctions:function(){return p}});var r=n(1142),o=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=r._G.eX,s=r._G.Sg,a=r._G.vM,u=r.P6.Gc,c=r.BM.D,f="functions",l=new(function(){function t(){}return t.prototype.callFunction=function(t,e){return n=this,r=void 0,a=function(){var n,r,o,a,c,l,h,p,d,y,g,v;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(m){switch(m.label){case 0:if(n=t.name,r=t.data,o=t.query,a=t.parse,c=t.search,!n)throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(f,".callFunction] invalid function name")}));try{l=r?JSON.stringify(r):""}catch(t){throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(f,".callFunction] invalid data")}))}h="functions.invokeFunction",p={inQuery:o,parse:a,search:c,function_name:n,request_data:l},d=this.request,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,d.send(h,p)];case 2:if((y=m.sent()).code)return[2,u(e,null,y)];if(g=y.data.response_data,a)return[2,u(e,null,{result:g,requestId:y.requestId})];try{return g=JSON.parse(y.data.response_data),[2,u(e,null,{result:g,requestId:y.requestId})]}catch(t){u(e,new Error("[".concat(i(),"][").concat(s.INVALID_PARAMS,"][").concat(f,".callFunction] response data must be json")))}return[3,4];case 3:return v=m.sent(),u(e,v),[3,4];case 4:return[2]}}))},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{u(a.next(t))}catch(t){e(t)}}function s(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,s)}u((a=a.apply(n,r||[])).next())}));var n,r,o,a},function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);i>3&&s&&Object.defineProperty(e,n,s)}([c({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(a)]}),o("design:type",Function),o("design:paramtypes",[Object,Function]),o("design:returntype",Promise)],t.prototype,"callFunction",null),t}()),h={name:f,entity:{callFunction:l.callFunction}};try{cloudbase.registerComponent(h)}catch(t){}function p(t){try{t.registerComponent(h)}catch(t){console.warn(t)}}},3337:function(t,e,n){"use strict";n.r(e),n.d(e,{registerRealtime:function(){return F}});var r=n(880),o=n.n(r),i=n(3373),s=n.n(i),a=n(9907),u=n.n(a);function c(t){return void 0===t&&(t=""),"".concat(t?"".concat(t,"_"):"").concat(+new Date,"_").concat(Math.random())}var f,l,h=function(t){this.close=t.close,this.onChange=t.onChange,this.onError=t.onError,t.debug&&Object.defineProperty(this,"virtualClient",{get:function(){return t.virtualClient}})},p=function(t){var e,n,r=t.id,o=t.docChanges,i=t.docs,s=t.msgType,a=t.type;Object.defineProperties(this,{id:{get:function(){return r},enumerable:!0},docChanges:{get:function(){return e||(e=JSON.parse(JSON.stringify(o))),e},enumerable:!0},docs:{get:function(){return n||(n=JSON.parse(JSON.stringify(i))),n},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})},d=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(t){function e(e){var n=t.call(this,"Watch Error ".concat(JSON.stringify(e.msgData)," (requestid: ").concat(e.requestId,")"))||this;return n.isRealtimeErrorMessageError=!0,n.payload=e,n}return d(e,t),e}(Error),g=function(t){return null==t?void 0:t.isRealtimeErrorMessageError},v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeout",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cancelled",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),b=function(t){function e(e){var n=t.call(this,e.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(_[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t}}}),n.errCode=e.errCode||"UNKNOWN_ERROR",n.errMsg=e.errMsg,n}return d(e,t),Object.defineProperty(e.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t},enumerable:!1,configurable:!0}),e}(Error),_={UNKNOWN_ERROR:"UNKNOWN_ERROR",SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG:"SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG",SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA:"SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED",SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL",SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR:"SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR"},w=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},E=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},I=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};!function(t){t.LOGGINGIN="LOGGINGIN",t.INITING="INITING",t.REBUILDING="REBUILDING",t.ACTIVE="ACTIVE",t.ERRORED="ERRORED",t.CLOSING="CLOSING",t.CLOSED="CLOSED",t.PAUSED="PAUSED",t.RESUMING="RESUMING"}(l||(l={}));var O=function(){function t(t){var e=this;this.watchStatus=l.INITING,this.wsLogin=function(t,n){return E(e,void 0,void 0,(function(){var e;return S(this,(function(r){switch(r.label){case 0:return this.watchStatus=l.LOGGINGIN,[4,this.login(t,n)];case 1:return e=r.sent(),this.envId||(this.envId=e.envId),[2,e]}}))}))},this.initWatch=function(t){return E(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.initWatchPromise&&void 0!==this.initWatchPromise)return[2,this.initWatchPromise];this.initWatchPromise=new Promise((function(e,r){E(n,void 0,void 0,(function(){var n,o,i,s,a,u,f,h,d,y;return S(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,4]),this.watchStatus===l.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:return n=g.sent().envId,this.watchStatus===l.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):(this.watchStatus=l.INITING,o={watchId:this.watchId,requestId:c(),msgType:"INIT_WATCH",msgData:{envId:n,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(i=g.sent(),s=i.msgData,a=s.events,u=s.currEvent,this.sessionInfo={queryID:i.msgData.queryID,currentEventId:u-1,currentDocs:[]},a.length>0){for(f=0,h=a;f<h.length;f++)h[f].ID=u;this.handleServerEvents(i)}else this.sessionInfo.currentEventId=u,d=new p({id:u,docChanges:[],docs:[],type:"init"}),this.listener.onChange(d),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=l.ACTIVE,this.availableRetries.INIT_WATCH=2,e(),[3,4];case 3:return y=g.sent(),this.handleWatchEstablishmentError(y,{operationName:"INIT_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.initWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.initWatchPromise=void 0,[7];case 4:return console.log("[realtime] initWatch ".concat(e?"success":"fail")),[2]}}))}))},this.rebuildWatch=function(t){return E(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.rebuildWatchPromise&&void 0!==this.rebuildWatchPromise)return[2,this.rebuildWatchPromise];this.rebuildWatchPromise=new Promise((function(e,r){E(n,void 0,void 0,(function(){var n,o,i,s;return S(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===l.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:if(n=a.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===l.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):(this.watchStatus=l.REBUILDING,o={watchId:this.watchId,requestId:c(),msgType:"REBUILD_WATCH",msgData:{envId:n,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return i=a.sent(),this.handleServerEvents(i),this.watchStatus=l.ACTIVE,this.availableRetries.REBUILD_WATCH=2,e(),[3,4];case 3:return s=a.sent(),this.handleWatchEstablishmentError(s,{operationName:"REBUILD_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.rebuildWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.rebuildWatchPromise=void 0,[7];case 4:return console.log("[realtime] rebuildWatch ".concat(e?"success":"fail")),[2]}}))}))},this.handleWatchEstablishmentError=function(t,n){return E(e,void 0,void 0,(function(){var e,r,o,i=this;return S(this,(function(s){return e="INIT_WATCH"===n.operationName,r=function(){i.closeWithError(new b({errCode:e?_.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:_.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:t})),n.reject(t)},o=function(t){i.useRetryTicket(n.operationName)?e?(i.initWatchPromise=void 0,n.resolve(i.initWatch(t))):(i.rebuildWatchPromise=void 0,n.resolve(i.rebuildWatch(t))):r()},this.handleCommonError(t,{onSignError:function(){return o(!0)},onTimeoutError:function(){return o(!1)},onNotRetryableError:r,onCancelledError:n.reject,onUnknownError:function(){E(i,void 0,void 0,(function(){var t,e=this;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),t=function(){return E(e,void 0,void 0,(function(){return S(this,(function(t){switch(t.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return t.sent(),o(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,t()];case 1:return r.sent(),[3,7];case 2:return[4,w(100)];case 3:return r.sent(),this.watchStatus!==l.PAUSED?[3,4]:(n.reject(new m("".concat(n.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,t()];case 5:return r.sent(),[3,7];case 6:o(!1),r.label=7;case 7:return[3,9];case 8:return r.sent(),o(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return E(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:if(t=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==l.ACTIVE)return this.watchStatus=l.CLOSED,this.onWatchClose(this,t),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=l.CLOSING,e={watchId:this.watchId,requestId:c(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:e})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=l.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:n})),[3,5];case 4:return this.onWatchClose(this,t),[7];case 5:return[2]}}))}))},this.scheduleSendACK=function(){e.clearACKSchedule(),e.ackTimeoutId=setTimeout((function(){e.waitExpectedTimeoutId?e.scheduleSendACK():e.sendACK()}),1e4)},this.clearACKSchedule=function(){e.ackTimeoutId&&clearTimeout(e.ackTimeoutId)},this.sendACK=function(){return E(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==l.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(t={watchId:this.watchId,requestId:c(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:t})]):(console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)"),[2]);case 1:return r.sent(),this.scheduleSendACK(),[3,3];case 2:if(e=r.sent(),g(e))switch((n=e.payload).msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return this.rebuildWatch(),[2];case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:n.msgData.code})),[2]}return this.availableRetries.CHECK_LAST&&this.availableRetries.CHECK_LAST>0?(this.availableRetries.CHECK_LAST-=1,this.scheduleSendACK()):this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:e})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(t,e){if(g(t))switch(t.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void e.onSignError(t);default:return void e.onNotRetryableError(t)}else{if(function(t){return"timeout"===t.type}(t))return void e.onTimeoutError(t);if(function(t){return"cancelled"===t.type}(t))return void e.onCancelledError(t)}e.onUnknownError(t)},this.watchId="watchid_".concat(+new Date,"_").concat(Math.random()),this.envId=t.envId,this.collectionName=t.collectionName,this.query=t.query,this.limit=t.limit,this.orderBy=t.orderBy,this.send=t.send,this.login=t.login,this.isWSConnected=t.isWSConnected,this.onceWSConnected=t.onceWSConnected,this.getWaitExpectedTimeoutLength=t.getWaitExpectedTimeoutLength,this.onWatchStart=t.onWatchStart,this.onWatchClose=t.onWatchClose,this.debug=t.debug,this.availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new h({close:function(){e.closeWatch()},onChange:t.onChange,onError:t.onError,debug:this.debug,virtualClient:this}),this.initWatch()}return t.prototype.onMessage=function(t){var e=this;switch(this.watchStatus){case l.PAUSED:if("ERROR"!==t.msgType)return;break;case l.LOGGINGIN:case l.INITING:case l.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case l.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case l.ERRORED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has ended with error")}if(this.sessionInfo)switch(this.scheduleSendACK(),t.msgType){case"NEXT_EVENT":console.warn("nextevent ".concat(t.msgData.currEvent," ignored"),t),this.handleServerEvents(t);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<t.msgData.currEvent&&(this.sessionInfo.expectEventId=t.msgData.currEvent,this.clearWaitExpectedEvent(),this.waitExpectedTimeoutId=setTimeout((function(){e.rebuildWatch()}),this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength ".concat(this.getWaitExpectedTimeoutLength())));break;case"ERROR":this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:"".concat(t.msgData.code," - ").concat(t.msgData.message)}));break;default:console.warn("[realtime listener] virtual client receive unexpected msg ".concat(t.msgType,": "),t)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")},t.prototype.closeWithError=function(t){var e;this.watchStatus=l.ERRORED,this.clearACKSchedule(),this.listener.onError(t),this.onWatchClose(this,(null===(e=this.sessionInfo)||void 0===e?void 0:e.queryID)||""),console.log("[realtime] client closed (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.pause=function(){this.watchStatus=l.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.resume=function(){return E(this,void 0,void 0,(function(){var t;return S(this,(function(e){switch(e.label){case 0:this.watchStatus=l.RESUMING,console.log("[realtime] client resuming with ".concat(this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"," (").concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.sessionInfo?this.rebuildWatch():this.initWatch()];case 2:return e.sent(),console.log("[realtime] client successfully resumed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),[3,4];case 3:return t=e.sent(),console.error("[realtime] client resume failed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")"),t),[3,4];case 4:return[2]}}))}))},t.prototype.useRetryTicket=function(t){return!!(this.availableRetries[t]&&this.availableRetries[t]>0)&&(this.availableRetries[t]-=1,console.log("[realtime] ".concat(t," use a retry ticket, now only ").concat(this.availableRetries[t]," retry left")),!0)},t.prototype.handleServerEvents=function(t){return E(this,void 0,void 0,(function(){var e;return S(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this.handleServerEventsInternel(t)];case 1:return n.sent(),this.postHandleServerEventsValidityCheck(t),[3,3];case 2:throw e=n.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",e),e;case 3:return[2]}}))}))},t.prototype.handleServerEventsInternel=function(t){return E(this,void 0,void 0,(function(){var e,n,r,i,a,c,f,l,h,d,y,g;return S(this,(function(v){switch(v.label){case 0:if(e=t.requestId,n=t.msgData.events,r=t.msgType,!n.length||!this.sessionInfo)return[2];i=this.sessionInfo;try{a=n.map(A)}catch(t){return this.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:t})),[2]}c=I([],i.currentDocs,!0),f=!1,l=function(n,l){var d,y,g,v,m,w,E,O,A,T,N,R;return S(this,(function(S){switch(S.label){case 0:return d=a[n],i.currentEventId>=d.id?(!a[n-1]||d.id>a[n-1].id?console.warn("[realtime] duplicate event received, cur ".concat(i.currentEventId," but got ").concat(d.id)):console.error("[realtime listener] server non-fatal error: events out of order (the latter event's id is smaller than that of the former) (requestId ".concat(e,")")),[2,"continue"]):[3,1];case 1:if(i.currentEventId!==d.id-1)return[3,2];switch(d.dataType){case"update":if(!d.doc)switch(d.queueType){case"update":case"dequeue":if(y=c.find((function(t){return t._id===d.docId})),y){if(g=u()(y),d.updatedFields&&Object.keys(d.updatedFields).forEach((function(t){o()(g,t,d.updatedFields[t])})),d.removedFields)for(v=0,m=d.removedFields;v<m.length;v++)w=m[v],s()(g,w);d.doc=g}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O}break;case"replace":if(!d.doc)throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O;break;case"remove":(E=c.find((function(t){return t._id===d.docId})))?d.doc=E:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!d.doc)switch(d.queueType){case"dequeue":(E=c.find((function(t){return t._id===d.docId})))?d.doc=E:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw O=new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),h.closeWithError(O),O}}switch(d.queueType){case"init":f?c.push(d.doc):(f=!0,c=[d.doc]);break;case"enqueue":c.push(d.doc);break;case"dequeue":A=c.findIndex((function(t){return t._id===d.docId})),A>-1?c.splice(A,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":A=c.findIndex((function(t){return t._id===d.docId})),A>-1?c[A]=d.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(n===l-1||a[n+1]&&a[n+1].id!==d.id)&&(T=I([],c,!0),N=a.slice(0,n+1).filter((function(t){return t.id===d.id})),h.sessionInfo.currentEventId=d.id,h.sessionInfo.currentDocs=c,R=new p({id:d.id,docChanges:N,docs:T,msgType:r}),h.listener.onChange(R)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(h.sessionInfo.currentEventId," but got ").concat(d.id)),[4,h.rebuildWatch()];case 3:return S.sent(),[2,{value:void 0}];case 4:return[2]}}))},h=this,d=0,y=a.length,v.label=1;case 1:return d<y?[5,l(d,y)]:[3,4];case 2:if("object"==typeof(g=v.sent()))return[2,g.value];v.label=3;case 3:return d++,[3,1];case 4:return[2]}}))}))},t.prototype.postHandleServerEventsValidityCheck=function(t){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<t.msgData.currEvent&&console.warn("[realtime listener] internal non-fatal error: client eventId does not match with server event id after server event handling")):console.error("[realtime listener] internal non-fatal error: sessionInfo lost after server event handling, this should never occur")},t.prototype.clearWaitExpectedEvent=function(){this.waitExpectedTimeoutId&&(clearTimeout(this.waitExpectedTimeoutId),this.waitExpectedTimeoutId=void 0)},t}();function A(t){var e={id:t.ID,dataType:t.DataType,queueType:t.QueueType,docId:t.DocID,doc:t.Doc&&"{}"!==t.Doc?JSON.parse(t.Doc):void 0};return"update"===t.DataType&&(t.UpdatedFields&&(e.updatedFields=JSON.parse(t.UpdatedFields)),(t.removedFields||t.RemovedFields)&&(e.removedFields=JSON.parse(t.removedFields))),e}var T,N={1e3:{code:1e3,name:"Normal Closure",description:"Normal closure; the connection successfully completed whatever purpose for which it was created."},1001:{code:1001,name:"Going Away",description:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{code:1002,name:"Protocol Error",description:"The endpoint is terminating the connection due to a protocol error."},1003:{code:1003,name:"Unsupported Data",description:"The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data)."},1005:{code:1005,name:"No Status Received",description:"Indicates that no status code was provided even though one was expected."},1006:{code:1006,name:"Abnormal Closure",description:"Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{code:1007,name:"Invalid frame payload data",description:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{code:1008,name:"Policy Violation",description:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{code:1009,name:"Message too big",description:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{code:1010,name:"Missing Extension",description:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{code:1011,name:"Internal Error",description:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{code:1012,name:"Service Restart",description:"The server is terminating the connection because it is restarting."},1013:{code:1013,name:"Try Again Later",description:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{code:1014,name:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{code:1015,name:"TLS Handshake",description:"Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},3e3:{code:3e3,name:"Reconnect WebSocket",description:"The client is terminating the connection because it wants to reconnect"},3001:{code:3001,name:"No Realtime Listeners",description:"The client is terminating the connection because no more realtime listeners exist"},3002:{code:3002,name:"Heartbeat Ping Error",description:"The client is terminating the connection due to its failure in sending heartbeat messages"},3003:{code:3003,name:"Heartbeat Pong Timeout Error",description:"The client is terminating the connection because no heartbeat response is received from the server"},3050:{code:3050,name:"Server Close",description:"The client is terminating the connection because no heartbeat response is received from the server"}};!function(t){t[t.NormalClosure=1e3]="NormalClosure",t[t.GoingAway=1001]="GoingAway",t[t.ProtocolError=1002]="ProtocolError",t[t.UnsupportedData=1003]="UnsupportedData",t[t.NoStatusReceived=1005]="NoStatusReceived",t[t.AbnormalClosure=1006]="AbnormalClosure",t[t.InvalidFramePayloadData=1007]="InvalidFramePayloadData",t[t.PolicyViolation=1008]="PolicyViolation",t[t.MessageTooBig=1009]="MessageTooBig",t[t.MissingExtension=1010]="MissingExtension",t[t.InternalError=1011]="InternalError",t[t.ServiceRestart=1012]="ServiceRestart",t[t.TryAgainLater=1013]="TryAgainLater",t[t.BadGateway=1014]="BadGateway",t[t.TLSHandshake=1015]="TLSHandshake",t[t.ReconnectWebSocket=3e3]="ReconnectWebSocket",t[t.NoRealtimeListeners=3001]="NoRealtimeListeners",t[t.HeartbeatPingError=3002]="HeartbeatPingError",t[t.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",t[t.NoAuthentication=3050]="NoAuthentication"}(T||(T={}));var R=function(t,e){var n=N[t],r=n?"".concat(n.name,", code ").concat(t,", reason ").concat(e||n.description):"code ".concat(t);return new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},L=null,C="web";function P(){return L}function D(){return C}function x(t){C=t}var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},U.apply(this,arguments)},M=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},j=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},B=function(){function t(t){var e=this;this.virtualWSClient=new Set,this.queryIdClientMap=new Map,this.watchIdClientMap=new Map,this.pingFailed=0,this.pongMissed=0,this.logins=new Map,this.wsReadySubsribers=[],this.wsResponseWait=new Map,this.rttObserved=[],this.send=function(t){return M(e,void 0,void 0,(function(){var e=this;return j(this,(function(n){return[2,new Promise((function(n,r){M(e,void 0,void 0,(function(){var e,o,i,s,a,u,c,f,l=this;return j(this,(function(h){switch(h.label){case 0:o=!1,i=!1,s=function(t){o=!0,e&&clearTimeout(e),n(t)},a=function(t){i=!0,e&&clearTimeout(e),r(t)},t.timeout&&(e=setTimeout((function(){M(l,void 0,void 0,(function(){return j(this,(function(t){switch(t.label){case 0:return o&&i?[3,2]:[4,w(0)];case 1:t.sent(),o&&i||a(new v("wsclient.send timedout")),t.label=2;case 2:return[2]}}))}))}),t.timeout)),h.label=1;case 1:return h.trys.push([1,8,,9]),void 0===this.wsInitPromise&&null===this.wsInitPromise?[3,3]:[4,this.wsInitPromise];case 2:h.sent(),h.label=3;case 3:if(!this.ws)return a(new Error("invalid state: ws connection not exists, can not send message")),[2];if(1!==this.ws.readyState)return a(new Error("ws readyState invalid: ".concat(this.ws.readyState,", can not send message"))),[2];t.waitResponse&&(u={resolve:s,reject:a,skipOnMessage:t.skipOnMessage},this.wsResponseWait.set(t.msg.requestId,u)),h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.ws.send(JSON.stringify(t.msg))];case 5:return h.sent(),t.waitResponse||s(void 0),[3,7];case 6:return(c=h.sent())&&(a(c),t.waitResponse&&this.wsResponseWait.delete(t.msg.requestId)),[3,7];case 7:return[3,9];case 8:return f=h.sent(),a(f),[3,9];case 9:return[2]}}))}))}))]}))}))},this.closeAllClients=function(t){e.virtualWSClient.forEach((function(e){e.closeWithError(t)}))},this.pauseClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.pause()}))},this.resumeClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.resume()}))},this.initWebSocketConnection=function(t,n){return void 0===n&&(n=e.maxReconnect),M(e,void 0,void 0,(function(){var e=this;return j(this,(function(r){switch(r.label){case 0:if(t&&this.reconnectState)return[2];if(t&&(this.reconnectState=!0),void 0!==this.wsInitPromise&&null!==this.wsInitPromise)return[2,this.wsInitPromise];t&&this.pauseClients(),this.close(T.ReconnectWebSocket),this.wsInitPromise=new Promise((function(r,o){M(e,void 0,void 0,(function(){var e,i,s=this;return j(this,(function(a){switch(a.label){case 0:return a.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return e=a.sent(),[4,new Promise((function(t){var n=e.wsUrl||"wss://tcb-ws.tencentcloudapi.com",r=P();s.ws=r?new r(n):new WebSocket(n),t(void 0)}))];case 2:return a.sent(),this.ws.connect?[4,this.ws.connect()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return a.sent(),r(),t&&(this.resumeClients(),this.reconnectState=!1),[3,11];case 6:return i=a.sent(),console.error("[realtime] initWebSocketConnection connect fail",i),n>0?(this.wsInitPromise=void 0,[4,w(this.reconnectInterval)]):[3,9];case 7:a.sent(),t&&(this.reconnectState=!1),a.label=8;case 8:return r(this.initWebSocketConnection(t,n-1)),[3,10];case 9:o(i),t&&this.closeAllClients(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:i})),a.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.wsInitPromise];case 2:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.resolve)()})),[3,5];case 3:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.reject)()})),[3,5];case 4:return this.wsInitPromise=void 0,this.wsReadySubsribers=[],[7];case 5:return[2]}}))}))},this.initWebSocketEvent=function(){return new Promise((function(t,n){if(!e.ws)throw new Error("can not initWebSocketEvent, ws not exists");var r=!1;e.ws.onopen=function(e){console.warn("[realtime] ws event: open",e),r=!0,t()},e.ws.onerror=function(t){e.logins=new Map,r?(console.error("[realtime] ws event: error",t),e.clearHeartbeat(),e.virtualWSClient.forEach((function(e){return e.closeWithError(new b({errCode:_.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:t}))}))):(console.error("[realtime] ws open failed with ws event: error",t),n(t))},e.ws.onclose=function(t){switch(console.warn("[realtime] ws event: close",t),e.logins=new Map,e.clearHeartbeat(),t.code){case T.ReconnectWebSocket:case T.NoRealtimeListeners:break;case T.HeartbeatPingError:case T.HeartbeatPongTimeoutError:case T.NormalClosure:case T.AbnormalClosure:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(R(t.code));break;case T.NoAuthentication:e.closeAllClients(R(t.code,t.reason));break;default:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(R(t.code))}},e.ws.onmessage=function(t){var n,r=t.data;e.heartbeat();try{n=JSON.parse(r)}catch(t){throw new Error("[realtime] onMessage parse res.data error: ".concat(t))}if("ERROR"===n.msgType){var o=null;e.virtualWSClient.forEach((function(t){t.watchId===n.watchId&&(o=t)})),o&&o.listener.onError(n)}var i=e.wsResponseWait.get(n.requestId);if(i){try{"ERROR"===n.msgType?i.reject(new y(n)):i.resolve(n)}catch(t){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",t)}finally{e.wsResponseWait.delete(n.requestId)}if(i.skipOnMessage)return}if("PONG"!==n.msgType){var s=n.watchId&&e.watchIdClientMap.get(n.watchId);if(s)s.onMessage(n);else switch(console.error("[realtime] no realtime listener found responsible for watchId ".concat(n.watchId,": "),n),n.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":(s=e.queryIdClientMap.get(n.msgData.queryID))&&s.onMessage(n);break;default:for(var a=0,u=Array.from(e.watchIdClientMap.entries());a<u.length;a++){u[a][1].onMessage(n);break}}}else if(e.lastPingSendTS){var c=Date.now()-e.lastPingSendTS;if(c>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(c));e.rttObserved.length>=3&&e.rttObserved.splice(0,e.rttObserved.length-3+1),e.rttObserved.push(c)}},e.heartbeat()}))},this.isWSConnected=function(){return Boolean(e.ws&&1===e.ws.readyState)},this.onceWSConnected=function(){return M(e,void 0,void 0,(function(){var t=this;return j(this,(function(e){return this.isWSConnected()?[2]:null!==this.wsInitPromise&&void 0!==this.wsInitPromise?[2,this.wsInitPromise]:[2,new Promise((function(e,n){t.wsReadySubsribers.push({resolve:e,reject:n})}))]}))}))},this.webLogin=function(t,n){return M(e,void 0,void 0,(function(){var e,r,o,i,s,a,u,f,l=this;return j(this,(function(h){switch(h.label){case 0:if(!n)if(t){if(e=this.logins.get(t)){if(e.loggedIn&&e.loginResult)return[2,e.loginResult];if(null!==e.loggingInPromise&&void 0!==e.loggingInPromise)return[2,e.loggingInPromise]}}else if(null!==(null==(r=this.logins.get(""))?void 0:r.loggingInPromise)&&void 0!==(null==r?void 0:r.loggingInPromise))return[2,r.loggingInPromise];o=new Promise((function(t,e){M(l,void 0,void 0,(function(){var n,r,o,i,s;return j(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return n=a.sent(),r={envId:n.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},o={watchId:void 0,requestId:c(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:D(),signStr:n.signStr,secretVersion:n.secretVersion}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(i=a.sent()).msgData.code?e(new Error("".concat(i.msgData.code," ").concat(i.msgData.message))):t({envId:n.envId}),[3,4];case 3:return s=a.sent(),e(s),[3,4];case 4:return[2]}}))}))})),i=t&&this.logins.get(t),s=Date.now(),i?(i.loggedIn=!1,i.loggingInPromise=o,i.loginStartTS=s):(i={loggedIn:!1,loggingInPromise:o,loginStartTS:s},this.logins.set(t||"",i)),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,o];case 2:if(a=h.sent(),(u=t&&this.logins.get(t))&&u===i&&u.loginStartTS===s)return i.loggedIn=!0,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=a,[2,a];if(u){if(u.loggedIn&&u.loginResult)return[2,u.loginResult];if(null!==u.loggingInPromise&&void 0!==u.loggingInPromise)return[2,u.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw f=h.sent(),i.loggedIn=!1,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=void 0,f;case 4:return[2]}}))}))},this.getWsSign=function(){return M(e,void 0,void 0,(function(){var t,e,n,r,o,i,s;return j(this,(function(a){switch(a.label){case 0:return this.wsSign&&this.wsSign.expiredTs>Date.now()?[2,this.wsSign]:(t=Date.now()+6e4,[4,this.context.appConfig.request.send("auth.wsWebSign",{runtime:D()})]);case 1:if((e=a.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(e.code));if(e.data)return n=e.data,r=n.signStr,o=n.wsUrl,i=n.secretVersion,s=n.envId,[2,{signStr:r,wsUrl:o,secretVersion:i,envId:s,expiredTs:t}];throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")}}))}))},this.getWaitExpectedTimeoutLength=function(){return e.rttObserved.length?e.rttObserved.reduce((function(t,e){return t+e}))/e.rttObserved.length*1.5:5e3},this.ping=function(){return M(e,void 0,void 0,(function(){var t;return j(this,(function(e){switch(e.label){case 0:return t={watchId:void 0,requestId:c(),msgType:"PING",msgData:null},[4,this.send({msg:t})];case 1:return e.sent(),[2]}}))}))},this.onWatchStart=function(t,n){e.queryIdClientMap.set(n,t)},this.onWatchClose=function(t,n){n&&e.queryIdClientMap.delete(n),e.watchIdClientMap.delete(t.watchId),e.virtualWSClient.delete(t),e.virtualWSClient.size||e.close(T.NoRealtimeListeners)},this.maxReconnect=t.maxReconnect||5,this.reconnectInterval=t.reconnectInterval||1e4,this.context=t.context}return t.prototype.clearHeartbeat=function(){this.pingTimeoutId&&clearTimeout(this.pingTimeoutId),this.pongTimeoutId&&clearTimeout(this.pongTimeoutId)},t.prototype.close=function(t){this.clearHeartbeat(),this.ws&&(this.ws.close(t,N[t].name),this.ws=void 0)},t.prototype.watch=function(t){this.ws||void 0!==this.wsInitPromise&&null!==this.wsInitPromise||this.initWebSocketConnection(!1);var e=new O(U(U({},t),{send:this.send,login:this.webLogin,isWSConnected:this.isWSConnected,onceWSConnected:this.onceWSConnected,getWaitExpectedTimeoutLength:this.getWaitExpectedTimeoutLength,onWatchStart:this.onWatchStart,onWatchClose:this.onWatchClose,debug:!0}));return this.virtualWSClient.add(e),this.watchIdClientMap.set(e.watchId,e),e.listener},t.prototype.heartbeat=function(t){var e=this;this.clearHeartbeat(),this.pingTimeoutId=setTimeout((function(){M(e,void 0,void 0,(function(){var t=this;return j(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.ws&&1===this.ws.readyState?(this.lastPingSendTS=Date.now(),[4,this.ping()]):[2];case 1:return e.sent(),this.pingFailed=0,this.pongTimeoutId=setTimeout((function(){console.error("pong timed out"),t.pongMissed<2?(t.pongMissed+=1,t.heartbeat(!0)):t.initWebSocketConnection(!0)}),this.context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return e.sent(),this.pingFailed<2?(this.pingFailed+=1,this.heartbeat()):this.close(T.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),t?0:this.context.appConfig.realtimePingInterval)},t}(),k={target:"database",entity:function(){var t,e=this.platform,n=e.adapter,r=e.runtime;t=n.wsClass,L=t,x(r)}},q={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=B}};try{cloudbase.registerComponent(q),cloudbase.registerHook(k)}catch(t){}function F(t){try{t.registerComponent(q),t.registerHook(k)}catch(t){console.warn(t)}}},7766:function(t,e,n){"use strict";n.r(e),n.d(e,{registerStorage:function(){return w}});var r,o=n(1142),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},s=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},c=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};!function(t){t.put="put",t.post="post"}(r||(r={}));var f=o._G.eX,l=o._G.Sg,h=o._G.vM,p=o.P6.kJ,d=o.P6.HD,y=o.P6.JV,g=o.P6.Gc,v=o.BM.D,m="storage",b=new(function(){function t(){}return t.prototype.uploadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,o,s,a,u,h,p,y,v,b,_,w,E,S,I,O,A,T,N,R,L,C,P,D,x;return c(this,(function(c){switch(c.label){case 0:if(n=t.cloudPath,o=t.filePath,s=t.onUploadProgress,a=t.method,u=void 0===a?"put":a,h=t.headers,p=void 0===h?{}:h,!d(n)||!o)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".uploadFile] invalid params")}));return y={put:r.put,post:r.post}[u.toLocaleLowerCase()]||r.put,v=this.request,b={path:n,method:y},y===r.put&&(b.headers=p),[4,v.send("storage.getUploadMetadata",b)];case 1:return _=c.sent(),w=_.data,E=w.url,S=w.authorization,I=w.token,O=w.fileId,A=w.cosFileId,T=w.download_url,N=_.requestId,L=i(i({},R={url:E,file:o,name:n,onUploadProgress:s}),{method:r.put,headers:i(i({},p),{authorization:S,"x-cos-meta-fileid":A,"x-cos-security-token":I})}),C=i(i({},R),{method:r.post,data:{key:n,signature:S,"x-cos-meta-fileid":A,success_action_status:"201","x-cos-security-token":I}}),(x={})[r.put]={params:L,isSuccess:function(t){return t>=200&&t<300}},x[r.post]={params:C,isSuccess:function(t){return 201===t}},P=x,[4,v.upload(P[y].params)];case 2:return D=c.sent(),P[y].isSuccess(D.statusCode)?[2,g(e,null,{fileID:O,download_url:T,requestId:N})]:[2,g(e,new Error("[".concat(f(),"][").concat(l.OPERATION_FAIL,"][").concat(m,"]:").concat(D.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s;return c(this,(function(a){switch(a.label){case 0:if(n=t.cloudPath,!d(n))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getUploadMetadata] invalid cloudPath")}));r=this.request,o="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(o,{path:n})];case 2:return i=a.sent(),[2,g(e,null,i)];case 3:return s=a.sent(),[2,g(e,s)];case 4:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileList must not be empty")}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!d(i))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=u.sent()).code?[2,g(e,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,g(e,null,a)])}}))}))},t.prototype.getTempFileURL=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++)if(s=i[o],y(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!d(s))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] invalid fileList")}));r.push({fileid:s})}return[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=u.sent()).code?[2,g(e,null,a)]:[2,g(e,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},t.prototype.downloadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,o,i,s,a;return c(this,(function(u){switch(u.label){case 0:if(n=t.fileID,!d(n))throw new Error(JSON.stringify({code:l.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=u.sent(),"SUCCESS"!==(o=r.fileList[0]).code?[2,g(e,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=u.sent(),[2,g(e,null,a)]}}))}))},s([v({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"uploadFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getUploadMetadata",null),s([v({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"deleteFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getTempFileURL",null),s([v({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(h)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"downloadFile",null),t}()),_={name:m,entity:{uploadFile:b.uploadFile,deleteFile:b.deleteFile,getTempFileURL:b.getTempFileURL,downloadFile:b.downloadFile,getUploadMetadata:b.getUploadMetadata}};try{cloudbase.registerComponent(_)}catch(t){}function w(t){try{t.registerComponent(_)}catch(t){console.warn(t)}}},1142:function(t,e,n){"use strict";n.d(e,{j$:function(){return i},Fs:function(){return s},_G:function(){return r},U3:function(){return a},BM:function(){return u},P6:function(){return o}});var r={};n.r(r),n.d(r,{vM:function(){return y},Sg:function(){return g},Fk:function(){return d},eX:function(){return l},pM:function(){return p},tC:function(){return f}});var o={};n.r(o),n.d(o,{Gc:function(){return A},CN:function(){return I},Jc:function(){return S},kJ:function(){return m},hp:function(){return E},V9:function(){return w},JV:function(){return _},HD:function(){return b},Jz:function(){return R},xe:function(){return T},_y:function(){return N},UK:function(){return O}});var i={};n.r(i),n.d(i,{Fk:function(){return U},xY:function(){return M}});var s={};n.r(s),n.d(s,{q:function(){return F}});var a={};n.r(a),n.d(a,{yE:function(){return V}});var u={};n.r(u),n.d(u,{D:function(){return z}});var c="@cloudbase/js-sdk";function f(t){c=t}function l(){return c}var h="https:";function p(t){h=t}var d=!1,y="https://support.qq.com/products/148793",g={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},v=n(2829);function m(t){return"[object Array]"===Object.prototype.toString.call(t)}function b(t){return"string"==typeof t}function _(t){return"[object Object]"===Object.prototype.toString.call(t)}function w(t,e){return t instanceof e}function E(t){return"[object FormData]"===Object.prototype.toString.call(t)}function S(){return Math.random().toString(16).slice(2)}function I(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}function O(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}function A(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n}function T(t,e){console.warn("[".concat(l(),"][").concat(t,"]:").concat(e))}function N(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(l(),"][").concat(t,"]:").concat(e)}))}function R(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,o=t.content,i=void 0===o?[]:o,s=t.printTrace,a=void 0!==s&&s,u=t.collapsed;void 0!==u&&u?console.groupCollapsed(e,r):console.group(e,r);for(var c=0,f=i;c<f.length;c++){var l=f[c],h=l.type,p=l.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()}var L,C,P=(L=function(t,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},L(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}L(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(){return D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},D.apply(this,arguments)},x=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return P(e,t),e.prototype.get=function(t){return this.request(D(D({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(D(D({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(D(D({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(D(D({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(D(D({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,o=function(){var e,n,r,o;return function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(D(D({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,u=t.headers,c=void 0===u?{}:u,f=t.data,l=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,g=I(h,a,"get"===r?f:{}),v=new XMLHttpRequest;v.open(r,g),l&&(v.responseType=l),Object.keys(c).forEach((function(t){v.setRequestHeader(t,c[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=v.status;try{t.data="blob"===l?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===l?v.response:v.responseText}clearTimeout(i),o(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=E(f)?f:"application/x-www-form-urlencoded"===c["content-type"]?O(f):d||(f?JSON.stringify(f):void 0),p&&(v.withCredentials=!0),v.send(s)}))},e}(v.jJ);function U(t){for(var e=0,n=m(t)?t:[t];e<n.length;e++){var r=n[e],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}}function M(){return{adapter:{root:window,reqClass:x,wsClass:WebSocket,localStorage:localStorage},runtime:C.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(C||(C={}));var j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),B=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},k=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},q=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return j(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}(v.x_),F=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(T(g.INVALID_PARAMS,"localStorage is not supported on current platform"),new q(e.root));case"none":return new q(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:g.OPERATION_FAIL,msg:"[".concat(l(),"][").concat(g.OPERATION_FAIL,"]setStore failed"),info:t}))}}else T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return B(this,void 0,void 0,(function(){var r;return k(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]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return B(this,void 0,void 0,(function(){var r;return k(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):T(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return B(this,void 0,void 0,(function(){return k(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),W=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),G=function(t,e){this.data=e||null,this.name=t},$=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return W(e,t),e}(G),V=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(w(t,$))return console.error(t.error),this;var n=b(t)?new G(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];o<i.length;o++)i[o].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new V;var H=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Y=function(t,e){var n,r,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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},J=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(J=-1!==navigator.userAgent.indexOf("Firefox"));var K=J?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,Q=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function z(t){var e=t.mode,n=void 0===e?"async":e,r=t.customInfo,o=void 0===r?{}:r,i=t.title,s=t.messages,a=void 0===s?[]:s;return function(t,e,r){if(d){var s=o.className||t.constructor.name,u=o.methodName||e,c=r.value,f=function(t){var e="",n=(new Error).stack.split("\n"),r=n.findIndex((function(t){return K.test(t)}));if(-1!==r){var o=Q.exec(n[r+1]||"");e=o?o[0]:""}return e}();r.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=X({err:new Error,className:s,methodName:u,sourceLink:f});try{return c.apply(this,t)}catch(t){var r=t,o=t.message,l=t.error,h=t.error_description,p={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var d=JSON.parse(o);p.subtitle=o,d.code&&(n?(n.code=d.code,n.msg=d.msg):(t.code=d.code,t.message=d.msg),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}})))}throw l&&h&&(p.subtitle=h,n?(n.code=l,n.msg=h):(t.code=l,t.message=h),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}}))),R(p),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H(this,void 0,void 0,(function(){var e,n,r,o,l,h,p,d;return Y(this,(function(y){switch(y.label){case 0:e=X({err:new Error,className:s,methodName:u,sourceLink:f}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,c.apply(this,t)];case 2:return[2,y.sent()];case 3:throw n=y.sent(),r=n,o=n.message,l=n.error,h=n.error_description,p={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:n}]},o&&/^\{.*\}$/.test(o)&&(d=JSON.parse(o),p.subtitle=d,d.code&&(e?(e.code=d.code,e.message=d.msg):(n.code=d.code,n.message=d.msg),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}})))),l&&h&&(p.subtitle=h,e?(e.code=l,e.msg=h):(n.code=l,n.message=h),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}}))),R(p),r;case 4:return[2]}}))}))}}}}function X(t){var e=t.err,n=t.className,r=t.methodName,o=t.sourceLink;if(!o)return null;var i,s=e.stack.split("\n"),a=J?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),u=J?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),c=s.findIndex((function(t){return a.test(t)}));if(-1!==c){var f=s.filter((function(t,e){return e>c}));f.unshift(s[c].replace(u,"".concat(n,".").concat(r)).replace(Q,o)),(i=new Error).stack="".concat(J?"@debugger":"Error","\n").concat(f.join("\n"))}return i}function Z(t){this.message=t}function tt(t){this.message=t}Z.prototype=new Error,Z.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),tt.prototype=new Error,tt.prototype.name="InvalidTokenError"},8656:function(t,e,n){"use strict";n.r(e),n.d(e,{BSONError:function(){return _},BSONRegExp:function(){return ee},BSONSymbol:function(){return ne},BSONTypeError:function(){return w},BSON_BINARY_SUBTYPE_BYTE_ARRAY:function(){return yt},BSON_BINARY_SUBTYPE_COLUMN:function(){return _t},BSON_BINARY_SUBTYPE_DEFAULT:function(){return pt},BSON_BINARY_SUBTYPE_ENCRYPTED:function(){return bt},BSON_BINARY_SUBTYPE_FUNCTION:function(){return dt},BSON_BINARY_SUBTYPE_MD5:function(){return mt},BSON_BINARY_SUBTYPE_USER_DEFINED:function(){return wt},BSON_BINARY_SUBTYPE_UUID:function(){return gt},BSON_BINARY_SUBTYPE_UUID_NEW:function(){return vt},BSON_DATA_ARRAY:function(){return K},BSON_DATA_BINARY:function(){return Q},BSON_DATA_BOOLEAN:function(){return Z},BSON_DATA_CODE:function(){return ot},BSON_DATA_CODE_W_SCOPE:function(){return st},BSON_DATA_DATE:function(){return tt},BSON_DATA_DBPOINTER:function(){return rt},BSON_DATA_DECIMAL128:function(){return ft},BSON_DATA_INT:function(){return at},BSON_DATA_LONG:function(){return ct},BSON_DATA_MAX_KEY:function(){return ht},BSON_DATA_MIN_KEY:function(){return lt},BSON_DATA_NULL:function(){return et},BSON_DATA_NUMBER:function(){return H},BSON_DATA_OBJECT:function(){return J},BSON_DATA_OID:function(){return X},BSON_DATA_REGEXP:function(){return nt},BSON_DATA_STRING:function(){return Y},BSON_DATA_SYMBOL:function(){return it},BSON_DATA_TIMESTAMP:function(){return ut},BSON_DATA_UNDEFINED:function(){return z},BSON_INT32_MAX:function(){return q},BSON_INT32_MIN:function(){return F},BSON_INT64_MAX:function(){return W},BSON_INT64_MIN:function(){return G},Binary:function(){return Et},Code:function(){return It},DBRef:function(){return At},Decimal128:function(){return Ht},Double:function(){return Yt},EJSON:function(){return de},Int32:function(){return Jt},Long:function(){return Dt},LongWithoutOverridesClass:function(){return re},Map:function(){return ye},MaxKey:function(){return Kt},MinKey:function(){return Qt},ObjectID:function(){return te},ObjectId:function(){return te},Timestamp:function(){return oe},UUID:function(){return St},calculateObjectSize:function(){return gn},deserialize:function(){return yn},deserializeStream:function(){return vn},serialize:function(){return pn},serializeWithBufferAndIndex:function(){return dn},setInternalBufferSize:function(){return hn}});for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],o[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var o,i,s=[],a=e;a<n;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var l=function(t){var e,n,r=c(t),s=r[0],a=r[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),f=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===a&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,u[f++]=255&e),1===a&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},h=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(f(t,a,a+s>u?u:a+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")},p=function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,f=-7,l=n?o-1:0,h=n?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+t[e+l],l+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=c}return(p?-1:1)*s*Math.pow(2,i-r)},d=function(t,e,n,r,o,i){var s,a,u,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,o),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;t[n+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[n+p]=255&s,p+=d,s/=256,c-=8);t[n+p-d]|=128*y},y=function(t,e){return function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=i,e.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function o(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,i.prototype),e}function i(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|g(t,e),r=o(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){var e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return i.from(r,e,n);var s=function(t){if(i.isBuffer(t)){var e=0|y(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||G(t.length)?o(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return a(t),o(t<0?0:0|y(t))}function c(t){for(var e=t.length<0?0:0|y(t.length),n=o(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,i.prototype),r}function y(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(o)return r?-1:k(t).length;e=(""+e).toLowerCase(),o=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=i.from(e,r)),i.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,o){var i,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var f=-1;for(i=n;i<a;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===u)return f*s}else-1!==f&&(i-=i-f),f=-1}else for(n+u>a&&(n=a-u),i=n;i>=0;i--){for(var l=!0,h=0;h<u;h++)if(c(t,i+h)!==c(e,h)){l=!1;break}if(l)return i}return-1}function w(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(G(a))return s;t[n+s]=a}return s}function E(t,e,n,r){return F(k(e,t.length-n),t,n,r)}function S(t,e,n,r){return F(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function I(t,e,n,r){return F(q(e),t,n,r)}function O(t,e,n,r){return F(function(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?h(t):h(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,s,a,u,c=t[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(f=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),o+=l}return function(t){var e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=N));return n}(r)}e.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,e){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,o=0,s=Math.min(n,r);o<s;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=i.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var s=t[n];if(W(s,Uint8Array))o+s.length>r.length?i.from(s).copy(r,o):Uint8Array.prototype.set.call(r,s,o);else{if(!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o)}o+=s.length}return r},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):v.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(t,e,n,r,o){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(r,o),f=t.slice(e,n),l=0;l<u;++l)if(c[l]!==f[l]){s=c[l],a=f[l];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},i.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},i.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},i.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return I(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function R(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function L(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function C(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=$[t[i]];return o}function P(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length-1;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function D(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function U(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,4),d(t,e,n,r,23,4),n+4}function j(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,8),d(t,e,n,r,52,8),n+8}i.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,i.prototype),r},i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),p(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),p(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),p(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),p(this,t,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),o},i.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var o=t.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=i.isBuffer(t)?t:i.from(t,r),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var B=/[^+/0-9A-Za-z-_]/g;function k(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(t){return l(function(t){if((t=(t=t.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}var $=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)e[r+o]=t[n]+t[o];return e}()}(e={exports:{}},e.exports),e.exports}(),g=y.Buffer;y.SlowBuffer,y.INSPECT_MAX_BYTES,y.kMaxLength;var v=function(t,e){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},v(t,e)};function m(t,e){function n(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var b=function(){return b=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},b.apply(this,arguments)},_=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return m(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),w=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return m(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function E(t){return t&&t.Math==Math&&t}function S(){return E("object"==typeof globalThis&&globalThis)||E("object"==typeof window&&window)||E("object"==typeof self&&self)||E("object"==typeof n.g&&n.g)||Function("return this")()}function I(t){return t.toString().replace("function(","function (")}var O=function(t){var e,n="object"==typeof(e=S()).navigator&&"ReactNative"===e.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var r=g.alloc(t),o=0;o<t;++o)r[o]=Math.floor(256*Math.random());return r},A=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(g.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(g.alloc(t))}:O}();function T(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function N(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function R(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)}function L(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)}function C(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function P(t){return D(t)&&"[object Date]"===Object.prototype.toString.call(t)}function D(t){return"object"==typeof t&&null!==t}function x(t,e){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return n||(console.warn(e),n=!0),t.apply(this,r)}}function U(t){if(ArrayBuffer.isView(t))return g.from(t.buffer,t.byteOffset,t.byteLength);if(T(t))return g.from(t);throw new w("Must use either Buffer or TypedArray")}var M=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,j=function(t){return"string"==typeof t&&M.test(t)},B=function(t){if(!j(t))throw new w('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return g.from(e,"hex")},k=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},q=2147483647,F=-2147483648,W=Math.pow(2,63)-1,G=-Math.pow(2,63),$=Math.pow(2,53),V=-Math.pow(2,53),H=1,Y=2,J=3,K=4,Q=5,z=6,X=7,Z=8,tt=9,et=10,nt=11,rt=12,ot=13,it=14,st=15,at=16,ut=17,ct=18,ft=19,lt=255,ht=127,pt=0,dt=1,yt=2,gt=3,vt=4,mt=5,bt=6,_t=7,wt=128,Et=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new w("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=g.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=g.from(e,"binary"):Array.isArray(e)?this.buffer=g.from(e):this.buffer=U(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new w("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new w("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new w("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=g.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=g.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(U(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new St(this.buffer.slice(0,this.position));throw new _('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,o;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,r=g.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=g.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,r=B(e.$uuid)),!r)throw new w("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return o===vt?new St(r):new t(r,o)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(Et.prototype,"_bsontype",{value:"Binary"});var St=function(t){function e(n){var r,o,i=this;if(null==n)r=e.generate();else if(n instanceof e)r=g.from(n.buffer),o=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=U(n);else{if("string"!=typeof n)throw new w("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=B(n)}return(i=t.call(this,r,vt)||this).__id=o,i}return m(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=k(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=k(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new Et(this.id,Et.SUBTYPE_UUID)},e.generate=function(){var t=A(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,g.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?j(t):!!N(t)&&16===t.length&&64==(240&t[6])&&128==(128&t[8])))},e.createFromHexString=function(t){return new e(B(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(Et),It=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();function Ot(t){return D(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}Object.defineProperty(It.prototype,"_bsontype",{value:"Code"});var At=function(){function t(e,n,r,o){if(!(this instanceof t))return new t(e,n,r,o);var i=e.split(".");2===i.length&&(r=i.shift(),e=i.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=o||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(At.prototype,"_bsontype",{value:"DBRef"});var Tt=void 0;try{Tt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}var Nt=4294967296,Rt=0x10000000000000000,Lt=Rt/2,Ct={},Pt={},Dt=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,o,i;return n?(i=0<=(e>>>=0)&&e<256)&&(o=Pt[e])?o:(r=t.fromBits(e,(0|e)<0?-1:0,!0),i&&(Pt[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(o=Ct[e])?o:(r=t.fromBits(e,e<0?-1:0,!1),i&&(Ct[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=Rt)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Lt)return t.MIN_VALUE;if(e+1>=Lt)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%Nt|0,e/Nt|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return t.fromString(e.substring(1),n,r).neg();for(var i=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var f=t.fromNumber(Math.pow(r,u));s=s.mul(f).add(t.fromNumber(c))}else s=(s=s.mul(i)).add(t.fromNumber(c))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return D(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,f=0,l=0,h=0;return l+=(h+=i+(65535&e.low))>>>16,h&=65535,f+=(l+=o+u)>>>16,l&=65535,c+=(f+=r+a)>>>16,f&=65535,c+=n+s,c&=65535,t.fromBits(l<<16|h,c<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Tt){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?Tt.div_u:Tt.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;i=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=t.ZERO}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(o);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),i=i.add(u),o=o.sub(c)}return i},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Tt){var n=(this.unsigned?Tt.rem_u:Tt.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Tt){var n=Tt.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,Tt.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,c=e.low>>>16,f=65535&e.low,l=0,h=0,p=0,d=0;return p+=(d+=s*f)>>>16,d&=65535,h+=(p+=i*f)>>>16,p&=65535,h+=(p+=s*c)>>>16,p&=65535,l+=(h+=o*f)>>>16,h&=65535,l+=(h+=i*c)>>>16,h&=65535,l+=(h+=s*u)>>>16,h&=65535,l+=r*f+o*c+i*u+s*a,l&=65535,t.fromBits(p<<16|d,l<<16|h,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Nt+(this.low>>>0):this.high*Nt+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(i),c=(s.sub(u.mul(i)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Dt.prototype,"__isLong__",{value:!0}),Object.defineProperty(Dt.prototype,"_bsontype",{value:"Long"});var xt=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ut=/^(\+|-)?(Infinity|inf)$/i,Mt=/^(\+|-)?NaN$/i,jt=6111,Bt=-6176,kt=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),qt=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ft=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Wt=/^([-+])?(\d+)?$/;function Gt(t){return!isNaN(parseInt(t,10))}function $t(t){var e=Dt.fromNumber(1e9),n=Dt.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Dt(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Vt(t,e){throw new w('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ht=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!N(e))throw new w("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new w("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,o=!1,i=!1,s=0,a=0,u=0,c=0,f=0,l=[0],h=0,p=0,d=0,y=0,v=0,m=0,b=new Dt(0,0),_=new Dt(0,0),E=0;if(e.length>=7e3)throw new w(e+" not a valid Decimal128 string");var S=e.match(xt),I=e.match(Ut),O=e.match(Mt);if(!S&&!I&&!O||0===e.length)throw new w(e+" not a valid Decimal128 string");if(S){var A=S[2],T=S[4],N=S[5],R=S[6];T&&void 0===R&&Vt(e,"missing exponent power"),T&&void 0===A&&Vt(e,"missing exponent base"),void 0===T&&(N||R)&&Vt(e,"missing e before exponent")}if("+"!==e[E]&&"-"!==e[E]||(r="-"===e[E++]),!Gt(e[E])&&"."!==e[E]){if("i"===e[E]||"I"===e[E])return new t(g.from(r?qt:Ft));if("N"===e[E])return new t(g.from(kt))}for(;Gt(e[E])||"."===e[E];)"."!==e[E]?(h<34&&("0"!==e[E]||i)&&(i||(f=a),i=!0,l[p++]=parseInt(e[E],10),h+=1),i&&(u+=1),o&&(c+=1),a+=1,E+=1):(o&&Vt(e,"contains multiple periods"),o=!0,E+=1);if(o&&!a)throw new w(e+" not a valid Decimal128 string");if("e"===e[E]||"E"===e[E]){var L=e.substr(++E).match(Wt);if(!L||!L[2])return new t(g.from(kt));v=parseInt(L[0],10),E+=L[0].length}if(e[E])return new t(g.from(kt));if(d=0,h){if(y=h-1,1!==(s=u))for(;0===l[f+s-1];)s-=1}else d=0,y=0,l[0]=0,u=1,h=1,s=0;for(v<=c&&c-v>16384?v=Bt:v-=c;v>jt;){if((y+=1)-d>34){if(l.join("").match(/^0+$/)){v=jt;break}Vt(e,"overflow")}v-=1}for(;v<Bt||h<u;){if(0===y&&s<h){v=Bt,s=0;break}if(h<u?u-=1:y-=1,v<jt)v+=1;else{if(l.join("").match(/^0+$/)){v=jt;break}Vt(e,"overflow")}}if(y-d+1<s){var C=a;o&&(f+=1,C+=1),r&&(f+=1,C+=1);var P=parseInt(e[f+y+1],10),D=0;if(P>=5&&(D=1,5===P))for(D=l[y]%2==1?1:0,m=f+y+2;m<C;m++)if(parseInt(e[m],10)){D=1;break}if(D)for(var x=y;x>=0;x--)if(++l[x]>9&&(l[x]=0,0===x)){if(!(v<jt))return new t(g.from(r?qt:Ft));v+=1,l[x]=1}}if(b=Dt.fromNumber(0),_=Dt.fromNumber(0),0===s)b=Dt.fromNumber(0),_=Dt.fromNumber(0);else if(y-d<17)for(x=d,_=Dt.fromNumber(l[x++]),b=new Dt(0,0);x<=y;x++)_=(_=_.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]));else{for(x=d,b=Dt.fromNumber(l[x++]);x<=y-17;x++)b=(b=b.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]));for(_=Dt.fromNumber(l[x++]);x<=y;x++)_=(_=_.multiply(Dt.fromNumber(10))).add(Dt.fromNumber(l[x]))}var U,M,j,B,k=function(t,e){if(!t&&!e)return{high:Dt.fromNumber(0),low:Dt.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Dt(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new Dt(e.getLowBits(),0),s=n.multiply(o),a=n.multiply(i),u=r.multiply(o),c=r.multiply(i);return s=s.add(a.shiftRightUnsigned(32)),a=new Dt(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new Dt(c.getLowBits(),0))}}(b,Dt.fromString("100000000000000000"));k.low=k.low.add(_),M=_,((j=(U=k.low).high>>>0)<(B=M.high>>>0)||j===B&&U.low>>>0<M.low>>>0)&&(k.high=k.high.add(Dt.fromNumber(1))),n=v+6176;var q={low:Dt.fromNumber(0),high:Dt.fromNumber(0)};k.high.shiftRightUnsigned(49).and(Dt.fromNumber(1)).equals(Dt.fromNumber(1))?(q.high=q.high.or(Dt.fromNumber(3).shiftLeft(61)),q.high=q.high.or(Dt.fromNumber(n).and(Dt.fromNumber(16383).shiftLeft(47))),q.high=q.high.or(k.high.and(Dt.fromNumber(0x7fffffffffff)))):(q.high=q.high.or(Dt.fromNumber(16383&n).shiftLeft(49)),q.high=q.high.or(k.high.and(Dt.fromNumber(562949953421311)))),q.low=k.low,r&&(q.high=q.high.or(Dt.fromString("9223372036854775808")));var F=g.alloc(16);return E=0,F[E++]=255&q.low.low,F[E++]=q.low.low>>8&255,F[E++]=q.low.low>>16&255,F[E++]=q.low.low>>24&255,F[E++]=255&q.low.high,F[E++]=q.low.high>>8&255,F[E++]=q.low.high>>16&255,F[E++]=q.low.high>>24&255,F[E++]=255&q.high.low,F[E++]=q.high.low>>8&255,F[E++]=q.high.low>>16&255,F[E++]=q.high.low>>24&255,F[E++]=255&q.high.high,F[E++]=q.high.high>>8&255,F[E++]=q.high.high>>16&255,F[E++]=q.high.high>>24&255,new t(F)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var o,i,s,a=0,u=!1,c={parts:[0,0,0,0]},f=[];a=0;var l=this.bytes,h=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,p=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,d=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24,y=l[a++]|l[a++]<<8|l[a++]<<16|l[a++]<<24;a=0,(new Dt(h,p),new Dt(d,y)).lessThan(Dt.ZERO)&&f.push("-");var g=y>>26&31;if(g>>3==3){if(30===g)return f.join("")+"Infinity";if(31===g)return"NaN";t=y>>15&16383,o=8+(y>>14&1)}else o=y>>14&7,t=y>>17&16383;var v=t-6176;if(c.parts[0]=(16383&y)+((15&o)<<14),c.parts[1]=d,c.parts[2]=p,c.parts[3]=h,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var m=0,b=$t(c);if(c=b.quotient,m=b.rem.low)for(i=8;i>=0;i--)n[9*s+i]=m%10,m=Math.floor(m/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var _=e-1+v;if(_>=34||_<=-7||v>0){if(e>34)return f.push("".concat(0)),v>0?f.push("E+".concat(v)):v<0&&f.push("E".concat(v)),f.join("");for(f.push("".concat(n[a++])),(e-=1)&&f.push("."),r=0;r<e;r++)f.push("".concat(n[a++]));f.push("E"),_>0?f.push("+".concat(_)):f.push("".concat(_))}else if(v>=0)for(r=0;r<e;r++)f.push("".concat(n[a++]));else{var w=e+v;if(w>0)for(r=0;r<w;r++)f.push("".concat(n[a++]));else f.push("0");for(f.push(".");w++<0;)f.push("0");for(r=0;r<e-Math.max(w-1,0);r++)f.push("".concat(n[a++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Ht.prototype,"_bsontype",{value:"Decimal128"});var Yt=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(Yt.prototype,"_bsontype",{value:"Double"});var Jt=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Jt.prototype,"_bsontype",{value:"Int32"});var Kt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Kt.prototype,"_bsontype",{value:"MaxKey"});var Qt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Qt.prototype,"_bsontype",{value:"MinKey"});var zt=new RegExp("^[0-9a-fA-F]{24}$"),Xt=null,Zt=Symbol("id"),te=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new w("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?g.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Zt]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Zt]=n instanceof g?n:U(n);else{if("string"!=typeof n)throw new w("Argument passed in does not match the accepted types");if(12===n.length){var r=g.from(n);if(12!==r.byteLength)throw new w("Argument passed in must be a string of 12 bytes");this[Zt]=r}else{if(24!==n.length||!zt.test(n))throw new w("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Zt]=g.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Zt]},set:function(e){this[Zt]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=g.alloc(12);return r.writeUInt32BE(e,0),null===Xt&&(Xt=A(5)),r[4]=Xt[0],r[5]=Xt[1],r[6]=Xt[2],r[7]=Xt[3],r[8]=Xt[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Zt][11]===e[Zt][11]&&this[Zt].equals(e[Zt]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&N(this.id))return e===g.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return g.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=g.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new w("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(g.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(te.prototype,"generate",{value:x((function(t){return te.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(te.prototype,"getInc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"get_inc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te,"get_inc",{value:x((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"_bsontype",{value:"ObjectID"});var ee=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new _("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new _("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new _("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new w("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(ee.prototype,"_bsontype",{value:"BSONRegExp"});var ne=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(ne.prototype,"_bsontype",{value:"Symbol"});var re=Dt,oe=function(t){function e(n,r){var o=this;return o instanceof e?(o=Dt.isLong(n)?t.call(this,n.low,n.high,!0)||this:D(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(n,r)}return m(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Dt.fromInt(t,!0))},e.fromNumber=function(t){return new e(Dt.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Dt.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Dt.MAX_UNSIGNED_VALUE,e}(re);function ie(t){return D(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}var se=2147483647,ae=-2147483648,ue=0x8000000000000000,ce=-0x8000000000000000,fe={$oid:te,$binary:Et,$uuid:Et,$symbol:ne,$numberInt:Jt,$numberDecimal:Ht,$numberDouble:Yt,$numberLong:Dt,$minKey:Qt,$maxKey:Kt,$regex:ee,$regularExpression:ee,$timestamp:oe};function le(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ae&&t<=se)return new Jt(t);if(t>=ce&&t<=ue)return Dt.fromNumber(t)}return new Yt(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var o=fe[n[r]];if(o)return o.fromExtendedJSON(t,e)}if(null!=t.$date){var i=t.$date,s=new Date;return e.legacy?"number"==typeof i?s.setTime(i):"string"==typeof i&&s.setTime(Date.parse(i)):"string"==typeof i?s.setTime(Date.parse(i)):Dt.isLong(i)?s.setTime(i.toNumber()):"number"==typeof i&&e.relaxed&&s.setTime(i),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=le(t.$scope)),It.fromExtendedJSON(t)}if(Ot(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof At)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),f=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(f=!1)})),f)return At.fromExtendedJSON(u)}return t}function he(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function pe(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 r=e.seenObjects.map((function(t){return t.propertyName})),o=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),i=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],u=" ".repeat(o.length+i.length/2),c="-".repeat(s.length+(i.length+a.length)/2-1);throw new w("Converting circular structure to EJSON:\n"+" ".concat(o).concat(i).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return pe(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||P(t)){var f=t.getTime(),l=f>-1&&f<2534023188e5;return e.legacy?e.relaxed&&l?{$date:t.getTime()}:{$date:he(t)}:e.relaxed&&l?{$date:he(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var h=t>=ce&&t<=ue;if(t>=ae&&t<=se)return{$numberInt:t.toString()};if(h)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||C(t)){var p=t.flags;if(void 0===p){var d=t.toString().match(/[gimuy]*$/);d&&(p=d[0])}return new ee(t.source,p).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new _("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var o in t){e.seenObjects.push({propertyName:o,obj:null});try{var i=pe(t[o],e);"__proto__"===o?Object.defineProperty(r,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):r[o]=i}finally{e.seenObjects.pop()}}return r}if(ie(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=ge[t._bsontype];if(!a)throw new w("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new It(s.code,pe(s.scope,e)):"DBRef"===n&&s.oid&&(s=new At(pe(s.collection,e),pe(s.oid,e),pe(s.db,e),pe(s.fields,e))),s.toExtendedJSON(e)}throw new _("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var de,ye,ge={Binary:function(t){return new Et(t.value(),t.sub_type)},Code:function(t){return new It(t.code,t.scope)},DBRef:function(t){return new At(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ht(t.bytes)},Double:function(t){return new Yt(t.value)},Int32:function(t){return new Jt(t.value)},Long:function(t){return Dt.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 Kt},MinKey:function(){return new Qt},ObjectID:function(t){return new te(t)},ObjectId:function(t){return new te(t)},BSONRegExp:function(t){return new ee(t.pattern,t.options)},Symbol:function(t){return new ne(t.value)},Timestamp:function(t){return oe.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new _("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return le(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var o=pe(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(de||(de={}));var ve=S();function me(t,e,n){var r=5;if(Array.isArray(t))for(var o=0;o<t.length;o++)r+=be(o.toString(),t[o],e,!0,n);else for(var i in"function"==typeof(null==t?void 0:t.toBSON)&&(t=t.toBSON()),t)r+=be(i,t[i],e,!1,n);return r}function be(t,e,n,r,o){switch(void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),"function"==typeof(null==e?void 0:e.toBSON)&&(e=e.toBSON()),typeof e){case"string":return 1+g.byteLength(t,"utf8")+1+4+g.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=V&&e<=$&&e>=F&&e<=q?(null!=t?g.byteLength(t,"utf8")+1:0)+5:(null!=t?g.byteLength(t,"utf8")+1:0)+9;case"undefined":return r||!o?(null!=t?g.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?g.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||P(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||T(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(e.code.toString(),"utf8")+1+me(e.scope,n,o):(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype){var i=e;return i.sub_type===Et.SUBTYPE_BYTE_ARRAY?(null!=t?g.byteLength(t,"utf8")+1:0)+(i.position+1+4+1+4):(null!=t?g.byteLength(t,"utf8")+1:0)+(i.position+1+4+1)}if("Symbol"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+g.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var s=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(s.$db=e.db),(null!=t?g.byteLength(t,"utf8")+1:0)+1+me(s,n,o)}return e instanceof RegExp||C(e)?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.pattern,"utf8")+1+g.byteLength(e.options,"utf8")+1:(null!=t?g.byteLength(t,"utf8")+1:0)+me(e,n,o)+1;case"function":if(e instanceof RegExp||C(e)||"[object RegExp]"===String.call(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.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?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(I(e),"utf8")+1+me(e.scope,n,o);if(n)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(I(e),"utf8")+1}return 0}ye=ve.Map?ve.Map: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 n=t[e],r=n[0],o=n[1];this._keys.push(r),this._values[r]={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 n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,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 n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},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 n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var _e=128,we=192,Ee=224,Se=240,Ie=248,Oe=192,Ae=224,Te=240,Ne=128;function Re(t,e,n){for(var r=0,o=e;o<n;o+=1){var i=t[o];if(r){if((i&we)!==Ne)return!1;r-=1}else if(i&_e)if((i&Ee)===Oe)r=1;else if((i&Se)===Ae)r=2;else{if((i&Ie)!==Te)return!1;r=3}}return!r}var Le=Dt.fromNumber($),Ce=Dt.fromNumber(V),Pe={};function De(t,e,n){var r=(e=null==e?{}:e)&&e.index?e.index:0,o=t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24;if(o<5)throw new _("bson size must be >= 5, is ".concat(o));if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new _("buffer length ".concat(t.length," must be >= bson size ").concat(o));if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new _("buffer length ".concat(t.length," must === bson size ").concat(o));if(o+r>t.byteLength)throw new _("(bson size ".concat(o," + options.index ").concat(r," must be <= buffer length ").concat(t.byteLength,")"));if(0!==t[r+o-1])throw new _("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return Ue(t,r,e,n)}var xe=/^\$ref$|^\$id$|^\$db$/;function Ue(t,e,n,r){void 0===r&&(r=!1);var o,i=null!=n.evalFunctions&&n.evalFunctions,s=null!=n.cacheFunctions&&n.cacheFunctions,a=null==n.fieldsAsRaw?null:n.fieldsAsRaw,u=null!=n.raw&&n.raw,c="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,f=null!=n.promoteBuffers&&n.promoteBuffers,l=null==n.promoteLongs||n.promoteLongs,h=null==n.promoteValues||n.promoteValues,p=null==n.validation?{utf8:!0}:n.validation,d=!0,y=new Set,v=p.utf8;if("boolean"==typeof v)o=v;else{d=!1;var m=Object.keys(v).map((function(t){return v[t]}));if(0===m.length)throw new _("UTF-8 validation setting cannot be empty");if("boolean"!=typeof m[0])throw new _("Invalid UTF-8 validation option, must specify boolean values");if(o=m[0],!m.every((function(t){return t===o})))throw new _("Invalid UTF-8 validation option - keys must be all true or all false")}if(!d)for(var w=0,E=Object.keys(v);w<E.length;w++){var S=E[w];y.add(S)}var I=e;if(t.length<5)throw new _("corrupt bson message < 5 bytes long");var O=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(O<5||O>t.length)throw new _("corrupt bson message");for(var A=r?[]:{},T=0,N=!r&&null,R=new DataView(t.buffer,t.byteOffset,t.byteLength);;){var L=t[e++];if(0===L)break;for(var C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.byteLength)throw new _("Bad BSON Document: illegal CString");var P,D=r?T++:t.toString("utf8",e,C);P=d||y.has(D)?o:!o,!1!==N&&"$"===D[0]&&(N=xe.test(D));var x=void 0;if(e=C+1,L===Y){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");x=je(t,e,e+Lt-1,P),e+=Lt}else if(L===X){var U=g.alloc(12);t.copy(U,0,e,e+12),x=new te(U),e+=12}else if(L===at&&!1===h)x=new Jt(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(L===at)x=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(L===H&&!1===h)x=new Yt(R.getFloat64(e,!0)),e+=8;else if(L===H)x=R.getFloat64(e,!0),e+=8;else if(L===tt){var M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;x=new Date(new Dt(M,j).toNumber())}else if(L===Z){if(0!==t[e]&&1!==t[e])throw new _("illegal boolean type value");x=1===t[e++]}else if(L===J){var B=e;if((Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||Nt>t.length-e)throw new _("bad embedded document length in bson");if(u)x=t.slice(e,e+Nt);else{var k=n;d||(k=b(b({},n),{validation:{utf8:P}})),x=Ue(t,B,k,!1)}e+=Nt}else if(L===K){B=e;var q=n,F=e+(Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(a&&a[D]){for(var W in q={},n)q[W]=n[W];q.raw=!0}if(d||(q=b(b({},q),{validation:{utf8:P}})),x=Ue(t,B,q,!0),0!==t[(e+=Nt)-1])throw new _("invalid array terminator byte");if(e!==F)throw new _("corrupted array bson")}else if(L===z)x=void 0;else if(L===et)x=null;else if(L===ct){M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var G=new Dt(M,j);x=l&&!0===h&&G.lessThanOrEqual(Le)&&G.greaterThanOrEqual(Ce)?G.toNumber():G}else if(L===ft){var $=g.alloc(16);t.copy($,0,e,e+16),e+=16;var V=new Ht($);x="toObject"in V&&"function"==typeof V.toObject?V.toObject():V}else if(L===Q){var pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,dt=pt,yt=t[e++];if(pt<0)throw new _("Negative binary type element size found");if(pt>t.byteLength)throw new _("Binary type size larger than document size");if(null!=t.slice){if(yt===Et.SUBTYPE_BYTE_ARRAY){if((pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new _("Negative binary type element size found for subtype 0x02");if(pt>dt-4)throw new _("Binary type with subtype 0x02 contains too long binary size");if(pt<dt-4)throw new _("Binary type with subtype 0x02 contains too short binary size")}f&&h?x=t.slice(e,e+pt):(x=new Et(t.slice(e,e+pt),yt),yt===vt&&(x=x.toUUID()))}else{var gt=g.alloc(pt);if(yt===Et.SUBTYPE_BYTE_ARRAY){if((pt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new _("Negative binary type element size found for subtype 0x02");if(pt>dt-4)throw new _("Binary type with subtype 0x02 contains too long binary size");if(pt<dt-4)throw new _("Binary type with subtype 0x02 contains too short binary size")}for(C=0;C<pt;C++)gt[C]=t[e+C];x=f&&h?gt:yt===vt?new Et(t.slice(e,e+pt),yt).toUUID():new Et(t.slice(e,e+pt),yt)}e+=pt}else if(L===nt&&!1===c){for(C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");var mt=t.toString("utf8",e,C);for(C=e=C+1;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");var bt=t.toString("utf8",e,C);e=C+1;var _t=new Array(bt.length);for(C=0;C<bt.length;C++)switch(bt[C]){case"m":_t[C]="m";break;case"s":_t[C]="g";break;case"i":_t[C]="i"}x=new RegExp(mt,_t.join(""))}else if(L===nt&&!0===c){for(C=e;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");for(mt=t.toString("utf8",e,C),C=e=C+1;0!==t[C]&&C<t.length;)C++;if(C>=t.length)throw new _("Bad BSON Document: illegal CString");bt=t.toString("utf8",e,C),e=C+1,x=new ee(mt,bt)}else if(L===it){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");var wt=je(t,e,e+Lt-1,P);x=h?wt:new ne(wt),e+=Lt}else if(L===ut)M=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,x=new oe(M,j);else if(L===lt)x=new Qt;else if(L===ht)x=new Kt;else if(L===ot){if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");var St=je(t,e,e+Lt-1,P);x=i?s?Me(St,Pe,A):Me(St):new It(St),e+=Lt}else if(L===st){var Tt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(Tt<13)throw new _("code_w_scope total size shorter minimum expected length");if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");St=je(t,e,e+Lt-1,P),B=e+=Lt;var Nt=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,Rt=Ue(t,B,n,!1);if(e+=Nt,Tt<8+Nt+Lt)throw new _("code_w_scope total size is too short, truncating scope");if(Tt>8+Nt+Lt)throw new _("code_w_scope total size is too long, clips outer document");i?(x=s?Me(St,Pe,A):Me(St)).scope=Rt:x=new It(St,Rt)}else{if(L!==rt)throw new _("Detected unknown BSON type ".concat(L.toString(16),' for fieldname "').concat(D,'"'));var Lt;if((Lt=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||Lt>t.length-e||0!==t[e+Lt-1])throw new _("bad string length in bson");if(null!=p&&p.utf8&&!Re(t,e,e+Lt-1))throw new _("Invalid UTF-8 string in BSON document");var Ct=t.toString("utf8",e,e+Lt-1);e+=Lt;var Pt=g.alloc(12);t.copy(Pt,0,e,e+12),U=new te(Pt),e+=12,x=new At(Ct,U)}"__proto__"===D?Object.defineProperty(A,D,{value:x,writable:!0,enumerable:!0,configurable:!0}):A[D]=x}if(O!==e-I){if(r)throw new _("corrupt array bson");throw new _("corrupt object bson")}if(!N)return A;if(Ot(A)){var xt=Object.assign({},A);return delete xt.$ref,delete xt.$id,delete xt.$db,new At(A.$ref,A.$id,A.$db,xt)}return A}function Me(t,e,n){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(n)):new Function(t)}function je(t,e,n,r){var o=t.toString("utf8",e,n);if(r)for(var i=0;i<o.length;i++)if(65533===o.charCodeAt(i)){if(!Re(t,e,n))throw new _("Invalid UTF-8 string in BSON document");break}return o}var Be=/\x00/,ke=new Set(["$db","$ref","$id","$clusterTime"]);function qe(t,e,n,r,o){t[r++]=Y;var i=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8");t[(r=r+i+1)-1]=0;var s=t.write(n,r+4,void 0,"utf8");return t[r+3]=s+1>>24&255,t[r+2]=s+1>>16&255,t[r+1]=s+1>>8&255,t[r]=s+1&255,r=r+4+s,t[r++]=0,r}var Fe=new Uint8Array(8),We=new DataView(Fe.buffer,Fe.byteOffset,Fe.byteLength);function Ge(t,e,n,r,o){return Number.isInteger(n)&&n>=F&&n<=q?(t[r++]=at,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=255&n,t[r++]=n>>8&255,t[r++]=n>>16&255,t[r++]=n>>24&255):(t[r++]=H,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,We.setFloat64(0,n,!0),t.set(Fe,r),r+=8),r}function $e(t,e,n,r,o){return t[r++]=et,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,r}function Ve(t,e,n,r,o){return t[r++]=Z,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=n?1:0,r}function He(t,e,n,r,o){t[r++]=tt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=Dt.fromNumber(n.getTime()),s=i.getLowBits(),a=i.getHighBits();return t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,t[r++]=255&a,t[r++]=a>>8&255,t[r++]=a>>16&255,t[r++]=a>>24&255,r}function Ye(t,e,n,r,o){if(t[r++]=nt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,n.source&&null!=n.source.match(Be))throw Error("value "+n.source+" must not contain null bytes");return r+=t.write(n.source,r,void 0,"utf8"),t[r++]=0,n.ignoreCase&&(t[r++]=105),n.global&&(t[r++]=115),n.multiline&&(t[r++]=109),t[r++]=0,r}function Je(t,e,n,r,o){if(t[r++]=nt,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,null!=n.pattern.match(Be))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=t.write(n.pattern,r,void 0,"utf8"),t[r++]=0,r+=t.write(n.options.split("").sort().join(""),r,void 0,"utf8"),t[r++]=0,r}function Ke(t,e,n,r,o){return null===n?t[r++]=et:"MinKey"===n._bsontype?t[r++]=lt:t[r++]=ht,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,r}function Qe(t,e,n,r,o){if(t[r++]=X,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,"string"==typeof n.id)t.write(n.id,r,void 0,"binary");else{if(!N(n.id))throw new w("object ["+JSON.stringify(n)+"] is not a valid ObjectId");t.set(n.id.subarray(0,12),r)}return r+12}function ze(t,e,n,r,o){t[r++]=Q,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.length;return t[r++]=255&i,t[r++]=i>>8&255,t[r++]=i>>16&255,t[r++]=i>>24&255,t[r++]=pt,t.set(U(n),r),r+i}function Xe(t,e,n,r,o,i,s,a,u,c){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),void 0===c&&(c=[]);for(var f=0;f<c.length;f++)if(c[f]===n)throw new _("cyclic dependency detected");c.push(n),t[r++]=Array.isArray(n)?K:J,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var l=cn(t,n,o,r,i+1,s,a,c);return c.pop(),l}function Ze(t,e,n,r,o){return t[r++]=ft,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t.set(n.bytes.subarray(0,16),r),r+16}function tn(t,e,n,r,o){t[r++]="Long"===n._bsontype?ct:ut,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.getLowBits(),s=n.getHighBits();return t[r++]=255&i,t[r++]=i>>8&255,t[r++]=i>>16&255,t[r++]=i>>24&255,t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,r}function en(t,e,n,r,o){return n=n.valueOf(),t[r++]=at,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,t[r++]=255&n,t[r++]=n>>8&255,t[r++]=n>>16&255,t[r++]=n>>24&255,r}function nn(t,e,n,r,o){return t[r++]=H,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,We.setFloat64(0,n.value,!0),t.set(Fe,r),r+8}function rn(t,e,n,r,o,i,s){t[r++]=ot,r+=s?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var a=I(n),u=t.write(a,r+4,void 0,"utf8")+1;return t[r]=255&u,t[r+1]=u>>8&255,t[r+2]=u>>16&255,t[r+3]=u>>24&255,r=r+4+u-1,t[r++]=0,r}function on(t,e,n,r,o,i,s,a,u){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),n.scope&&"object"==typeof n.scope){t[r++]=st,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var c=r,f="string"==typeof n.code?n.code:n.code.toString();r+=4;var l=t.write(f,r+4,void 0,"utf8")+1;t[r]=255&l,t[r+1]=l>>8&255,t[r+2]=l>>16&255,t[r+3]=l>>24&255,t[r+4+l-1]=0,r=r+l+4;var h=cn(t,n.scope,o,r,i+1,s,a);r=h-1;var p=h-c;t[c++]=255&p,t[c++]=p>>8&255,t[c++]=p>>16&255,t[c++]=p>>24&255,t[r++]=0}else{t[r++]=ot,r+=u?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0,f=n.code.toString();var d=t.write(f,r+4,void 0,"utf8")+1;t[r]=255&d,t[r+1]=d>>8&255,t[r+2]=d>>16&255,t[r+3]=d>>24&255,r=r+4+d-1,t[r++]=0}return r}function sn(t,e,n,r,o){t[r++]=Q,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=n.value(!0),s=n.position;return n.sub_type===Et.SUBTYPE_BYTE_ARRAY&&(s+=4),t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255,t[r++]=n.sub_type,n.sub_type===Et.SUBTYPE_BYTE_ARRAY&&(s-=4,t[r++]=255&s,t[r++]=s>>8&255,t[r++]=s>>16&255,t[r++]=s>>24&255),t.set(i,r),r+n.position}function an(t,e,n,r,o){t[r++]=it,r+=o?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var i=t.write(n.value,r+4,void 0,"utf8")+1;return t[r]=255&i,t[r+1]=i>>8&255,t[r+2]=i>>16&255,t[r+3]=i>>24&255,r=r+4+i-1,t[r++]=0,r}function un(t,e,n,r,o,i,s){t[r++]=J,r+=s?t.write(e,r,void 0,"ascii"):t.write(e,r,void 0,"utf8"),t[r++]=0;var a=r,u={$ref:n.collection||n.namespace,$id:n.oid};null!=n.db&&(u.$db=n.db);var c=cn(t,u=Object.assign(u,n.fields),!1,r,o+1,i),f=c-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,c}function cn(t,e,n,r,o,i,s,a){void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=!1),void 0===s&&(s=!0),void 0===a&&(a=[]),r=r||0,(a=a||[]).push(e);var u,c=r+4;if(Array.isArray(e))for(var f=0;f<e.length;f++){var l="".concat(f);if("function"==typeof(null==(g=e[f])?void 0:g.toBSON)&&(g=g.toBSON()),"string"==typeof g)c=qe(t,l,g,c,!0);else if("number"==typeof g)c=Ge(t,l,g,c,!0);else{if("bigint"==typeof g)throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof g)c=Ve(t,l,g,c,!0);else if(g instanceof Date||P(g))c=He(t,l,g,c,!0);else if(void 0===g)c=$e(t,l,0,c,!0);else if(null===g)c=$e(t,l,0,c,!0);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c,!0);else if(N(g))c=ze(t,l,g,c,!0);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c,!0);else if("object"==typeof g&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!0,a);else if("object"==typeof g&&ie(g)&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c,!0);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c,!0);else if("Double"===g._bsontype)c=nn(t,l,g,c,!0);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,!0);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s,!0);else if("Binary"===g._bsontype)c=sn(t,l,g,c,!0);else if("Symbol"===g._bsontype)c=an(t,l,g,c,!0);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i,!0);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c,!0);else if("Int32"===g._bsontype)c=en(t,l,g,c,!0);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c,!0);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}else if(e instanceof ye||(u=e,"[object Map]"===Object.prototype.toString.call(u)))for(var h=e.entries(),p=!1;!p;){var d=h.next();if(!(p=!!d.done)){l=d.value[0];var y=typeof(g=d.value[1]);if("string"==typeof l&&!ke.has(l)){if(null!=l.match(Be))throw Error("key "+l+" must not contain null bytes");if(n){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)c=qe(t,l,g,c);else if("number"===y)c=Ge(t,l,g,c);else{if("bigint"===y||R(g)||L(g))throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"===y)c=Ve(t,l,g,c);else if(g instanceof Date||P(g))c=He(t,l,g,c);else if(null===g||void 0===g&&!1===s)c=$e(t,l,0,c);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c);else if(N(g))c=ze(t,l,g,c);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c);else if("object"===y&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!1,a);else if("object"===y&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c);else if("Double"===g._bsontype)c=nn(t,l,g,c);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,i);else if("Binary"===g._bsontype)c=sn(t,l,g,c);else if("Symbol"===g._bsontype)c=an(t,l,g,c);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c);else if("Int32"===g._bsontype)c=en(t,l,g,c);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}}else{if("function"==typeof(null==e?void 0:e.toBSON)&&null!=(e=e.toBSON())&&"object"!=typeof e)throw new w("toBSON function did not return an object");for(var l in e){var g;if("function"==typeof(null==(g=e[l])?void 0:g.toBSON)&&(g=g.toBSON()),y=typeof g,"string"==typeof l&&!ke.has(l)){if(null!=l.match(Be))throw Error("key "+l+" must not contain null bytes");if(n){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)c=qe(t,l,g,c);else if("number"===y)c=Ge(t,l,g,c);else{if("bigint"===y)throw new w("Unsupported type BigInt, please use Decimal128");if("boolean"===y)c=Ve(t,l,g,c);else if(g instanceof Date||P(g))c=He(t,l,g,c);else if(void 0===g)!1===s&&(c=$e(t,l,0,c));else if(null===g)c=$e(t,l,0,c);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)c=Qe(t,l,g,c);else if(N(g))c=ze(t,l,g,c);else if(g instanceof RegExp||C(g))c=Ye(t,l,g,c);else if("object"===y&&null==g._bsontype)c=Xe(t,l,g,c,n,o,i,s,!1,a);else if("object"===y&&"Decimal128"===g._bsontype)c=Ze(t,l,g,c);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)c=tn(t,l,g,c);else if("Double"===g._bsontype)c=nn(t,l,g,c);else if("Code"===g._bsontype)c=on(t,l,g,c,n,o,i,s);else if("function"==typeof g&&i)c=rn(t,l,g,c,0,0,i);else if("Binary"===g._bsontype)c=sn(t,l,g,c);else if("Symbol"===g._bsontype)c=an(t,l,g,c);else if("DBRef"===g._bsontype)c=un(t,l,g,c,o,i);else if("BSONRegExp"===g._bsontype)c=Je(t,l,g,c);else if("Int32"===g._bsontype)c=en(t,l,g,c);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)c=Ke(t,l,g,c);else if(void 0!==g._bsontype)throw new w("Unrecognized or invalid _bsontype: ".concat(String(g._bsontype)))}}}a.pop(),t[c++]=0;var v=c-r;return t[r++]=255&v,t[r++]=v>>8&255,t[r++]=v>>16&255,t[r++]=v>>24&255,c}var fn=17825792,ln=g.alloc(fn);function hn(t){ln.length<t&&(ln=g.alloc(t))}function pn(t,e){void 0===e&&(e={});var n="boolean"==typeof e.checkKeys&&e.checkKeys,r="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,o="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,i="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:fn;ln.length<i&&(ln=g.alloc(i));var s=cn(ln,t,n,0,0,r,o,[]),a=g.alloc(s);return ln.copy(a,0,0,a.length),a}function dn(t,e,n){void 0===n&&(n={});var r="boolean"==typeof n.checkKeys&&n.checkKeys,o="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,i="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0,a=cn(ln,t,r,0,0,o,i);return ln.copy(e,s,0,a),s+a-1}function yn(t,e){return void 0===e&&(e={}),De(t instanceof g?t:U(t),e)}function gn(t,e){return void 0===e&&(e={}),me(t,"boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,"boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined)}function vn(t,e,n,r,o,i){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),a=U(t),u=e,c=0;c<n;c++){var f=a[u]|a[u+1]<<8|a[u+2]<<16|a[u+3]<<24;s.index=u,r[o+c]=De(a,s),u+=f}return u}var mn={Binary:Et,Code:It,DBRef:At,Decimal128:Ht,Double:Yt,Int32:Jt,Long:Dt,UUID:St,Map:ye,MaxKey:Kt,MinKey:Qt,ObjectId:te,ObjectID:te,BSONRegExp:ee,BSONSymbol:ne,Timestamp:oe,EJSON:de,setInternalBufferSize:hn,serialize:pn,serializeWithBufferAndIndex:dn,deserialize:yn,calculateObjectSize:gn,deserializeStream:vn,BSONError:_,BSONTypeError:w};e.default=mn},9907:function(t,e,n){t=n.nmd(t);var r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",f="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",N="[object Uint16Array]",R="[object Uint32Array]",L=/\w*$/,C=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,D={};D[i]=D["[object Array]"]=D[b]=D[_]=D[s]=D[a]=D[w]=D[E]=D[S]=D[I]=D[O]=D[f]=D[l]=D[h]=D[d]=D[y]=D[g]=D[v]=D[A]=D[T]=D[N]=D[R]=!0,D["[object Error]"]=D[u]=D[m]=!1;var x="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,M=x||U||Function("return this")(),j=e&&!e.nodeType&&e,B=j&&t&&!t.nodeType&&t,k=B&&B.exports===j;function q(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function W(t,e,n,r){var o=-1,i=t?t.length:0;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function G(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function $(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function V(t,e){return function(n){return t(e(n))}}function H(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var Y,J=Array.prototype,K=Function.prototype,Q=Object.prototype,z=M["__core-js_shared__"],X=(Y=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",Z=K.toString,tt=Q.hasOwnProperty,et=Q.toString,nt=RegExp("^"+Z.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=k?M.Buffer:void 0,ot=M.Symbol,it=M.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ut=Q.propertyIsEnumerable,ct=J.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Mt(M,"DataView"),dt=Mt(M,"Map"),yt=Mt(M,"Promise"),gt=Mt(M,"Set"),vt=Mt(M,"WeakMap"),mt=Mt(Object,"create"),bt=Ft(pt),_t=Ft(dt),wt=Ft(yt),Et=Ft(gt),St=Ft(vt),It=ot?ot.prototype:void 0,Ot=It?It.valueOf:void 0;function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rt(t){this.__data__=new Tt(t)}function Lt(t,e,n){var r=t[e];tt.call(t,e)&&Wt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(Wt(t[n][0],e))return n;return-1}function Pt(t,e,n,r,o,p,m){var C;if(r&&(C=p?r(t,o,p,m):r(t)),void 0!==C)return C;if(!Yt(t))return t;var P=Gt(t);if(P){if(C=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,C)}else{var x=Bt(t),U=x==u||x==c;if(Vt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(x==h||x==i||U&&!p){if(G(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||qt(t)?{}:Yt(e=st(t))?at(e):{};var e}(U?{}:t),!e)return function(t,e){return xt(t,jt(t),e)}(t,function(t,e){return t&&xt(e,Jt(e),t)}(C,t))}else{if(!D[x])return p?t:{};C=function(t,e,n,r){var o,i=t.constructor;switch(e){case b:return Dt(t);case s:case a:return new i(+t);case _:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case w:case E:case S:case I:case O:case A:case T:case N:case R:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return W(e?n($(t),!0):$(t),q,new t.constructor)}(t,r,n);case l:case g:return new i(t);case d:return function(t){var e=new t.constructor(t.source,L.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return W(e?n(H(t),!0):H(t),F,new t.constructor)}(t,r,n);case v:return o=t,Ot?Object(Ot.call(o)):{}}}(t,x,Pt,e)}}m||(m=new Rt);var M=m.get(t);if(M)return M;if(m.set(t,C),!P)var j=n?function(t){return function(t,e,n){var r=e(t);return Gt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Jt,jt)}(t):Jt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(j||t,(function(o,i){j&&(o=t[i=o]),Lt(C,i,Pt(o,e,n,r,i,t,m))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function xt(t,e,n,r){n||(n={});for(var o=-1,i=e.length;++o<i;){var s=e[o],a=r?r(n[s],t[s],s,n,t):void 0;Lt(n,s,void 0===a?t[s]:a)}return n}function Ut(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Mt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Yt(t)||(e=t,X&&X in e))&&(Ht(t)||G(t)?nt:C).test(Ft(t));var e}(n)?n:void 0}At.prototype.clear=function(){this.__data__=mt?mt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(mt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return mt?void 0!==e[t]:tt.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=mt&&void 0===e?r:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ct.call(e,n,1),0))},Tt.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},Tt.prototype.has=function(t){return Ct(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Nt.prototype.clear=function(){this.__data__={hash:new At,map:new(dt||Tt),string:new At}},Nt.prototype.delete=function(t){return Ut(this,t).delete(t)},Nt.prototype.get=function(t){return Ut(this,t).get(t)},Nt.prototype.has=function(t){return Ut(this,t).has(t)},Nt.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},Rt.prototype.clear=function(){this.__data__=new Tt},Rt.prototype.delete=function(t){return this.__data__.delete(t)},Rt.prototype.get=function(t){return this.__data__.get(t)},Rt.prototype.has=function(t){return this.__data__.has(t)},Rt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Tt){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Nt(r)}return n.set(t,e),this};var jt=ft?V(ft,Object):function(){return[]},Bt=function(t){return et.call(t)};function kt(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function qt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Q)}function Ft(t){if(null!=t){try{return Z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Wt(t,e){return t===e||t!=t&&e!=e}(pt&&Bt(new pt(new ArrayBuffer(1)))!=_||dt&&Bt(new dt)!=f||yt&&Bt(yt.resolve())!=p||gt&&Bt(new gt)!=y||vt&&Bt(new vt)!=m)&&(Bt=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?Ft(n):void 0;if(r)switch(r){case bt:return _;case _t:return f;case wt:return p;case Et:return y;case St:return m}return e});var Gt=Array.isArray;function $t(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!Ht(t)}var Vt=lt||function(){return!1};function Ht(t){var e=Yt(t)?et.call(t):"";return e==u||e==c}function Yt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return $t(t)?function(t,e){var n=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&$t(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==i)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var s in t)!e&&!tt.call(t,s)||o&&("length"==s||kt(s,r))||n.push(s);return n}(t):function(t){if(!qt(t))return ht(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}},880:function(t,e,n){var r,o="Expected a function",i="__lodash_hash_undefined__",s=1/0,a=9007199254740991,u="[object Function]",c="[object GeneratorFunction]",f="[object Symbol]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,p=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,v=/^(?:0|[1-9]\d*)$/,m="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,b="object"==typeof self&&self&&self.Object===Object&&self,_=m||b||Function("return this")(),w=Array.prototype,E=Function.prototype,S=Object.prototype,I=_["__core-js_shared__"],O=(r=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",A=E.toString,T=S.hasOwnProperty,N=S.toString,R=RegExp("^"+A.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=_.Symbol,C=w.splice,P=W(_,"Map"),D=W(Object,"create"),x=L?L.prototype:void 0,U=x?x.toString:void 0;function M(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function k(t,e,n){var r=t[e];T.call(t,e)&&Y(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function q(t,e){for(var n=t.length;n--;)if(Y(t[n][0],e))return n;return-1}function F(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function W(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!K(t)||O&&O in t)return!1;var e=function(t){var e=K(t)?N.call(t):"";return e==u||e==c}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?R:g;return e.test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function G(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||v.test(t))&&t>-1&&t%1==0&&t<e}M.prototype.clear=function(){this.__data__=D?D(null):{}},M.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},M.prototype.get=function(t){var e=this.__data__;if(D){var n=e[t];return n===i?void 0:n}return T.call(e,t)?e[t]:void 0},M.prototype.has=function(t){var e=this.__data__;return D?void 0!==e[t]:T.call(e,t)},M.prototype.set=function(t,e){return this.__data__[t]=D&&void 0===e?i:e,this},j.prototype.clear=function(){this.__data__=[]},j.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():C.call(e,n,1),0))},j.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},j.prototype.has=function(t){return q(this.__data__,t)>-1},j.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},B.prototype.clear=function(){this.__data__={hash:new M,map:new(P||j),string:new M}},B.prototype.delete=function(t){return F(this,t).delete(t)},B.prototype.get=function(t){return F(this,t).get(t)},B.prototype.has=function(t){return F(this,t).has(t)},B.prototype.set=function(t,e){return F(this,t).set(t,e),this};var $=H((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Q(t))return U?U.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(d,(function(t,e,r,o){n.push(r?o.replace(y,"$1"):e||t)})),n}));function V(t){if("string"==typeof t||Q(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function H(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(H.Cache||B),n}function Y(t,e){return t===e||t!=t&&e!=e}H.Cache=B;var J=Array.isArray;function K(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Q(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&N.call(t)==f}t.exports=function(t,e,n){return null==t?t:function(t,e,n,r){if(!K(t))return t;e=function(t,e){if(J(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Q(t))||h.test(t)||!l.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return J(t)?t:$(t)}(e);for(var o=-1,i=e.length,s=i-1,a=t;null!=a&&++o<i;){var u=V(e[o]),c=n;if(o!=s){var f=a[u];void 0===(c=r?r(f,u,a):void 0)&&(c=K(f)?f:G(e[o+1])?[]:{})}k(a,u,c),a=a[u]}return t}(t,e,n)}},3373:function(t,e,n){var r,o="Expected a function",i="__lodash_hash_undefined__",s=1/0,a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,h=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,v="object"==typeof self&&self&&self.Object===Object&&self,m=g||v||Function("return this")(),b=Array.prototype,_=Function.prototype,w=Object.prototype,E=m["__core-js_shared__"],S=(r=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",I=_.toString,O=w.hasOwnProperty,A=w.toString,T=RegExp("^"+I.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=m.Symbol,R=b.splice,L=q(m,"Map"),C=q(Object,"create"),P=N?N.prototype:void 0,D=P?P.toString:void 0;function x(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function M(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function B(t){return V(t)?t:W(t)}function k(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!H(t)||S&&S in t)return!1;var e=function(t){var e=H(t)?A.call(t):"";return e==a||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?T:y;return e.test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function F(t,e){if(V(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Y(t))||l.test(t)||!f.test(t)||null!=e&&t in Object(e)}x.prototype.clear=function(){this.__data__=C?C(null):{}},x.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},x.prototype.get=function(t){var e=this.__data__;if(C){var n=e[t];return n===i?void 0:n}return O.call(e,t)?e[t]:void 0},x.prototype.has=function(t){var e=this.__data__;return C?void 0!==e[t]:O.call(e,t)},x.prototype.set=function(t,e){return this.__data__[t]=C&&void 0===e?i:e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,n=j(e,t);return!(n<0||(n==e.length-1?e.pop():R.call(e,n,1),0))},U.prototype.get=function(t){var e=this.__data__,n=j(e,t);return n<0?void 0:e[n][1]},U.prototype.has=function(t){return j(this.__data__,t)>-1},U.prototype.set=function(t,e){var n=this.__data__,r=j(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},M.prototype.clear=function(){this.__data__={hash:new x,map:new(L||U),string:new x}},M.prototype.delete=function(t){return k(this,t).delete(t)},M.prototype.get=function(t){return k(this,t).get(t)},M.prototype.has=function(t){return k(this,t).has(t)},M.prototype.set=function(t,e){return k(this,t).set(t,e),this};var W=$((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Y(t))return D?D.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return h.test(t)&&n.push(""),t.replace(p,(function(t,e,r,o){n.push(r?o.replace(d,"$1"):e||t)})),n}));function G(t){if("string"==typeof t||Y(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function $(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new($.Cache||M),n}$.Cache=M;var V=Array.isArray;function H(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&A.call(t)==c}t.exports=function(t,e){return null==t||function(t,e){t=function(t,e){return 1==e.length?t:function(t,e){for(var n=0,r=(e=F(e,t)?[e]:B(e)).length;null!=t&&n<r;)t=t[G(e[n++])];return n&&n==r?t:void 0}(t,function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i}(e,0,-1))}(t,e=F(e,t)?[e]:B(e));var n,r,o=G((r=(n=e)?n.length:0)?n[r-1]:void 0);return!(null!=t&&O.call(t,o))||delete t[o]}(t,e)}},5047:function(t){var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,s=Object.create(i.prototype),a=new L(r||[]);return o(s,"_invoke",{value:A(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",g={};function v(){}function m(){}function b(){}var _={};c(_,s,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(C([])));E&&E!==n&&r.call(E,s)&&(_=E);var S=b.prototype=v.prototype=Object.create(_);function I(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function n(o,i,s,a){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function A(t,e,n){var r=h;return function(o,i){if(r===d)throw new Error("Generator is already running");if(r===y){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=T(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(t,e,n);if("normal"===u.type){if(r=n.done?y:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=y,n.method="throw",n.arg=u.arg)}}}function T(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=l(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var s=i.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function C(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},I(O.prototype),c(O.prototype,a,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var s=new O(f(e,n,r,o),i);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(S),c(S,u,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return a.type="throw",a.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;R(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},4536:function(t){"use strict";t.exports=JSON.parse('{"version":"2.5.36-beta.0"}')}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},n(5047),n(9195)}()}));
|